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
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.
43 (FIRST_ALTIVEC_REGNO 77)
44 (LAST_ALTIVEC_REGNO 108)
57 [(UNSPEC_FRSP 0) ; frsp for POWER machines
58 (UNSPEC_PROBE_STACK 4) ; probe stack memory reference
59 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
60 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
61 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
63 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
69 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
70 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
73 (UNSPEC_MOVESI_FROM_CR 19)
74 (UNSPEC_MOVESI_TO_CR 20)
76 (UNSPEC_TLSDTPRELHA 22)
77 (UNSPEC_TLSDTPRELLO 23)
78 (UNSPEC_TLSGOTDTPREL 24)
80 (UNSPEC_TLSTPRELHA 26)
81 (UNSPEC_TLSTPRELLO 27)
82 (UNSPEC_TLSGOTTPREL 28)
84 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
85 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
101 (UNSPEC_DLMZB_STRLEN 47)
104 (UNSPEC_MACHOPIC_OFFSET 50)
116 ;; UNSPEC_VOLATILE usage
121 (UNSPECV_LL 1) ; load-locked
122 (UNSPECV_SC 2) ; store-conditional
123 (UNSPECV_PROBE_STACK_RANGE 3) ; probe range of stack addresses
124 (UNSPECV_EH_RR 9) ; eh_reg_restore
127 ;; Define an insn type attribute. This is used in function unit delay
129 (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"
130 (const_string "integer"))
132 ;; Define floating point instruction sub-types for use with Xfpu.md
133 (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"))
135 ;; Length (in bytes).
136 ; '(pc)' in the following doesn't include the instruction itself; it is
137 ; calculated as if the instruction had zero size.
138 (define_attr "length" ""
139 (if_then_else (eq_attr "type" "branch")
140 (if_then_else (and (ge (minus (match_dup 0) (pc))
142 (lt (minus (match_dup 0) (pc))
148 ;; Processor type -- this attribute must exactly match the processor_type
149 ;; enumeration in rs6000.h.
151 (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"
152 (const (symbol_ref "rs6000_cpu_attr")))
155 ;; If this instruction is microcoded on the CELL processor
156 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
157 (define_attr "cell_micro" "not,conditional,always"
158 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
159 (const_string "always")
160 (const_string "not")))
162 (automata_option "ndfa")
176 (include "e300c2c3.md")
177 (include "e500mc.md")
178 (include "e500mc64.md")
179 (include "power4.md")
180 (include "power5.md")
181 (include "power6.md")
182 (include "power7.md")
188 (include "predicates.md")
189 (include "constraints.md")
191 (include "darwin.md")
196 ; This mode iterator allows :GPR to be used to indicate the allowable size
197 ; of whole values in GPRs.
198 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
200 ; Any supported integer mode.
201 (define_mode_iterator INT [QI HI SI DI TI])
203 ; Any supported integer mode that fits in one register.
204 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
206 ; extend modes for DImode
207 (define_mode_iterator QHSI [QI HI SI])
209 ; SImode or DImode, even if DImode doesn't fit in GPRs.
210 (define_mode_iterator SDI [SI DI])
212 ; The size of a pointer. Also, the size of the value that a record-condition
213 ; (one with a '.') will compare; and the size used for arithmetic carries.
214 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
216 ; Any hardware-supported floating-point mode
217 (define_mode_iterator FP [
218 (SF "TARGET_HARD_FLOAT
219 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
220 (DF "TARGET_HARD_FLOAT
221 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
222 (TF "!TARGET_IEEEQUAD
224 && (TARGET_FPRS || TARGET_E500_DOUBLE)
225 && TARGET_LONG_DOUBLE_128")
229 ; Any fma capable floating-point mode.
230 (define_mode_iterator FMA_F [
231 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
232 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
233 || VECTOR_UNIT_VSX_P (DFmode)")
234 (V2SF "TARGET_PAIRED_FLOAT")
235 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
236 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
239 ; These modes do not fit in integer registers in 32-bit mode.
240 ; but on e500v2, the gpr are 64 bit registers
241 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
243 ; Iterator for reciprocal estimate instructions
244 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
246 ; Iterator for just SF/DF
247 (define_mode_iterator SFDF [SF DF])
249 ; Various instructions that come in SI and DI forms.
250 ; A generic w/d attribute, for things like cmpw/cmpd.
251 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
254 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
256 ;; ISEL/ISEL64 target selection
257 (define_mode_attr sel [(SI "") (DI "64")])
259 ;; Suffix for reload patterns
260 (define_mode_attr ptrsize [(SI "32bit")
263 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
264 (DI "TARGET_64BIT")])
266 (define_mode_attr mptrsize [(SI "si")
269 (define_mode_attr rreg [(SF "f")
274 (define_mode_attr rreg2 [(SF "f")
277 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
278 (DF "TARGET_FCFID")])
280 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
281 (DF "TARGET_E500_DOUBLE")])
283 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
284 (DF "TARGET_DOUBLE_FLOAT")])
286 ;; Start with fixed-point load and store insns. Here we put only the more
287 ;; complex forms. Basic data transfer is done later.
289 (define_expand "zero_extend<mode>di2"
290 [(set (match_operand:DI 0 "gpc_reg_operand" "")
291 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
295 (define_insn "*zero_extend<mode>di2_internal1"
296 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
297 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
301 rldicl %0,%1,0,<dbits>"
302 [(set_attr "type" "load,*")])
304 (define_insn "*zero_extend<mode>di2_internal2"
305 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
306 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
308 (clobber (match_scratch:DI 2 "=r,r"))]
311 rldicl. %2,%1,0,<dbits>
313 [(set_attr "type" "compare")
314 (set_attr "length" "4,8")])
317 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
318 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
320 (clobber (match_scratch:DI 2 ""))]
321 "TARGET_POWERPC64 && reload_completed"
323 (zero_extend:DI (match_dup 1)))
325 (compare:CC (match_dup 2)
329 (define_insn "*zero_extend<mode>di2_internal3"
330 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
331 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
333 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
334 (zero_extend:DI (match_dup 1)))]
337 rldicl. %0,%1,0,<dbits>
339 [(set_attr "type" "compare")
340 (set_attr "length" "4,8")])
343 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
344 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
346 (set (match_operand:DI 0 "gpc_reg_operand" "")
347 (zero_extend:DI (match_dup 1)))]
348 "TARGET_POWERPC64 && reload_completed"
350 (zero_extend:DI (match_dup 1)))
352 (compare:CC (match_dup 0)
356 (define_insn "extendqidi2"
357 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
358 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
361 [(set_attr "type" "exts")])
364 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
365 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
367 (clobber (match_scratch:DI 2 "=r,r"))]
372 [(set_attr "type" "compare")
373 (set_attr "length" "4,8")])
376 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
377 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
379 (clobber (match_scratch:DI 2 ""))]
380 "TARGET_POWERPC64 && reload_completed"
382 (sign_extend:DI (match_dup 1)))
384 (compare:CC (match_dup 2)
389 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
390 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
392 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
393 (sign_extend:DI (match_dup 1)))]
398 [(set_attr "type" "compare")
399 (set_attr "length" "4,8")])
402 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
403 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
405 (set (match_operand:DI 0 "gpc_reg_operand" "")
406 (sign_extend:DI (match_dup 1)))]
407 "TARGET_POWERPC64 && reload_completed"
409 (sign_extend:DI (match_dup 1)))
411 (compare:CC (match_dup 0)
415 (define_expand "extendhidi2"
416 [(set (match_operand:DI 0 "gpc_reg_operand" "")
417 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
422 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
423 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
424 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
428 [(set_attr "type" "load_ext,exts")])
431 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
432 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
433 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
435 [(set_attr "type" "exts")])
438 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
439 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
441 (clobber (match_scratch:DI 2 "=r,r"))]
446 [(set_attr "type" "compare")
447 (set_attr "length" "4,8")])
450 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
451 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
453 (clobber (match_scratch:DI 2 ""))]
454 "TARGET_POWERPC64 && reload_completed"
456 (sign_extend:DI (match_dup 1)))
458 (compare:CC (match_dup 2)
463 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
464 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
466 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
467 (sign_extend:DI (match_dup 1)))]
472 [(set_attr "type" "compare")
473 (set_attr "length" "4,8")])
476 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
477 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
479 (set (match_operand:DI 0 "gpc_reg_operand" "")
480 (sign_extend:DI (match_dup 1)))]
481 "TARGET_POWERPC64 && reload_completed"
483 (sign_extend:DI (match_dup 1)))
485 (compare:CC (match_dup 0)
489 (define_expand "extendsidi2"
490 [(set (match_operand:DI 0 "gpc_reg_operand" "")
491 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
496 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
497 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
498 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
502 [(set_attr "type" "load_ext,exts")])
505 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
506 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
507 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
509 [(set_attr "type" "exts")])
512 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
513 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
515 (clobber (match_scratch:DI 2 "=r,r"))]
520 [(set_attr "type" "compare")
521 (set_attr "length" "4,8")])
524 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
525 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
527 (clobber (match_scratch:DI 2 ""))]
528 "TARGET_POWERPC64 && reload_completed"
530 (sign_extend:DI (match_dup 1)))
532 (compare:CC (match_dup 2)
537 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
538 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
540 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
541 (sign_extend:DI (match_dup 1)))]
546 [(set_attr "type" "compare")
547 (set_attr "length" "4,8")])
550 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
551 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
553 (set (match_operand:DI 0 "gpc_reg_operand" "")
554 (sign_extend:DI (match_dup 1)))]
555 "TARGET_POWERPC64 && reload_completed"
557 (sign_extend:DI (match_dup 1)))
559 (compare:CC (match_dup 0)
563 (define_expand "zero_extendqisi2"
564 [(set (match_operand:SI 0 "gpc_reg_operand" "")
565 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
570 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
571 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
575 {rlinm|rlwinm} %0,%1,0,0xff"
576 [(set_attr "type" "load,*")])
579 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
580 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
582 (clobber (match_scratch:SI 2 "=r,r"))]
585 {andil.|andi.} %2,%1,0xff
587 [(set_attr "type" "fast_compare,compare")
588 (set_attr "length" "4,8")])
591 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
592 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
594 (clobber (match_scratch:SI 2 ""))]
597 (zero_extend:SI (match_dup 1)))
599 (compare:CC (match_dup 2)
604 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
605 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
607 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
608 (zero_extend:SI (match_dup 1)))]
611 {andil.|andi.} %0,%1,0xff
613 [(set_attr "type" "fast_compare,compare")
614 (set_attr "length" "4,8")])
617 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
618 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
620 (set (match_operand:SI 0 "gpc_reg_operand" "")
621 (zero_extend:SI (match_dup 1)))]
624 (zero_extend:SI (match_dup 1)))
626 (compare:CC (match_dup 0)
630 (define_expand "extendqisi2"
631 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
632 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
637 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
638 else if (TARGET_POWER)
639 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
641 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
645 (define_insn "extendqisi2_ppc"
646 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
647 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
650 [(set_attr "type" "exts")])
653 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
654 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
656 (clobber (match_scratch:SI 2 "=r,r"))]
661 [(set_attr "type" "compare")
662 (set_attr "length" "4,8")])
665 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
666 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
668 (clobber (match_scratch:SI 2 ""))]
669 "TARGET_POWERPC && reload_completed"
671 (sign_extend:SI (match_dup 1)))
673 (compare:CC (match_dup 2)
678 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
679 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
681 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
682 (sign_extend:SI (match_dup 1)))]
687 [(set_attr "type" "compare")
688 (set_attr "length" "4,8")])
691 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
692 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
694 (set (match_operand:SI 0 "gpc_reg_operand" "")
695 (sign_extend:SI (match_dup 1)))]
696 "TARGET_POWERPC && reload_completed"
698 (sign_extend:SI (match_dup 1)))
700 (compare:CC (match_dup 0)
704 (define_expand "extendqisi2_power"
705 [(parallel [(set (match_dup 2)
706 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
708 (clobber (scratch:SI))])
709 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
710 (ashiftrt:SI (match_dup 2)
712 (clobber (scratch:SI))])]
715 { operands[1] = gen_lowpart (SImode, operands[1]);
716 operands[2] = gen_reg_rtx (SImode); }")
718 (define_expand "extendqisi2_no_power"
720 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
722 (set (match_operand:SI 0 "gpc_reg_operand" "")
723 (ashiftrt:SI (match_dup 2)
725 "! TARGET_POWER && ! TARGET_POWERPC"
727 { operands[1] = gen_lowpart (SImode, operands[1]);
728 operands[2] = gen_reg_rtx (SImode); }")
730 (define_expand "zero_extendqihi2"
731 [(set (match_operand:HI 0 "gpc_reg_operand" "")
732 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
737 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
738 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
742 {rlinm|rlwinm} %0,%1,0,0xff"
743 [(set_attr "type" "load,*")])
746 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
747 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
749 (clobber (match_scratch:HI 2 "=r,r"))]
752 {andil.|andi.} %2,%1,0xff
754 [(set_attr "type" "fast_compare,compare")
755 (set_attr "length" "4,8")])
758 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
759 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
761 (clobber (match_scratch:HI 2 ""))]
764 (zero_extend:HI (match_dup 1)))
766 (compare:CC (match_dup 2)
771 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
772 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
774 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
775 (zero_extend:HI (match_dup 1)))]
778 {andil.|andi.} %0,%1,0xff
780 [(set_attr "type" "fast_compare,compare")
781 (set_attr "length" "4,8")])
784 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
785 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
787 (set (match_operand:HI 0 "gpc_reg_operand" "")
788 (zero_extend:HI (match_dup 1)))]
791 (zero_extend:HI (match_dup 1)))
793 (compare:CC (match_dup 0)
797 (define_expand "extendqihi2"
798 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
799 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
804 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
805 else if (TARGET_POWER)
806 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
808 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
812 (define_insn "extendqihi2_ppc"
813 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
814 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
817 [(set_attr "type" "exts")])
820 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
821 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
823 (clobber (match_scratch:HI 2 "=r,r"))]
828 [(set_attr "type" "compare")
829 (set_attr "length" "4,8")])
832 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
833 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
835 (clobber (match_scratch:HI 2 ""))]
836 "TARGET_POWERPC && reload_completed"
838 (sign_extend:HI (match_dup 1)))
840 (compare:CC (match_dup 2)
845 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
846 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
848 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
849 (sign_extend:HI (match_dup 1)))]
854 [(set_attr "type" "compare")
855 (set_attr "length" "4,8")])
858 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
859 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
861 (set (match_operand:HI 0 "gpc_reg_operand" "")
862 (sign_extend:HI (match_dup 1)))]
863 "TARGET_POWERPC && reload_completed"
865 (sign_extend:HI (match_dup 1)))
867 (compare:CC (match_dup 0)
871 (define_expand "extendqihi2_power"
872 [(parallel [(set (match_dup 2)
873 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
875 (clobber (scratch:SI))])
876 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
877 (ashiftrt:SI (match_dup 2)
879 (clobber (scratch:SI))])]
882 { operands[0] = gen_lowpart (SImode, operands[0]);
883 operands[1] = gen_lowpart (SImode, operands[1]);
884 operands[2] = gen_reg_rtx (SImode); }")
886 (define_expand "extendqihi2_no_power"
888 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
890 (set (match_operand:HI 0 "gpc_reg_operand" "")
891 (ashiftrt:SI (match_dup 2)
893 "! TARGET_POWER && ! TARGET_POWERPC"
895 { operands[0] = gen_lowpart (SImode, operands[0]);
896 operands[1] = gen_lowpart (SImode, operands[1]);
897 operands[2] = gen_reg_rtx (SImode); }")
899 (define_expand "zero_extendhisi2"
900 [(set (match_operand:SI 0 "gpc_reg_operand" "")
901 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
906 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
907 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
911 {rlinm|rlwinm} %0,%1,0,0xffff"
912 [(set_attr "type" "load,*")])
915 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
916 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
918 (clobber (match_scratch:SI 2 "=r,r"))]
921 {andil.|andi.} %2,%1,0xffff
923 [(set_attr "type" "fast_compare,compare")
924 (set_attr "length" "4,8")])
927 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
928 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
930 (clobber (match_scratch:SI 2 ""))]
933 (zero_extend:SI (match_dup 1)))
935 (compare:CC (match_dup 2)
940 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
941 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
943 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
944 (zero_extend:SI (match_dup 1)))]
947 {andil.|andi.} %0,%1,0xffff
949 [(set_attr "type" "fast_compare,compare")
950 (set_attr "length" "4,8")])
953 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
954 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
956 (set (match_operand:SI 0 "gpc_reg_operand" "")
957 (zero_extend:SI (match_dup 1)))]
960 (zero_extend:SI (match_dup 1)))
962 (compare:CC (match_dup 0)
966 (define_expand "extendhisi2"
967 [(set (match_operand:SI 0 "gpc_reg_operand" "")
968 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
973 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
974 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
975 "rs6000_gen_cell_microcode"
979 [(set_attr "type" "load_ext,exts")])
982 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
983 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
984 "!rs6000_gen_cell_microcode"
986 [(set_attr "type" "exts")])
989 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
990 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
992 (clobber (match_scratch:SI 2 "=r,r"))]
997 [(set_attr "type" "compare")
998 (set_attr "length" "4,8")])
1001 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1002 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1004 (clobber (match_scratch:SI 2 ""))]
1007 (sign_extend:SI (match_dup 1)))
1009 (compare:CC (match_dup 2)
1014 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1015 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1017 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1018 (sign_extend:SI (match_dup 1)))]
1021 {exts.|extsh.} %0,%1
1023 [(set_attr "type" "compare")
1024 (set_attr "length" "4,8")])
1026 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1028 (define_insn "*macchwc"
1029 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1030 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1031 (match_operand:SI 2 "gpc_reg_operand" "r")
1034 (match_operand:HI 1 "gpc_reg_operand" "r")))
1035 (match_operand:SI 4 "gpc_reg_operand" "0"))
1037 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1038 (plus:SI (mult:SI (ashiftrt:SI
1045 "macchw. %0, %1, %2"
1046 [(set_attr "type" "imul3")])
1048 (define_insn "*macchw"
1049 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1050 (plus:SI (mult:SI (ashiftrt:SI
1051 (match_operand:SI 2 "gpc_reg_operand" "r")
1054 (match_operand:HI 1 "gpc_reg_operand" "r")))
1055 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1058 [(set_attr "type" "imul3")])
1060 (define_insn "*macchwuc"
1061 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1062 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1063 (match_operand:SI 2 "gpc_reg_operand" "r")
1066 (match_operand:HI 1 "gpc_reg_operand" "r")))
1067 (match_operand:SI 4 "gpc_reg_operand" "0"))
1069 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1070 (plus:SI (mult:SI (lshiftrt:SI
1077 "macchwu. %0, %1, %2"
1078 [(set_attr "type" "imul3")])
1080 (define_insn "*macchwu"
1081 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1082 (plus:SI (mult:SI (lshiftrt:SI
1083 (match_operand:SI 2 "gpc_reg_operand" "r")
1086 (match_operand:HI 1 "gpc_reg_operand" "r")))
1087 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1089 "macchwu %0, %1, %2"
1090 [(set_attr "type" "imul3")])
1092 (define_insn "*machhwc"
1093 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1094 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1095 (match_operand:SI 1 "gpc_reg_operand" "%r")
1098 (match_operand:SI 2 "gpc_reg_operand" "r")
1100 (match_operand:SI 4 "gpc_reg_operand" "0"))
1102 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1103 (plus:SI (mult:SI (ashiftrt:SI
1111 "machhw. %0, %1, %2"
1112 [(set_attr "type" "imul3")])
1114 (define_insn "*machhw"
1115 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1116 (plus:SI (mult:SI (ashiftrt:SI
1117 (match_operand:SI 1 "gpc_reg_operand" "%r")
1120 (match_operand:SI 2 "gpc_reg_operand" "r")
1122 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1125 [(set_attr "type" "imul3")])
1127 (define_insn "*machhwuc"
1128 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1129 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1130 (match_operand:SI 1 "gpc_reg_operand" "%r")
1133 (match_operand:SI 2 "gpc_reg_operand" "r")
1135 (match_operand:SI 4 "gpc_reg_operand" "0"))
1137 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1138 (plus:SI (mult:SI (lshiftrt:SI
1146 "machhwu. %0, %1, %2"
1147 [(set_attr "type" "imul3")])
1149 (define_insn "*machhwu"
1150 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1151 (plus:SI (mult:SI (lshiftrt:SI
1152 (match_operand:SI 1 "gpc_reg_operand" "%r")
1155 (match_operand:SI 2 "gpc_reg_operand" "r")
1157 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1159 "machhwu %0, %1, %2"
1160 [(set_attr "type" "imul3")])
1162 (define_insn "*maclhwc"
1163 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1164 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1165 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1167 (match_operand:HI 2 "gpc_reg_operand" "r")))
1168 (match_operand:SI 4 "gpc_reg_operand" "0"))
1170 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1171 (plus:SI (mult:SI (sign_extend:SI
1177 "maclhw. %0, %1, %2"
1178 [(set_attr "type" "imul3")])
1180 (define_insn "*maclhw"
1181 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1182 (plus:SI (mult:SI (sign_extend:SI
1183 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1185 (match_operand:HI 2 "gpc_reg_operand" "r")))
1186 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1189 [(set_attr "type" "imul3")])
1191 (define_insn "*maclhwuc"
1192 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1193 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1194 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1196 (match_operand:HI 2 "gpc_reg_operand" "r")))
1197 (match_operand:SI 4 "gpc_reg_operand" "0"))
1199 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1200 (plus:SI (mult:SI (zero_extend:SI
1206 "maclhwu. %0, %1, %2"
1207 [(set_attr "type" "imul3")])
1209 (define_insn "*maclhwu"
1210 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1211 (plus:SI (mult:SI (zero_extend:SI
1212 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1214 (match_operand:HI 2 "gpc_reg_operand" "r")))
1215 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1217 "maclhwu %0, %1, %2"
1218 [(set_attr "type" "imul3")])
1220 (define_insn "*nmacchwc"
1221 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1222 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1223 (mult:SI (ashiftrt:SI
1224 (match_operand:SI 2 "gpc_reg_operand" "r")
1227 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1229 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1230 (minus:SI (match_dup 4)
1231 (mult:SI (ashiftrt:SI
1237 "nmacchw. %0, %1, %2"
1238 [(set_attr "type" "imul3")])
1240 (define_insn "*nmacchw"
1241 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1242 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1243 (mult:SI (ashiftrt:SI
1244 (match_operand:SI 2 "gpc_reg_operand" "r")
1247 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1249 "nmacchw %0, %1, %2"
1250 [(set_attr "type" "imul3")])
1252 (define_insn "*nmachhwc"
1253 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1254 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1255 (mult:SI (ashiftrt:SI
1256 (match_operand:SI 1 "gpc_reg_operand" "%r")
1259 (match_operand:SI 2 "gpc_reg_operand" "r")
1262 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1263 (minus:SI (match_dup 4)
1264 (mult:SI (ashiftrt:SI
1271 "nmachhw. %0, %1, %2"
1272 [(set_attr "type" "imul3")])
1274 (define_insn "*nmachhw"
1275 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1276 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1277 (mult:SI (ashiftrt:SI
1278 (match_operand:SI 1 "gpc_reg_operand" "%r")
1281 (match_operand:SI 2 "gpc_reg_operand" "r")
1284 "nmachhw %0, %1, %2"
1285 [(set_attr "type" "imul3")])
1287 (define_insn "*nmaclhwc"
1288 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1289 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1290 (mult:SI (sign_extend:SI
1291 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1293 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1295 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1296 (minus:SI (match_dup 4)
1297 (mult:SI (sign_extend:SI
1302 "nmaclhw. %0, %1, %2"
1303 [(set_attr "type" "imul3")])
1305 (define_insn "*nmaclhw"
1306 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1307 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1308 (mult:SI (sign_extend:SI
1309 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1311 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1313 "nmaclhw %0, %1, %2"
1314 [(set_attr "type" "imul3")])
1316 (define_insn "*mulchwc"
1317 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1318 (compare:CC (mult:SI (ashiftrt:SI
1319 (match_operand:SI 2 "gpc_reg_operand" "r")
1322 (match_operand:HI 1 "gpc_reg_operand" "r")))
1324 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1325 (mult:SI (ashiftrt:SI
1331 "mulchw. %0, %1, %2"
1332 [(set_attr "type" "imul3")])
1334 (define_insn "*mulchw"
1335 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1336 (mult:SI (ashiftrt:SI
1337 (match_operand:SI 2 "gpc_reg_operand" "r")
1340 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1343 [(set_attr "type" "imul3")])
1345 (define_insn "*mulchwuc"
1346 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1347 (compare:CC (mult:SI (lshiftrt:SI
1348 (match_operand:SI 2 "gpc_reg_operand" "r")
1351 (match_operand:HI 1 "gpc_reg_operand" "r")))
1353 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1354 (mult:SI (lshiftrt:SI
1360 "mulchwu. %0, %1, %2"
1361 [(set_attr "type" "imul3")])
1363 (define_insn "*mulchwu"
1364 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1365 (mult:SI (lshiftrt:SI
1366 (match_operand:SI 2 "gpc_reg_operand" "r")
1369 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1371 "mulchwu %0, %1, %2"
1372 [(set_attr "type" "imul3")])
1374 (define_insn "*mulhhwc"
1375 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1376 (compare:CC (mult:SI (ashiftrt:SI
1377 (match_operand:SI 1 "gpc_reg_operand" "%r")
1380 (match_operand:SI 2 "gpc_reg_operand" "r")
1383 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1384 (mult:SI (ashiftrt:SI
1391 "mulhhw. %0, %1, %2"
1392 [(set_attr "type" "imul3")])
1394 (define_insn "*mulhhw"
1395 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1396 (mult:SI (ashiftrt:SI
1397 (match_operand:SI 1 "gpc_reg_operand" "%r")
1400 (match_operand:SI 2 "gpc_reg_operand" "r")
1404 [(set_attr "type" "imul3")])
1406 (define_insn "*mulhhwuc"
1407 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1408 (compare:CC (mult:SI (lshiftrt:SI
1409 (match_operand:SI 1 "gpc_reg_operand" "%r")
1412 (match_operand:SI 2 "gpc_reg_operand" "r")
1415 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1416 (mult:SI (lshiftrt:SI
1423 "mulhhwu. %0, %1, %2"
1424 [(set_attr "type" "imul3")])
1426 (define_insn "*mulhhwu"
1427 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1428 (mult:SI (lshiftrt:SI
1429 (match_operand:SI 1 "gpc_reg_operand" "%r")
1432 (match_operand:SI 2 "gpc_reg_operand" "r")
1435 "mulhhwu %0, %1, %2"
1436 [(set_attr "type" "imul3")])
1438 (define_insn "*mullhwc"
1439 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1440 (compare:CC (mult:SI (sign_extend:SI
1441 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1443 (match_operand:HI 2 "gpc_reg_operand" "r")))
1445 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1446 (mult:SI (sign_extend:SI
1451 "mullhw. %0, %1, %2"
1452 [(set_attr "type" "imul3")])
1454 (define_insn "*mullhw"
1455 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1456 (mult:SI (sign_extend:SI
1457 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1459 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1462 [(set_attr "type" "imul3")])
1464 (define_insn "*mullhwuc"
1465 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1466 (compare:CC (mult:SI (zero_extend:SI
1467 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1469 (match_operand:HI 2 "gpc_reg_operand" "r")))
1471 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1472 (mult:SI (zero_extend:SI
1477 "mullhwu. %0, %1, %2"
1478 [(set_attr "type" "imul3")])
1480 (define_insn "*mullhwu"
1481 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1482 (mult:SI (zero_extend:SI
1483 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1485 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1487 "mullhwu %0, %1, %2"
1488 [(set_attr "type" "imul3")])
1490 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1491 (define_insn "dlmzb"
1492 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1493 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1494 (match_operand:SI 2 "gpc_reg_operand" "r")]
1496 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1497 (unspec:SI [(match_dup 1)
1501 "dlmzb. %0, %1, %2")
1503 (define_expand "strlensi"
1504 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1505 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1506 (match_operand:QI 2 "const_int_operand" "")
1507 (match_operand 3 "const_int_operand" "")]
1508 UNSPEC_DLMZB_STRLEN))
1509 (clobber (match_scratch:CC 4 "=x"))]
1510 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1512 rtx result = operands[0];
1513 rtx src = operands[1];
1514 rtx search_char = operands[2];
1515 rtx align = operands[3];
1516 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1517 rtx loop_label, end_label, mem, cr0, cond;
1518 if (search_char != const0_rtx
1519 || GET_CODE (align) != CONST_INT
1520 || INTVAL (align) < 8)
1522 word1 = gen_reg_rtx (SImode);
1523 word2 = gen_reg_rtx (SImode);
1524 scratch_dlmzb = gen_reg_rtx (SImode);
1525 scratch_string = gen_reg_rtx (Pmode);
1526 loop_label = gen_label_rtx ();
1527 end_label = gen_label_rtx ();
1528 addr = force_reg (Pmode, XEXP (src, 0));
1529 emit_move_insn (scratch_string, addr);
1530 emit_label (loop_label);
1531 mem = change_address (src, SImode, scratch_string);
1532 emit_move_insn (word1, mem);
1533 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1534 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1535 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1536 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1537 emit_jump_insn (gen_rtx_SET (VOIDmode,
1539 gen_rtx_IF_THEN_ELSE (VOIDmode,
1545 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1546 emit_jump_insn (gen_rtx_SET (VOIDmode,
1548 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1550 emit_label (end_label);
1551 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1552 emit_insn (gen_subsi3 (result, scratch_string, addr));
1553 emit_insn (gen_subsi3 (result, result, const1_rtx));
1558 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1559 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1561 (set (match_operand:SI 0 "gpc_reg_operand" "")
1562 (sign_extend:SI (match_dup 1)))]
1565 (sign_extend:SI (match_dup 1)))
1567 (compare:CC (match_dup 0)
1571 ;; Fixed-point arithmetic insns.
1573 (define_expand "add<mode>3"
1574 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1575 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1576 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1579 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1581 if (non_short_cint_operand (operands[2], DImode))
1584 else if (GET_CODE (operands[2]) == CONST_INT
1585 && ! add_operand (operands[2], <MODE>mode))
1587 rtx tmp = ((!can_create_pseudo_p ()
1588 || rtx_equal_p (operands[0], operands[1]))
1589 ? operands[0] : gen_reg_rtx (<MODE>mode));
1591 HOST_WIDE_INT val = INTVAL (operands[2]);
1592 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1593 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1595 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1598 /* The ordering here is important for the prolog expander.
1599 When space is allocated from the stack, adding 'low' first may
1600 produce a temporary deallocation (which would be bad). */
1601 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1602 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1607 ;; Discourage ai/addic because of carry but provide it in an alternative
1608 ;; allowing register zero as source.
1609 (define_insn "*add<mode>3_internal1"
1610 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1611 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1612 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1613 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1616 {cal %0,%2(%1)|addi %0,%1,%2}
1618 {cau|addis} %0,%1,%v2"
1619 [(set_attr "length" "4,4,4,4")])
1621 (define_insn "addsi3_high"
1622 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1623 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1624 (high:SI (match_operand 2 "" ""))))]
1625 "TARGET_MACHO && !TARGET_64BIT"
1626 "{cau|addis} %0,%1,ha16(%2)"
1627 [(set_attr "length" "4")])
1629 (define_insn "*add<mode>3_internal2"
1630 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1631 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1632 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1634 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1637 {cax.|add.} %3,%1,%2
1638 {ai.|addic.} %3,%1,%2
1641 [(set_attr "type" "fast_compare,compare,compare,compare")
1642 (set_attr "length" "4,4,8,8")])
1645 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1646 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1647 (match_operand:GPR 2 "reg_or_short_operand" ""))
1649 (clobber (match_scratch:GPR 3 ""))]
1652 (plus:GPR (match_dup 1)
1655 (compare:CC (match_dup 3)
1659 (define_insn "*add<mode>3_internal3"
1660 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1661 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1662 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1664 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1665 (plus:P (match_dup 1)
1669 {cax.|add.} %0,%1,%2
1670 {ai.|addic.} %0,%1,%2
1673 [(set_attr "type" "fast_compare,compare,compare,compare")
1674 (set_attr "length" "4,4,8,8")])
1677 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1678 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1679 (match_operand:P 2 "reg_or_short_operand" ""))
1681 (set (match_operand:P 0 "gpc_reg_operand" "")
1682 (plus:P (match_dup 1) (match_dup 2)))]
1685 (plus:P (match_dup 1)
1688 (compare:CC (match_dup 0)
1692 ;; Split an add that we can't do in one insn into two insns, each of which
1693 ;; does one 16-bit part. This is used by combine. Note that the low-order
1694 ;; add should be last in case the result gets used in an address.
1697 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1698 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1699 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1701 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1702 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1704 HOST_WIDE_INT val = INTVAL (operands[2]);
1705 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1706 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1708 operands[4] = GEN_INT (low);
1709 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1710 operands[3] = GEN_INT (rest);
1711 else if (can_create_pseudo_p ())
1713 operands[3] = gen_reg_rtx (DImode);
1714 emit_move_insn (operands[3], operands[2]);
1715 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1722 (define_insn "one_cmpl<mode>2"
1723 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1724 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1729 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1730 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1732 (clobber (match_scratch:P 2 "=r,r"))]
1737 [(set_attr "type" "fast_compare,compare")
1738 (set_attr "length" "4,8")])
1741 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1742 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1744 (clobber (match_scratch:P 2 ""))]
1747 (not:P (match_dup 1)))
1749 (compare:CC (match_dup 2)
1754 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1755 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1757 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1758 (not:P (match_dup 1)))]
1763 [(set_attr "type" "fast_compare,compare")
1764 (set_attr "length" "4,8")])
1767 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1768 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1770 (set (match_operand:P 0 "gpc_reg_operand" "")
1771 (not:P (match_dup 1)))]
1774 (not:P (match_dup 1)))
1776 (compare:CC (match_dup 0)
1781 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1782 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1783 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1785 "{sf%I1|subf%I1c} %0,%2,%1")
1788 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1789 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1790 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1797 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1798 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1799 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1801 (clobber (match_scratch:SI 3 "=r,r"))]
1804 {sf.|subfc.} %3,%2,%1
1806 [(set_attr "type" "compare")
1807 (set_attr "length" "4,8")])
1810 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1811 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1812 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1814 (clobber (match_scratch:P 3 "=r,r"))]
1819 [(set_attr "type" "fast_compare")
1820 (set_attr "length" "4,8")])
1823 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1824 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1825 (match_operand:P 2 "gpc_reg_operand" ""))
1827 (clobber (match_scratch:P 3 ""))]
1830 (minus:P (match_dup 1)
1833 (compare:CC (match_dup 3)
1838 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1839 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1840 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1842 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1843 (minus:SI (match_dup 1) (match_dup 2)))]
1846 {sf.|subfc.} %0,%2,%1
1848 [(set_attr "type" "compare")
1849 (set_attr "length" "4,8")])
1852 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1853 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1854 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1856 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1857 (minus:P (match_dup 1)
1863 [(set_attr "type" "fast_compare")
1864 (set_attr "length" "4,8")])
1867 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1868 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1869 (match_operand:P 2 "gpc_reg_operand" ""))
1871 (set (match_operand:P 0 "gpc_reg_operand" "")
1872 (minus:P (match_dup 1)
1876 (minus:P (match_dup 1)
1879 (compare:CC (match_dup 0)
1883 (define_expand "sub<mode>3"
1884 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1885 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1886 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1890 if (GET_CODE (operands[2]) == CONST_INT)
1892 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1893 negate_rtx (<MODE>mode, operands[2])));
1898 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1899 ;; instruction and some auxiliary computations. Then we just have a single
1900 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1903 (define_expand "sminsi3"
1905 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1906 (match_operand:SI 2 "reg_or_short_operand" ""))
1908 (minus:SI (match_dup 2) (match_dup 1))))
1909 (set (match_operand:SI 0 "gpc_reg_operand" "")
1910 (minus:SI (match_dup 2) (match_dup 3)))]
1911 "TARGET_POWER || TARGET_ISEL"
1916 operands[2] = force_reg (SImode, operands[2]);
1917 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1921 operands[3] = gen_reg_rtx (SImode);
1925 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1926 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1927 (match_operand:SI 2 "reg_or_short_operand" "")))
1928 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1931 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1933 (minus:SI (match_dup 2) (match_dup 1))))
1934 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1937 (define_expand "smaxsi3"
1939 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1940 (match_operand:SI 2 "reg_or_short_operand" ""))
1942 (minus:SI (match_dup 2) (match_dup 1))))
1943 (set (match_operand:SI 0 "gpc_reg_operand" "")
1944 (plus:SI (match_dup 3) (match_dup 1)))]
1945 "TARGET_POWER || TARGET_ISEL"
1950 operands[2] = force_reg (SImode, operands[2]);
1951 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1954 operands[3] = gen_reg_rtx (SImode);
1958 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1959 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1960 (match_operand:SI 2 "reg_or_short_operand" "")))
1961 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1964 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1966 (minus:SI (match_dup 2) (match_dup 1))))
1967 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1970 (define_expand "uminsi3"
1971 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1973 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1975 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1977 (minus:SI (match_dup 4) (match_dup 3))))
1978 (set (match_operand:SI 0 "gpc_reg_operand" "")
1979 (minus:SI (match_dup 2) (match_dup 3)))]
1980 "TARGET_POWER || TARGET_ISEL"
1985 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1988 operands[3] = gen_reg_rtx (SImode);
1989 operands[4] = gen_reg_rtx (SImode);
1990 operands[5] = GEN_INT (-2147483647 - 1);
1993 (define_expand "umaxsi3"
1994 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1996 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1998 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2000 (minus:SI (match_dup 4) (match_dup 3))))
2001 (set (match_operand:SI 0 "gpc_reg_operand" "")
2002 (plus:SI (match_dup 3) (match_dup 1)))]
2003 "TARGET_POWER || TARGET_ISEL"
2008 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
2011 operands[3] = gen_reg_rtx (SImode);
2012 operands[4] = gen_reg_rtx (SImode);
2013 operands[5] = GEN_INT (-2147483647 - 1);
2017 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2018 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
2019 (match_operand:SI 2 "reg_or_short_operand" "rI"))
2021 (minus:SI (match_dup 2) (match_dup 1))))]
2026 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2028 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2029 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2031 (minus:SI (match_dup 2) (match_dup 1)))
2033 (clobber (match_scratch:SI 3 "=r,r"))]
2038 [(set_attr "type" "delayed_compare")
2039 (set_attr "length" "4,8")])
2042 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2044 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2045 (match_operand:SI 2 "reg_or_short_operand" ""))
2047 (minus:SI (match_dup 2) (match_dup 1)))
2049 (clobber (match_scratch:SI 3 ""))]
2050 "TARGET_POWER && reload_completed"
2052 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2054 (minus:SI (match_dup 2) (match_dup 1))))
2056 (compare:CC (match_dup 3)
2061 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2063 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2064 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2066 (minus:SI (match_dup 2) (match_dup 1)))
2068 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2069 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2071 (minus:SI (match_dup 2) (match_dup 1))))]
2076 [(set_attr "type" "delayed_compare")
2077 (set_attr "length" "4,8")])
2080 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2082 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2083 (match_operand:SI 2 "reg_or_short_operand" ""))
2085 (minus:SI (match_dup 2) (match_dup 1)))
2087 (set (match_operand:SI 0 "gpc_reg_operand" "")
2088 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2090 (minus:SI (match_dup 2) (match_dup 1))))]
2091 "TARGET_POWER && reload_completed"
2093 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2095 (minus:SI (match_dup 2) (match_dup 1))))
2097 (compare:CC (match_dup 0)
2101 ;; We don't need abs with condition code because such comparisons should
2103 (define_expand "abssi2"
2104 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2105 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2111 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2114 else if (! TARGET_POWER)
2116 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2121 (define_insn "*abssi2_power"
2122 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2123 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2127 (define_insn_and_split "abs<mode>2_isel"
2128 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2129 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2130 (clobber (match_scratch:GPR 2 "=&b"))
2131 (clobber (match_scratch:CC 3 "=y"))]
2134 "&& reload_completed"
2135 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2137 (compare:CC (match_dup 1)
2140 (if_then_else:GPR (lt (match_dup 3)
2146 (define_insn_and_split "nabs<mode>2_isel"
2147 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2148 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2149 (clobber (match_scratch:GPR 2 "=&b"))
2150 (clobber (match_scratch:CC 3 "=y"))]
2153 "&& reload_completed"
2154 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2156 (compare:CC (match_dup 1)
2159 (if_then_else:GPR (lt (match_dup 3)
2165 (define_insn_and_split "abssi2_nopower"
2166 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2167 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2168 (clobber (match_scratch:SI 2 "=&r,&r"))]
2169 "! TARGET_POWER && ! TARGET_ISEL"
2171 "&& reload_completed"
2172 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2173 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2174 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2177 (define_insn "*nabs_power"
2178 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2179 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2183 (define_insn_and_split "*nabs_nopower"
2184 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2185 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2186 (clobber (match_scratch:SI 2 "=&r,&r"))]
2189 "&& reload_completed"
2190 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2191 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2192 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2195 (define_expand "neg<mode>2"
2196 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2197 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2201 (define_insn "*neg<mode>2_internal"
2202 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2203 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2208 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2209 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2211 (clobber (match_scratch:P 2 "=r,r"))]
2216 [(set_attr "type" "fast_compare")
2217 (set_attr "length" "4,8")])
2220 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2221 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2223 (clobber (match_scratch:P 2 ""))]
2226 (neg:P (match_dup 1)))
2228 (compare:CC (match_dup 2)
2233 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2234 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2236 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2237 (neg:P (match_dup 1)))]
2242 [(set_attr "type" "fast_compare")
2243 (set_attr "length" "4,8")])
2246 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2247 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2249 (set (match_operand:P 0 "gpc_reg_operand" "")
2250 (neg:P (match_dup 1)))]
2253 (neg:P (match_dup 1)))
2255 (compare:CC (match_dup 0)
2259 (define_insn "clz<mode>2"
2260 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2261 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2263 "{cntlz|cntlz<wd>} %0,%1"
2264 [(set_attr "type" "cntlz")])
2266 (define_expand "ctz<mode>2"
2268 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2269 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2271 (clobber (scratch:CC))])
2272 (set (match_dup 4) (clz:GPR (match_dup 3)))
2273 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2274 (minus:GPR (match_dup 5) (match_dup 4)))]
2277 operands[2] = gen_reg_rtx (<MODE>mode);
2278 operands[3] = gen_reg_rtx (<MODE>mode);
2279 operands[4] = gen_reg_rtx (<MODE>mode);
2280 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2283 (define_expand "ffs<mode>2"
2285 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2286 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2288 (clobber (scratch:CC))])
2289 (set (match_dup 4) (clz:GPR (match_dup 3)))
2290 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2291 (minus:GPR (match_dup 5) (match_dup 4)))]
2294 operands[2] = gen_reg_rtx (<MODE>mode);
2295 operands[3] = gen_reg_rtx (<MODE>mode);
2296 operands[4] = gen_reg_rtx (<MODE>mode);
2297 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2300 (define_insn "popcntb<mode>2"
2301 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2302 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2307 (define_insn "popcntd<mode>2"
2308 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2309 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2313 (define_expand "popcount<mode>2"
2314 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2315 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2316 "TARGET_POPCNTB || TARGET_POPCNTD"
2318 rs6000_emit_popcount (operands[0], operands[1]);
2322 (define_insn "parity<mode>2_cmpb"
2323 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2324 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2325 "TARGET_CMPB && TARGET_POPCNTB"
2328 (define_expand "parity<mode>2"
2329 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2330 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2333 rs6000_emit_parity (operands[0], operands[1]);
2337 ;; Since the hardware zeros the upper part of the register, save generating the
2338 ;; AND immediate if we are converting to unsigned
2339 (define_insn "*bswaphi2_extenddi"
2340 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2342 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2345 [(set_attr "length" "4")
2346 (set_attr "type" "load")])
2348 (define_insn "*bswaphi2_extendsi"
2349 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2351 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2354 [(set_attr "length" "4")
2355 (set_attr "type" "load")])
2357 (define_expand "bswaphi2"
2358 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2360 (match_operand:HI 1 "reg_or_mem_operand" "")))
2361 (clobber (match_scratch:SI 2 ""))])]
2364 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2365 operands[1] = force_reg (HImode, operands[1]);
2368 (define_insn "bswaphi2_internal"
2369 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2371 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2372 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2378 [(set_attr "length" "4,4,12")
2379 (set_attr "type" "load,store,*")])
2382 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2383 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2384 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2385 "TARGET_POWERPC && reload_completed"
2387 (zero_extract:SI (match_dup 4)
2391 (and:SI (ashift:SI (match_dup 4)
2393 (const_int 65280))) ;; 0xff00
2395 (ior:SI (match_dup 3)
2399 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2400 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2403 (define_insn "*bswapsi2_extenddi"
2404 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2406 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2409 [(set_attr "length" "4")
2410 (set_attr "type" "load")])
2412 (define_expand "bswapsi2"
2413 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2415 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2418 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2419 operands[1] = force_reg (SImode, operands[1]);
2422 (define_insn "*bswapsi2_internal"
2423 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2425 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2429 {stbrx|stwbrx} %1,%y0
2431 [(set_attr "length" "4,4,12")
2432 (set_attr "type" "load,store,*")])
2435 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2436 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2439 (rotate:SI (match_dup 1) (const_int 8)))
2440 (set (zero_extract:SI (match_dup 0)
2444 (set (zero_extract:SI (match_dup 0)
2447 (rotate:SI (match_dup 1)
2451 (define_expand "bswapdi2"
2452 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2454 (match_operand:DI 1 "reg_or_mem_operand" "")))
2455 (clobber (match_scratch:DI 2 ""))
2456 (clobber (match_scratch:DI 3 ""))
2457 (clobber (match_scratch:DI 4 ""))])]
2460 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2461 operands[1] = force_reg (DImode, operands[1]);
2463 if (!TARGET_POWERPC64)
2465 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2466 that uses 64-bit registers needs the same scratch registers as 64-bit
2468 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2473 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2474 (define_insn "*bswapdi2_ldbrx"
2475 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2476 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2477 (clobber (match_scratch:DI 2 "=X,X,&r"))
2478 (clobber (match_scratch:DI 3 "=X,X,&r"))
2479 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2480 "TARGET_POWERPC64 && TARGET_LDBRX
2481 && (REG_P (operands[0]) || REG_P (operands[1]))"
2486 [(set_attr "length" "4,4,36")
2487 (set_attr "type" "load,store,*")])
2489 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2490 (define_insn "*bswapdi2_64bit"
2491 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2492 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2493 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2494 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2495 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2496 "TARGET_POWERPC64 && !TARGET_LDBRX
2497 && (REG_P (operands[0]) || REG_P (operands[1]))"
2499 [(set_attr "length" "16,12,36")])
2502 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2503 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2504 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2505 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2506 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2507 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2511 rtx dest = operands[0];
2512 rtx src = operands[1];
2513 rtx op2 = operands[2];
2514 rtx op3 = operands[3];
2515 rtx op4 = operands[4];
2516 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2517 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2523 addr1 = XEXP (src, 0);
2524 if (GET_CODE (addr1) == PLUS)
2526 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2527 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2531 emit_move_insn (op2, GEN_INT (4));
2532 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2535 if (BYTES_BIG_ENDIAN)
2537 word_high = change_address (src, SImode, addr1);
2538 word_low = change_address (src, SImode, addr2);
2542 word_high = change_address (src, SImode, addr2);
2543 word_low = change_address (src, SImode, addr1);
2546 emit_insn (gen_bswapsi2 (op3_32, word_low));
2547 emit_insn (gen_bswapsi2 (op4_32, word_high));
2548 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2549 emit_insn (gen_iordi3 (dest, dest, op4));
2553 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2554 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2555 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2556 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2557 (clobber (match_operand:DI 4 "" ""))]
2558 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2562 rtx dest = operands[0];
2563 rtx src = operands[1];
2564 rtx op2 = operands[2];
2565 rtx op3 = operands[3];
2566 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2567 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2573 addr1 = XEXP (dest, 0);
2574 if (GET_CODE (addr1) == PLUS)
2576 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2577 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2581 emit_move_insn (op2, GEN_INT (4));
2582 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2585 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2586 if (BYTES_BIG_ENDIAN)
2588 word_high = change_address (dest, SImode, addr1);
2589 word_low = change_address (dest, SImode, addr2);
2590 emit_insn (gen_bswapsi2 (word_high, src_si));
2591 emit_insn (gen_bswapsi2 (word_low, op3_si));
2595 word_high = change_address (dest, SImode, addr2);
2596 word_low = change_address (dest, SImode, addr1);
2597 emit_insn (gen_bswapsi2 (word_low, src_si));
2598 emit_insn (gen_bswapsi2 (word_high, op3_si));
2603 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2604 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2605 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2606 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2607 (clobber (match_operand:DI 4 "" ""))]
2608 "TARGET_POWERPC64 && reload_completed"
2612 rtx dest = operands[0];
2613 rtx src = operands[1];
2614 rtx op2 = operands[2];
2615 rtx op3 = operands[3];
2616 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2617 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2618 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2619 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2621 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2622 emit_insn (gen_bswapsi2 (dest_si, src_si));
2623 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2624 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2625 emit_insn (gen_iordi3 (dest, dest, op3));
2628 (define_insn "bswapdi2_32bit"
2629 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2630 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2631 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2632 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2634 [(set_attr "length" "16,12,36")])
2637 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2638 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2639 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2640 "!TARGET_POWERPC64 && reload_completed"
2644 rtx dest = operands[0];
2645 rtx src = operands[1];
2646 rtx op2 = operands[2];
2647 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2648 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2654 addr1 = XEXP (src, 0);
2655 if (GET_CODE (addr1) == PLUS)
2657 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2658 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2662 emit_move_insn (op2, GEN_INT (4));
2663 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2666 if (BYTES_BIG_ENDIAN)
2668 word_high = change_address (src, SImode, addr1);
2669 word_low = change_address (src, SImode, addr2);
2673 word_high = change_address (src, SImode, addr2);
2674 word_low = change_address (src, SImode, addr1);
2677 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2678 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2682 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2683 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2684 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2685 "!TARGET_POWERPC64 && reload_completed"
2689 rtx dest = operands[0];
2690 rtx src = operands[1];
2691 rtx op2 = operands[2];
2692 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2693 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2699 addr1 = XEXP (dest, 0);
2700 if (GET_CODE (addr1) == PLUS)
2702 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2703 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2707 emit_move_insn (op2, GEN_INT (4));
2708 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2711 if (BYTES_BIG_ENDIAN)
2713 word_high = change_address (dest, SImode, addr1);
2714 word_low = change_address (dest, SImode, addr2);
2718 word_high = change_address (dest, SImode, addr2);
2719 word_low = change_address (dest, SImode, addr1);
2722 emit_insn (gen_bswapsi2 (word_high, src_low));
2723 emit_insn (gen_bswapsi2 (word_low, src_high));
2727 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2728 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2729 (clobber (match_operand:SI 2 "" ""))]
2730 "!TARGET_POWERPC64 && reload_completed"
2734 rtx dest = operands[0];
2735 rtx src = operands[1];
2736 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2737 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2738 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2739 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2741 emit_insn (gen_bswapsi2 (dest_high, src_low));
2742 emit_insn (gen_bswapsi2 (dest_low, src_high));
2745 (define_expand "mulsi3"
2746 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2747 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2748 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2753 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2755 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2759 (define_insn "mulsi3_mq"
2760 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2761 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2762 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2763 (clobber (match_scratch:SI 3 "=q,q"))]
2766 {muls|mullw} %0,%1,%2
2767 {muli|mulli} %0,%1,%2"
2769 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2770 (const_string "imul3")
2771 (match_operand:SI 2 "short_cint_operand" "")
2772 (const_string "imul2")]
2773 (const_string "imul")))])
2775 (define_insn "mulsi3_no_mq"
2776 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2777 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2778 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2781 {muls|mullw} %0,%1,%2
2782 {muli|mulli} %0,%1,%2"
2784 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2785 (const_string "imul3")
2786 (match_operand:SI 2 "short_cint_operand" "")
2787 (const_string "imul2")]
2788 (const_string "imul")))])
2790 (define_insn "*mulsi3_mq_internal1"
2791 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2792 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2793 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2795 (clobber (match_scratch:SI 3 "=r,r"))
2796 (clobber (match_scratch:SI 4 "=q,q"))]
2799 {muls.|mullw.} %3,%1,%2
2801 [(set_attr "type" "imul_compare")
2802 (set_attr "length" "4,8")])
2805 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2806 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2807 (match_operand:SI 2 "gpc_reg_operand" ""))
2809 (clobber (match_scratch:SI 3 ""))
2810 (clobber (match_scratch:SI 4 ""))]
2811 "TARGET_POWER && reload_completed"
2812 [(parallel [(set (match_dup 3)
2813 (mult:SI (match_dup 1) (match_dup 2)))
2814 (clobber (match_dup 4))])
2816 (compare:CC (match_dup 3)
2820 (define_insn "*mulsi3_no_mq_internal1"
2821 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2822 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2823 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2825 (clobber (match_scratch:SI 3 "=r,r"))]
2828 {muls.|mullw.} %3,%1,%2
2830 [(set_attr "type" "imul_compare")
2831 (set_attr "length" "4,8")])
2834 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2835 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2836 (match_operand:SI 2 "gpc_reg_operand" ""))
2838 (clobber (match_scratch:SI 3 ""))]
2839 "! TARGET_POWER && reload_completed"
2841 (mult:SI (match_dup 1) (match_dup 2)))
2843 (compare:CC (match_dup 3)
2847 (define_insn "*mulsi3_mq_internal2"
2848 [(set (match_operand:CC 3 "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 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2853 (mult:SI (match_dup 1) (match_dup 2)))
2854 (clobber (match_scratch:SI 4 "=q,q"))]
2857 {muls.|mullw.} %0,%1,%2
2859 [(set_attr "type" "imul_compare")
2860 (set_attr "length" "4,8")])
2863 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2864 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2865 (match_operand:SI 2 "gpc_reg_operand" ""))
2867 (set (match_operand:SI 0 "gpc_reg_operand" "")
2868 (mult:SI (match_dup 1) (match_dup 2)))
2869 (clobber (match_scratch:SI 4 ""))]
2870 "TARGET_POWER && reload_completed"
2871 [(parallel [(set (match_dup 0)
2872 (mult:SI (match_dup 1) (match_dup 2)))
2873 (clobber (match_dup 4))])
2875 (compare:CC (match_dup 0)
2879 (define_insn "*mulsi3_no_mq_internal2"
2880 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2881 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2882 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2884 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2885 (mult:SI (match_dup 1) (match_dup 2)))]
2888 {muls.|mullw.} %0,%1,%2
2890 [(set_attr "type" "imul_compare")
2891 (set_attr "length" "4,8")])
2894 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2895 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2896 (match_operand:SI 2 "gpc_reg_operand" ""))
2898 (set (match_operand:SI 0 "gpc_reg_operand" "")
2899 (mult:SI (match_dup 1) (match_dup 2)))]
2900 "! TARGET_POWER && reload_completed"
2902 (mult:SI (match_dup 1) (match_dup 2)))
2904 (compare:CC (match_dup 0)
2908 ;; Operand 1 is divided by operand 2; quotient goes to operand
2909 ;; 0 and remainder to operand 3.
2910 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2912 (define_expand "divmodsi4"
2913 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2914 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2915 (match_operand:SI 2 "gpc_reg_operand" "")))
2916 (set (match_operand:SI 3 "register_operand" "")
2917 (mod:SI (match_dup 1) (match_dup 2)))])]
2918 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2921 if (! TARGET_POWER && ! TARGET_POWERPC)
2923 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2924 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2925 emit_insn (gen_divss_call ());
2926 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2927 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2932 (define_insn "*divmodsi4_internal"
2933 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2934 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2935 (match_operand:SI 2 "gpc_reg_operand" "r")))
2936 (set (match_operand:SI 3 "register_operand" "=q")
2937 (mod:SI (match_dup 1) (match_dup 2)))]
2940 [(set_attr "type" "idiv")])
2942 (define_expand "udiv<mode>3"
2943 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2944 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2945 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2946 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2949 if (! TARGET_POWER && ! TARGET_POWERPC)
2951 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2952 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2953 emit_insn (gen_quous_call ());
2954 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2957 else if (TARGET_POWER)
2959 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2964 (define_insn "udivsi3_mq"
2965 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2966 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2967 (match_operand:SI 2 "gpc_reg_operand" "r")))
2968 (clobber (match_scratch:SI 3 "=q"))]
2969 "TARGET_POWERPC && TARGET_POWER"
2971 [(set_attr "type" "idiv")])
2973 (define_insn "*udivsi3_no_mq"
2974 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2975 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2976 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2977 "TARGET_POWERPC && ! TARGET_POWER"
2980 (cond [(match_operand:SI 0 "" "")
2981 (const_string "idiv")]
2982 (const_string "ldiv")))])
2985 ;; For powers of two we can do srai/aze for divide and then adjust for
2986 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2987 ;; used; for PowerPC, force operands into register and do a normal divide;
2988 ;; for AIX common-mode, use quoss call on register operands.
2989 (define_expand "div<mode>3"
2990 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2991 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2992 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2996 if (GET_CODE (operands[2]) == CONST_INT
2997 && INTVAL (operands[2]) > 0
2998 && exact_log2 (INTVAL (operands[2])) >= 0)
3000 else if (TARGET_POWERPC)
3002 operands[2] = force_reg (<MODE>mode, operands[2]);
3005 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
3009 else if (TARGET_POWER)
3013 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3014 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3015 emit_insn (gen_quoss_call ());
3016 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3021 (define_insn "divsi3_mq"
3022 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3023 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3024 (match_operand:SI 2 "gpc_reg_operand" "r")))
3025 (clobber (match_scratch:SI 3 "=q"))]
3026 "TARGET_POWERPC && TARGET_POWER"
3028 [(set_attr "type" "idiv")])
3030 (define_insn "*div<mode>3_no_mq"
3031 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3032 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3033 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3034 "TARGET_POWERPC && ! TARGET_POWER"
3037 (cond [(match_operand:SI 0 "" "")
3038 (const_string "idiv")]
3039 (const_string "ldiv")))])
3041 (define_expand "mod<mode>3"
3042 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
3043 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
3044 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3052 if (GET_CODE (operands[2]) != CONST_INT
3053 || INTVAL (operands[2]) <= 0
3054 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3057 temp1 = gen_reg_rtx (<MODE>mode);
3058 temp2 = gen_reg_rtx (<MODE>mode);
3060 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3061 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3062 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3067 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3068 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3069 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3071 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3072 [(set_attr "type" "two")
3073 (set_attr "length" "8")])
3076 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3077 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3078 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3080 (clobber (match_scratch:P 3 "=r,r"))]
3083 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3085 [(set_attr "type" "compare")
3086 (set_attr "length" "8,12")
3087 (set_attr "cell_micro" "not")])
3090 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3091 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3092 (match_operand:GPR 2 "exact_log2_cint_operand"
3095 (clobber (match_scratch:GPR 3 ""))]
3098 (div:<MODE> (match_dup 1) (match_dup 2)))
3100 (compare:CC (match_dup 3)
3105 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3106 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3107 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3109 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3110 (div:P (match_dup 1) (match_dup 2)))]
3113 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3115 [(set_attr "type" "compare")
3116 (set_attr "length" "8,12")
3117 (set_attr "cell_micro" "not")])
3120 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3121 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3122 (match_operand:GPR 2 "exact_log2_cint_operand"
3125 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3126 (div:GPR (match_dup 1) (match_dup 2)))]
3129 (div:<MODE> (match_dup 1) (match_dup 2)))
3131 (compare:CC (match_dup 0)
3136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3139 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3141 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3142 (match_operand:SI 3 "gpc_reg_operand" "r")))
3143 (set (match_operand:SI 2 "register_operand" "=*q")
3146 (zero_extend:DI (match_dup 1)) (const_int 32))
3147 (zero_extend:DI (match_dup 4)))
3151 [(set_attr "type" "idiv")])
3153 ;; To do unsigned divide we handle the cases of the divisor looking like a
3154 ;; negative number. If it is a constant that is less than 2**31, we don't
3155 ;; have to worry about the branches. So make a few subroutines here.
3157 ;; First comes the normal case.
3158 (define_expand "udivmodsi4_normal"
3159 [(set (match_dup 4) (const_int 0))
3160 (parallel [(set (match_operand:SI 0 "" "")
3161 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3163 (zero_extend:DI (match_operand:SI 1 "" "")))
3164 (match_operand:SI 2 "" "")))
3165 (set (match_operand:SI 3 "" "")
3166 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3168 (zero_extend:DI (match_dup 1)))
3172 { operands[4] = gen_reg_rtx (SImode); }")
3174 ;; This handles the branches.
3175 (define_expand "udivmodsi4_tests"
3176 [(set (match_operand:SI 0 "" "") (const_int 0))
3177 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3178 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3179 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3180 (label_ref (match_operand:SI 4 "" "")) (pc)))
3181 (set (match_dup 0) (const_int 1))
3182 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3183 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3184 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3185 (label_ref (match_dup 4)) (pc)))]
3188 { operands[5] = gen_reg_rtx (CCUNSmode);
3189 operands[6] = gen_reg_rtx (CCmode);
3192 (define_expand "udivmodsi4"
3193 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3194 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3195 (match_operand:SI 2 "reg_or_cint_operand" "")))
3196 (set (match_operand:SI 3 "gpc_reg_operand" "")
3197 (umod:SI (match_dup 1) (match_dup 2)))])]
3205 if (! TARGET_POWERPC)
3207 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3208 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3209 emit_insn (gen_divus_call ());
3210 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3211 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3218 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3220 operands[2] = force_reg (SImode, operands[2]);
3221 label = gen_label_rtx ();
3222 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3223 operands[3], label));
3226 operands[2] = force_reg (SImode, operands[2]);
3228 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3236 ;; AIX architecture-independent common-mode multiply (DImode),
3237 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3238 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3239 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3240 ;; assumed unused if generating common-mode, so ignore.
3241 (define_insn "mulh_call"
3244 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3245 (sign_extend:DI (reg:SI 4)))
3247 (clobber (reg:SI LR_REGNO))]
3248 "! TARGET_POWER && ! TARGET_POWERPC"
3250 [(set_attr "type" "imul")])
3252 (define_insn "mull_call"
3254 (mult:DI (sign_extend:DI (reg:SI 3))
3255 (sign_extend:DI (reg:SI 4))))
3256 (clobber (reg:SI LR_REGNO))
3257 (clobber (reg:SI 0))]
3258 "! TARGET_POWER && ! TARGET_POWERPC"
3260 [(set_attr "type" "imul")])
3262 (define_insn "divss_call"
3264 (div:SI (reg:SI 3) (reg:SI 4)))
3266 (mod:SI (reg:SI 3) (reg:SI 4)))
3267 (clobber (reg:SI LR_REGNO))
3268 (clobber (reg:SI 0))]
3269 "! TARGET_POWER && ! TARGET_POWERPC"
3271 [(set_attr "type" "idiv")])
3273 (define_insn "divus_call"
3275 (udiv:SI (reg:SI 3) (reg:SI 4)))
3277 (umod:SI (reg:SI 3) (reg:SI 4)))
3278 (clobber (reg:SI LR_REGNO))
3279 (clobber (reg:SI 0))
3280 (clobber (match_scratch:CC 0 "=x"))
3281 (clobber (reg:CC CR1_REGNO))]
3282 "! TARGET_POWER && ! TARGET_POWERPC"
3284 [(set_attr "type" "idiv")])
3286 (define_insn "quoss_call"
3288 (div:SI (reg:SI 3) (reg:SI 4)))
3289 (clobber (reg:SI LR_REGNO))]
3290 "! TARGET_POWER && ! TARGET_POWERPC"
3292 [(set_attr "type" "idiv")])
3294 (define_insn "quous_call"
3296 (udiv:SI (reg:SI 3) (reg:SI 4)))
3297 (clobber (reg:SI LR_REGNO))
3298 (clobber (reg:SI 0))
3299 (clobber (match_scratch:CC 0 "=x"))
3300 (clobber (reg:CC CR1_REGNO))]
3301 "! TARGET_POWER && ! TARGET_POWERPC"
3303 [(set_attr "type" "idiv")])
3305 ;; Logical instructions
3306 ;; The logical instructions are mostly combined by using match_operator,
3307 ;; but the plain AND insns are somewhat different because there is no
3308 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3309 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3311 (define_expand "andsi3"
3313 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3314 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3315 (match_operand:SI 2 "and_operand" "")))
3316 (clobber (match_scratch:CC 3 ""))])]
3320 (define_insn "andsi3_mc"
3321 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3322 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3323 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3324 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3325 "rs6000_gen_cell_microcode"
3328 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3329 {andil.|andi.} %0,%1,%b2
3330 {andiu.|andis.} %0,%1,%u2"
3331 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3333 (define_insn "andsi3_nomc"
3334 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3335 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3336 (match_operand:SI 2 "and_operand" "?r,T")))
3337 (clobber (match_scratch:CC 3 "=X,X"))]
3338 "!rs6000_gen_cell_microcode"
3341 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3343 (define_insn "andsi3_internal0_nomc"
3344 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3345 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3346 (match_operand:SI 2 "and_operand" "?r,T")))]
3347 "!rs6000_gen_cell_microcode"
3350 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3353 ;; Note to set cr's other than cr0 we do the and immediate and then
3354 ;; the test again -- this avoids a mfcr which on the higher end
3355 ;; machines causes an execution serialization
3357 (define_insn "*andsi3_internal2_mc"
3358 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3359 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3360 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3362 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3363 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3364 "TARGET_32BIT && rs6000_gen_cell_microcode"
3367 {andil.|andi.} %3,%1,%b2
3368 {andiu.|andis.} %3,%1,%u2
3369 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3374 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3375 compare,compare,compare,compare")
3376 (set_attr "length" "4,4,4,4,8,8,8,8")])
3378 (define_insn "*andsi3_internal3_mc"
3379 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3380 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3381 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3383 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3384 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3385 "TARGET_64BIT && rs6000_gen_cell_microcode"
3388 {andil.|andi.} %3,%1,%b2
3389 {andiu.|andis.} %3,%1,%u2
3390 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3395 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3396 compare,compare,compare")
3397 (set_attr "length" "8,4,4,4,8,8,8,8")])
3400 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3401 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3402 (match_operand:GPR 2 "and_operand" ""))
3404 (clobber (match_scratch:GPR 3 ""))
3405 (clobber (match_scratch:CC 4 ""))]
3407 [(parallel [(set (match_dup 3)
3408 (and:<MODE> (match_dup 1)
3410 (clobber (match_dup 4))])
3412 (compare:CC (match_dup 3)
3416 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3417 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3420 [(set (match_operand:CC 0 "cc_reg_operand" "")
3421 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3422 (match_operand:SI 2 "gpc_reg_operand" ""))
3424 (clobber (match_scratch:SI 3 ""))
3425 (clobber (match_scratch:CC 4 ""))]
3426 "TARGET_POWERPC64 && reload_completed"
3427 [(parallel [(set (match_dup 3)
3428 (and:SI (match_dup 1)
3430 (clobber (match_dup 4))])
3432 (compare:CC (match_dup 3)
3436 (define_insn "*andsi3_internal4"
3437 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3438 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3439 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3441 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3442 (and:SI (match_dup 1)
3444 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3445 "TARGET_32BIT && rs6000_gen_cell_microcode"
3448 {andil.|andi.} %0,%1,%b2
3449 {andiu.|andis.} %0,%1,%u2
3450 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3455 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3456 compare,compare,compare,compare")
3457 (set_attr "length" "4,4,4,4,8,8,8,8")])
3459 (define_insn "*andsi3_internal5_mc"
3460 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3461 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3462 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3464 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3465 (and:SI (match_dup 1)
3467 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3468 "TARGET_64BIT && rs6000_gen_cell_microcode"
3471 {andil.|andi.} %0,%1,%b2
3472 {andiu.|andis.} %0,%1,%u2
3473 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3478 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3479 compare,compare,compare")
3480 (set_attr "length" "8,4,4,4,8,8,8,8")])
3483 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3484 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3485 (match_operand:SI 2 "and_operand" ""))
3487 (set (match_operand:SI 0 "gpc_reg_operand" "")
3488 (and:SI (match_dup 1)
3490 (clobber (match_scratch:CC 4 ""))]
3492 [(parallel [(set (match_dup 0)
3493 (and:SI (match_dup 1)
3495 (clobber (match_dup 4))])
3497 (compare:CC (match_dup 0)
3502 [(set (match_operand:CC 3 "cc_reg_operand" "")
3503 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3504 (match_operand:SI 2 "gpc_reg_operand" ""))
3506 (set (match_operand:SI 0 "gpc_reg_operand" "")
3507 (and:SI (match_dup 1)
3509 (clobber (match_scratch:CC 4 ""))]
3510 "TARGET_POWERPC64 && reload_completed"
3511 [(parallel [(set (match_dup 0)
3512 (and:SI (match_dup 1)
3514 (clobber (match_dup 4))])
3516 (compare:CC (match_dup 0)
3520 ;; Handle the PowerPC64 rlwinm corner case
3522 (define_insn_and_split "*andsi3_internal6"
3523 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3524 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3525 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3530 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3533 (rotate:SI (match_dup 0) (match_dup 5)))]
3536 int mb = extract_MB (operands[2]);
3537 int me = extract_ME (operands[2]);
3538 operands[3] = GEN_INT (me + 1);
3539 operands[5] = GEN_INT (32 - (me + 1));
3540 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3542 [(set_attr "length" "8")])
3544 (define_expand "iorsi3"
3545 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3546 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3547 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3551 if (GET_CODE (operands[2]) == CONST_INT
3552 && ! logical_operand (operands[2], SImode))
3554 HOST_WIDE_INT value = INTVAL (operands[2]);
3555 rtx tmp = ((!can_create_pseudo_p ()
3556 || rtx_equal_p (operands[0], operands[1]))
3557 ? operands[0] : gen_reg_rtx (SImode));
3559 emit_insn (gen_iorsi3 (tmp, operands[1],
3560 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3561 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3566 (define_expand "xorsi3"
3567 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3568 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3569 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3573 if (GET_CODE (operands[2]) == CONST_INT
3574 && ! logical_operand (operands[2], SImode))
3576 HOST_WIDE_INT value = INTVAL (operands[2]);
3577 rtx tmp = ((!can_create_pseudo_p ()
3578 || rtx_equal_p (operands[0], operands[1]))
3579 ? operands[0] : gen_reg_rtx (SImode));
3581 emit_insn (gen_xorsi3 (tmp, operands[1],
3582 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3583 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3588 (define_insn "*boolsi3_internal1"
3589 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3590 (match_operator:SI 3 "boolean_or_operator"
3591 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3592 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3596 {%q3il|%q3i} %0,%1,%b2
3597 {%q3iu|%q3is} %0,%1,%u2")
3599 (define_insn "*boolsi3_internal2"
3600 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3601 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3602 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3603 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3605 (clobber (match_scratch:SI 3 "=r,r"))]
3610 [(set_attr "type" "fast_compare,compare")
3611 (set_attr "length" "4,8")])
3614 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3615 (compare:CC (match_operator:SI 4 "boolean_operator"
3616 [(match_operand:SI 1 "gpc_reg_operand" "")
3617 (match_operand:SI 2 "gpc_reg_operand" "")])
3619 (clobber (match_scratch:SI 3 ""))]
3620 "TARGET_32BIT && reload_completed"
3621 [(set (match_dup 3) (match_dup 4))
3623 (compare:CC (match_dup 3)
3627 (define_insn "*boolsi3_internal3"
3628 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3629 (compare:CC (match_operator:SI 4 "boolean_operator"
3630 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3631 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3633 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3639 [(set_attr "type" "fast_compare,compare")
3640 (set_attr "length" "4,8")])
3643 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3644 (compare:CC (match_operator:SI 4 "boolean_operator"
3645 [(match_operand:SI 1 "gpc_reg_operand" "")
3646 (match_operand:SI 2 "gpc_reg_operand" "")])
3648 (set (match_operand:SI 0 "gpc_reg_operand" "")
3650 "TARGET_32BIT && reload_completed"
3651 [(set (match_dup 0) (match_dup 4))
3653 (compare:CC (match_dup 0)
3657 ;; Split a logical operation that we can't do in one insn into two insns,
3658 ;; each of which does one 16-bit part. This is used by combine.
3661 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3662 (match_operator:SI 3 "boolean_or_operator"
3663 [(match_operand:SI 1 "gpc_reg_operand" "")
3664 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3666 [(set (match_dup 0) (match_dup 4))
3667 (set (match_dup 0) (match_dup 5))]
3671 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3672 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3674 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3675 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3679 (define_insn "*boolcsi3_internal1"
3680 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3681 (match_operator:SI 3 "boolean_operator"
3682 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3683 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3687 (define_insn "*boolcsi3_internal2"
3688 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3689 (compare:CC (match_operator:SI 4 "boolean_operator"
3690 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3691 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3693 (clobber (match_scratch:SI 3 "=r,r"))]
3698 [(set_attr "type" "compare")
3699 (set_attr "length" "4,8")])
3702 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3703 (compare:CC (match_operator:SI 4 "boolean_operator"
3704 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3705 (match_operand:SI 2 "gpc_reg_operand" "")])
3707 (clobber (match_scratch:SI 3 ""))]
3708 "TARGET_32BIT && reload_completed"
3709 [(set (match_dup 3) (match_dup 4))
3711 (compare:CC (match_dup 3)
3715 (define_insn "*boolcsi3_internal3"
3716 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3717 (compare:CC (match_operator:SI 4 "boolean_operator"
3718 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3719 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3721 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3727 [(set_attr "type" "compare")
3728 (set_attr "length" "4,8")])
3731 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3732 (compare:CC (match_operator:SI 4 "boolean_operator"
3733 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3734 (match_operand:SI 2 "gpc_reg_operand" "")])
3736 (set (match_operand:SI 0 "gpc_reg_operand" "")
3738 "TARGET_32BIT && reload_completed"
3739 [(set (match_dup 0) (match_dup 4))
3741 (compare:CC (match_dup 0)
3745 (define_insn "*boolccsi3_internal1"
3746 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3747 (match_operator:SI 3 "boolean_operator"
3748 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3749 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3753 (define_insn "*boolccsi3_internal2"
3754 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3755 (compare:CC (match_operator:SI 4 "boolean_operator"
3756 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3757 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3759 (clobber (match_scratch:SI 3 "=r,r"))]
3764 [(set_attr "type" "fast_compare,compare")
3765 (set_attr "length" "4,8")])
3768 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3769 (compare:CC (match_operator:SI 4 "boolean_operator"
3770 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3771 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3773 (clobber (match_scratch:SI 3 ""))]
3774 "TARGET_32BIT && reload_completed"
3775 [(set (match_dup 3) (match_dup 4))
3777 (compare:CC (match_dup 3)
3781 (define_insn "*boolccsi3_internal3"
3782 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3783 (compare:CC (match_operator:SI 4 "boolean_operator"
3784 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3785 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3787 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3793 [(set_attr "type" "fast_compare,compare")
3794 (set_attr "length" "4,8")])
3797 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3798 (compare:CC (match_operator:SI 4 "boolean_operator"
3799 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3800 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3802 (set (match_operand:SI 0 "gpc_reg_operand" "")
3804 "TARGET_32BIT && reload_completed"
3805 [(set (match_dup 0) (match_dup 4))
3807 (compare:CC (match_dup 0)
3811 ;; maskir insn. We need four forms because things might be in arbitrary
3812 ;; orders. Don't define forms that only set CR fields because these
3813 ;; would modify an input register.
3815 (define_insn "*maskir_internal1"
3816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3817 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3818 (match_operand:SI 1 "gpc_reg_operand" "0"))
3819 (and:SI (match_dup 2)
3820 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3824 (define_insn "*maskir_internal2"
3825 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3826 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3827 (match_operand:SI 1 "gpc_reg_operand" "0"))
3828 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3833 (define_insn "*maskir_internal3"
3834 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3835 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3836 (match_operand:SI 3 "gpc_reg_operand" "r"))
3837 (and:SI (not:SI (match_dup 2))
3838 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3842 (define_insn "*maskir_internal4"
3843 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3844 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3845 (match_operand:SI 2 "gpc_reg_operand" "r"))
3846 (and:SI (not:SI (match_dup 2))
3847 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3851 (define_insn "*maskir_internal5"
3852 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3854 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3855 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3856 (and:SI (match_dup 2)
3857 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3859 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3860 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3861 (and:SI (match_dup 2) (match_dup 3))))]
3866 [(set_attr "type" "compare")
3867 (set_attr "length" "4,8")])
3870 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3872 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3873 (match_operand:SI 1 "gpc_reg_operand" ""))
3874 (and:SI (match_dup 2)
3875 (match_operand:SI 3 "gpc_reg_operand" "")))
3877 (set (match_operand:SI 0 "gpc_reg_operand" "")
3878 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3879 (and:SI (match_dup 2) (match_dup 3))))]
3880 "TARGET_POWER && reload_completed"
3882 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3883 (and:SI (match_dup 2) (match_dup 3))))
3885 (compare:CC (match_dup 0)
3889 (define_insn "*maskir_internal6"
3890 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3892 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3893 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3894 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3897 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3898 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3899 (and:SI (match_dup 3) (match_dup 2))))]
3904 [(set_attr "type" "compare")
3905 (set_attr "length" "4,8")])
3908 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3910 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3911 (match_operand:SI 1 "gpc_reg_operand" ""))
3912 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3915 (set (match_operand:SI 0 "gpc_reg_operand" "")
3916 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3917 (and:SI (match_dup 3) (match_dup 2))))]
3918 "TARGET_POWER && reload_completed"
3920 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3921 (and:SI (match_dup 3) (match_dup 2))))
3923 (compare:CC (match_dup 0)
3927 (define_insn "*maskir_internal7"
3928 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3930 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3931 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3932 (and:SI (not:SI (match_dup 2))
3933 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3935 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3936 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3937 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3942 [(set_attr "type" "compare")
3943 (set_attr "length" "4,8")])
3946 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3948 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3949 (match_operand:SI 3 "gpc_reg_operand" ""))
3950 (and:SI (not:SI (match_dup 2))
3951 (match_operand:SI 1 "gpc_reg_operand" "")))
3953 (set (match_operand:SI 0 "gpc_reg_operand" "")
3954 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3955 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3956 "TARGET_POWER && reload_completed"
3958 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3959 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3961 (compare:CC (match_dup 0)
3965 (define_insn "*maskir_internal8"
3966 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3968 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3969 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3970 (and:SI (not:SI (match_dup 2))
3971 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3973 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3974 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3975 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3980 [(set_attr "type" "compare")
3981 (set_attr "length" "4,8")])
3984 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3986 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3987 (match_operand:SI 2 "gpc_reg_operand" ""))
3988 (and:SI (not:SI (match_dup 2))
3989 (match_operand:SI 1 "gpc_reg_operand" "")))
3991 (set (match_operand:SI 0 "gpc_reg_operand" "")
3992 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3993 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3994 "TARGET_POWER && reload_completed"
3996 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3997 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3999 (compare:CC (match_dup 0)
4003 ;; Rotate and shift insns, in all their variants. These support shifts,
4004 ;; field inserts and extracts, and various combinations thereof.
4005 (define_expand "insv"
4006 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
4007 (match_operand:SI 1 "const_int_operand" "")
4008 (match_operand:SI 2 "const_int_operand" ""))
4009 (match_operand 3 "gpc_reg_operand" ""))]
4013 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4014 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4015 compiler if the address of the structure is taken later. Likewise, do
4016 not handle invalid E500 subregs. */
4017 if (GET_CODE (operands[0]) == SUBREG
4018 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
4019 || ((TARGET_E500_DOUBLE || TARGET_SPE)
4020 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
4023 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
4024 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
4026 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
4030 (define_insn "insvsi"
4031 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4032 (match_operand:SI 1 "const_int_operand" "i")
4033 (match_operand:SI 2 "const_int_operand" "i"))
4034 (match_operand:SI 3 "gpc_reg_operand" "r"))]
4038 int start = INTVAL (operands[2]) & 31;
4039 int size = INTVAL (operands[1]) & 31;
4041 operands[4] = GEN_INT (32 - start - size);
4042 operands[1] = GEN_INT (start + size - 1);
4043 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4045 [(set_attr "type" "insert_word")])
4047 (define_insn "*insvsi_internal1"
4048 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4049 (match_operand:SI 1 "const_int_operand" "i")
4050 (match_operand:SI 2 "const_int_operand" "i"))
4051 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4052 (match_operand:SI 4 "const_int_operand" "i")))]
4053 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4056 int shift = INTVAL (operands[4]) & 31;
4057 int start = INTVAL (operands[2]) & 31;
4058 int size = INTVAL (operands[1]) & 31;
4060 operands[4] = GEN_INT (shift - start - size);
4061 operands[1] = GEN_INT (start + size - 1);
4062 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4064 [(set_attr "type" "insert_word")])
4066 (define_insn "*insvsi_internal2"
4067 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4068 (match_operand:SI 1 "const_int_operand" "i")
4069 (match_operand:SI 2 "const_int_operand" "i"))
4070 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4071 (match_operand:SI 4 "const_int_operand" "i")))]
4072 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4075 int shift = INTVAL (operands[4]) & 31;
4076 int start = INTVAL (operands[2]) & 31;
4077 int size = INTVAL (operands[1]) & 31;
4079 operands[4] = GEN_INT (32 - shift - start - size);
4080 operands[1] = GEN_INT (start + size - 1);
4081 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4083 [(set_attr "type" "insert_word")])
4085 (define_insn "*insvsi_internal3"
4086 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4087 (match_operand:SI 1 "const_int_operand" "i")
4088 (match_operand:SI 2 "const_int_operand" "i"))
4089 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4090 (match_operand:SI 4 "const_int_operand" "i")))]
4091 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4094 int shift = INTVAL (operands[4]) & 31;
4095 int start = INTVAL (operands[2]) & 31;
4096 int size = INTVAL (operands[1]) & 31;
4098 operands[4] = GEN_INT (32 - shift - start - size);
4099 operands[1] = GEN_INT (start + size - 1);
4100 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4102 [(set_attr "type" "insert_word")])
4104 (define_insn "*insvsi_internal4"
4105 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4106 (match_operand:SI 1 "const_int_operand" "i")
4107 (match_operand:SI 2 "const_int_operand" "i"))
4108 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4109 (match_operand:SI 4 "const_int_operand" "i")
4110 (match_operand:SI 5 "const_int_operand" "i")))]
4111 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4114 int extract_start = INTVAL (operands[5]) & 31;
4115 int extract_size = INTVAL (operands[4]) & 31;
4116 int insert_start = INTVAL (operands[2]) & 31;
4117 int insert_size = INTVAL (operands[1]) & 31;
4119 /* Align extract field with insert field */
4120 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4121 operands[1] = GEN_INT (insert_start + insert_size - 1);
4122 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4124 [(set_attr "type" "insert_word")])
4126 ;; combine patterns for rlwimi
4127 (define_insn "*insvsi_internal5"
4128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4129 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4130 (match_operand:SI 1 "mask_operand" "i"))
4131 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4132 (match_operand:SI 2 "const_int_operand" "i"))
4133 (match_operand:SI 5 "mask_operand" "i"))))]
4134 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4137 int me = extract_ME(operands[5]);
4138 int mb = extract_MB(operands[5]);
4139 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4140 operands[2] = GEN_INT(mb);
4141 operands[1] = GEN_INT(me);
4142 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4144 [(set_attr "type" "insert_word")])
4146 (define_insn "*insvsi_internal6"
4147 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4148 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4149 (match_operand:SI 2 "const_int_operand" "i"))
4150 (match_operand:SI 5 "mask_operand" "i"))
4151 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4152 (match_operand:SI 1 "mask_operand" "i"))))]
4153 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4156 int me = extract_ME(operands[5]);
4157 int mb = extract_MB(operands[5]);
4158 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4159 operands[2] = GEN_INT(mb);
4160 operands[1] = GEN_INT(me);
4161 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4163 [(set_attr "type" "insert_word")])
4165 (define_insn "insvdi"
4166 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4167 (match_operand:SI 1 "const_int_operand" "i")
4168 (match_operand:SI 2 "const_int_operand" "i"))
4169 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4173 int start = INTVAL (operands[2]) & 63;
4174 int size = INTVAL (operands[1]) & 63;
4176 operands[1] = GEN_INT (64 - start - size);
4177 return \"rldimi %0,%3,%H1,%H2\";
4179 [(set_attr "type" "insert_dword")])
4181 (define_insn "*insvdi_internal2"
4182 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4183 (match_operand:SI 1 "const_int_operand" "i")
4184 (match_operand:SI 2 "const_int_operand" "i"))
4185 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4186 (match_operand:SI 4 "const_int_operand" "i")))]
4188 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4191 int shift = INTVAL (operands[4]) & 63;
4192 int start = (INTVAL (operands[2]) & 63) - 32;
4193 int size = INTVAL (operands[1]) & 63;
4195 operands[4] = GEN_INT (64 - shift - start - size);
4196 operands[2] = GEN_INT (start);
4197 operands[1] = GEN_INT (start + size - 1);
4198 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4201 (define_insn "*insvdi_internal3"
4202 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4203 (match_operand:SI 1 "const_int_operand" "i")
4204 (match_operand:SI 2 "const_int_operand" "i"))
4205 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4206 (match_operand:SI 4 "const_int_operand" "i")))]
4208 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4211 int shift = INTVAL (operands[4]) & 63;
4212 int start = (INTVAL (operands[2]) & 63) - 32;
4213 int size = INTVAL (operands[1]) & 63;
4215 operands[4] = GEN_INT (64 - shift - start - size);
4216 operands[2] = GEN_INT (start);
4217 operands[1] = GEN_INT (start + size - 1);
4218 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4221 (define_expand "extzv"
4222 [(set (match_operand 0 "gpc_reg_operand" "")
4223 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4224 (match_operand:SI 2 "const_int_operand" "")
4225 (match_operand:SI 3 "const_int_operand" "")))]
4229 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4230 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4231 compiler if the address of the structure is taken later. */
4232 if (GET_CODE (operands[0]) == SUBREG
4233 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4236 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4237 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4239 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4243 (define_insn "extzvsi"
4244 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4245 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4246 (match_operand:SI 2 "const_int_operand" "i")
4247 (match_operand:SI 3 "const_int_operand" "i")))]
4251 int start = INTVAL (operands[3]) & 31;
4252 int size = INTVAL (operands[2]) & 31;
4254 if (start + size >= 32)
4255 operands[3] = const0_rtx;
4257 operands[3] = GEN_INT (start + size);
4258 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4261 (define_insn "*extzvsi_internal1"
4262 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4263 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4264 (match_operand:SI 2 "const_int_operand" "i,i")
4265 (match_operand:SI 3 "const_int_operand" "i,i"))
4267 (clobber (match_scratch:SI 4 "=r,r"))]
4271 int start = INTVAL (operands[3]) & 31;
4272 int size = INTVAL (operands[2]) & 31;
4274 /* Force split for non-cc0 compare. */
4275 if (which_alternative == 1)
4278 /* If the bit-field being tested fits in the upper or lower half of a
4279 word, it is possible to use andiu. or andil. to test it. This is
4280 useful because the condition register set-use delay is smaller for
4281 andi[ul]. than for rlinm. This doesn't work when the starting bit
4282 position is 0 because the LT and GT bits may be set wrong. */
4284 if ((start > 0 && start + size <= 16) || start >= 16)
4286 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4287 - (1 << (16 - (start & 15) - size))));
4289 return \"{andiu.|andis.} %4,%1,%3\";
4291 return \"{andil.|andi.} %4,%1,%3\";
4294 if (start + size >= 32)
4295 operands[3] = const0_rtx;
4297 operands[3] = GEN_INT (start + size);
4298 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4300 [(set_attr "type" "delayed_compare")
4301 (set_attr "length" "4,8")])
4304 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4305 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4306 (match_operand:SI 2 "const_int_operand" "")
4307 (match_operand:SI 3 "const_int_operand" ""))
4309 (clobber (match_scratch:SI 4 ""))]
4312 (zero_extract:SI (match_dup 1) (match_dup 2)
4315 (compare:CC (match_dup 4)
4319 (define_insn "*extzvsi_internal2"
4320 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4321 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4322 (match_operand:SI 2 "const_int_operand" "i,i")
4323 (match_operand:SI 3 "const_int_operand" "i,i"))
4325 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4326 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4330 int start = INTVAL (operands[3]) & 31;
4331 int size = INTVAL (operands[2]) & 31;
4333 /* Force split for non-cc0 compare. */
4334 if (which_alternative == 1)
4337 /* Since we are using the output value, we can't ignore any need for
4338 a shift. The bit-field must end at the LSB. */
4339 if (start >= 16 && start + size == 32)
4341 operands[3] = GEN_INT ((1 << size) - 1);
4342 return \"{andil.|andi.} %0,%1,%3\";
4345 if (start + size >= 32)
4346 operands[3] = const0_rtx;
4348 operands[3] = GEN_INT (start + size);
4349 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4351 [(set_attr "type" "delayed_compare")
4352 (set_attr "length" "4,8")])
4355 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4356 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4357 (match_operand:SI 2 "const_int_operand" "")
4358 (match_operand:SI 3 "const_int_operand" ""))
4360 (set (match_operand:SI 0 "gpc_reg_operand" "")
4361 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4364 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4366 (compare:CC (match_dup 0)
4370 (define_insn "extzvdi"
4371 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4372 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4373 (match_operand:SI 2 "const_int_operand" "i")
4374 (match_operand:SI 3 "const_int_operand" "i")))]
4378 int start = INTVAL (operands[3]) & 63;
4379 int size = INTVAL (operands[2]) & 63;
4381 if (start + size >= 64)
4382 operands[3] = const0_rtx;
4384 operands[3] = GEN_INT (start + size);
4385 operands[2] = GEN_INT (64 - size);
4386 return \"rldicl %0,%1,%3,%2\";
4389 (define_insn "*extzvdi_internal1"
4390 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4391 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4392 (match_operand:SI 2 "const_int_operand" "i")
4393 (match_operand:SI 3 "const_int_operand" "i"))
4395 (clobber (match_scratch:DI 4 "=r"))]
4396 "TARGET_64BIT && rs6000_gen_cell_microcode"
4399 int start = INTVAL (operands[3]) & 63;
4400 int size = INTVAL (operands[2]) & 63;
4402 if (start + size >= 64)
4403 operands[3] = const0_rtx;
4405 operands[3] = GEN_INT (start + size);
4406 operands[2] = GEN_INT (64 - size);
4407 return \"rldicl. %4,%1,%3,%2\";
4409 [(set_attr "type" "compare")])
4411 (define_insn "*extzvdi_internal2"
4412 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4413 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4414 (match_operand:SI 2 "const_int_operand" "i")
4415 (match_operand:SI 3 "const_int_operand" "i"))
4417 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4418 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4419 "TARGET_64BIT && rs6000_gen_cell_microcode"
4422 int start = INTVAL (operands[3]) & 63;
4423 int size = INTVAL (operands[2]) & 63;
4425 if (start + size >= 64)
4426 operands[3] = const0_rtx;
4428 operands[3] = GEN_INT (start + size);
4429 operands[2] = GEN_INT (64 - size);
4430 return \"rldicl. %0,%1,%3,%2\";
4432 [(set_attr "type" "compare")])
4434 (define_insn "rotlsi3"
4435 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4436 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4437 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4440 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4441 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4442 [(set_attr "type" "var_shift_rotate,integer")])
4444 (define_insn "*rotlsi3_64"
4445 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4447 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4448 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4451 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4452 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4453 [(set_attr "type" "var_shift_rotate,integer")])
4455 (define_insn "*rotlsi3_internal2"
4456 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4457 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4458 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4460 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4463 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4464 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4467 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4468 (set_attr "length" "4,4,8,8")])
4471 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4472 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4473 (match_operand:SI 2 "reg_or_cint_operand" ""))
4475 (clobber (match_scratch:SI 3 ""))]
4478 (rotate:SI (match_dup 1) (match_dup 2)))
4480 (compare:CC (match_dup 3)
4484 (define_insn "*rotlsi3_internal3"
4485 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4486 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4487 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4489 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4490 (rotate:SI (match_dup 1) (match_dup 2)))]
4493 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4494 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4497 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4498 (set_attr "length" "4,4,8,8")])
4501 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4502 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4503 (match_operand:SI 2 "reg_or_cint_operand" ""))
4505 (set (match_operand:SI 0 "gpc_reg_operand" "")
4506 (rotate:SI (match_dup 1) (match_dup 2)))]
4509 (rotate:SI (match_dup 1) (match_dup 2)))
4511 (compare:CC (match_dup 0)
4515 (define_insn "*rotlsi3_internal4"
4516 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4517 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4518 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4519 (match_operand:SI 3 "mask_operand" "n,n")))]
4522 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4523 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4524 [(set_attr "type" "var_shift_rotate,integer")])
4526 (define_insn "*rotlsi3_internal5"
4527 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4529 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4530 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4531 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4533 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4536 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4537 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4540 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4541 (set_attr "length" "4,4,8,8")])
4544 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4546 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4547 (match_operand:SI 2 "reg_or_cint_operand" ""))
4548 (match_operand:SI 3 "mask_operand" ""))
4550 (clobber (match_scratch:SI 4 ""))]
4553 (and:SI (rotate:SI (match_dup 1)
4557 (compare:CC (match_dup 4)
4561 (define_insn "*rotlsi3_internal6"
4562 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4564 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4565 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4566 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4568 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4569 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4572 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4573 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4576 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4577 (set_attr "length" "4,4,8,8")])
4580 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4582 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4583 (match_operand:SI 2 "reg_or_cint_operand" ""))
4584 (match_operand:SI 3 "mask_operand" ""))
4586 (set (match_operand:SI 0 "gpc_reg_operand" "")
4587 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4590 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4592 (compare:CC (match_dup 0)
4596 (define_insn "*rotlsi3_internal7"
4597 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4600 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4601 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4603 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4604 [(set (attr "cell_micro")
4605 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4606 (const_string "not")
4607 (const_string "always")))])
4609 (define_insn "*rotlsi3_internal8"
4610 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4611 (compare:CC (zero_extend:SI
4613 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4614 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4616 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4619 {rlnm.|rlwnm.} %3,%1,%2,0xff
4620 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4623 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4624 (set_attr "length" "4,4,8,8")])
4627 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4628 (compare:CC (zero_extend:SI
4630 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4631 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4633 (clobber (match_scratch:SI 3 ""))]
4636 (zero_extend:SI (subreg:QI
4637 (rotate:SI (match_dup 1)
4640 (compare:CC (match_dup 3)
4644 (define_insn "*rotlsi3_internal9"
4645 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4646 (compare:CC (zero_extend:SI
4648 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4649 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4651 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4652 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4655 {rlnm.|rlwnm.} %0,%1,%2,0xff
4656 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4659 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4660 (set_attr "length" "4,4,8,8")])
4663 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4664 (compare:CC (zero_extend:SI
4666 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4667 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4669 (set (match_operand:SI 0 "gpc_reg_operand" "")
4670 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4673 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4675 (compare:CC (match_dup 0)
4679 (define_insn "*rotlsi3_internal10"
4680 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4683 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4684 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4687 {rlnm|rlwnm} %0,%1,%2,0xffff
4688 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4689 [(set_attr "type" "var_shift_rotate,integer")])
4692 (define_insn "*rotlsi3_internal11"
4693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4694 (compare:CC (zero_extend:SI
4696 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4697 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4699 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4702 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4703 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4706 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4707 (set_attr "length" "4,4,8,8")])
4710 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4711 (compare:CC (zero_extend:SI
4713 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4714 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4716 (clobber (match_scratch:SI 3 ""))]
4719 (zero_extend:SI (subreg:HI
4720 (rotate:SI (match_dup 1)
4723 (compare:CC (match_dup 3)
4727 (define_insn "*rotlsi3_internal12"
4728 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4729 (compare:CC (zero_extend:SI
4731 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4732 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4734 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4735 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4738 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4739 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4742 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4743 (set_attr "length" "4,4,8,8")])
4746 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4747 (compare:CC (zero_extend:SI
4749 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4750 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4752 (set (match_operand:SI 0 "gpc_reg_operand" "")
4753 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4756 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4758 (compare:CC (match_dup 0)
4762 ;; Note that we use "sle." instead of "sl." so that we can set
4763 ;; SHIFT_COUNT_TRUNCATED.
4765 (define_expand "ashlsi3"
4766 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4767 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4768 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4773 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4775 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4779 (define_insn "ashlsi3_power"
4780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4781 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4782 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4783 (clobber (match_scratch:SI 3 "=q,X"))]
4787 {sli|slwi} %0,%1,%h2")
4789 (define_insn "ashlsi3_no_power"
4790 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4791 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4792 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4796 {sli|slwi} %0,%1,%h2"
4797 [(set_attr "type" "var_shift_rotate,shift")])
4799 (define_insn "*ashlsi3_64"
4800 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4802 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4803 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4807 {sli|slwi} %0,%1,%h2"
4808 [(set_attr "type" "var_shift_rotate,shift")])
4811 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4812 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4813 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4815 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4816 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4820 {sli.|slwi.} %3,%1,%h2
4823 [(set_attr "type" "delayed_compare")
4824 (set_attr "length" "4,4,8,8")])
4827 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4828 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4829 (match_operand:SI 2 "reg_or_cint_operand" ""))
4831 (clobber (match_scratch:SI 3 ""))
4832 (clobber (match_scratch:SI 4 ""))]
4833 "TARGET_POWER && reload_completed"
4834 [(parallel [(set (match_dup 3)
4835 (ashift:SI (match_dup 1) (match_dup 2)))
4836 (clobber (match_dup 4))])
4838 (compare:CC (match_dup 3)
4843 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4844 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4845 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4847 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4848 "! TARGET_POWER && TARGET_32BIT"
4851 {sli.|slwi.} %3,%1,%h2
4854 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4855 (set_attr "length" "4,4,8,8")])
4858 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4859 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4860 (match_operand:SI 2 "reg_or_cint_operand" ""))
4862 (clobber (match_scratch:SI 3 ""))]
4863 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4865 (ashift:SI (match_dup 1) (match_dup 2)))
4867 (compare:CC (match_dup 3)
4872 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4873 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4874 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4876 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4877 (ashift:SI (match_dup 1) (match_dup 2)))
4878 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4882 {sli.|slwi.} %0,%1,%h2
4885 [(set_attr "type" "delayed_compare")
4886 (set_attr "length" "4,4,8,8")])
4889 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4890 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4891 (match_operand:SI 2 "reg_or_cint_operand" ""))
4893 (set (match_operand:SI 0 "gpc_reg_operand" "")
4894 (ashift:SI (match_dup 1) (match_dup 2)))
4895 (clobber (match_scratch:SI 4 ""))]
4896 "TARGET_POWER && reload_completed"
4897 [(parallel [(set (match_dup 0)
4898 (ashift:SI (match_dup 1) (match_dup 2)))
4899 (clobber (match_dup 4))])
4901 (compare:CC (match_dup 0)
4906 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4907 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4908 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4910 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4911 (ashift:SI (match_dup 1) (match_dup 2)))]
4912 "! TARGET_POWER && TARGET_32BIT"
4915 {sli.|slwi.} %0,%1,%h2
4918 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4919 (set_attr "length" "4,4,8,8")])
4922 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4923 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4924 (match_operand:SI 2 "reg_or_cint_operand" ""))
4926 (set (match_operand:SI 0 "gpc_reg_operand" "")
4927 (ashift:SI (match_dup 1) (match_dup 2)))]
4928 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4930 (ashift:SI (match_dup 1) (match_dup 2)))
4932 (compare:CC (match_dup 0)
4936 (define_insn "rlwinm"
4937 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4938 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4939 (match_operand:SI 2 "const_int_operand" "i"))
4940 (match_operand:SI 3 "mask_operand" "n")))]
4941 "includes_lshift_p (operands[2], operands[3])"
4942 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4945 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4947 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4948 (match_operand:SI 2 "const_int_operand" "i,i"))
4949 (match_operand:SI 3 "mask_operand" "n,n"))
4951 (clobber (match_scratch:SI 4 "=r,r"))]
4952 "includes_lshift_p (operands[2], operands[3])"
4954 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4956 [(set_attr "type" "delayed_compare")
4957 (set_attr "length" "4,8")])
4960 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4962 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4963 (match_operand:SI 2 "const_int_operand" ""))
4964 (match_operand:SI 3 "mask_operand" ""))
4966 (clobber (match_scratch:SI 4 ""))]
4967 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4969 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4972 (compare:CC (match_dup 4)
4977 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4979 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4980 (match_operand:SI 2 "const_int_operand" "i,i"))
4981 (match_operand:SI 3 "mask_operand" "n,n"))
4983 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4984 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4985 "includes_lshift_p (operands[2], operands[3])"
4987 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4989 [(set_attr "type" "delayed_compare")
4990 (set_attr "length" "4,8")])
4993 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4995 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4996 (match_operand:SI 2 "const_int_operand" ""))
4997 (match_operand:SI 3 "mask_operand" ""))
4999 (set (match_operand:SI 0 "gpc_reg_operand" "")
5000 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5001 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
5003 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5005 (compare:CC (match_dup 0)
5009 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
5011 (define_expand "lshrsi3"
5012 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
5013 (use (match_operand:SI 1 "gpc_reg_operand" ""))
5014 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
5019 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
5021 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
5025 (define_insn "lshrsi3_power"
5026 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5027 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5028 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
5029 (clobber (match_scratch:SI 3 "=q,X,X"))]
5034 {s%A2i|s%A2wi} %0,%1,%h2")
5036 (define_insn "lshrsi3_no_power"
5037 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5038 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5039 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
5044 {sri|srwi} %0,%1,%h2"
5045 [(set_attr "type" "integer,var_shift_rotate,shift")])
5047 (define_insn "*lshrsi3_64"
5048 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5050 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5051 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5055 {sri|srwi} %0,%1,%h2"
5056 [(set_attr "type" "var_shift_rotate,shift")])
5059 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5060 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5061 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5063 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5064 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5069 {s%A2i.|s%A2wi.} %3,%1,%h2
5073 [(set_attr "type" "delayed_compare")
5074 (set_attr "length" "4,4,4,8,8,8")])
5077 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5078 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5079 (match_operand:SI 2 "reg_or_cint_operand" ""))
5081 (clobber (match_scratch:SI 3 ""))
5082 (clobber (match_scratch:SI 4 ""))]
5083 "TARGET_POWER && reload_completed"
5084 [(parallel [(set (match_dup 3)
5085 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5086 (clobber (match_dup 4))])
5088 (compare:CC (match_dup 3)
5093 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5094 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5095 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5097 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5098 "! TARGET_POWER && TARGET_32BIT"
5102 {sri.|srwi.} %3,%1,%h2
5106 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5107 (set_attr "length" "4,4,4,8,8,8")])
5110 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5111 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5112 (match_operand:SI 2 "reg_or_cint_operand" ""))
5114 (clobber (match_scratch:SI 3 ""))]
5115 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5117 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5119 (compare:CC (match_dup 3)
5124 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5125 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5126 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5128 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5129 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5130 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5135 {s%A2i.|s%A2wi.} %0,%1,%h2
5139 [(set_attr "type" "delayed_compare")
5140 (set_attr "length" "4,4,4,8,8,8")])
5143 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5144 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5145 (match_operand:SI 2 "reg_or_cint_operand" ""))
5147 (set (match_operand:SI 0 "gpc_reg_operand" "")
5148 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5149 (clobber (match_scratch:SI 4 ""))]
5150 "TARGET_POWER && reload_completed"
5151 [(parallel [(set (match_dup 0)
5152 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5153 (clobber (match_dup 4))])
5155 (compare:CC (match_dup 0)
5160 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5161 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5162 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5164 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5165 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5166 "! TARGET_POWER && TARGET_32BIT"
5170 {sri.|srwi.} %0,%1,%h2
5174 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5175 (set_attr "length" "4,4,4,8,8,8")])
5178 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5179 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5180 (match_operand:SI 2 "reg_or_cint_operand" ""))
5182 (set (match_operand:SI 0 "gpc_reg_operand" "")
5183 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5184 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5186 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5188 (compare:CC (match_dup 0)
5193 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5194 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5195 (match_operand:SI 2 "const_int_operand" "i"))
5196 (match_operand:SI 3 "mask_operand" "n")))]
5197 "includes_rshift_p (operands[2], operands[3])"
5198 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5201 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5203 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5204 (match_operand:SI 2 "const_int_operand" "i,i"))
5205 (match_operand:SI 3 "mask_operand" "n,n"))
5207 (clobber (match_scratch:SI 4 "=r,r"))]
5208 "includes_rshift_p (operands[2], operands[3])"
5210 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5212 [(set_attr "type" "delayed_compare")
5213 (set_attr "length" "4,8")])
5216 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5218 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5219 (match_operand:SI 2 "const_int_operand" ""))
5220 (match_operand:SI 3 "mask_operand" ""))
5222 (clobber (match_scratch:SI 4 ""))]
5223 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5225 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5228 (compare:CC (match_dup 4)
5233 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5235 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5236 (match_operand:SI 2 "const_int_operand" "i,i"))
5237 (match_operand:SI 3 "mask_operand" "n,n"))
5239 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5240 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5241 "includes_rshift_p (operands[2], operands[3])"
5243 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5245 [(set_attr "type" "delayed_compare")
5246 (set_attr "length" "4,8")])
5249 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5251 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5252 (match_operand:SI 2 "const_int_operand" ""))
5253 (match_operand:SI 3 "mask_operand" ""))
5255 (set (match_operand:SI 0 "gpc_reg_operand" "")
5256 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5257 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5259 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5261 (compare:CC (match_dup 0)
5266 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5269 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5270 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5271 "includes_rshift_p (operands[2], GEN_INT (255))"
5272 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5275 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5279 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5280 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5282 (clobber (match_scratch:SI 3 "=r,r"))]
5283 "includes_rshift_p (operands[2], GEN_INT (255))"
5285 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5287 [(set_attr "type" "delayed_compare")
5288 (set_attr "length" "4,8")])
5291 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5295 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5296 (match_operand:SI 2 "const_int_operand" "")) 0))
5298 (clobber (match_scratch:SI 3 ""))]
5299 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5301 (zero_extend:SI (subreg:QI
5302 (lshiftrt:SI (match_dup 1)
5305 (compare:CC (match_dup 3)
5310 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5314 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5315 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5317 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5318 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5319 "includes_rshift_p (operands[2], GEN_INT (255))"
5321 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5323 [(set_attr "type" "delayed_compare")
5324 (set_attr "length" "4,8")])
5327 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5331 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5332 (match_operand:SI 2 "const_int_operand" "")) 0))
5334 (set (match_operand:SI 0 "gpc_reg_operand" "")
5335 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5336 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5338 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5340 (compare:CC (match_dup 0)
5345 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5348 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5349 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5350 "includes_rshift_p (operands[2], GEN_INT (65535))"
5351 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5354 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5358 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5359 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5361 (clobber (match_scratch:SI 3 "=r,r"))]
5362 "includes_rshift_p (operands[2], GEN_INT (65535))"
5364 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5366 [(set_attr "type" "delayed_compare")
5367 (set_attr "length" "4,8")])
5370 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5374 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5375 (match_operand:SI 2 "const_int_operand" "")) 0))
5377 (clobber (match_scratch:SI 3 ""))]
5378 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5380 (zero_extend:SI (subreg:HI
5381 (lshiftrt:SI (match_dup 1)
5384 (compare:CC (match_dup 3)
5389 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5393 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5394 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5396 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5397 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5398 "includes_rshift_p (operands[2], GEN_INT (65535))"
5400 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5402 [(set_attr "type" "delayed_compare")
5403 (set_attr "length" "4,8")])
5406 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5410 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5411 (match_operand:SI 2 "const_int_operand" "")) 0))
5413 (set (match_operand:SI 0 "gpc_reg_operand" "")
5414 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5415 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5417 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5419 (compare:CC (match_dup 0)
5424 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5426 (match_operand:SI 1 "gpc_reg_operand" "r"))
5427 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5433 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5435 (match_operand:SI 1 "gpc_reg_operand" "r"))
5436 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5442 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5444 (match_operand:SI 1 "gpc_reg_operand" "r"))
5445 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5451 (define_expand "ashrsi3"
5452 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5453 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5454 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5459 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5461 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5465 (define_insn "ashrsi3_power"
5466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5467 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5468 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5469 (clobber (match_scratch:SI 3 "=q,X"))]
5473 {srai|srawi} %0,%1,%h2"
5474 [(set_attr "type" "shift")])
5476 (define_insn "ashrsi3_no_power"
5477 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5478 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5479 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5483 {srai|srawi} %0,%1,%h2"
5484 [(set_attr "type" "var_shift_rotate,shift")])
5486 (define_insn "*ashrsi3_64"
5487 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5489 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5490 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5494 {srai|srawi} %0,%1,%h2"
5495 [(set_attr "type" "var_shift_rotate,shift")])
5498 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5499 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5500 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5502 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5503 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5507 {srai.|srawi.} %3,%1,%h2
5510 [(set_attr "type" "delayed_compare")
5511 (set_attr "length" "4,4,8,8")])
5514 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5515 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5516 (match_operand:SI 2 "reg_or_cint_operand" ""))
5518 (clobber (match_scratch:SI 3 ""))
5519 (clobber (match_scratch:SI 4 ""))]
5520 "TARGET_POWER && reload_completed"
5521 [(parallel [(set (match_dup 3)
5522 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5523 (clobber (match_dup 4))])
5525 (compare:CC (match_dup 3)
5530 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5531 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5532 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5534 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5537 {sra.|sraw.} %3,%1,%2
5538 {srai.|srawi.} %3,%1,%h2
5541 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5542 (set_attr "length" "4,4,8,8")])
5545 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5546 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5547 (match_operand:SI 2 "reg_or_cint_operand" ""))
5549 (clobber (match_scratch:SI 3 ""))]
5550 "! TARGET_POWER && reload_completed"
5552 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5554 (compare:CC (match_dup 3)
5559 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5560 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5561 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5563 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5564 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5565 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5569 {srai.|srawi.} %0,%1,%h2
5572 [(set_attr "type" "delayed_compare")
5573 (set_attr "length" "4,4,8,8")])
5576 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5577 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5578 (match_operand:SI 2 "reg_or_cint_operand" ""))
5580 (set (match_operand:SI 0 "gpc_reg_operand" "")
5581 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5582 (clobber (match_scratch:SI 4 ""))]
5583 "TARGET_POWER && reload_completed"
5584 [(parallel [(set (match_dup 0)
5585 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5586 (clobber (match_dup 4))])
5588 (compare:CC (match_dup 0)
5593 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5594 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5595 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5597 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5598 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5601 {sra.|sraw.} %0,%1,%2
5602 {srai.|srawi.} %0,%1,%h2
5605 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5606 (set_attr "length" "4,4,8,8")])
5608 ;; Builtins to replace a division to generate FRE reciprocal estimate
5609 ;; instructions and the necessary fixup instructions
5610 (define_expand "recip<mode>3"
5611 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5612 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5613 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5614 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5616 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5620 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5621 ;; hardware division. This is only done before register allocation and with
5622 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5624 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5625 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5626 (match_operand 2 "gpc_reg_operand" "")))]
5627 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5628 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5629 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5632 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5636 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5637 ;; appropriate fixup.
5638 (define_expand "rsqrt<mode>2"
5639 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5640 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5641 "RS6000_RECIP_HAVE_RSQRT_P (<MODE>mode)"
5643 rs6000_emit_swrsqrt (operands[0], operands[1]);
5648 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5649 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5650 (match_operand:SI 2 "reg_or_cint_operand" ""))
5652 (set (match_operand:SI 0 "gpc_reg_operand" "")
5653 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5654 "! TARGET_POWER && reload_completed"
5656 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5658 (compare:CC (match_dup 0)
5662 ;; Floating-point insns, excluding normal data motion.
5664 ;; PowerPC has a full set of single-precision floating point instructions.
5666 ;; For the POWER architecture, we pretend that we have both SFmode and
5667 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5668 ;; The only conversions we will do will be when storing to memory. In that
5669 ;; case, we will use the "frsp" instruction before storing.
5671 ;; Note that when we store into a single-precision memory location, we need to
5672 ;; use the frsp insn first. If the register being stored isn't dead, we
5673 ;; need a scratch register for the frsp. But this is difficult when the store
5674 ;; is done by reload. It is not incorrect to do the frsp on the register in
5675 ;; this case, we just lose precision that we would have otherwise gotten but
5676 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5678 (define_expand "extendsfdf2"
5679 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5680 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5681 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5684 (define_insn_and_split "*extendsfdf2_fpr"
5685 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5686 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5687 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5692 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5695 emit_note (NOTE_INSN_DELETED);
5698 [(set_attr "type" "fp,fp,fpload")])
5700 (define_expand "truncdfsf2"
5701 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5702 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5703 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5706 (define_insn "*truncdfsf2_fpr"
5707 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5708 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5709 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5711 [(set_attr "type" "fp")])
5713 (define_insn "aux_truncdfsf2"
5714 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5715 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5716 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5718 [(set_attr "type" "fp")])
5720 (define_expand "negsf2"
5721 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5722 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5723 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5726 (define_insn "*negsf2"
5727 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5728 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5729 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5731 [(set_attr "type" "fp")])
5733 (define_expand "abssf2"
5734 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5735 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5736 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5739 (define_insn "*abssf2"
5740 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5741 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5742 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5744 [(set_attr "type" "fp")])
5747 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5748 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5749 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5751 [(set_attr "type" "fp")])
5753 (define_expand "addsf3"
5754 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5755 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5756 (match_operand:SF 2 "gpc_reg_operand" "")))]
5757 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5761 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5762 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5763 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5764 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5766 [(set_attr "type" "fp")
5767 (set_attr "fp_type" "fp_addsub_s")])
5770 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5771 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5772 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5773 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5774 "{fa|fadd} %0,%1,%2"
5775 [(set_attr "type" "fp")])
5777 (define_expand "subsf3"
5778 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5779 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5780 (match_operand:SF 2 "gpc_reg_operand" "")))]
5781 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5785 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5786 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5787 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5788 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5790 [(set_attr "type" "fp")
5791 (set_attr "fp_type" "fp_addsub_s")])
5794 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5795 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5796 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5797 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5798 "{fs|fsub} %0,%1,%2"
5799 [(set_attr "type" "fp")])
5801 (define_expand "mulsf3"
5802 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5803 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5804 (match_operand:SF 2 "gpc_reg_operand" "")))]
5805 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5809 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5810 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5811 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5812 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5814 [(set_attr "type" "fp")
5815 (set_attr "fp_type" "fp_mul_s")])
5818 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5819 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5820 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5821 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5822 "{fm|fmul} %0,%1,%2"
5823 [(set_attr "type" "dmul")])
5825 (define_expand "divsf3"
5826 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5827 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5828 (match_operand:SF 2 "gpc_reg_operand" "")))]
5829 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5833 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5834 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5835 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5836 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5837 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5839 [(set_attr "type" "sdiv")])
5842 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5843 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5844 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5845 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5846 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5847 "{fd|fdiv} %0,%1,%2"
5848 [(set_attr "type" "ddiv")])
5851 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5852 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5855 [(set_attr "type" "fp")])
5857 ; builtin fmaf support
5858 (define_insn "*fmasf4_fpr"
5859 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5860 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5861 (match_operand:SF 2 "gpc_reg_operand" "f")
5862 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5863 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5865 return (TARGET_POWERPC
5866 ? "fmadds %0,%1,%2,%3"
5867 : "{fma|fmadd} %0,%1,%2,%3");
5869 [(set_attr "type" "fp")
5870 (set_attr "fp_type" "fp_maddsub_s")])
5872 (define_insn "*fmssf4_fpr"
5873 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5874 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5875 (match_operand:SF 2 "gpc_reg_operand" "f")
5876 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5877 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5879 return (TARGET_POWERPC
5880 ? "fmsubs %0,%1,%2,%3"
5881 : "{fms|fmsub} %0,%1,%2,%3");
5883 [(set_attr "type" "fp")
5884 (set_attr "fp_type" "fp_maddsub_s")])
5886 (define_insn "*nfmasf4_fpr"
5887 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5888 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5889 (match_operand:SF 2 "gpc_reg_operand" "f")
5890 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5891 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5893 return (TARGET_POWERPC
5894 ? "fnmadds %0,%1,%2,%3"
5895 : "{fnma|fnmadd} %0,%1,%2,%3");
5897 [(set_attr "type" "fp")
5898 (set_attr "fp_type" "fp_maddsub_s")])
5900 (define_insn "*nfmssf4_fpr"
5901 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5902 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5903 (match_operand:SF 2 "gpc_reg_operand" "f")
5904 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
5905 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5907 return (TARGET_POWERPC
5908 ? "fnmsubs %0,%1,%2,%3"
5909 : "{fnms|fnmsub} %0,%1,%2,%3");
5911 [(set_attr "type" "fp")
5912 (set_attr "fp_type" "fp_maddsub_s")])
5914 (define_expand "sqrtsf2"
5915 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5916 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5917 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5918 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5919 && !TARGET_SIMPLE_FPU"
5923 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5924 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5925 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5926 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5928 [(set_attr "type" "ssqrt")])
5931 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5932 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5933 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5934 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5936 [(set_attr "type" "dsqrt")])
5938 (define_insn "*rsqrtsf_internal1"
5939 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5940 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5944 [(set_attr "type" "fp")])
5946 (define_expand "copysign<mode>3"
5948 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5950 (neg:SFDF (abs:SFDF (match_dup 1))))
5951 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5952 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5956 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5957 && ((TARGET_PPC_GFXOPT
5958 && !HONOR_NANS (<MODE>mode)
5959 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5961 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5963 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5965 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5970 operands[3] = gen_reg_rtx (<MODE>mode);
5971 operands[4] = gen_reg_rtx (<MODE>mode);
5972 operands[5] = CONST0_RTX (<MODE>mode);
5975 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5976 ;; compiler from optimizing -0.0
5977 (define_insn "copysign<mode>3_fcpsgn"
5978 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5979 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
5980 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
5982 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5984 [(set_attr "type" "fp")])
5986 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5987 ;; fsel instruction and some auxiliary computations. Then we just have a
5988 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5990 (define_expand "smaxsf3"
5991 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5992 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5993 (match_operand:SF 2 "gpc_reg_operand" ""))
5996 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5997 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5998 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6000 (define_expand "sminsf3"
6001 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6002 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6003 (match_operand:SF 2 "gpc_reg_operand" ""))
6006 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6007 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6008 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6011 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6012 (match_operator:SF 3 "min_max_operator"
6013 [(match_operand:SF 1 "gpc_reg_operand" "")
6014 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6015 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6016 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6019 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6020 operands[1], operands[2]);
6024 (define_expand "mov<mode>cc"
6025 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6026 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6027 (match_operand:GPR 2 "gpc_reg_operand" "")
6028 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6032 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6038 ;; We use the BASE_REGS for the isel input operands because, if rA is
6039 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6040 ;; because we may switch the operands and rB may end up being rA.
6042 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6043 ;; leave out the mode in operand 4 and use one pattern, but reload can
6044 ;; change the mode underneath our feet and then gets confused trying
6045 ;; to reload the value.
6046 (define_insn "isel_signed_<mode>"
6047 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6049 (match_operator 1 "scc_comparison_operator"
6050 [(match_operand:CC 4 "cc_reg_operand" "y,y")
6052 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6053 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6056 { return output_isel (operands); }"
6057 [(set_attr "type" "isel")
6058 (set_attr "length" "4")])
6060 (define_insn "isel_unsigned_<mode>"
6061 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6063 (match_operator 1 "scc_comparison_operator"
6064 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
6066 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6067 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6070 { return output_isel (operands); }"
6071 [(set_attr "type" "isel")
6072 (set_attr "length" "4")])
6074 ;; These patterns can be useful for combine; they let combine know that
6075 ;; isel can handle reversed comparisons so long as the operands are
6078 (define_insn "*isel_reversed_signed_<mode>"
6079 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6081 (match_operator 1 "scc_rev_comparison_operator"
6082 [(match_operand:CC 4 "cc_reg_operand" "y")
6084 (match_operand:GPR 2 "gpc_reg_operand" "b")
6085 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6088 { return output_isel (operands); }"
6089 [(set_attr "type" "isel")
6090 (set_attr "length" "4")])
6092 (define_insn "*isel_reversed_unsigned_<mode>"
6093 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6095 (match_operator 1 "scc_rev_comparison_operator"
6096 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6098 (match_operand:GPR 2 "gpc_reg_operand" "b")
6099 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6102 { return output_isel (operands); }"
6103 [(set_attr "type" "isel")
6104 (set_attr "length" "4")])
6106 (define_expand "movsfcc"
6107 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6108 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6109 (match_operand:SF 2 "gpc_reg_operand" "")
6110 (match_operand:SF 3 "gpc_reg_operand" "")))]
6111 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6114 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6120 (define_insn "*fselsfsf4"
6121 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6122 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6123 (match_operand:SF 4 "zero_fp_constant" "F"))
6124 (match_operand:SF 2 "gpc_reg_operand" "f")
6125 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6126 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6128 [(set_attr "type" "fp")])
6130 (define_insn "*fseldfsf4"
6131 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6132 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6133 (match_operand:DF 4 "zero_fp_constant" "F"))
6134 (match_operand:SF 2 "gpc_reg_operand" "f")
6135 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6136 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6138 [(set_attr "type" "fp")])
6140 (define_expand "negdf2"
6141 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6142 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6143 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6146 (define_insn "*negdf2_fpr"
6147 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6148 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6149 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6150 && !VECTOR_UNIT_VSX_P (DFmode)"
6152 [(set_attr "type" "fp")])
6154 (define_expand "absdf2"
6155 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6156 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6157 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6160 (define_insn "*absdf2_fpr"
6161 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6162 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6163 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6164 && !VECTOR_UNIT_VSX_P (DFmode)"
6166 [(set_attr "type" "fp")])
6168 (define_insn "*nabsdf2_fpr"
6169 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6170 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6171 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6172 && !VECTOR_UNIT_VSX_P (DFmode)"
6174 [(set_attr "type" "fp")])
6176 (define_expand "adddf3"
6177 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6178 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6179 (match_operand:DF 2 "gpc_reg_operand" "")))]
6180 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6183 (define_insn "*adddf3_fpr"
6184 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6185 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6186 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6187 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6188 && !VECTOR_UNIT_VSX_P (DFmode)"
6189 "{fa|fadd} %0,%1,%2"
6190 [(set_attr "type" "fp")
6191 (set_attr "fp_type" "fp_addsub_d")])
6193 (define_expand "subdf3"
6194 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6195 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6196 (match_operand:DF 2 "gpc_reg_operand" "")))]
6197 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6200 (define_insn "*subdf3_fpr"
6201 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6202 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6203 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6204 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6205 && !VECTOR_UNIT_VSX_P (DFmode)"
6206 "{fs|fsub} %0,%1,%2"
6207 [(set_attr "type" "fp")
6208 (set_attr "fp_type" "fp_addsub_d")])
6210 (define_expand "muldf3"
6211 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6212 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6213 (match_operand:DF 2 "gpc_reg_operand" "")))]
6214 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6217 (define_insn "*muldf3_fpr"
6218 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6219 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6220 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6221 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6222 && !VECTOR_UNIT_VSX_P (DFmode)"
6223 "{fm|fmul} %0,%1,%2"
6224 [(set_attr "type" "dmul")
6225 (set_attr "fp_type" "fp_mul_d")])
6227 (define_expand "divdf3"
6228 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6229 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6230 (match_operand:DF 2 "gpc_reg_operand" "")))]
6232 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6233 && !TARGET_SIMPLE_FPU"
6236 (define_insn "*divdf3_fpr"
6237 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6238 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6239 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6240 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6241 && !VECTOR_UNIT_VSX_P (DFmode)"
6242 "{fd|fdiv} %0,%1,%2"
6243 [(set_attr "type" "ddiv")])
6245 (define_insn "*fred_fpr"
6246 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6247 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6248 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
6250 [(set_attr "type" "fp")])
6252 (define_insn "*rsqrtdf_internal1"
6253 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6254 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
6256 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
6258 [(set_attr "type" "fp")])
6260 ; builtin fma support
6261 (define_insn "*fmadf4_fpr"
6262 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6263 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6264 (match_operand:DF 2 "gpc_reg_operand" "f")
6265 (match_operand:DF 3 "gpc_reg_operand" "f")))]
6266 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6267 && VECTOR_UNIT_NONE_P (DFmode)"
6268 "{fma|fmadd} %0,%1,%2,%3"
6269 [(set_attr "type" "fp")
6270 (set_attr "fp_type" "fp_maddsub_s")])
6272 (define_insn "*fmsdf4_fpr"
6273 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6274 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6275 (match_operand:DF 2 "gpc_reg_operand" "f")
6276 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6277 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6278 && VECTOR_UNIT_NONE_P (DFmode)"
6279 "{fms|fmsub} %0,%1,%2,%3"
6280 [(set_attr "type" "fp")
6281 (set_attr "fp_type" "fp_maddsub_s")])
6283 (define_insn "*nfmadf4_fpr"
6284 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6285 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6286 (match_operand:DF 2 "gpc_reg_operand" "f")
6287 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6288 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6289 && VECTOR_UNIT_NONE_P (DFmode)"
6290 "{fnma|fnmadd} %0,%1,%2,%3"
6291 [(set_attr "type" "fp")
6292 (set_attr "fp_type" "fp_maddsub_s")])
6294 (define_insn "*nfmsdf4_fpr"
6295 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6296 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6297 (match_operand:DF 2 "gpc_reg_operand" "f")
6298 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
6299 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6300 && VECTOR_UNIT_NONE_P (DFmode)"
6301 "{fnms|fnmsub} %0,%1,%2,%3"
6302 [(set_attr "type" "fp")
6303 (set_attr "fp_type" "fp_maddsub_s")])
6305 (define_expand "sqrtdf2"
6306 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6307 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6308 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6309 && TARGET_DOUBLE_FLOAT"
6312 (define_insn "*sqrtdf2_fpr"
6313 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6314 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6315 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6316 && TARGET_DOUBLE_FLOAT
6317 && !VECTOR_UNIT_VSX_P (DFmode)"
6319 [(set_attr "type" "dsqrt")])
6321 ;; The conditional move instructions allow us to perform max and min
6322 ;; operations even when
6324 (define_expand "smaxdf3"
6325 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6326 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6327 (match_operand:DF 2 "gpc_reg_operand" ""))
6330 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6331 && !flag_trapping_math"
6332 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6334 (define_expand "smindf3"
6335 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6336 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6337 (match_operand:DF 2 "gpc_reg_operand" ""))
6340 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6341 && !flag_trapping_math"
6342 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6345 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6346 (match_operator:DF 3 "min_max_operator"
6347 [(match_operand:DF 1 "gpc_reg_operand" "")
6348 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6349 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6350 && !flag_trapping_math"
6353 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6354 operands[1], operands[2]);
6358 (define_expand "movdfcc"
6359 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6360 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6361 (match_operand:DF 2 "gpc_reg_operand" "")
6362 (match_operand:DF 3 "gpc_reg_operand" "")))]
6363 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6366 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6372 (define_insn "*fseldfdf4"
6373 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6374 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6375 (match_operand:DF 4 "zero_fp_constant" "F"))
6376 (match_operand:DF 2 "gpc_reg_operand" "d")
6377 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6378 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6380 [(set_attr "type" "fp")])
6382 (define_insn "*fselsfdf4"
6383 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6384 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6385 (match_operand:SF 4 "zero_fp_constant" "F"))
6386 (match_operand:DF 2 "gpc_reg_operand" "d")
6387 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6388 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6390 [(set_attr "type" "fp")])
6392 ;; Conversions to and from floating-point.
6394 ; We don't define lfiwax/lfiwzx with the normal definition, because we
6395 ; don't want to support putting SImode in FPR registers.
6396 (define_insn "lfiwax"
6397 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6398 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6400 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
6402 [(set_attr "type" "fpload")])
6404 ; This split must be run before register allocation because it allocates the
6405 ; memory slot that is needed to move values to/from the FPR. We don't allocate
6406 ; it earlier to allow for the combiner to merge insns together where it might
6407 ; not be needed and also in case the insns are deleted as dead code.
6409 (define_insn_and_split "floatsi<mode>2_lfiwax"
6410 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6411 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
6412 (clobber (match_scratch:DI 2 "=d"))]
6413 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6414 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
6420 rtx dest = operands[0];
6421 rtx src = operands[1];
6424 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
6425 tmp = convert_to_mode (DImode, src, false);
6429 if (GET_CODE (tmp) == SCRATCH)
6430 tmp = gen_reg_rtx (DImode);
6433 src = rs6000_address_for_fpconvert (src);
6434 emit_insn (gen_lfiwax (tmp, src));
6438 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6439 emit_move_insn (stack, src);
6440 emit_insn (gen_lfiwax (tmp, stack));
6443 emit_insn (gen_floatdi<mode>2 (dest, tmp));
6446 [(set_attr "length" "12")
6447 (set_attr "type" "fpload")])
6449 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
6450 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
6453 (match_operand:SI 1 "memory_operand" "Z,Z"))))
6454 (clobber (match_scratch:DI 2 "=0,d"))]
6455 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6462 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6463 if (GET_CODE (operands[2]) == SCRATCH)
6464 operands[2] = gen_reg_rtx (DImode);
6465 emit_insn (gen_lfiwax (operands[2], operands[1]));
6466 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6469 [(set_attr "length" "8")
6470 (set_attr "type" "fpload")])
6472 (define_insn "lfiwzx"
6473 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6474 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6476 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
6478 [(set_attr "type" "fpload")])
6480 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
6481 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6482 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
6483 (clobber (match_scratch:DI 2 "=d"))]
6484 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6491 rtx dest = operands[0];
6492 rtx src = operands[1];
6495 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
6496 tmp = convert_to_mode (DImode, src, true);
6500 if (GET_CODE (tmp) == SCRATCH)
6501 tmp = gen_reg_rtx (DImode);
6504 src = rs6000_address_for_fpconvert (src);
6505 emit_insn (gen_lfiwzx (tmp, src));
6509 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6510 emit_move_insn (stack, src);
6511 emit_insn (gen_lfiwzx (tmp, stack));
6514 emit_insn (gen_floatdi<mode>2 (dest, tmp));
6517 [(set_attr "length" "12")
6518 (set_attr "type" "fpload")])
6520 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
6521 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
6522 (unsigned_float:SFDF
6524 (match_operand:SI 1 "memory_operand" "Z,Z"))))
6525 (clobber (match_scratch:DI 2 "=0,d"))]
6526 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6533 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6534 if (GET_CODE (operands[2]) == SCRATCH)
6535 operands[2] = gen_reg_rtx (DImode);
6536 emit_insn (gen_lfiwzx (operands[2], operands[1]));
6537 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6540 [(set_attr "length" "8")
6541 (set_attr "type" "fpload")])
6543 ; For each of these conversions, there is a define_expand, a define_insn
6544 ; with a '#' template, and a define_split (with C code). The idea is
6545 ; to allow constant folding with the template of the define_insn,
6546 ; then to have the insns split later (between sched1 and final).
6548 (define_expand "floatsidf2"
6549 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6550 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6553 (clobber (match_dup 4))
6554 (clobber (match_dup 5))
6555 (clobber (match_dup 6))])]
6557 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6560 if (TARGET_E500_DOUBLE)
6562 if (!REG_P (operands[1]))
6563 operands[1] = force_reg (SImode, operands[1]);
6564 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6567 else if (TARGET_LFIWAX && TARGET_FCFID)
6569 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
6572 else if (TARGET_FCFID)
6574 rtx dreg = operands[1];
6576 dreg = force_reg (SImode, dreg);
6577 dreg = convert_to_mode (DImode, dreg, false);
6578 emit_insn (gen_floatdidf2 (operands[0], dreg));
6582 if (!REG_P (operands[1]))
6583 operands[1] = force_reg (SImode, operands[1]);
6584 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6585 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6586 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6587 operands[5] = gen_reg_rtx (DFmode);
6588 operands[6] = gen_reg_rtx (SImode);
6591 (define_insn_and_split "*floatsidf2_internal"
6592 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6593 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6594 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6595 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6596 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6597 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6598 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6599 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6605 rtx lowword, highword;
6606 gcc_assert (MEM_P (operands[4]));
6607 highword = adjust_address (operands[4], SImode, 0);
6608 lowword = adjust_address (operands[4], SImode, 4);
6609 if (! WORDS_BIG_ENDIAN)
6612 tmp = highword; highword = lowword; lowword = tmp;
6615 emit_insn (gen_xorsi3 (operands[6], operands[1],
6616 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6617 emit_move_insn (lowword, operands[6]);
6618 emit_move_insn (highword, operands[2]);
6619 emit_move_insn (operands[5], operands[4]);
6620 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6623 [(set_attr "length" "24")
6624 (set_attr "type" "fp")])
6626 ;; If we don't have a direct conversion to single precision, don't enable this
6627 ;; conversion for 32-bit without fast math, because we don't have the insn to
6628 ;; generate the fixup swizzle to avoid double rounding problems.
6629 (define_expand "floatunssisf2"
6630 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6631 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6632 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6635 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
6636 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6637 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6642 if (!REG_P (operands[1]))
6643 operands[1] = force_reg (SImode, operands[1]);
6645 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
6647 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
6652 rtx dreg = operands[1];
6654 dreg = force_reg (SImode, dreg);
6655 dreg = convert_to_mode (DImode, dreg, true);
6656 emit_insn (gen_floatdisf2 (operands[0], dreg));
6661 (define_expand "floatunssidf2"
6662 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6663 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6666 (clobber (match_dup 4))
6667 (clobber (match_dup 5))])]
6669 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6672 if (TARGET_E500_DOUBLE)
6674 if (!REG_P (operands[1]))
6675 operands[1] = force_reg (SImode, operands[1]);
6676 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6679 else if (TARGET_LFIWZX && TARGET_FCFID)
6681 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
6684 else if (TARGET_FCFID)
6686 rtx dreg = operands[1];
6688 dreg = force_reg (SImode, dreg);
6689 dreg = convert_to_mode (DImode, dreg, true);
6690 emit_insn (gen_floatdidf2 (operands[0], dreg));
6694 if (!REG_P (operands[1]))
6695 operands[1] = force_reg (SImode, operands[1]);
6696 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6697 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6698 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6699 operands[5] = gen_reg_rtx (DFmode);
6702 (define_insn_and_split "*floatunssidf2_internal"
6703 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6704 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6705 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6706 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6707 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6708 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6709 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6710 && !(TARGET_FCFID && TARGET_POWERPC64)"
6716 rtx lowword, highword;
6717 gcc_assert (MEM_P (operands[4]));
6718 highword = adjust_address (operands[4], SImode, 0);
6719 lowword = adjust_address (operands[4], SImode, 4);
6720 if (! WORDS_BIG_ENDIAN)
6723 tmp = highword; highword = lowword; lowword = tmp;
6726 emit_move_insn (lowword, operands[1]);
6727 emit_move_insn (highword, operands[2]);
6728 emit_move_insn (operands[5], operands[4]);
6729 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6732 [(set_attr "length" "20")
6733 (set_attr "type" "fp")])
6735 (define_expand "fix_trunc<mode>si2"
6736 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6737 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6738 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT
6739 && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6742 if (!<E500_CONVERT>)
6747 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6750 tmp = gen_reg_rtx (DImode);
6751 stack = rs6000_allocate_stack_temp (DImode, true, false);
6752 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6759 ; Like the convert to float patterns, this insn must be split before
6760 ; register allocation so that it can allocate the memory slot if it
6762 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6763 [(set (match_operand:SI 0 "general_operand" "=rm")
6764 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6765 (clobber (match_scratch:DI 2 "=d"))]
6766 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6767 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6768 && TARGET_STFIWX && can_create_pseudo_p ()"
6773 rtx dest = operands[0];
6774 rtx src = operands[1];
6775 rtx tmp = operands[2];
6777 if (GET_CODE (tmp) == SCRATCH)
6778 tmp = gen_reg_rtx (DImode);
6780 emit_insn (gen_fctiwz_<mode> (tmp, src));
6783 dest = rs6000_address_for_fpconvert (dest);
6784 emit_insn (gen_stfiwx (dest, tmp));
6787 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6789 dest = gen_lowpart (DImode, dest);
6790 emit_move_insn (dest, tmp);
6795 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6796 emit_insn (gen_stfiwx (stack, tmp));
6797 emit_move_insn (dest, stack);
6801 [(set_attr "length" "12")
6802 (set_attr "type" "fp")])
6804 (define_insn_and_split "fix_trunc<mode>si2_internal"
6805 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6806 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6807 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6808 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6809 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6810 && TARGET_DOUBLE_FLOAT"
6817 gcc_assert (MEM_P (operands[3]));
6818 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6820 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6821 emit_move_insn (operands[3], operands[2]);
6822 emit_move_insn (operands[0], lowword);
6825 [(set_attr "length" "16")
6826 (set_attr "type" "fp")])
6828 (define_expand "fix_trunc<mode>di2"
6829 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6830 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6831 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6835 (define_insn "*fix_trunc<mode>di2_fctidz"
6836 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6837 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6838 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6839 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6841 [(set_attr "type" "fp")])
6843 (define_expand "fixuns_trunc<mode>si2"
6844 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6845 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6847 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6851 if (!<E500_CONVERT>)
6853 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6858 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6859 [(set (match_operand:SI 0 "general_operand" "=rm")
6860 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6861 (clobber (match_scratch:DI 2 "=d"))]
6862 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6863 && TARGET_STFIWX && can_create_pseudo_p ()"
6868 rtx dest = operands[0];
6869 rtx src = operands[1];
6870 rtx tmp = operands[2];
6872 if (GET_CODE (tmp) == SCRATCH)
6873 tmp = gen_reg_rtx (DImode);
6875 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6878 dest = rs6000_address_for_fpconvert (dest);
6879 emit_insn (gen_stfiwx (dest, tmp));
6882 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6884 dest = gen_lowpart (DImode, dest);
6885 emit_move_insn (dest, tmp);
6890 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6891 emit_insn (gen_stfiwx (stack, tmp));
6892 emit_move_insn (dest, stack);
6896 [(set_attr "length" "12")
6897 (set_attr "type" "fp")])
6899 (define_expand "fixuns_trunc<mode>di2"
6900 [(set (match_operand:DI 0 "register_operand" "")
6901 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6902 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6905 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6906 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6907 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6908 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6909 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6911 [(set_attr "type" "fp")])
6913 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6914 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6915 ; because the first makes it clear that operand 0 is not live
6916 ; before the instruction.
6917 (define_insn "fctiwz_<mode>"
6918 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6919 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6921 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6922 && TARGET_DOUBLE_FLOAT"
6923 "{fcirz|fctiwz} %0,%1"
6924 [(set_attr "type" "fp")])
6926 (define_insn "fctiwuz_<mode>"
6927 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6928 (unspec:DI [(unsigned_fix:SI
6929 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6931 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6933 [(set_attr "type" "fp")])
6935 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6936 ;; since the friz instruction does not truncate the value if the floating
6937 ;; point value is < LONG_MIN or > LONG_MAX.
6938 (define_insn "*friz"
6939 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6940 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6941 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6942 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6943 && !flag_trapping_math && TARGET_FRIZ"
6945 [(set_attr "type" "fp")])
6947 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6948 ;; load to properly sign extend the value, but at least doing a store, load
6949 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6950 ;; if we have 32-bit memory ops
6951 (define_insn_and_split "*round32<mode>2_fprs"
6952 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6954 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6955 (clobber (match_scratch:DI 2 "=d"))
6956 (clobber (match_scratch:DI 3 "=d"))]
6957 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6958 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6959 && can_create_pseudo_p ()"
6964 rtx dest = operands[0];
6965 rtx src = operands[1];
6966 rtx tmp1 = operands[2];
6967 rtx tmp2 = operands[3];
6968 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6970 if (GET_CODE (tmp1) == SCRATCH)
6971 tmp1 = gen_reg_rtx (DImode);
6972 if (GET_CODE (tmp2) == SCRATCH)
6973 tmp2 = gen_reg_rtx (DImode);
6975 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6976 emit_insn (gen_stfiwx (stack, tmp1));
6977 emit_insn (gen_lfiwax (tmp2, stack));
6978 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6981 [(set_attr "type" "fpload")
6982 (set_attr "length" "16")])
6984 (define_insn_and_split "*roundu32<mode>2_fprs"
6985 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6986 (unsigned_float:SFDF
6987 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6988 (clobber (match_scratch:DI 2 "=d"))
6989 (clobber (match_scratch:DI 3 "=d"))]
6990 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6991 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6992 && can_create_pseudo_p ()"
6997 rtx dest = operands[0];
6998 rtx src = operands[1];
6999 rtx tmp1 = operands[2];
7000 rtx tmp2 = operands[3];
7001 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
7003 if (GET_CODE (tmp1) == SCRATCH)
7004 tmp1 = gen_reg_rtx (DImode);
7005 if (GET_CODE (tmp2) == SCRATCH)
7006 tmp2 = gen_reg_rtx (DImode);
7008 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
7009 emit_insn (gen_stfiwx (stack, tmp1));
7010 emit_insn (gen_lfiwzx (tmp2, stack));
7011 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
7014 [(set_attr "type" "fpload")
7015 (set_attr "length" "16")])
7017 ;; No VSX equivalent to fctid
7018 (define_insn "lrint<mode>di2"
7019 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7020 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7022 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7024 [(set_attr "type" "fp")])
7026 (define_expand "btrunc<mode>2"
7027 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7028 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7030 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7033 (define_insn "*btrunc<mode>2_fpr"
7034 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7035 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7037 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7038 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7040 [(set_attr "type" "fp")])
7042 (define_expand "ceil<mode>2"
7043 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7044 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7046 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7049 (define_insn "*ceil<mode>2_fpr"
7050 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7051 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7053 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7054 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7056 [(set_attr "type" "fp")])
7058 (define_expand "floor<mode>2"
7059 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7060 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7062 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7065 (define_insn "*floor<mode>2_fpr"
7066 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7067 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7069 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7070 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7072 [(set_attr "type" "fp")])
7074 ;; No VSX equivalent to frin
7075 (define_insn "round<mode>2"
7076 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7077 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7079 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7081 [(set_attr "type" "fp")])
7083 ; An UNSPEC is used so we don't have to support SImode in FP registers.
7084 (define_insn "stfiwx"
7085 [(set (match_operand:SI 0 "memory_operand" "=Z")
7086 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
7090 [(set_attr "type" "fpstore")])
7092 ;; If we don't have a direct conversion to single precision, don't enable this
7093 ;; conversion for 32-bit without fast math, because we don't have the insn to
7094 ;; generate the fixup swizzle to avoid double rounding problems.
7095 (define_expand "floatsisf2"
7096 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7097 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
7098 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
7101 && ((TARGET_FCFIDS && TARGET_LFIWAX)
7102 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
7103 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
7108 if (!REG_P (operands[1]))
7109 operands[1] = force_reg (SImode, operands[1]);
7111 else if (TARGET_FCFIDS && TARGET_LFIWAX)
7113 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
7116 else if (TARGET_FCFID && TARGET_LFIWAX)
7118 rtx dfreg = gen_reg_rtx (DFmode);
7119 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
7120 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
7125 rtx dreg = operands[1];
7127 dreg = force_reg (SImode, dreg);
7128 dreg = convert_to_mode (DImode, dreg, false);
7129 emit_insn (gen_floatdisf2 (operands[0], dreg));
7134 (define_expand "floatdidf2"
7135 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7136 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
7137 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
7140 (define_insn "*floatdidf2_fpr"
7141 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7142 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7143 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7144 && !VECTOR_UNIT_VSX_P (DFmode)"
7146 [(set_attr "type" "fp")])
7148 ; Allow the combiner to merge source memory operands to the conversion so that
7149 ; the optimizer/register allocator doesn't try to load the value too early in a
7150 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
7151 ; hit. We will split after reload to avoid the trip through the GPRs
7153 (define_insn_and_split "*floatdidf2_mem"
7154 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7155 (float:DF (match_operand:DI 1 "memory_operand" "m")))
7156 (clobber (match_scratch:DI 2 "=d"))]
7157 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
7159 "&& reload_completed"
7160 [(set (match_dup 2) (match_dup 1))
7161 (set (match_dup 0) (float:DF (match_dup 2)))]
7163 [(set_attr "length" "8")
7164 (set_attr "type" "fpload")])
7166 (define_expand "floatunsdidf2"
7167 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7169 (match_operand:DI 1 "gpc_reg_operand" "")))]
7170 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
7173 (define_insn "*floatunsdidf2_fcfidu"
7174 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7175 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7176 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
7178 [(set_attr "type" "fp")
7179 (set_attr "length" "4")])
7181 (define_insn_and_split "*floatunsdidf2_mem"
7182 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7183 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
7184 (clobber (match_scratch:DI 2 "=d"))]
7185 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
7187 "&& reload_completed"
7188 [(set (match_dup 2) (match_dup 1))
7189 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
7191 [(set_attr "length" "8")
7192 (set_attr "type" "fpload")])
7194 (define_expand "floatdisf2"
7195 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7196 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7197 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7198 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
7203 rtx val = operands[1];
7204 if (!flag_unsafe_math_optimizations)
7206 rtx label = gen_label_rtx ();
7207 val = gen_reg_rtx (DImode);
7208 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
7211 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
7216 (define_insn "floatdisf2_fcfids"
7217 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7218 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7219 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7220 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7222 [(set_attr "type" "fp")])
7224 (define_insn_and_split "*floatdisf2_mem"
7225 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7226 (float:SF (match_operand:DI 1 "memory_operand" "m")))
7227 (clobber (match_scratch:DI 2 "=f"))]
7228 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7229 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7231 "&& reload_completed"
7235 emit_move_insn (operands[2], operands[1]);
7236 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
7239 [(set_attr "length" "8")])
7241 ;; This is not IEEE compliant if rounding mode is "round to nearest".
7242 ;; If the DI->DF conversion is inexact, then it's possible to suffer
7243 ;; from double rounding.
7244 ;; Instead of creating a new cpu type for two FP operations, just use fp
7245 (define_insn_and_split "floatdisf2_internal1"
7246 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7247 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
7248 (clobber (match_scratch:DF 2 "=d"))]
7249 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7251 "&& reload_completed"
7253 (float:DF (match_dup 1)))
7255 (float_truncate:SF (match_dup 2)))]
7257 [(set_attr "length" "8")
7258 (set_attr "type" "fp")])
7260 ;; Twiddles bits to avoid double rounding.
7261 ;; Bits that might be truncated when converting to DFmode are replaced
7262 ;; by a bit that won't be lost at that stage, but is below the SFmode
7263 ;; rounding position.
7264 (define_expand "floatdisf2_internal2"
7265 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
7267 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
7269 (clobber (scratch:CC))])
7270 (set (match_dup 3) (plus:DI (match_dup 3)
7272 (set (match_dup 0) (plus:DI (match_dup 0)
7274 (set (match_dup 4) (compare:CCUNS (match_dup 3)
7276 (set (match_dup 0) (ior:DI (match_dup 0)
7278 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
7280 (clobber (scratch:CC))])
7281 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
7282 (label_ref (match_operand:DI 2 "" ""))
7284 (set (match_dup 0) (match_dup 1))]
7285 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7288 operands[3] = gen_reg_rtx (DImode);
7289 operands[4] = gen_reg_rtx (CCUNSmode);
7292 (define_expand "floatunsdisf2"
7293 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7294 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7295 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7296 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7299 (define_insn "floatunsdisf2_fcfidus"
7300 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7301 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7302 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7303 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7305 [(set_attr "type" "fp")])
7307 (define_insn_and_split "*floatunsdisf2_mem"
7308 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7309 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
7310 (clobber (match_scratch:DI 2 "=f"))]
7311 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7312 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7314 "&& reload_completed"
7318 emit_move_insn (operands[2], operands[1]);
7319 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
7322 [(set_attr "length" "8")
7323 (set_attr "type" "fpload")])
7325 ;; Define the DImode operations that can be done in a small number
7326 ;; of instructions. The & constraints are to prevent the register
7327 ;; allocator from allocating registers that overlap with the inputs
7328 ;; (for example, having an input in 7,8 and an output in 6,7). We
7329 ;; also allow for the output being the same as one of the inputs.
7331 (define_insn "*adddi3_noppc64"
7332 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
7333 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
7334 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
7335 "! TARGET_POWERPC64"
7338 if (WORDS_BIG_ENDIAN)
7339 return (GET_CODE (operands[2])) != CONST_INT
7340 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
7341 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
7343 return (GET_CODE (operands[2])) != CONST_INT
7344 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
7345 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
7347 [(set_attr "type" "two")
7348 (set_attr "length" "8")])
7350 (define_insn "*subdi3_noppc64"
7351 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
7352 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
7353 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
7354 "! TARGET_POWERPC64"
7357 if (WORDS_BIG_ENDIAN)
7358 return (GET_CODE (operands[1]) != CONST_INT)
7359 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
7360 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
7362 return (GET_CODE (operands[1]) != CONST_INT)
7363 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
7364 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
7366 [(set_attr "type" "two")
7367 (set_attr "length" "8")])
7369 (define_insn "*negdi2_noppc64"
7370 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7371 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
7372 "! TARGET_POWERPC64"
7375 return (WORDS_BIG_ENDIAN)
7376 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
7377 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
7379 [(set_attr "type" "two")
7380 (set_attr "length" "8")])
7382 (define_expand "mulsidi3"
7383 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7384 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7385 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7386 "! TARGET_POWERPC64"
7389 if (! TARGET_POWER && ! TARGET_POWERPC)
7391 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7392 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7393 emit_insn (gen_mull_call ());
7394 if (WORDS_BIG_ENDIAN)
7395 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
7398 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
7399 gen_rtx_REG (SImode, 3));
7400 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
7401 gen_rtx_REG (SImode, 4));
7405 else if (TARGET_POWER)
7407 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
7412 (define_insn "mulsidi3_mq"
7413 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7414 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7415 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7416 (clobber (match_scratch:SI 3 "=q"))]
7418 "mul %0,%1,%2\;mfmq %L0"
7419 [(set_attr "type" "imul")
7420 (set_attr "length" "8")])
7422 (define_insn "*mulsidi3_no_mq"
7423 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7424 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7425 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7426 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7429 return (WORDS_BIG_ENDIAN)
7430 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
7431 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
7433 [(set_attr "type" "imul")
7434 (set_attr "length" "8")])
7437 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7438 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7439 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7440 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7443 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
7444 (sign_extend:DI (match_dup 2)))
7447 (mult:SI (match_dup 1)
7451 int endian = (WORDS_BIG_ENDIAN == 0);
7452 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7453 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7456 (define_expand "umulsidi3"
7457 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7458 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7459 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7460 "TARGET_POWERPC && ! TARGET_POWERPC64"
7465 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7470 (define_insn "umulsidi3_mq"
7471 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7472 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7473 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7474 (clobber (match_scratch:SI 3 "=q"))]
7475 "TARGET_POWERPC && TARGET_POWER"
7478 return (WORDS_BIG_ENDIAN)
7479 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7480 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7482 [(set_attr "type" "imul")
7483 (set_attr "length" "8")])
7485 (define_insn "*umulsidi3_no_mq"
7486 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7487 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7488 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7489 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7492 return (WORDS_BIG_ENDIAN)
7493 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7494 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7496 [(set_attr "type" "imul")
7497 (set_attr "length" "8")])
7500 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7501 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7502 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7503 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7506 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7507 (zero_extend:DI (match_dup 2)))
7510 (mult:SI (match_dup 1)
7514 int endian = (WORDS_BIG_ENDIAN == 0);
7515 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7516 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7519 (define_expand "smulsi3_highpart"
7520 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7522 (lshiftrt:DI (mult:DI (sign_extend:DI
7523 (match_operand:SI 1 "gpc_reg_operand" ""))
7525 (match_operand:SI 2 "gpc_reg_operand" "")))
7530 if (! TARGET_POWER && ! TARGET_POWERPC)
7532 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7533 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7534 emit_insn (gen_mulh_call ());
7535 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7538 else if (TARGET_POWER)
7540 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7545 (define_insn "smulsi3_highpart_mq"
7546 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7548 (lshiftrt:DI (mult:DI (sign_extend:DI
7549 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7551 (match_operand:SI 2 "gpc_reg_operand" "r")))
7553 (clobber (match_scratch:SI 3 "=q"))]
7556 [(set_attr "type" "imul")])
7558 (define_insn "*smulsi3_highpart_no_mq"
7559 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7561 (lshiftrt:DI (mult:DI (sign_extend:DI
7562 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7564 (match_operand:SI 2 "gpc_reg_operand" "r")))
7566 "TARGET_POWERPC && ! TARGET_POWER"
7568 [(set_attr "type" "imul")])
7570 (define_expand "umulsi3_highpart"
7571 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7573 (lshiftrt:DI (mult:DI (zero_extend:DI
7574 (match_operand:SI 1 "gpc_reg_operand" ""))
7576 (match_operand:SI 2 "gpc_reg_operand" "")))
7583 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7588 (define_insn "umulsi3_highpart_mq"
7589 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7591 (lshiftrt:DI (mult:DI (zero_extend:DI
7592 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7594 (match_operand:SI 2 "gpc_reg_operand" "r")))
7596 (clobber (match_scratch:SI 3 "=q"))]
7597 "TARGET_POWERPC && TARGET_POWER"
7599 [(set_attr "type" "imul")])
7601 (define_insn "*umulsi3_highpart_no_mq"
7602 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7604 (lshiftrt:DI (mult:DI (zero_extend:DI
7605 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7607 (match_operand:SI 2 "gpc_reg_operand" "r")))
7609 "TARGET_POWERPC && ! TARGET_POWER"
7611 [(set_attr "type" "imul")])
7613 ;; If operands 0 and 2 are in the same register, we have a problem. But
7614 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7615 ;; why we have the strange constraints below.
7616 (define_insn "ashldi3_power"
7617 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7618 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7619 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7620 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7623 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7624 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7625 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7626 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7627 [(set_attr "length" "8")])
7629 (define_insn "lshrdi3_power"
7630 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7631 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7632 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7633 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7636 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7637 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7638 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7639 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7640 [(set_attr "length" "8")])
7642 ;; Shift by a variable amount is too complex to be worth open-coding. We
7643 ;; just handle shifts by constants.
7644 (define_insn "ashrdi3_power"
7645 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7646 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7647 (match_operand:SI 2 "const_int_operand" "M,i")))
7648 (clobber (match_scratch:SI 3 "=X,q"))]
7651 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7652 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7653 [(set_attr "type" "shift")
7654 (set_attr "length" "8")])
7656 (define_insn "ashrdi3_no_power"
7657 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7658 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7659 (match_operand:SI 2 "const_int_operand" "M,i")))]
7660 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7662 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7663 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7664 [(set_attr "type" "two,three")
7665 (set_attr "length" "8,12")])
7667 (define_insn "*ashrdisi3_noppc64"
7668 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7669 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7670 (const_int 32)) 4))]
7671 "TARGET_32BIT && !TARGET_POWERPC64"
7674 if (REGNO (operands[0]) == REGNO (operands[1]))
7677 return \"mr %0,%1\";
7679 [(set_attr "length" "4")])
7682 ;; PowerPC64 DImode operations.
7684 (define_expand "absdi2"
7685 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7686 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7691 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7693 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7697 (define_insn_and_split "absdi2_internal"
7698 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7699 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7700 (clobber (match_scratch:DI 2 "=&r,&r"))]
7701 "TARGET_POWERPC64 && !TARGET_ISEL"
7703 "&& reload_completed"
7704 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7705 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7706 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7709 (define_insn_and_split "*nabsdi2"
7710 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7711 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7712 (clobber (match_scratch:DI 2 "=&r,&r"))]
7713 "TARGET_POWERPC64 && !TARGET_ISEL"
7715 "&& reload_completed"
7716 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7717 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7718 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7721 (define_insn "muldi3"
7722 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7723 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7724 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7730 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7731 (const_string "imul3")
7732 (match_operand:SI 2 "short_cint_operand" "")
7733 (const_string "imul2")]
7734 (const_string "lmul")))])
7736 (define_insn "*muldi3_internal1"
7737 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7738 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7739 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7741 (clobber (match_scratch:DI 3 "=r,r"))]
7746 [(set_attr "type" "lmul_compare")
7747 (set_attr "length" "4,8")])
7750 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7751 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7752 (match_operand:DI 2 "gpc_reg_operand" ""))
7754 (clobber (match_scratch:DI 3 ""))]
7755 "TARGET_POWERPC64 && reload_completed"
7757 (mult:DI (match_dup 1) (match_dup 2)))
7759 (compare:CC (match_dup 3)
7763 (define_insn "*muldi3_internal2"
7764 [(set (match_operand:CC 3 "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 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7769 (mult:DI (match_dup 1) (match_dup 2)))]
7774 [(set_attr "type" "lmul_compare")
7775 (set_attr "length" "4,8")])
7778 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7779 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7780 (match_operand:DI 2 "gpc_reg_operand" ""))
7782 (set (match_operand:DI 0 "gpc_reg_operand" "")
7783 (mult:DI (match_dup 1) (match_dup 2)))]
7784 "TARGET_POWERPC64 && reload_completed"
7786 (mult:DI (match_dup 1) (match_dup 2)))
7788 (compare:CC (match_dup 0)
7792 (define_insn "smuldi3_highpart"
7793 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7795 (lshiftrt:TI (mult:TI (sign_extend:TI
7796 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7798 (match_operand:DI 2 "gpc_reg_operand" "r")))
7802 [(set_attr "type" "lmul")])
7804 (define_insn "umuldi3_highpart"
7805 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7807 (lshiftrt:TI (mult:TI (zero_extend:TI
7808 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7810 (match_operand:DI 2 "gpc_reg_operand" "r")))
7814 [(set_attr "type" "lmul")])
7816 (define_insn "rotldi3"
7817 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7818 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7819 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7824 [(set_attr "type" "var_shift_rotate,integer")])
7826 (define_insn "*rotldi3_internal2"
7827 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7828 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7829 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7831 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7838 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7839 (set_attr "length" "4,4,8,8")])
7842 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7843 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7844 (match_operand:DI 2 "reg_or_cint_operand" ""))
7846 (clobber (match_scratch:DI 3 ""))]
7847 "TARGET_POWERPC64 && reload_completed"
7849 (rotate:DI (match_dup 1) (match_dup 2)))
7851 (compare:CC (match_dup 3)
7855 (define_insn "*rotldi3_internal3"
7856 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7857 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7858 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7860 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7861 (rotate:DI (match_dup 1) (match_dup 2)))]
7868 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7869 (set_attr "length" "4,4,8,8")])
7872 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7873 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7874 (match_operand:DI 2 "reg_or_cint_operand" ""))
7876 (set (match_operand:DI 0 "gpc_reg_operand" "")
7877 (rotate:DI (match_dup 1) (match_dup 2)))]
7878 "TARGET_POWERPC64 && reload_completed"
7880 (rotate:DI (match_dup 1) (match_dup 2)))
7882 (compare:CC (match_dup 0)
7886 (define_insn "*rotldi3_internal4"
7887 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7888 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7889 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7890 (match_operand:DI 3 "mask64_operand" "n,n")))]
7893 rldc%B3 %0,%1,%2,%S3
7894 rldic%B3 %0,%1,%H2,%S3"
7895 [(set_attr "type" "var_shift_rotate,integer")])
7897 (define_insn "*rotldi3_internal5"
7898 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7900 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7901 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7902 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7904 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7907 rldc%B3. %4,%1,%2,%S3
7908 rldic%B3. %4,%1,%H2,%S3
7911 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7912 (set_attr "length" "4,4,8,8")])
7915 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7917 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7918 (match_operand:DI 2 "reg_or_cint_operand" ""))
7919 (match_operand:DI 3 "mask64_operand" ""))
7921 (clobber (match_scratch:DI 4 ""))]
7922 "TARGET_POWERPC64 && reload_completed"
7924 (and:DI (rotate:DI (match_dup 1)
7928 (compare:CC (match_dup 4)
7932 (define_insn "*rotldi3_internal6"
7933 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7935 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7936 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7937 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7939 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7940 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7943 rldc%B3. %0,%1,%2,%S3
7944 rldic%B3. %0,%1,%H2,%S3
7947 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7948 (set_attr "length" "4,4,8,8")])
7951 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7953 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7954 (match_operand:DI 2 "reg_or_cint_operand" ""))
7955 (match_operand:DI 3 "mask64_operand" ""))
7957 (set (match_operand:DI 0 "gpc_reg_operand" "")
7958 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7959 "TARGET_POWERPC64 && reload_completed"
7961 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7963 (compare:CC (match_dup 0)
7967 (define_insn "*rotldi3_internal7"
7968 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7971 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7972 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7976 rldicl %0,%1,%H2,56"
7977 [(set_attr "type" "var_shift_rotate,integer")])
7979 (define_insn "*rotldi3_internal8"
7980 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7981 (compare:CC (zero_extend:DI
7983 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7984 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7986 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7990 rldicl. %3,%1,%H2,56
7993 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7994 (set_attr "length" "4,4,8,8")])
7997 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7998 (compare:CC (zero_extend:DI
8000 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8001 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8003 (clobber (match_scratch:DI 3 ""))]
8004 "TARGET_POWERPC64 && reload_completed"
8006 (zero_extend:DI (subreg:QI
8007 (rotate:DI (match_dup 1)
8010 (compare:CC (match_dup 3)
8014 (define_insn "*rotldi3_internal9"
8015 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8016 (compare:CC (zero_extend:DI
8018 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8019 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8021 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8022 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8026 rldicl. %0,%1,%H2,56
8029 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8030 (set_attr "length" "4,4,8,8")])
8033 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8034 (compare:CC (zero_extend:DI
8036 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8037 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8039 (set (match_operand:DI 0 "gpc_reg_operand" "")
8040 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8041 "TARGET_POWERPC64 && reload_completed"
8043 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8045 (compare:CC (match_dup 0)
8049 (define_insn "*rotldi3_internal10"
8050 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8053 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8054 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8058 rldicl %0,%1,%H2,48"
8059 [(set_attr "type" "var_shift_rotate,integer")])
8061 (define_insn "*rotldi3_internal11"
8062 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8063 (compare:CC (zero_extend:DI
8065 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8066 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8068 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8072 rldicl. %3,%1,%H2,48
8075 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8076 (set_attr "length" "4,4,8,8")])
8079 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8080 (compare:CC (zero_extend:DI
8082 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8083 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8085 (clobber (match_scratch:DI 3 ""))]
8086 "TARGET_POWERPC64 && reload_completed"
8088 (zero_extend:DI (subreg:HI
8089 (rotate:DI (match_dup 1)
8092 (compare:CC (match_dup 3)
8096 (define_insn "*rotldi3_internal12"
8097 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8098 (compare:CC (zero_extend:DI
8100 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8101 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8103 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8104 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8108 rldicl. %0,%1,%H2,48
8111 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8112 (set_attr "length" "4,4,8,8")])
8115 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8116 (compare:CC (zero_extend:DI
8118 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8119 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8121 (set (match_operand:DI 0 "gpc_reg_operand" "")
8122 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8123 "TARGET_POWERPC64 && reload_completed"
8125 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8127 (compare:CC (match_dup 0)
8131 (define_insn "*rotldi3_internal13"
8132 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8135 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8136 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8140 rldicl %0,%1,%H2,32"
8141 [(set_attr "type" "var_shift_rotate,integer")])
8143 (define_insn "*rotldi3_internal14"
8144 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8145 (compare:CC (zero_extend:DI
8147 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8148 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8150 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8154 rldicl. %3,%1,%H2,32
8157 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8158 (set_attr "length" "4,4,8,8")])
8161 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8162 (compare:CC (zero_extend:DI
8164 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8165 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8167 (clobber (match_scratch:DI 3 ""))]
8168 "TARGET_POWERPC64 && reload_completed"
8170 (zero_extend:DI (subreg:SI
8171 (rotate:DI (match_dup 1)
8174 (compare:CC (match_dup 3)
8178 (define_insn "*rotldi3_internal15"
8179 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8180 (compare:CC (zero_extend:DI
8182 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8183 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8185 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8186 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8190 rldicl. %0,%1,%H2,32
8193 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8194 (set_attr "length" "4,4,8,8")])
8197 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8198 (compare:CC (zero_extend:DI
8200 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8201 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8203 (set (match_operand:DI 0 "gpc_reg_operand" "")
8204 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8205 "TARGET_POWERPC64 && reload_completed"
8207 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8209 (compare:CC (match_dup 0)
8213 (define_expand "ashldi3"
8214 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8215 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8216 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8217 "TARGET_POWERPC64 || TARGET_POWER"
8220 if (TARGET_POWERPC64)
8222 else if (TARGET_POWER)
8224 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
8231 (define_insn "*ashldi3_internal1"
8232 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8233 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8234 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8239 [(set_attr "type" "var_shift_rotate,shift")])
8241 (define_insn "*ashldi3_internal2"
8242 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8243 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8244 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8246 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8253 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8254 (set_attr "length" "4,4,8,8")])
8257 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8258 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8259 (match_operand:SI 2 "reg_or_cint_operand" ""))
8261 (clobber (match_scratch:DI 3 ""))]
8262 "TARGET_POWERPC64 && reload_completed"
8264 (ashift:DI (match_dup 1) (match_dup 2)))
8266 (compare:CC (match_dup 3)
8270 (define_insn "*ashldi3_internal3"
8271 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8272 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8273 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8275 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8276 (ashift:DI (match_dup 1) (match_dup 2)))]
8283 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8284 (set_attr "length" "4,4,8,8")])
8287 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8288 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8289 (match_operand:SI 2 "reg_or_cint_operand" ""))
8291 (set (match_operand:DI 0 "gpc_reg_operand" "")
8292 (ashift:DI (match_dup 1) (match_dup 2)))]
8293 "TARGET_POWERPC64 && reload_completed"
8295 (ashift:DI (match_dup 1) (match_dup 2)))
8297 (compare:CC (match_dup 0)
8301 (define_insn "*ashldi3_internal4"
8302 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8303 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8304 (match_operand:SI 2 "const_int_operand" "i"))
8305 (match_operand:DI 3 "const_int_operand" "n")))]
8306 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
8307 "rldic %0,%1,%H2,%W3")
8309 (define_insn "ashldi3_internal5"
8310 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8312 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8313 (match_operand:SI 2 "const_int_operand" "i,i"))
8314 (match_operand:DI 3 "const_int_operand" "n,n"))
8316 (clobber (match_scratch:DI 4 "=r,r"))]
8317 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8319 rldic. %4,%1,%H2,%W3
8321 [(set_attr "type" "compare")
8322 (set_attr "length" "4,8")])
8325 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8327 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8328 (match_operand:SI 2 "const_int_operand" ""))
8329 (match_operand:DI 3 "const_int_operand" ""))
8331 (clobber (match_scratch:DI 4 ""))]
8332 "TARGET_POWERPC64 && reload_completed
8333 && includes_rldic_lshift_p (operands[2], operands[3])"
8335 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8338 (compare:CC (match_dup 4)
8342 (define_insn "*ashldi3_internal6"
8343 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8345 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8346 (match_operand:SI 2 "const_int_operand" "i,i"))
8347 (match_operand:DI 3 "const_int_operand" "n,n"))
8349 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8350 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8351 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8353 rldic. %0,%1,%H2,%W3
8355 [(set_attr "type" "compare")
8356 (set_attr "length" "4,8")])
8359 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8361 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8362 (match_operand:SI 2 "const_int_operand" ""))
8363 (match_operand:DI 3 "const_int_operand" ""))
8365 (set (match_operand:DI 0 "gpc_reg_operand" "")
8366 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8367 "TARGET_POWERPC64 && reload_completed
8368 && includes_rldic_lshift_p (operands[2], operands[3])"
8370 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8373 (compare:CC (match_dup 0)
8377 (define_insn "*ashldi3_internal7"
8378 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8379 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8380 (match_operand:SI 2 "const_int_operand" "i"))
8381 (match_operand:DI 3 "mask64_operand" "n")))]
8382 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
8383 "rldicr %0,%1,%H2,%S3")
8385 (define_insn "ashldi3_internal8"
8386 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8388 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8389 (match_operand:SI 2 "const_int_operand" "i,i"))
8390 (match_operand:DI 3 "mask64_operand" "n,n"))
8392 (clobber (match_scratch:DI 4 "=r,r"))]
8393 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8395 rldicr. %4,%1,%H2,%S3
8397 [(set_attr "type" "compare")
8398 (set_attr "length" "4,8")])
8401 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8403 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8404 (match_operand:SI 2 "const_int_operand" ""))
8405 (match_operand:DI 3 "mask64_operand" ""))
8407 (clobber (match_scratch:DI 4 ""))]
8408 "TARGET_POWERPC64 && reload_completed
8409 && includes_rldicr_lshift_p (operands[2], operands[3])"
8411 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8414 (compare:CC (match_dup 4)
8418 (define_insn "*ashldi3_internal9"
8419 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8421 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8422 (match_operand:SI 2 "const_int_operand" "i,i"))
8423 (match_operand:DI 3 "mask64_operand" "n,n"))
8425 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8426 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8427 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8429 rldicr. %0,%1,%H2,%S3
8431 [(set_attr "type" "compare")
8432 (set_attr "length" "4,8")])
8435 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8437 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8438 (match_operand:SI 2 "const_int_operand" ""))
8439 (match_operand:DI 3 "mask64_operand" ""))
8441 (set (match_operand:DI 0 "gpc_reg_operand" "")
8442 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8443 "TARGET_POWERPC64 && reload_completed
8444 && includes_rldicr_lshift_p (operands[2], operands[3])"
8446 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8449 (compare:CC (match_dup 0)
8453 (define_expand "lshrdi3"
8454 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8455 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8456 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8457 "TARGET_POWERPC64 || TARGET_POWER"
8460 if (TARGET_POWERPC64)
8462 else if (TARGET_POWER)
8464 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8471 (define_insn "*lshrdi3_internal1"
8472 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8473 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8474 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8479 [(set_attr "type" "var_shift_rotate,shift")])
8481 (define_insn "*lshrdi3_internal2"
8482 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8483 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8484 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8486 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8493 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8494 (set_attr "length" "4,4,8,8")])
8497 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8498 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8499 (match_operand:SI 2 "reg_or_cint_operand" ""))
8501 (clobber (match_scratch:DI 3 ""))]
8502 "TARGET_POWERPC64 && reload_completed"
8504 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8506 (compare:CC (match_dup 3)
8510 (define_insn "*lshrdi3_internal3"
8511 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8512 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8513 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8515 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8516 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8523 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8524 (set_attr "length" "4,4,8,8")])
8527 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8528 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8529 (match_operand:SI 2 "reg_or_cint_operand" ""))
8531 (set (match_operand:DI 0 "gpc_reg_operand" "")
8532 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8533 "TARGET_POWERPC64 && reload_completed"
8535 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8537 (compare:CC (match_dup 0)
8541 (define_expand "ashrdi3"
8542 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8543 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8544 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8548 if (TARGET_POWERPC64)
8550 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8552 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8555 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8556 && WORDS_BIG_ENDIAN)
8558 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8565 (define_insn "*ashrdi3_internal1"
8566 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8567 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8568 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8573 [(set_attr "type" "var_shift_rotate,shift")])
8575 (define_insn "*ashrdi3_internal2"
8576 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8577 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8578 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8580 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8587 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8588 (set_attr "length" "4,4,8,8")])
8591 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8592 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8593 (match_operand:SI 2 "reg_or_cint_operand" ""))
8595 (clobber (match_scratch:DI 3 ""))]
8596 "TARGET_POWERPC64 && reload_completed"
8598 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8600 (compare:CC (match_dup 3)
8604 (define_insn "*ashrdi3_internal3"
8605 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8606 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8607 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8609 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8610 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8617 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8618 (set_attr "length" "4,4,8,8")])
8621 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8622 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8623 (match_operand:SI 2 "reg_or_cint_operand" ""))
8625 (set (match_operand:DI 0 "gpc_reg_operand" "")
8626 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8627 "TARGET_POWERPC64 && reload_completed"
8629 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8631 (compare:CC (match_dup 0)
8635 (define_expand "anddi3"
8637 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8638 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8639 (match_operand:DI 2 "and64_2_operand" "")))
8640 (clobber (match_scratch:CC 3 ""))])]
8644 (define_insn "anddi3_mc"
8645 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8646 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8647 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8648 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8649 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8652 rldic%B2 %0,%1,0,%S2
8653 rlwinm %0,%1,0,%m2,%M2
8657 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8658 (set_attr "length" "4,4,4,4,4,8")])
8660 (define_insn "anddi3_nomc"
8661 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8662 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8663 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8664 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8665 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8668 rldic%B2 %0,%1,0,%S2
8669 rlwinm %0,%1,0,%m2,%M2
8671 [(set_attr "length" "4,4,4,8")])
8674 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8675 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8676 (match_operand:DI 2 "mask64_2_operand" "")))
8677 (clobber (match_scratch:CC 3 ""))]
8679 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8680 && !mask_operand (operands[2], DImode)
8681 && !mask64_operand (operands[2], DImode)"
8683 (and:DI (rotate:DI (match_dup 1)
8687 (and:DI (rotate:DI (match_dup 0)
8691 build_mask64_2_operands (operands[2], &operands[4]);
8694 (define_insn "*anddi3_internal2_mc"
8695 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8696 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8697 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8699 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8700 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8701 "TARGET_64BIT && rs6000_gen_cell_microcode"
8704 rldic%B2. %3,%1,0,%S2
8705 rlwinm. %3,%1,0,%m2,%M2
8715 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8716 fast_compare,compare,compare,compare,compare,compare,\
8718 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8721 [(set (match_operand:CC 0 "cc_reg_operand" "")
8722 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8723 (match_operand:DI 2 "mask64_2_operand" ""))
8725 (clobber (match_scratch:DI 3 ""))
8726 (clobber (match_scratch:CC 4 ""))]
8727 "TARGET_64BIT && reload_completed
8728 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8729 && !mask_operand (operands[2], DImode)
8730 && !mask64_operand (operands[2], DImode)"
8732 (and:DI (rotate:DI (match_dup 1)
8735 (parallel [(set (match_dup 0)
8736 (compare:CC (and:DI (rotate:DI (match_dup 3)
8740 (clobber (match_dup 3))])]
8743 build_mask64_2_operands (operands[2], &operands[5]);
8746 (define_insn "*anddi3_internal3_mc"
8747 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8748 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8749 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8751 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8752 (and:DI (match_dup 1) (match_dup 2)))
8753 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8754 "TARGET_64BIT && rs6000_gen_cell_microcode"
8757 rldic%B2. %0,%1,0,%S2
8758 rlwinm. %0,%1,0,%m2,%M2
8768 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8769 fast_compare,compare,compare,compare,compare,compare,\
8771 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8774 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8775 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8776 (match_operand:DI 2 "and64_2_operand" ""))
8778 (set (match_operand:DI 0 "gpc_reg_operand" "")
8779 (and:DI (match_dup 1) (match_dup 2)))
8780 (clobber (match_scratch:CC 4 ""))]
8781 "TARGET_64BIT && reload_completed"
8782 [(parallel [(set (match_dup 0)
8783 (and:DI (match_dup 1) (match_dup 2)))
8784 (clobber (match_dup 4))])
8786 (compare:CC (match_dup 0)
8791 [(set (match_operand:CC 3 "cc_reg_operand" "")
8792 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8793 (match_operand:DI 2 "mask64_2_operand" ""))
8795 (set (match_operand:DI 0 "gpc_reg_operand" "")
8796 (and:DI (match_dup 1) (match_dup 2)))
8797 (clobber (match_scratch:CC 4 ""))]
8798 "TARGET_64BIT && reload_completed
8799 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8800 && !mask_operand (operands[2], DImode)
8801 && !mask64_operand (operands[2], DImode)"
8803 (and:DI (rotate:DI (match_dup 1)
8806 (parallel [(set (match_dup 3)
8807 (compare:CC (and:DI (rotate:DI (match_dup 0)
8812 (and:DI (rotate:DI (match_dup 0)
8817 build_mask64_2_operands (operands[2], &operands[5]);
8820 (define_expand "iordi3"
8821 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8822 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8823 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8827 if (non_logical_cint_operand (operands[2], DImode))
8829 HOST_WIDE_INT value;
8830 rtx tmp = ((!can_create_pseudo_p ()
8831 || rtx_equal_p (operands[0], operands[1]))
8832 ? operands[0] : gen_reg_rtx (DImode));
8834 if (GET_CODE (operands[2]) == CONST_INT)
8836 value = INTVAL (operands[2]);
8837 emit_insn (gen_iordi3 (tmp, operands[1],
8838 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8842 value = CONST_DOUBLE_LOW (operands[2]);
8843 emit_insn (gen_iordi3 (tmp, operands[1],
8844 immed_double_const (value
8845 & (~ (HOST_WIDE_INT) 0xffff),
8849 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8854 (define_expand "xordi3"
8855 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8856 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8857 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8861 if (non_logical_cint_operand (operands[2], DImode))
8863 HOST_WIDE_INT value;
8864 rtx tmp = ((!can_create_pseudo_p ()
8865 || rtx_equal_p (operands[0], operands[1]))
8866 ? operands[0] : gen_reg_rtx (DImode));
8868 if (GET_CODE (operands[2]) == CONST_INT)
8870 value = INTVAL (operands[2]);
8871 emit_insn (gen_xordi3 (tmp, operands[1],
8872 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8876 value = CONST_DOUBLE_LOW (operands[2]);
8877 emit_insn (gen_xordi3 (tmp, operands[1],
8878 immed_double_const (value
8879 & (~ (HOST_WIDE_INT) 0xffff),
8883 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8888 (define_insn "*booldi3_internal1"
8889 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8890 (match_operator:DI 3 "boolean_or_operator"
8891 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8892 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8899 (define_insn "*booldi3_internal2"
8900 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8901 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8902 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8903 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8905 (clobber (match_scratch:DI 3 "=r,r"))]
8910 [(set_attr "type" "fast_compare,compare")
8911 (set_attr "length" "4,8")])
8914 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8915 (compare:CC (match_operator:DI 4 "boolean_operator"
8916 [(match_operand:DI 1 "gpc_reg_operand" "")
8917 (match_operand:DI 2 "gpc_reg_operand" "")])
8919 (clobber (match_scratch:DI 3 ""))]
8920 "TARGET_POWERPC64 && reload_completed"
8921 [(set (match_dup 3) (match_dup 4))
8923 (compare:CC (match_dup 3)
8927 (define_insn "*booldi3_internal3"
8928 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8929 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8930 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8931 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8933 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8939 [(set_attr "type" "fast_compare,compare")
8940 (set_attr "length" "4,8")])
8943 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8944 (compare:CC (match_operator:DI 4 "boolean_operator"
8945 [(match_operand:DI 1 "gpc_reg_operand" "")
8946 (match_operand:DI 2 "gpc_reg_operand" "")])
8948 (set (match_operand:DI 0 "gpc_reg_operand" "")
8950 "TARGET_POWERPC64 && reload_completed"
8951 [(set (match_dup 0) (match_dup 4))
8953 (compare:CC (match_dup 0)
8957 ;; Split a logical operation that we can't do in one insn into two insns,
8958 ;; each of which does one 16-bit part. This is used by combine.
8961 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8962 (match_operator:DI 3 "boolean_or_operator"
8963 [(match_operand:DI 1 "gpc_reg_operand" "")
8964 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8966 [(set (match_dup 0) (match_dup 4))
8967 (set (match_dup 0) (match_dup 5))]
8972 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8974 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8975 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8977 i4 = GEN_INT (value & 0xffff);
8981 i3 = GEN_INT (INTVAL (operands[2])
8982 & (~ (HOST_WIDE_INT) 0xffff));
8983 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8985 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8987 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8991 (define_insn "*boolcdi3_internal1"
8992 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8993 (match_operator:DI 3 "boolean_operator"
8994 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8995 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8999 (define_insn "*boolcdi3_internal2"
9000 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9001 (compare:CC (match_operator:DI 4 "boolean_operator"
9002 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9003 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9005 (clobber (match_scratch:DI 3 "=r,r"))]
9010 [(set_attr "type" "fast_compare,compare")
9011 (set_attr "length" "4,8")])
9014 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9015 (compare:CC (match_operator:DI 4 "boolean_operator"
9016 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9017 (match_operand:DI 2 "gpc_reg_operand" "")])
9019 (clobber (match_scratch:DI 3 ""))]
9020 "TARGET_POWERPC64 && reload_completed"
9021 [(set (match_dup 3) (match_dup 4))
9023 (compare:CC (match_dup 3)
9027 (define_insn "*boolcdi3_internal3"
9028 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9029 (compare:CC (match_operator:DI 4 "boolean_operator"
9030 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9031 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9033 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9039 [(set_attr "type" "fast_compare,compare")
9040 (set_attr "length" "4,8")])
9043 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9044 (compare:CC (match_operator:DI 4 "boolean_operator"
9045 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9046 (match_operand:DI 2 "gpc_reg_operand" "")])
9048 (set (match_operand:DI 0 "gpc_reg_operand" "")
9050 "TARGET_POWERPC64 && reload_completed"
9051 [(set (match_dup 0) (match_dup 4))
9053 (compare:CC (match_dup 0)
9057 (define_insn "*boolccdi3_internal1"
9058 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9059 (match_operator:DI 3 "boolean_operator"
9060 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9061 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
9065 (define_insn "*boolccdi3_internal2"
9066 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9067 (compare:CC (match_operator:DI 4 "boolean_operator"
9068 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9069 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9071 (clobber (match_scratch:DI 3 "=r,r"))]
9076 [(set_attr "type" "fast_compare,compare")
9077 (set_attr "length" "4,8")])
9080 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9081 (compare:CC (match_operator:DI 4 "boolean_operator"
9082 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9083 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9085 (clobber (match_scratch:DI 3 ""))]
9086 "TARGET_POWERPC64 && reload_completed"
9087 [(set (match_dup 3) (match_dup 4))
9089 (compare:CC (match_dup 3)
9093 (define_insn "*boolccdi3_internal3"
9094 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9095 (compare:CC (match_operator:DI 4 "boolean_operator"
9096 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9097 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9099 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9105 [(set_attr "type" "fast_compare,compare")
9106 (set_attr "length" "4,8")])
9109 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9110 (compare:CC (match_operator:DI 4 "boolean_operator"
9111 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9112 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9114 (set (match_operand:DI 0 "gpc_reg_operand" "")
9116 "TARGET_POWERPC64 && reload_completed"
9117 [(set (match_dup 0) (match_dup 4))
9119 (compare:CC (match_dup 0)
9123 (define_expand "smindi3"
9124 [(match_operand:DI 0 "gpc_reg_operand" "")
9125 (match_operand:DI 1 "gpc_reg_operand" "")
9126 (match_operand:DI 2 "gpc_reg_operand" "")]
9130 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
9134 (define_expand "smaxdi3"
9135 [(match_operand:DI 0 "gpc_reg_operand" "")
9136 (match_operand:DI 1 "gpc_reg_operand" "")
9137 (match_operand:DI 2 "gpc_reg_operand" "")]
9141 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
9145 (define_expand "umindi3"
9146 [(match_operand:DI 0 "gpc_reg_operand" "")
9147 (match_operand:DI 1 "gpc_reg_operand" "")
9148 (match_operand:DI 2 "gpc_reg_operand" "")]
9152 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
9156 (define_expand "umaxdi3"
9157 [(match_operand:DI 0 "gpc_reg_operand" "")
9158 (match_operand:DI 1 "gpc_reg_operand" "")
9159 (match_operand:DI 2 "gpc_reg_operand" "")]
9163 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
9168 ;; Now define ways of moving data around.
9170 ;; Set up a register with a value from the GOT table
9172 (define_expand "movsi_got"
9173 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9174 (unspec:SI [(match_operand:SI 1 "got_operand" "")
9175 (match_dup 2)] UNSPEC_MOVSI_GOT))]
9176 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9179 if (GET_CODE (operands[1]) == CONST)
9181 rtx offset = const0_rtx;
9182 HOST_WIDE_INT value;
9184 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
9185 value = INTVAL (offset);
9188 rtx tmp = (!can_create_pseudo_p ()
9190 : gen_reg_rtx (Pmode));
9191 emit_insn (gen_movsi_got (tmp, operands[1]));
9192 emit_insn (gen_addsi3 (operands[0], tmp, offset));
9197 operands[2] = rs6000_got_register (operands[1]);
9200 (define_insn "*movsi_got_internal"
9201 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9202 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9203 (match_operand:SI 2 "gpc_reg_operand" "b")]
9205 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9206 "{l|lwz} %0,%a1@got(%2)"
9207 [(set_attr "type" "load")])
9209 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
9210 ;; didn't get allocated to a hard register.
9212 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9213 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9214 (match_operand:SI 2 "memory_operand" "")]
9216 "DEFAULT_ABI == ABI_V4
9218 && (reload_in_progress || reload_completed)"
9219 [(set (match_dup 0) (match_dup 2))
9220 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
9224 ;; For SI, we special-case integers that can't be loaded in one insn. We
9225 ;; do the load 16-bits at a time. We could do this by loading from memory,
9226 ;; and this is even supposed to be faster, but it is simpler not to get
9227 ;; integers in the TOC.
9228 (define_insn "movsi_low"
9229 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9230 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9231 (match_operand 2 "" ""))))]
9232 "TARGET_MACHO && ! TARGET_64BIT"
9233 "{l|lwz} %0,lo16(%2)(%1)"
9234 [(set_attr "type" "load")
9235 (set_attr "length" "4")])
9237 (define_insn "*movsi_internal1"
9238 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
9239 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
9240 "!TARGET_SINGLE_FPU &&
9241 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9245 {l%U1%X1|lwz%U1%X1} %0,%1
9246 {st%U0%X0|stw%U0%X0} %1,%0
9256 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
9257 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
9259 (define_insn "*movsi_internal1_single"
9260 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
9261 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
9262 "TARGET_SINGLE_FPU &&
9263 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9267 {l%U1%X1|lwz%U1%X1} %0,%1
9268 {st%U0%X0|stw%U0%X0} %1,%0
9280 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
9281 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
9283 ;; Split a load of a large constant into the appropriate two-insn
9287 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9288 (match_operand:SI 1 "const_int_operand" ""))]
9289 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
9290 && (INTVAL (operands[1]) & 0xffff) != 0"
9294 (ior:SI (match_dup 0)
9297 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
9299 if (tem == operands[0])
9305 (define_insn "*mov<mode>_internal2"
9306 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
9307 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
9309 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
9312 {cmpi|cmp<wd>i} %2,%0,0
9315 [(set_attr "type" "cmp,compare,cmp")
9316 (set_attr "length" "4,4,8")])
9319 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
9320 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
9322 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
9324 [(set (match_dup 0) (match_dup 1))
9326 (compare:CC (match_dup 0)
9330 (define_insn "*movhi_internal"
9331 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9332 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9333 "gpc_reg_operand (operands[0], HImode)
9334 || gpc_reg_operand (operands[1], HImode)"
9344 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9346 (define_expand "mov<mode>"
9347 [(set (match_operand:INT 0 "general_operand" "")
9348 (match_operand:INT 1 "any_operand" ""))]
9350 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9352 (define_insn "*movqi_internal"
9353 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9354 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9355 "gpc_reg_operand (operands[0], QImode)
9356 || gpc_reg_operand (operands[1], QImode)"
9366 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9368 ;; Here is how to move condition codes around. When we store CC data in
9369 ;; an integer register or memory, we store just the high-order 4 bits.
9370 ;; This lets us not shift in the most common case of CR0.
9371 (define_expand "movcc"
9372 [(set (match_operand:CC 0 "nonimmediate_operand" "")
9373 (match_operand:CC 1 "nonimmediate_operand" ""))]
9377 (define_insn "*movcc_internal1"
9378 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
9379 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
9380 "register_operand (operands[0], CCmode)
9381 || register_operand (operands[1], CCmode)"
9385 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
9388 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
9394 {l%U1%X1|lwz%U1%X1} %0,%1
9395 {st%U0%U1|stw%U0%U1} %1,%0"
9397 (cond [(eq_attr "alternative" "0,3")
9398 (const_string "cr_logical")
9399 (eq_attr "alternative" "1,2")
9400 (const_string "mtcr")
9401 (eq_attr "alternative" "6,7,9")
9402 (const_string "integer")
9403 (eq_attr "alternative" "8")
9404 (const_string "mfjmpr")
9405 (eq_attr "alternative" "10")
9406 (const_string "mtjmpr")
9407 (eq_attr "alternative" "11")
9408 (const_string "load")
9409 (eq_attr "alternative" "12")
9410 (const_string "store")
9411 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
9412 (const_string "mfcrf")
9414 (const_string "mfcr")))
9415 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
9417 ;; For floating-point, we normally deal with the floating-point registers
9418 ;; unless -msoft-float is used. The sole exception is that parameter passing
9419 ;; can produce floating-point values in fixed-point registers. Unless the
9420 ;; value is a simple constant or already in memory, we deal with this by
9421 ;; allocating memory and copying the value explicitly via that memory location.
9422 (define_expand "movsf"
9423 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9424 (match_operand:SF 1 "any_operand" ""))]
9426 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
9429 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9430 (match_operand:SF 1 "const_double_operand" ""))]
9432 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9433 || (GET_CODE (operands[0]) == SUBREG
9434 && GET_CODE (SUBREG_REG (operands[0])) == REG
9435 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9436 [(set (match_dup 2) (match_dup 3))]
9442 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9443 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
9445 if (! TARGET_POWERPC64)
9446 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
9448 operands[2] = gen_lowpart (SImode, operands[0]);
9450 operands[3] = gen_int_mode (l, SImode);
9453 (define_insn "*movsf_hardfloat"
9454 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9455 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9456 "(gpc_reg_operand (operands[0], SFmode)
9457 || gpc_reg_operand (operands[1], SFmode))
9458 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9461 {l%U1%X1|lwz%U1%X1} %0,%1
9462 {st%U0%X0|stw%U0%X0} %1,%0
9472 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9473 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9475 (define_insn "*movsf_softfloat"
9476 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9477 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9478 "(gpc_reg_operand (operands[0], SFmode)
9479 || gpc_reg_operand (operands[1], SFmode))
9480 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9486 {l%U1%X1|lwz%U1%X1} %0,%1
9487 {st%U0%X0|stw%U0%X0} %1,%0
9494 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9495 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9498 (define_expand "movdf"
9499 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9500 (match_operand:DF 1 "any_operand" ""))]
9502 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9505 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9506 (match_operand:DF 1 "const_int_operand" ""))]
9507 "! TARGET_POWERPC64 && reload_completed
9508 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9509 || (GET_CODE (operands[0]) == SUBREG
9510 && GET_CODE (SUBREG_REG (operands[0])) == REG
9511 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9512 [(set (match_dup 2) (match_dup 4))
9513 (set (match_dup 3) (match_dup 1))]
9516 int endian = (WORDS_BIG_ENDIAN == 0);
9517 HOST_WIDE_INT value = INTVAL (operands[1]);
9519 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9520 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9521 #if HOST_BITS_PER_WIDE_INT == 32
9522 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9524 operands[4] = GEN_INT (value >> 32);
9525 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9530 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9531 (match_operand:DF 1 "const_double_operand" ""))]
9532 "! TARGET_POWERPC64 && reload_completed
9533 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9534 || (GET_CODE (operands[0]) == SUBREG
9535 && GET_CODE (SUBREG_REG (operands[0])) == REG
9536 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9537 [(set (match_dup 2) (match_dup 4))
9538 (set (match_dup 3) (match_dup 5))]
9541 int endian = (WORDS_BIG_ENDIAN == 0);
9545 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9546 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9548 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9549 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9550 operands[4] = gen_int_mode (l[endian], SImode);
9551 operands[5] = gen_int_mode (l[1 - endian], SImode);
9555 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9556 (match_operand:DF 1 "const_double_operand" ""))]
9557 "TARGET_POWERPC64 && reload_completed
9558 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9559 || (GET_CODE (operands[0]) == SUBREG
9560 && GET_CODE (SUBREG_REG (operands[0])) == REG
9561 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9562 [(set (match_dup 2) (match_dup 3))]
9565 int endian = (WORDS_BIG_ENDIAN == 0);
9568 #if HOST_BITS_PER_WIDE_INT >= 64
9572 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9573 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9575 operands[2] = gen_lowpart (DImode, operands[0]);
9576 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9577 #if HOST_BITS_PER_WIDE_INT >= 64
9578 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9579 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9581 operands[3] = gen_int_mode (val, DImode);
9583 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9587 ;; Don't have reload use general registers to load a constant. First,
9588 ;; it might not work if the output operand is the equivalent of
9589 ;; a non-offsettable memref, but also it is less efficient than loading
9590 ;; the constant into an FP register, since it will probably be used there.
9591 ;; The "??" is a kludge until we can figure out a more reasonable way
9592 ;; of handling these non-offsettable values.
9593 (define_insn "*movdf_hardfloat32"
9594 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9595 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9596 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9597 && (gpc_reg_operand (operands[0], DFmode)
9598 || gpc_reg_operand (operands[1], DFmode))"
9601 switch (which_alternative)
9611 return \"xxlor %x0,%x1,%x1\";
9614 return \"lxsd%U1x %x0,%y1\";
9617 return \"stxsd%U0x %x1,%y0\";
9619 return \"fmr %0,%1\";
9621 return \"lfd%U1%X1 %0,%1\";
9623 return \"stfd%U0%X0 %1,%0\";
9625 return \"xxlxor %x0,%x0,%x0\";
9632 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9633 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9635 (define_insn "*movdf_softfloat32"
9636 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9637 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9639 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9640 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9641 && (gpc_reg_operand (operands[0], DFmode)
9642 || gpc_reg_operand (operands[1], DFmode))"
9644 [(set_attr "type" "two,load,store,*,*,*")
9645 (set_attr "length" "8,8,8,8,12,16")])
9647 ; ld/std require word-aligned displacements -> 'Y' constraint.
9648 ; List Y->r and r->Y before r->r for reload.
9649 (define_insn "*movdf_hardfloat64_mfpgpr"
9650 [(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")
9651 (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"))]
9652 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9653 && TARGET_DOUBLE_FLOAT
9654 && (gpc_reg_operand (operands[0], DFmode)
9655 || gpc_reg_operand (operands[1], DFmode))"
9678 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9679 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9681 ; ld/std require word-aligned displacements -> 'Y' constraint.
9682 ; List Y->r and r->Y before r->r for reload.
9683 (define_insn "*movdf_hardfloat64"
9684 [(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")
9685 (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"))]
9686 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9687 && TARGET_DOUBLE_FLOAT
9688 && (gpc_reg_operand (operands[0], DFmode)
9689 || gpc_reg_operand (operands[1], DFmode))"
9710 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9711 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9713 (define_insn "*movdf_softfloat64"
9714 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9715 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9716 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9717 && (gpc_reg_operand (operands[0], DFmode)
9718 || gpc_reg_operand (operands[1], DFmode))"
9729 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9730 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9732 (define_expand "movtf"
9733 [(set (match_operand:TF 0 "general_operand" "")
9734 (match_operand:TF 1 "any_operand" ""))]
9735 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9736 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9738 ; It's important to list the o->f and f->o moves before f->f because
9739 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9740 ; which doesn't make progress. Likewise r->Y must be before r->r.
9741 (define_insn_and_split "*movtf_internal"
9742 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9743 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9745 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9746 && (gpc_reg_operand (operands[0], TFmode)
9747 || gpc_reg_operand (operands[1], TFmode))"
9749 "&& reload_completed"
9751 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9752 [(set_attr "length" "8,8,8,20,20,16")])
9754 (define_insn_and_split "*movtf_softfloat"
9755 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9756 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9758 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9759 && (gpc_reg_operand (operands[0], TFmode)
9760 || gpc_reg_operand (operands[1], TFmode))"
9762 "&& reload_completed"
9764 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9765 [(set_attr "length" "20,20,16")])
9767 (define_expand "extenddftf2"
9768 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9769 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9771 && TARGET_HARD_FLOAT
9772 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9773 && TARGET_LONG_DOUBLE_128"
9775 if (TARGET_E500_DOUBLE)
9776 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9778 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9782 (define_expand "extenddftf2_fprs"
9783 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9784 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9785 (use (match_dup 2))])]
9787 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9788 && TARGET_LONG_DOUBLE_128"
9790 operands[2] = CONST0_RTX (DFmode);
9791 /* Generate GOT reference early for SVR4 PIC. */
9792 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9793 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9796 (define_insn_and_split "*extenddftf2_internal"
9797 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9798 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9799 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9801 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9802 && TARGET_LONG_DOUBLE_128"
9804 "&& reload_completed"
9807 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9808 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9809 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9811 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9816 (define_expand "extendsftf2"
9817 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9818 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9820 && TARGET_HARD_FLOAT
9821 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9822 && TARGET_LONG_DOUBLE_128"
9824 rtx tmp = gen_reg_rtx (DFmode);
9825 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9826 emit_insn (gen_extenddftf2 (operands[0], tmp));
9830 (define_expand "trunctfdf2"
9831 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9832 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9834 && TARGET_HARD_FLOAT
9835 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9836 && TARGET_LONG_DOUBLE_128"
9839 (define_insn_and_split "trunctfdf2_internal1"
9840 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9841 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9842 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9843 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9847 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9850 emit_note (NOTE_INSN_DELETED);
9853 [(set_attr "type" "fp")])
9855 (define_insn "trunctfdf2_internal2"
9856 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9857 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9858 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9859 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9860 && TARGET_LONG_DOUBLE_128"
9862 [(set_attr "type" "fp")
9863 (set_attr "fp_type" "fp_addsub_d")])
9865 (define_expand "trunctfsf2"
9866 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9867 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9869 && TARGET_HARD_FLOAT
9870 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9871 && TARGET_LONG_DOUBLE_128"
9873 if (TARGET_E500_DOUBLE)
9874 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9876 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9880 (define_insn_and_split "trunctfsf2_fprs"
9881 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9882 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9883 (clobber (match_scratch:DF 2 "=d"))]
9885 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9886 && TARGET_LONG_DOUBLE_128"
9888 "&& reload_completed"
9890 (float_truncate:DF (match_dup 1)))
9892 (float_truncate:SF (match_dup 2)))]
9895 (define_expand "floatsitf2"
9896 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9897 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9899 && TARGET_HARD_FLOAT
9900 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9901 && TARGET_LONG_DOUBLE_128"
9903 rtx tmp = gen_reg_rtx (DFmode);
9904 expand_float (tmp, operands[1], false);
9905 emit_insn (gen_extenddftf2 (operands[0], tmp));
9909 ; fadd, but rounding towards zero.
9910 ; This is probably not the optimal code sequence.
9911 (define_insn "fix_trunc_helper"
9912 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9913 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9914 UNSPEC_FIX_TRUNC_TF))
9915 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9916 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9917 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9918 [(set_attr "type" "fp")
9919 (set_attr "length" "20")])
9921 (define_expand "fix_trunctfsi2"
9922 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9923 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9925 && (TARGET_POWER2 || TARGET_POWERPC)
9926 && TARGET_HARD_FLOAT
9927 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9928 && TARGET_LONG_DOUBLE_128"
9930 if (TARGET_E500_DOUBLE)
9931 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9933 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9937 (define_expand "fix_trunctfsi2_fprs"
9938 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9939 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9940 (clobber (match_dup 2))
9941 (clobber (match_dup 3))
9942 (clobber (match_dup 4))
9943 (clobber (match_dup 5))])]
9945 && (TARGET_POWER2 || TARGET_POWERPC)
9946 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9948 operands[2] = gen_reg_rtx (DFmode);
9949 operands[3] = gen_reg_rtx (DFmode);
9950 operands[4] = gen_reg_rtx (DImode);
9951 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
9954 (define_insn_and_split "*fix_trunctfsi2_internal"
9955 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9956 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9957 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9958 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9959 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9960 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9962 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9968 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9970 gcc_assert (MEM_P (operands[5]));
9971 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9973 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9974 emit_move_insn (operands[5], operands[4]);
9975 emit_move_insn (operands[0], lowword);
9979 (define_expand "negtf2"
9980 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9981 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9983 && TARGET_HARD_FLOAT
9984 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9985 && TARGET_LONG_DOUBLE_128"
9988 (define_insn "negtf2_internal"
9989 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9990 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9992 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9995 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9996 return \"fneg %L0,%L1\;fneg %0,%1\";
9998 return \"fneg %0,%1\;fneg %L0,%L1\";
10000 [(set_attr "type" "fp")
10001 (set_attr "length" "8")])
10003 (define_expand "abstf2"
10004 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10005 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
10007 && TARGET_HARD_FLOAT
10008 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10009 && TARGET_LONG_DOUBLE_128"
10012 rtx label = gen_label_rtx ();
10013 if (TARGET_E500_DOUBLE)
10015 if (flag_finite_math_only && !flag_trapping_math)
10016 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
10018 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
10021 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
10022 emit_label (label);
10026 (define_expand "abstf2_internal"
10027 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10028 (match_operand:TF 1 "gpc_reg_operand" ""))
10029 (set (match_dup 3) (match_dup 5))
10030 (set (match_dup 5) (abs:DF (match_dup 5)))
10031 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
10032 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
10033 (label_ref (match_operand 2 "" ""))
10035 (set (match_dup 6) (neg:DF (match_dup 6)))]
10037 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10038 && TARGET_LONG_DOUBLE_128"
10041 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
10042 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
10043 operands[3] = gen_reg_rtx (DFmode);
10044 operands[4] = gen_reg_rtx (CCFPmode);
10045 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
10046 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
10049 ;; Next come the multi-word integer load and store and the load and store
10052 ; List r->r after r->"o<>", otherwise reload will try to reload a
10053 ; non-offsettable address by using r->r which won't make progress.
10054 (define_insn "*movdi_internal32"
10055 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
10056 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
10057 "! TARGET_POWERPC64
10058 && (gpc_reg_operand (operands[0], DImode)
10059 || gpc_reg_operand (operands[1], DImode))"
10068 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
10071 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10072 (match_operand:DI 1 "const_int_operand" ""))]
10073 "! TARGET_POWERPC64 && reload_completed"
10074 [(set (match_dup 2) (match_dup 4))
10075 (set (match_dup 3) (match_dup 1))]
10078 HOST_WIDE_INT value = INTVAL (operands[1]);
10079 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10081 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10083 #if HOST_BITS_PER_WIDE_INT == 32
10084 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
10086 operands[4] = GEN_INT (value >> 32);
10087 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
10092 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
10093 (match_operand:DIFD 1 "input_operand" ""))]
10094 "reload_completed && !TARGET_POWERPC64
10095 && gpr_or_gpr_p (operands[0], operands[1])"
10097 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10099 (define_insn "*movdi_mfpgpr"
10100 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
10101 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
10102 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
10103 && (gpc_reg_operand (operands[0], DImode)
10104 || gpc_reg_operand (operands[1], DImode))"
10121 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
10122 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
10124 (define_insn "*movdi_internal64"
10125 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
10126 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
10127 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
10128 && (gpc_reg_operand (operands[0], DImode)
10129 || gpc_reg_operand (operands[1], DImode))"
10144 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
10145 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
10147 ;; immediate value valid for a single instruction hiding in a const_double
10149 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10150 (match_operand:DI 1 "const_double_operand" "F"))]
10151 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
10152 && GET_CODE (operands[1]) == CONST_DOUBLE
10153 && num_insns_constant (operands[1], DImode) == 1"
10156 return ((unsigned HOST_WIDE_INT)
10157 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
10158 ? \"li %0,%1\" : \"lis %0,%v1\";
10161 ;; Generate all one-bits and clear left or right.
10162 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
10164 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10165 (match_operand:DI 1 "mask64_operand" ""))]
10166 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10167 [(set (match_dup 0) (const_int -1))
10169 (and:DI (rotate:DI (match_dup 0)
10174 ;; Split a load of a large constant into the appropriate five-instruction
10175 ;; sequence. Handle anything in a constant number of insns.
10176 ;; When non-easy constants can go in the TOC, this should use
10177 ;; easy_fp_constant predicate.
10179 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10180 (match_operand:DI 1 "const_int_operand" ""))]
10181 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10182 [(set (match_dup 0) (match_dup 2))
10183 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10185 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10187 if (tem == operands[0])
10194 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10195 (match_operand:DI 1 "const_double_operand" ""))]
10196 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10197 [(set (match_dup 0) (match_dup 2))
10198 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10200 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10202 if (tem == operands[0])
10208 ;; TImode is similar, except that we usually want to compute the address into
10209 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
10210 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
10212 ;; We say that MQ is clobbered in the last alternative because the first
10213 ;; alternative would never get used otherwise since it would need a reload
10214 ;; while the 2nd alternative would not. We put memory cases first so they
10215 ;; are preferred. Otherwise, we'd try to reload the output instead of
10216 ;; giving the SCRATCH mq.
10218 (define_insn "*movti_power"
10219 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
10220 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
10221 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
10222 "TARGET_POWER && ! TARGET_POWERPC64
10223 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10226 switch (which_alternative)
10229 gcc_unreachable ();
10233 return \"{stsi|stswi} %1,%P0,16\";
10238 /* If the address is not used in the output, we can use lsi. Otherwise,
10239 fall through to generating four loads. */
10241 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10242 return \"{lsi|lswi} %0,%P1,16\";
10243 /* ... fall through ... */
10249 [(set_attr "type" "store,store,*,load,load,*")])
10251 (define_insn "*movti_string"
10252 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
10253 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
10254 "! TARGET_POWER && ! TARGET_POWERPC64
10255 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10258 switch (which_alternative)
10261 gcc_unreachable ();
10264 return \"{stsi|stswi} %1,%P0,16\";
10269 /* If the address is not used in the output, we can use lsi. Otherwise,
10270 fall through to generating four loads. */
10272 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10273 return \"{lsi|lswi} %0,%P1,16\";
10274 /* ... fall through ... */
10280 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
10281 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
10282 (const_string "always")
10283 (const_string "conditional")))])
10285 (define_insn "*movti_ppc64"
10286 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
10287 (match_operand:TI 1 "input_operand" "r,r,m"))]
10288 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
10289 || gpc_reg_operand (operands[1], TImode)))
10290 && VECTOR_MEM_NONE_P (TImode)"
10292 [(set_attr "type" "*,store,load")])
10295 [(set (match_operand:TI 0 "gpc_reg_operand" "")
10296 (match_operand:TI 1 "const_double_operand" ""))]
10297 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
10298 [(set (match_dup 2) (match_dup 4))
10299 (set (match_dup 3) (match_dup 5))]
10302 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10304 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10306 if (GET_CODE (operands[1]) == CONST_DOUBLE)
10308 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
10309 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
10311 else if (GET_CODE (operands[1]) == CONST_INT)
10313 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10314 operands[5] = operands[1];
10321 [(set (match_operand:TI 0 "nonimmediate_operand" "")
10322 (match_operand:TI 1 "input_operand" ""))]
10323 "reload_completed && VECTOR_MEM_NONE_P (TImode)
10324 && gpr_or_gpr_p (operands[0], operands[1])"
10326 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10328 (define_expand "load_multiple"
10329 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10330 (match_operand:SI 1 "" ""))
10331 (use (match_operand:SI 2 "" ""))])]
10332 "TARGET_STRING && !TARGET_POWERPC64"
10340 /* Support only loading a constant number of fixed-point registers from
10341 memory and only bother with this if more than two; the machine
10342 doesn't support more than eight. */
10343 if (GET_CODE (operands[2]) != CONST_INT
10344 || INTVAL (operands[2]) <= 2
10345 || INTVAL (operands[2]) > 8
10346 || GET_CODE (operands[1]) != MEM
10347 || GET_CODE (operands[0]) != REG
10348 || REGNO (operands[0]) >= 32)
10351 count = INTVAL (operands[2]);
10352 regno = REGNO (operands[0]);
10354 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10355 op1 = replace_equiv_address (operands[1],
10356 force_reg (SImode, XEXP (operands[1], 0)));
10358 for (i = 0; i < count; i++)
10359 XVECEXP (operands[3], 0, i)
10360 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10361 adjust_address_nv (op1, SImode, i * 4));
10364 (define_insn "*ldmsi8"
10365 [(match_parallel 0 "load_multiple_operation"
10366 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10367 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10368 (set (match_operand:SI 3 "gpc_reg_operand" "")
10369 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10370 (set (match_operand:SI 4 "gpc_reg_operand" "")
10371 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10372 (set (match_operand:SI 5 "gpc_reg_operand" "")
10373 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10374 (set (match_operand:SI 6 "gpc_reg_operand" "")
10375 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10376 (set (match_operand:SI 7 "gpc_reg_operand" "")
10377 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10378 (set (match_operand:SI 8 "gpc_reg_operand" "")
10379 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10380 (set (match_operand:SI 9 "gpc_reg_operand" "")
10381 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10382 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10384 { return rs6000_output_load_multiple (operands); }"
10385 [(set_attr "type" "load_ux")
10386 (set_attr "length" "32")])
10388 (define_insn "*ldmsi7"
10389 [(match_parallel 0 "load_multiple_operation"
10390 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10391 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10392 (set (match_operand:SI 3 "gpc_reg_operand" "")
10393 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10394 (set (match_operand:SI 4 "gpc_reg_operand" "")
10395 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10396 (set (match_operand:SI 5 "gpc_reg_operand" "")
10397 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10398 (set (match_operand:SI 6 "gpc_reg_operand" "")
10399 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10400 (set (match_operand:SI 7 "gpc_reg_operand" "")
10401 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10402 (set (match_operand:SI 8 "gpc_reg_operand" "")
10403 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10404 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10406 { return rs6000_output_load_multiple (operands); }"
10407 [(set_attr "type" "load_ux")
10408 (set_attr "length" "32")])
10410 (define_insn "*ldmsi6"
10411 [(match_parallel 0 "load_multiple_operation"
10412 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10413 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10414 (set (match_operand:SI 3 "gpc_reg_operand" "")
10415 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10416 (set (match_operand:SI 4 "gpc_reg_operand" "")
10417 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10418 (set (match_operand:SI 5 "gpc_reg_operand" "")
10419 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10420 (set (match_operand:SI 6 "gpc_reg_operand" "")
10421 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10422 (set (match_operand:SI 7 "gpc_reg_operand" "")
10423 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10424 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10426 { return rs6000_output_load_multiple (operands); }"
10427 [(set_attr "type" "load_ux")
10428 (set_attr "length" "32")])
10430 (define_insn "*ldmsi5"
10431 [(match_parallel 0 "load_multiple_operation"
10432 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10433 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10434 (set (match_operand:SI 3 "gpc_reg_operand" "")
10435 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10436 (set (match_operand:SI 4 "gpc_reg_operand" "")
10437 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10438 (set (match_operand:SI 5 "gpc_reg_operand" "")
10439 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10440 (set (match_operand:SI 6 "gpc_reg_operand" "")
10441 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10442 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10444 { return rs6000_output_load_multiple (operands); }"
10445 [(set_attr "type" "load_ux")
10446 (set_attr "length" "32")])
10448 (define_insn "*ldmsi4"
10449 [(match_parallel 0 "load_multiple_operation"
10450 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10451 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10452 (set (match_operand:SI 3 "gpc_reg_operand" "")
10453 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10454 (set (match_operand:SI 4 "gpc_reg_operand" "")
10455 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10456 (set (match_operand:SI 5 "gpc_reg_operand" "")
10457 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10458 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10460 { return rs6000_output_load_multiple (operands); }"
10461 [(set_attr "type" "load_ux")
10462 (set_attr "length" "32")])
10464 (define_insn "*ldmsi3"
10465 [(match_parallel 0 "load_multiple_operation"
10466 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10467 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10468 (set (match_operand:SI 3 "gpc_reg_operand" "")
10469 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10470 (set (match_operand:SI 4 "gpc_reg_operand" "")
10471 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10472 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10474 { return rs6000_output_load_multiple (operands); }"
10475 [(set_attr "type" "load_ux")
10476 (set_attr "length" "32")])
10478 (define_expand "store_multiple"
10479 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10480 (match_operand:SI 1 "" ""))
10481 (clobber (scratch:SI))
10482 (use (match_operand:SI 2 "" ""))])]
10483 "TARGET_STRING && !TARGET_POWERPC64"
10492 /* Support only storing a constant number of fixed-point registers to
10493 memory and only bother with this if more than two; the machine
10494 doesn't support more than eight. */
10495 if (GET_CODE (operands[2]) != CONST_INT
10496 || INTVAL (operands[2]) <= 2
10497 || INTVAL (operands[2]) > 8
10498 || GET_CODE (operands[0]) != MEM
10499 || GET_CODE (operands[1]) != REG
10500 || REGNO (operands[1]) >= 32)
10503 count = INTVAL (operands[2]);
10504 regno = REGNO (operands[1]);
10506 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10507 to = force_reg (SImode, XEXP (operands[0], 0));
10508 op0 = replace_equiv_address (operands[0], to);
10510 XVECEXP (operands[3], 0, 0)
10511 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10512 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10513 gen_rtx_SCRATCH (SImode));
10515 for (i = 1; i < count; i++)
10516 XVECEXP (operands[3], 0, i + 1)
10517 = gen_rtx_SET (VOIDmode,
10518 adjust_address_nv (op0, SImode, i * 4),
10519 gen_rtx_REG (SImode, regno + i));
10522 (define_insn "*stmsi8"
10523 [(match_parallel 0 "store_multiple_operation"
10524 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10525 (match_operand:SI 2 "gpc_reg_operand" "r"))
10526 (clobber (match_scratch:SI 3 "=X"))
10527 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10528 (match_operand:SI 4 "gpc_reg_operand" "r"))
10529 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10530 (match_operand:SI 5 "gpc_reg_operand" "r"))
10531 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10532 (match_operand:SI 6 "gpc_reg_operand" "r"))
10533 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10534 (match_operand:SI 7 "gpc_reg_operand" "r"))
10535 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10536 (match_operand:SI 8 "gpc_reg_operand" "r"))
10537 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10538 (match_operand:SI 9 "gpc_reg_operand" "r"))
10539 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10540 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10541 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10542 "{stsi|stswi} %2,%1,%O0"
10543 [(set_attr "type" "store_ux")
10544 (set_attr "cell_micro" "always")])
10546 (define_insn "*stmsi7"
10547 [(match_parallel 0 "store_multiple_operation"
10548 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10549 (match_operand:SI 2 "gpc_reg_operand" "r"))
10550 (clobber (match_scratch:SI 3 "=X"))
10551 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10552 (match_operand:SI 4 "gpc_reg_operand" "r"))
10553 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10554 (match_operand:SI 5 "gpc_reg_operand" "r"))
10555 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10556 (match_operand:SI 6 "gpc_reg_operand" "r"))
10557 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10558 (match_operand:SI 7 "gpc_reg_operand" "r"))
10559 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10560 (match_operand:SI 8 "gpc_reg_operand" "r"))
10561 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10562 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10563 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10564 "{stsi|stswi} %2,%1,%O0"
10565 [(set_attr "type" "store_ux")
10566 (set_attr "cell_micro" "always")])
10568 (define_insn "*stmsi6"
10569 [(match_parallel 0 "store_multiple_operation"
10570 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10571 (match_operand:SI 2 "gpc_reg_operand" "r"))
10572 (clobber (match_scratch:SI 3 "=X"))
10573 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10574 (match_operand:SI 4 "gpc_reg_operand" "r"))
10575 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10576 (match_operand:SI 5 "gpc_reg_operand" "r"))
10577 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10578 (match_operand:SI 6 "gpc_reg_operand" "r"))
10579 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10580 (match_operand:SI 7 "gpc_reg_operand" "r"))
10581 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10582 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10583 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10584 "{stsi|stswi} %2,%1,%O0"
10585 [(set_attr "type" "store_ux")
10586 (set_attr "cell_micro" "always")])
10588 (define_insn "*stmsi5"
10589 [(match_parallel 0 "store_multiple_operation"
10590 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10591 (match_operand:SI 2 "gpc_reg_operand" "r"))
10592 (clobber (match_scratch:SI 3 "=X"))
10593 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10594 (match_operand:SI 4 "gpc_reg_operand" "r"))
10595 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10596 (match_operand:SI 5 "gpc_reg_operand" "r"))
10597 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10598 (match_operand:SI 6 "gpc_reg_operand" "r"))
10599 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10600 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10601 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10602 "{stsi|stswi} %2,%1,%O0"
10603 [(set_attr "type" "store_ux")
10604 (set_attr "cell_micro" "always")])
10606 (define_insn "*stmsi4"
10607 [(match_parallel 0 "store_multiple_operation"
10608 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10609 (match_operand:SI 2 "gpc_reg_operand" "r"))
10610 (clobber (match_scratch:SI 3 "=X"))
10611 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10612 (match_operand:SI 4 "gpc_reg_operand" "r"))
10613 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10614 (match_operand:SI 5 "gpc_reg_operand" "r"))
10615 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10616 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10617 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10618 "{stsi|stswi} %2,%1,%O0"
10619 [(set_attr "type" "store_ux")
10620 (set_attr "cell_micro" "always")])
10622 (define_insn "*stmsi3"
10623 [(match_parallel 0 "store_multiple_operation"
10624 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10625 (match_operand:SI 2 "gpc_reg_operand" "r"))
10626 (clobber (match_scratch:SI 3 "=X"))
10627 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10628 (match_operand:SI 4 "gpc_reg_operand" "r"))
10629 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10630 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10631 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10632 "{stsi|stswi} %2,%1,%O0"
10633 [(set_attr "type" "store_ux")
10634 (set_attr "cell_micro" "always")])
10636 (define_insn "*stmsi8_power"
10637 [(match_parallel 0 "store_multiple_operation"
10638 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10639 (match_operand:SI 2 "gpc_reg_operand" "r"))
10640 (clobber (match_scratch:SI 3 "=q"))
10641 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10642 (match_operand:SI 4 "gpc_reg_operand" "r"))
10643 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10644 (match_operand:SI 5 "gpc_reg_operand" "r"))
10645 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10646 (match_operand:SI 6 "gpc_reg_operand" "r"))
10647 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10648 (match_operand:SI 7 "gpc_reg_operand" "r"))
10649 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10650 (match_operand:SI 8 "gpc_reg_operand" "r"))
10651 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10652 (match_operand:SI 9 "gpc_reg_operand" "r"))
10653 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10654 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10655 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10656 "{stsi|stswi} %2,%1,%O0"
10657 [(set_attr "type" "store_ux")
10658 (set_attr "cell_micro" "always")])
10660 (define_insn "*stmsi7_power"
10661 [(match_parallel 0 "store_multiple_operation"
10662 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10663 (match_operand:SI 2 "gpc_reg_operand" "r"))
10664 (clobber (match_scratch:SI 3 "=q"))
10665 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10666 (match_operand:SI 4 "gpc_reg_operand" "r"))
10667 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10668 (match_operand:SI 5 "gpc_reg_operand" "r"))
10669 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10670 (match_operand:SI 6 "gpc_reg_operand" "r"))
10671 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10672 (match_operand:SI 7 "gpc_reg_operand" "r"))
10673 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10674 (match_operand:SI 8 "gpc_reg_operand" "r"))
10675 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10676 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10677 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10678 "{stsi|stswi} %2,%1,%O0"
10679 [(set_attr "type" "store_ux")
10680 (set_attr "cell_micro" "always")])
10682 (define_insn "*stmsi6_power"
10683 [(match_parallel 0 "store_multiple_operation"
10684 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10685 (match_operand:SI 2 "gpc_reg_operand" "r"))
10686 (clobber (match_scratch:SI 3 "=q"))
10687 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10688 (match_operand:SI 4 "gpc_reg_operand" "r"))
10689 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10690 (match_operand:SI 5 "gpc_reg_operand" "r"))
10691 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10692 (match_operand:SI 6 "gpc_reg_operand" "r"))
10693 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10694 (match_operand:SI 7 "gpc_reg_operand" "r"))
10695 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10696 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10697 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10698 "{stsi|stswi} %2,%1,%O0"
10699 [(set_attr "type" "store_ux")
10700 (set_attr "cell_micro" "always")])
10702 (define_insn "*stmsi5_power"
10703 [(match_parallel 0 "store_multiple_operation"
10704 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10705 (match_operand:SI 2 "gpc_reg_operand" "r"))
10706 (clobber (match_scratch:SI 3 "=q"))
10707 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10708 (match_operand:SI 4 "gpc_reg_operand" "r"))
10709 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10710 (match_operand:SI 5 "gpc_reg_operand" "r"))
10711 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10712 (match_operand:SI 6 "gpc_reg_operand" "r"))
10713 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10714 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10715 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10716 "{stsi|stswi} %2,%1,%O0"
10717 [(set_attr "type" "store_ux")
10718 (set_attr "cell_micro" "always")])
10720 (define_insn "*stmsi4_power"
10721 [(match_parallel 0 "store_multiple_operation"
10722 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10723 (match_operand:SI 2 "gpc_reg_operand" "r"))
10724 (clobber (match_scratch:SI 3 "=q"))
10725 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10726 (match_operand:SI 4 "gpc_reg_operand" "r"))
10727 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10728 (match_operand:SI 5 "gpc_reg_operand" "r"))
10729 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10730 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10731 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10732 "{stsi|stswi} %2,%1,%O0"
10733 [(set_attr "type" "store_ux")
10734 (set_attr "cell_micro" "always")])
10736 (define_insn "*stmsi3_power"
10737 [(match_parallel 0 "store_multiple_operation"
10738 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10739 (match_operand:SI 2 "gpc_reg_operand" "r"))
10740 (clobber (match_scratch:SI 3 "=q"))
10741 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10742 (match_operand:SI 4 "gpc_reg_operand" "r"))
10743 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10744 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10745 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10746 "{stsi|stswi} %2,%1,%O0"
10747 [(set_attr "type" "store_ux")
10748 (set_attr "cell_micro" "always")])
10750 (define_expand "setmemsi"
10751 [(parallel [(set (match_operand:BLK 0 "" "")
10752 (match_operand 2 "const_int_operand" ""))
10753 (use (match_operand:SI 1 "" ""))
10754 (use (match_operand:SI 3 "" ""))])]
10758 /* If value to set is not zero, use the library routine. */
10759 if (operands[2] != const0_rtx)
10762 if (expand_block_clear (operands))
10768 ;; String/block move insn.
10769 ;; Argument 0 is the destination
10770 ;; Argument 1 is the source
10771 ;; Argument 2 is the length
10772 ;; Argument 3 is the alignment
10774 (define_expand "movmemsi"
10775 [(parallel [(set (match_operand:BLK 0 "" "")
10776 (match_operand:BLK 1 "" ""))
10777 (use (match_operand:SI 2 "" ""))
10778 (use (match_operand:SI 3 "" ""))])]
10782 if (expand_block_move (operands))
10788 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10789 ;; register allocator doesn't have a clue about allocating 8 word registers.
10790 ;; rD/rS = r5 is preferred, efficient form.
10791 (define_expand "movmemsi_8reg"
10792 [(parallel [(set (match_operand 0 "" "")
10793 (match_operand 1 "" ""))
10794 (use (match_operand 2 "" ""))
10795 (use (match_operand 3 "" ""))
10796 (clobber (reg:SI 5))
10797 (clobber (reg:SI 6))
10798 (clobber (reg:SI 7))
10799 (clobber (reg:SI 8))
10800 (clobber (reg:SI 9))
10801 (clobber (reg:SI 10))
10802 (clobber (reg:SI 11))
10803 (clobber (reg:SI 12))
10804 (clobber (match_scratch:SI 4 ""))])]
10809 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10810 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10811 (use (match_operand:SI 2 "immediate_operand" "i"))
10812 (use (match_operand:SI 3 "immediate_operand" "i"))
10813 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10814 (clobber (reg:SI 6))
10815 (clobber (reg:SI 7))
10816 (clobber (reg:SI 8))
10817 (clobber (reg:SI 9))
10818 (clobber (reg:SI 10))
10819 (clobber (reg:SI 11))
10820 (clobber (reg:SI 12))
10821 (clobber (match_scratch:SI 5 "=q"))]
10822 "TARGET_STRING && TARGET_POWER
10823 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10824 || INTVAL (operands[2]) == 0)
10825 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10826 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10827 && REGNO (operands[4]) == 5"
10828 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10829 [(set_attr "type" "store_ux")
10830 (set_attr "cell_micro" "always")
10831 (set_attr "length" "8")])
10834 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10835 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10836 (use (match_operand:SI 2 "immediate_operand" "i"))
10837 (use (match_operand:SI 3 "immediate_operand" "i"))
10838 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10839 (clobber (reg:SI 6))
10840 (clobber (reg:SI 7))
10841 (clobber (reg:SI 8))
10842 (clobber (reg:SI 9))
10843 (clobber (reg:SI 10))
10844 (clobber (reg:SI 11))
10845 (clobber (reg:SI 12))
10846 (clobber (match_scratch:SI 5 "=X"))]
10847 "TARGET_STRING && ! TARGET_POWER
10848 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10849 || INTVAL (operands[2]) == 0)
10850 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10851 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10852 && REGNO (operands[4]) == 5"
10853 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10854 [(set_attr "type" "store_ux")
10855 (set_attr "cell_micro" "always")
10856 (set_attr "length" "8")])
10858 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10859 ;; register allocator doesn't have a clue about allocating 6 word registers.
10860 ;; rD/rS = r5 is preferred, efficient form.
10861 (define_expand "movmemsi_6reg"
10862 [(parallel [(set (match_operand 0 "" "")
10863 (match_operand 1 "" ""))
10864 (use (match_operand 2 "" ""))
10865 (use (match_operand 3 "" ""))
10866 (clobber (reg:SI 5))
10867 (clobber (reg:SI 6))
10868 (clobber (reg:SI 7))
10869 (clobber (reg:SI 8))
10870 (clobber (reg:SI 9))
10871 (clobber (reg:SI 10))
10872 (clobber (match_scratch:SI 4 ""))])]
10877 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10878 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10879 (use (match_operand:SI 2 "immediate_operand" "i"))
10880 (use (match_operand:SI 3 "immediate_operand" "i"))
10881 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10882 (clobber (reg:SI 6))
10883 (clobber (reg:SI 7))
10884 (clobber (reg:SI 8))
10885 (clobber (reg:SI 9))
10886 (clobber (reg:SI 10))
10887 (clobber (match_scratch:SI 5 "=q"))]
10888 "TARGET_STRING && TARGET_POWER
10889 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10890 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10891 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10892 && REGNO (operands[4]) == 5"
10893 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10894 [(set_attr "type" "store_ux")
10895 (set_attr "cell_micro" "always")
10896 (set_attr "length" "8")])
10899 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10900 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10901 (use (match_operand:SI 2 "immediate_operand" "i"))
10902 (use (match_operand:SI 3 "immediate_operand" "i"))
10903 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10904 (clobber (reg:SI 6))
10905 (clobber (reg:SI 7))
10906 (clobber (reg:SI 8))
10907 (clobber (reg:SI 9))
10908 (clobber (reg:SI 10))
10909 (clobber (match_scratch:SI 5 "=X"))]
10910 "TARGET_STRING && ! TARGET_POWER
10911 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10912 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10913 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10914 && REGNO (operands[4]) == 5"
10915 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10916 [(set_attr "type" "store_ux")
10917 (set_attr "cell_micro" "always")
10918 (set_attr "length" "8")])
10920 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10921 ;; problems with TImode.
10922 ;; rD/rS = r5 is preferred, efficient form.
10923 (define_expand "movmemsi_4reg"
10924 [(parallel [(set (match_operand 0 "" "")
10925 (match_operand 1 "" ""))
10926 (use (match_operand 2 "" ""))
10927 (use (match_operand 3 "" ""))
10928 (clobber (reg:SI 5))
10929 (clobber (reg:SI 6))
10930 (clobber (reg:SI 7))
10931 (clobber (reg:SI 8))
10932 (clobber (match_scratch:SI 4 ""))])]
10937 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10938 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10939 (use (match_operand:SI 2 "immediate_operand" "i"))
10940 (use (match_operand:SI 3 "immediate_operand" "i"))
10941 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10942 (clobber (reg:SI 6))
10943 (clobber (reg:SI 7))
10944 (clobber (reg:SI 8))
10945 (clobber (match_scratch:SI 5 "=q"))]
10946 "TARGET_STRING && TARGET_POWER
10947 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10948 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10949 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10950 && REGNO (operands[4]) == 5"
10951 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10952 [(set_attr "type" "store_ux")
10953 (set_attr "cell_micro" "always")
10954 (set_attr "length" "8")])
10957 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10958 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10959 (use (match_operand:SI 2 "immediate_operand" "i"))
10960 (use (match_operand:SI 3 "immediate_operand" "i"))
10961 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10962 (clobber (reg:SI 6))
10963 (clobber (reg:SI 7))
10964 (clobber (reg:SI 8))
10965 (clobber (match_scratch:SI 5 "=X"))]
10966 "TARGET_STRING && ! TARGET_POWER
10967 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10968 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10969 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10970 && REGNO (operands[4]) == 5"
10971 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10972 [(set_attr "type" "store_ux")
10973 (set_attr "cell_micro" "always")
10974 (set_attr "length" "8")])
10976 ;; Move up to 8 bytes at a time.
10977 (define_expand "movmemsi_2reg"
10978 [(parallel [(set (match_operand 0 "" "")
10979 (match_operand 1 "" ""))
10980 (use (match_operand 2 "" ""))
10981 (use (match_operand 3 "" ""))
10982 (clobber (match_scratch:DI 4 ""))
10983 (clobber (match_scratch:SI 5 ""))])]
10984 "TARGET_STRING && ! TARGET_POWERPC64"
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_scratch:DI 4 "=&r"))
10993 (clobber (match_scratch:SI 5 "=q"))]
10994 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
10995 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10996 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10997 [(set_attr "type" "store_ux")
10998 (set_attr "cell_micro" "always")
10999 (set_attr "length" "8")])
11002 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11003 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11004 (use (match_operand:SI 2 "immediate_operand" "i"))
11005 (use (match_operand:SI 3 "immediate_operand" "i"))
11006 (clobber (match_scratch:DI 4 "=&r"))
11007 (clobber (match_scratch:SI 5 "=X"))]
11008 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
11009 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
11010 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11011 [(set_attr "type" "store_ux")
11012 (set_attr "cell_micro" "always")
11013 (set_attr "length" "8")])
11015 ;; Move up to 4 bytes at a time.
11016 (define_expand "movmemsi_1reg"
11017 [(parallel [(set (match_operand 0 "" "")
11018 (match_operand 1 "" ""))
11019 (use (match_operand 2 "" ""))
11020 (use (match_operand 3 "" ""))
11021 (clobber (match_scratch:SI 4 ""))
11022 (clobber (match_scratch:SI 5 ""))])]
11027 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11028 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11029 (use (match_operand:SI 2 "immediate_operand" "i"))
11030 (use (match_operand:SI 3 "immediate_operand" "i"))
11031 (clobber (match_scratch:SI 4 "=&r"))
11032 (clobber (match_scratch:SI 5 "=q"))]
11033 "TARGET_STRING && TARGET_POWER
11034 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11035 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11036 [(set_attr "type" "store_ux")
11037 (set_attr "cell_micro" "always")
11038 (set_attr "length" "8")])
11041 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11042 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11043 (use (match_operand:SI 2 "immediate_operand" "i"))
11044 (use (match_operand:SI 3 "immediate_operand" "i"))
11045 (clobber (match_scratch:SI 4 "=&r"))
11046 (clobber (match_scratch:SI 5 "=X"))]
11047 "TARGET_STRING && ! TARGET_POWER
11048 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11049 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11050 [(set_attr "type" "store_ux")
11051 (set_attr "cell_micro" "always")
11052 (set_attr "length" "8")])
11054 ;; Define insns that do load or store with update. Some of these we can
11055 ;; get by using pre-decrement or pre-increment, but the hardware can also
11056 ;; do cases where the increment is not the size of the object.
11058 ;; In all these cases, we use operands 0 and 1 for the register being
11059 ;; incremented because those are the operands that local-alloc will
11060 ;; tie and these are the pair most likely to be tieable (and the ones
11061 ;; that will benefit the most).
11063 (define_insn "*movdi_update1"
11064 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
11065 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
11066 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
11067 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
11068 (plus:DI (match_dup 1) (match_dup 2)))]
11069 "TARGET_POWERPC64 && TARGET_UPDATE
11070 && (!avoiding_indexed_address_p (DImode)
11071 || !gpc_reg_operand (operands[2], DImode))"
11075 [(set_attr "type" "load_ux,load_u")])
11077 (define_insn "movdi_<mode>_update"
11078 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11079 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11080 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11081 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11082 (plus:P (match_dup 1) (match_dup 2)))]
11083 "TARGET_POWERPC64 && TARGET_UPDATE
11084 && (!avoiding_indexed_address_p (Pmode)
11085 || !gpc_reg_operand (operands[2], Pmode)
11086 || (REG_P (operands[0])
11087 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11091 [(set_attr "type" "store_ux,store_u")])
11093 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
11094 ;; needed for stack allocation, even if the user passes -mno-update.
11095 (define_insn "movdi_<mode>_update_stack"
11096 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11097 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11098 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11099 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11100 (plus:P (match_dup 1) (match_dup 2)))]
11105 [(set_attr "type" "store_ux,store_u")])
11107 (define_insn "*movsi_update1"
11108 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11109 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11110 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11111 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11112 (plus:SI (match_dup 1) (match_dup 2)))]
11114 && (!avoiding_indexed_address_p (SImode)
11115 || !gpc_reg_operand (operands[2], SImode))"
11117 {lux|lwzux} %3,%0,%2
11118 {lu|lwzu} %3,%2(%0)"
11119 [(set_attr "type" "load_ux,load_u")])
11121 (define_insn "*movsi_update2"
11122 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
11124 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
11125 (match_operand:DI 2 "gpc_reg_operand" "r")))))
11126 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
11127 (plus:DI (match_dup 1) (match_dup 2)))]
11128 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
11129 && !avoiding_indexed_address_p (DImode)"
11131 [(set_attr "type" "load_ext_ux")])
11133 (define_insn "movsi_update"
11134 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11135 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11136 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11137 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11138 (plus:SI (match_dup 1) (match_dup 2)))]
11140 && (!avoiding_indexed_address_p (SImode)
11141 || !gpc_reg_operand (operands[2], SImode)
11142 || (REG_P (operands[0])
11143 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11145 {stux|stwux} %3,%0,%2
11146 {stu|stwu} %3,%2(%0)"
11147 [(set_attr "type" "store_ux,store_u")])
11149 ;; This is an unconditional pattern; needed for stack allocation, even
11150 ;; if the user passes -mno-update.
11151 (define_insn "movsi_update_stack"
11152 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11153 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11154 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11155 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11156 (plus:SI (match_dup 1) (match_dup 2)))]
11159 {stux|stwux} %3,%0,%2
11160 {stu|stwu} %3,%2(%0)"
11161 [(set_attr "type" "store_ux,store_u")])
11163 (define_insn "*movhi_update1"
11164 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
11165 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11166 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11167 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11168 (plus:SI (match_dup 1) (match_dup 2)))]
11170 && (!avoiding_indexed_address_p (SImode)
11171 || !gpc_reg_operand (operands[2], SImode))"
11175 [(set_attr "type" "load_ux,load_u")])
11177 (define_insn "*movhi_update2"
11178 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11180 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11181 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11182 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11183 (plus:SI (match_dup 1) (match_dup 2)))]
11185 && (!avoiding_indexed_address_p (SImode)
11186 || !gpc_reg_operand (operands[2], SImode))"
11190 [(set_attr "type" "load_ux,load_u")])
11192 (define_insn "*movhi_update3"
11193 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11195 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11196 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11197 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11198 (plus:SI (match_dup 1) (match_dup 2)))]
11199 "TARGET_UPDATE && rs6000_gen_cell_microcode
11200 && (!avoiding_indexed_address_p (SImode)
11201 || !gpc_reg_operand (operands[2], SImode))"
11205 [(set_attr "type" "load_ext_ux,load_ext_u")])
11207 (define_insn "*movhi_update4"
11208 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11209 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11210 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
11211 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11212 (plus:SI (match_dup 1) (match_dup 2)))]
11214 && (!avoiding_indexed_address_p (SImode)
11215 || !gpc_reg_operand (operands[2], SImode))"
11219 [(set_attr "type" "store_ux,store_u")])
11221 (define_insn "*movqi_update1"
11222 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
11223 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11224 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11225 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11226 (plus:SI (match_dup 1) (match_dup 2)))]
11228 && (!avoiding_indexed_address_p (SImode)
11229 || !gpc_reg_operand (operands[2], SImode))"
11233 [(set_attr "type" "load_ux,load_u")])
11235 (define_insn "*movqi_update2"
11236 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11238 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11239 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11240 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11241 (plus:SI (match_dup 1) (match_dup 2)))]
11243 && (!avoiding_indexed_address_p (SImode)
11244 || !gpc_reg_operand (operands[2], SImode))"
11248 [(set_attr "type" "load_ux,load_u")])
11250 (define_insn "*movqi_update3"
11251 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11252 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11253 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
11254 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11255 (plus:SI (match_dup 1) (match_dup 2)))]
11257 && (!avoiding_indexed_address_p (SImode)
11258 || !gpc_reg_operand (operands[2], SImode))"
11262 [(set_attr "type" "store_ux,store_u")])
11264 (define_insn "*movsf_update1"
11265 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
11266 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11267 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11268 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11269 (plus:SI (match_dup 1) (match_dup 2)))]
11270 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11271 && (!avoiding_indexed_address_p (SImode)
11272 || !gpc_reg_operand (operands[2], SImode))"
11276 [(set_attr "type" "fpload_ux,fpload_u")])
11278 (define_insn "*movsf_update2"
11279 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11280 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11281 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
11282 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11283 (plus:SI (match_dup 1) (match_dup 2)))]
11284 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11285 && (!avoiding_indexed_address_p (SImode)
11286 || !gpc_reg_operand (operands[2], SImode))"
11290 [(set_attr "type" "fpstore_ux,fpstore_u")])
11292 (define_insn "*movsf_update3"
11293 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
11294 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11295 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11296 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11297 (plus:SI (match_dup 1) (match_dup 2)))]
11298 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11299 && (!avoiding_indexed_address_p (SImode)
11300 || !gpc_reg_operand (operands[2], SImode))"
11302 {lux|lwzux} %3,%0,%2
11303 {lu|lwzu} %3,%2(%0)"
11304 [(set_attr "type" "load_ux,load_u")])
11306 (define_insn "*movsf_update4"
11307 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11308 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11309 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
11310 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11311 (plus:SI (match_dup 1) (match_dup 2)))]
11312 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11313 && (!avoiding_indexed_address_p (SImode)
11314 || !gpc_reg_operand (operands[2], SImode))"
11316 {stux|stwux} %3,%0,%2
11317 {stu|stwu} %3,%2(%0)"
11318 [(set_attr "type" "store_ux,store_u")])
11320 (define_insn "*movdf_update1"
11321 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
11322 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11323 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11324 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11325 (plus:SI (match_dup 1) (match_dup 2)))]
11326 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11327 && (!avoiding_indexed_address_p (SImode)
11328 || !gpc_reg_operand (operands[2], SImode))"
11332 [(set_attr "type" "fpload_ux,fpload_u")])
11334 (define_insn "*movdf_update2"
11335 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11336 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11337 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
11338 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11339 (plus:SI (match_dup 1) (match_dup 2)))]
11340 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11341 && (!avoiding_indexed_address_p (SImode)
11342 || !gpc_reg_operand (operands[2], SImode))"
11346 [(set_attr "type" "fpstore_ux,fpstore_u")])
11348 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
11350 (define_insn "*lfq_power2"
11351 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
11352 (match_operand:V2DF 1 "memory_operand" ""))]
11354 && TARGET_HARD_FLOAT && TARGET_FPRS"
11358 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11359 (match_operand:DF 1 "memory_operand" ""))
11360 (set (match_operand:DF 2 "gpc_reg_operand" "")
11361 (match_operand:DF 3 "memory_operand" ""))]
11363 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11364 && registers_ok_for_quad_peep (operands[0], operands[2])
11365 && mems_ok_for_quad_peep (operands[1], operands[3])"
11366 [(set (match_dup 0)
11368 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
11369 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
11371 (define_insn "*stfq_power2"
11372 [(set (match_operand:V2DF 0 "memory_operand" "")
11373 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
11375 && TARGET_HARD_FLOAT && TARGET_FPRS"
11376 "stfq%U0%X0 %1,%0")
11380 [(set (match_operand:DF 0 "memory_operand" "")
11381 (match_operand:DF 1 "gpc_reg_operand" ""))
11382 (set (match_operand:DF 2 "memory_operand" "")
11383 (match_operand:DF 3 "gpc_reg_operand" ""))]
11385 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11386 && registers_ok_for_quad_peep (operands[1], operands[3])
11387 && mems_ok_for_quad_peep (operands[0], operands[2])"
11388 [(set (match_dup 0)
11390 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
11391 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
11393 ;; After inserting conditional returns we can sometimes have
11394 ;; unnecessary register moves. Unfortunately we cannot have a
11395 ;; modeless peephole here, because some single SImode sets have early
11396 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11397 ;; sequences, using get_attr_length here will smash the operands
11398 ;; array. Neither is there an early_cobbler_p predicate.
11399 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11401 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11402 (match_operand:DF 1 "any_operand" ""))
11403 (set (match_operand:DF 2 "gpc_reg_operand" "")
11405 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11406 && peep2_reg_dead_p (2, operands[0])"
11407 [(set (match_dup 2) (match_dup 1))])
11410 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11411 (match_operand:SF 1 "any_operand" ""))
11412 (set (match_operand:SF 2 "gpc_reg_operand" "")
11414 "peep2_reg_dead_p (2, operands[0])"
11415 [(set (match_dup 2) (match_dup 1))])
11420 ;; Mode attributes for different ABIs.
11421 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11422 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11423 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11424 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11426 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11427 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11428 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11429 (match_operand 4 "" "g")))
11430 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11431 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11433 (clobber (reg:SI LR_REGNO))]
11434 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11436 if (TARGET_CMODEL != CMODEL_SMALL)
11437 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;bl %z3\;%.";
11439 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;%.";
11441 "&& TARGET_TLS_MARKERS"
11442 [(set (match_dup 0)
11443 (unspec:TLSmode [(match_dup 1)
11446 (parallel [(set (match_dup 0)
11447 (call (mem:TLSmode (match_dup 3))
11449 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11450 (clobber (reg:SI LR_REGNO))])]
11452 [(set_attr "type" "two")
11453 (set (attr "length")
11454 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11458 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11459 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11460 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11461 (match_operand 4 "" "g")))
11462 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11463 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11465 (clobber (reg:SI LR_REGNO))]
11466 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11470 if (TARGET_SECURE_PLT && flag_pic == 2)
11471 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11473 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11476 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11478 "&& TARGET_TLS_MARKERS"
11479 [(set (match_dup 0)
11480 (unspec:TLSmode [(match_dup 1)
11483 (parallel [(set (match_dup 0)
11484 (call (mem:TLSmode (match_dup 3))
11486 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11487 (clobber (reg:SI LR_REGNO))])]
11489 [(set_attr "type" "two")
11490 (set_attr "length" "8")])
11492 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11493 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11494 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11495 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11497 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11498 "addi %0,%1,%2@got@tlsgd"
11499 "&& TARGET_CMODEL != CMODEL_SMALL"
11500 [(set (match_dup 3)
11501 (plus:TLSmode (match_dup 1)
11503 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD))))
11505 (lo_sum:TLSmode (match_dup 3)
11506 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
11509 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11511 [(set (attr "length")
11512 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11516 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11517 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11518 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11520 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11522 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11523 "addis %0,%1,%2@got@tlsgd@ha"
11524 [(set_attr "length" "4")])
11526 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11527 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11528 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11529 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11531 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11532 "addi %0,%1,%2@got@tlsgd@l"
11533 [(set_attr "length" "4")])
11535 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11536 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11537 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11538 (match_operand 2 "" "g")))
11539 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11541 (clobber (reg:SI LR_REGNO))]
11542 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11543 "bl %z1(%3@tlsgd)\;%."
11544 [(set_attr "type" "branch")
11545 (set_attr "length" "8")])
11547 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11548 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11549 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11550 (match_operand 2 "" "g")))
11551 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11553 (clobber (reg:SI LR_REGNO))]
11554 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11558 if (TARGET_SECURE_PLT && flag_pic == 2)
11559 return "bl %z1+32768(%3@tlsgd)@plt";
11560 return "bl %z1(%3@tlsgd)@plt";
11562 return "bl %z1(%3@tlsgd)";
11564 [(set_attr "type" "branch")
11565 (set_attr "length" "4")])
11567 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11568 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11569 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11570 (match_operand 3 "" "g")))
11571 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11573 (clobber (reg:SI LR_REGNO))]
11574 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11576 if (TARGET_CMODEL != CMODEL_SMALL)
11577 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;bl %z2\;%.";
11579 return "addi %0,%1,%&@got@tlsld\;bl %z2\;%.";
11581 "&& TARGET_TLS_MARKERS"
11582 [(set (match_dup 0)
11583 (unspec:TLSmode [(match_dup 1)]
11585 (parallel [(set (match_dup 0)
11586 (call (mem:TLSmode (match_dup 2))
11588 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11589 (clobber (reg:SI LR_REGNO))])]
11591 [(set_attr "type" "two")
11592 (set (attr "length")
11593 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11597 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11598 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11599 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11600 (match_operand 3 "" "g")))
11601 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11603 (clobber (reg:SI LR_REGNO))]
11604 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11608 if (TARGET_SECURE_PLT && flag_pic == 2)
11609 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11611 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11614 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11616 "&& TARGET_TLS_MARKERS"
11617 [(set (match_dup 0)
11618 (unspec:TLSmode [(match_dup 1)]
11620 (parallel [(set (match_dup 0)
11621 (call (mem:TLSmode (match_dup 2))
11623 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11624 (clobber (reg:SI LR_REGNO))])]
11626 [(set_attr "length" "8")])
11628 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11629 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11630 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11632 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11633 "addi %0,%1,%&@got@tlsld"
11634 "&& TARGET_CMODEL != CMODEL_SMALL"
11635 [(set (match_dup 2)
11636 (plus:TLSmode (match_dup 1)
11638 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))
11640 (lo_sum:TLSmode (match_dup 2)
11641 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11644 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11646 [(set (attr "length")
11647 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11651 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11652 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11653 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11655 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))]
11656 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11657 "addis %0,%1,%&@got@tlsld@ha"
11658 [(set_attr "length" "4")])
11660 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11661 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11662 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11663 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11664 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11665 "addi %0,%1,%&@got@tlsld@l"
11666 [(set_attr "length" "4")])
11668 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11669 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11670 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11671 (match_operand 2 "" "g")))
11672 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11673 (clobber (reg:SI LR_REGNO))]
11674 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11675 "bl %z1(%&@tlsld)\;%."
11676 [(set_attr "type" "branch")
11677 (set_attr "length" "8")])
11679 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11680 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11681 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11682 (match_operand 2 "" "g")))
11683 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11684 (clobber (reg:SI LR_REGNO))]
11685 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11689 if (TARGET_SECURE_PLT && flag_pic == 2)
11690 return "bl %z1+32768(%&@tlsld)@plt";
11691 return "bl %z1(%&@tlsld)@plt";
11693 return "bl %z1(%&@tlsld)";
11695 [(set_attr "type" "branch")
11696 (set_attr "length" "4")])
11698 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11699 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11700 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11701 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11702 UNSPEC_TLSDTPREL))]
11704 "addi %0,%1,%2@dtprel")
11706 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11707 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11708 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11709 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11710 UNSPEC_TLSDTPRELHA))]
11712 "addis %0,%1,%2@dtprel@ha")
11714 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11715 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11716 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11717 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11718 UNSPEC_TLSDTPRELLO))]
11720 "addi %0,%1,%2@dtprel@l")
11722 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11723 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11724 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11725 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11726 UNSPEC_TLSGOTDTPREL))]
11728 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11729 "&& TARGET_CMODEL != CMODEL_SMALL"
11730 [(set (match_dup 3)
11731 (plus:TLSmode (match_dup 1)
11733 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL))))
11735 (lo_sum:TLSmode (match_dup 3)
11736 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11739 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11741 [(set (attr "length")
11742 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11746 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11747 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11748 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11750 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11751 UNSPEC_TLSGOTDTPREL))))]
11752 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11753 "addis %0,%1,%2@got@dtprel@ha"
11754 [(set_attr "length" "4")])
11756 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11757 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11758 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11759 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11760 UNSPEC_TLSGOTDTPREL)))]
11761 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11762 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11763 [(set_attr "length" "4")])
11765 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11766 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11767 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11768 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11771 "addi %0,%1,%2@tprel")
11773 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11774 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11775 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11776 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11777 UNSPEC_TLSTPRELHA))]
11779 "addis %0,%1,%2@tprel@ha")
11781 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11782 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11783 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11784 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11785 UNSPEC_TLSTPRELLO))]
11787 "addi %0,%1,%2@tprel@l")
11789 ;; "b" output constraint here and on tls_tls input to support linker tls
11790 ;; optimization. The linker may edit the instructions emitted by a
11791 ;; tls_got_tprel/tls_tls pair to addis,addi.
11792 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11793 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11794 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11795 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11796 UNSPEC_TLSGOTTPREL))]
11798 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11799 "&& TARGET_CMODEL != CMODEL_SMALL"
11800 [(set (match_dup 3)
11801 (plus:TLSmode (match_dup 1)
11803 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL))))
11805 (lo_sum:TLSmode (match_dup 3)
11806 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11809 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11811 [(set (attr "length")
11812 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11816 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11817 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11818 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11820 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11821 UNSPEC_TLSGOTTPREL))))]
11822 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11823 "addis %0,%1,%2@got@tprel@ha"
11824 [(set_attr "length" "4")])
11826 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11827 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11828 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11829 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11830 UNSPEC_TLSGOTTPREL)))]
11831 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11832 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11833 [(set_attr "length" "4")])
11835 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11836 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11837 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11838 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11841 "add %0,%1,%2@tls")
11843 ;; Next come insns related to the calling sequence.
11845 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11846 ;; We move the back-chain and decrement the stack pointer.
11848 (define_expand "allocate_stack"
11849 [(set (match_operand 0 "gpc_reg_operand" "")
11850 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11852 (minus (reg 1) (match_dup 1)))]
11855 { rtx chain = gen_reg_rtx (Pmode);
11856 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11858 rtx insn, par, set, mem;
11860 emit_move_insn (chain, stack_bot);
11862 /* Check stack bounds if necessary. */
11863 if (crtl->limit_stack)
11866 available = expand_binop (Pmode, sub_optab,
11867 stack_pointer_rtx, stack_limit_rtx,
11868 NULL_RTX, 1, OPTAB_WIDEN);
11869 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11872 if (GET_CODE (operands[1]) != CONST_INT
11873 || INTVAL (operands[1]) < -32767
11874 || INTVAL (operands[1]) > 32768)
11876 neg_op0 = gen_reg_rtx (Pmode);
11878 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11880 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11883 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11885 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11886 : gen_movdi_di_update_stack))
11887 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11889 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11890 it now and set the alias set/attributes. The above gen_*_update
11891 calls will generate a PARALLEL with the MEM set being the first
11893 par = PATTERN (insn);
11894 gcc_assert (GET_CODE (par) == PARALLEL);
11895 set = XVECEXP (par, 0, 0);
11896 gcc_assert (GET_CODE (set) == SET);
11897 mem = SET_DEST (set);
11898 gcc_assert (MEM_P (mem));
11899 MEM_NOTRAP_P (mem) = 1;
11900 set_mem_alias_set (mem, get_frame_alias_set ());
11902 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11906 ;; These patterns say how to save and restore the stack pointer. We need not
11907 ;; save the stack pointer at function level since we are careful to
11908 ;; preserve the backchain. At block level, we have to restore the backchain
11909 ;; when we restore the stack pointer.
11911 ;; For nonlocal gotos, we must save both the stack pointer and its
11912 ;; backchain and restore both. Note that in the nonlocal case, the
11913 ;; save area is a memory location.
11915 (define_expand "save_stack_function"
11916 [(match_operand 0 "any_operand" "")
11917 (match_operand 1 "any_operand" "")]
11921 (define_expand "restore_stack_function"
11922 [(match_operand 0 "any_operand" "")
11923 (match_operand 1 "any_operand" "")]
11927 ;; Adjust stack pointer (op0) to a new value (op1).
11928 ;; First copy old stack backchain to new location, and ensure that the
11929 ;; scheduler won't reorder the sp assignment before the backchain write.
11930 (define_expand "restore_stack_block"
11931 [(set (match_dup 2) (match_dup 3))
11932 (set (match_dup 4) (match_dup 2))
11933 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11934 (set (match_operand 0 "register_operand" "")
11935 (match_operand 1 "register_operand" ""))]
11939 operands[1] = force_reg (Pmode, operands[1]);
11940 operands[2] = gen_reg_rtx (Pmode);
11941 operands[3] = gen_frame_mem (Pmode, operands[0]);
11942 operands[4] = gen_frame_mem (Pmode, operands[1]);
11943 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11946 (define_expand "save_stack_nonlocal"
11947 [(set (match_dup 3) (match_dup 4))
11948 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11949 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11953 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11955 /* Copy the backchain to the first word, sp to the second. */
11956 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11957 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11958 operands[3] = gen_reg_rtx (Pmode);
11959 operands[4] = gen_frame_mem (Pmode, operands[1]);
11962 (define_expand "restore_stack_nonlocal"
11963 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11964 (set (match_dup 3) (match_dup 4))
11965 (set (match_dup 5) (match_dup 2))
11966 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11967 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11971 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11973 /* Restore the backchain from the first word, sp from the second. */
11974 operands[2] = gen_reg_rtx (Pmode);
11975 operands[3] = gen_reg_rtx (Pmode);
11976 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11977 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11978 operands[5] = gen_frame_mem (Pmode, operands[3]);
11979 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11982 ;; TOC register handling.
11984 ;; Code to initialize the TOC register...
11986 (define_insn "load_toc_aix_si"
11987 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11988 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11989 (use (reg:SI 2))])]
11990 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11994 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11995 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11996 operands[2] = gen_rtx_REG (Pmode, 2);
11997 return \"{l|lwz} %0,%1(%2)\";
11999 [(set_attr "type" "load")])
12001 (define_insn "load_toc_aix_di"
12002 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12003 (unspec:DI [(const_int 0)] UNSPEC_TOC))
12004 (use (reg:DI 2))])]
12005 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
12009 #ifdef TARGET_RELOCATABLE
12010 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
12011 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
12013 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
12016 strcat (buf, \"@toc\");
12017 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12018 operands[2] = gen_rtx_REG (Pmode, 2);
12019 return \"ld %0,%1(%2)\";
12021 [(set_attr "type" "load")])
12023 (define_insn "load_toc_v4_pic_si"
12024 [(set (reg:SI LR_REGNO)
12025 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
12026 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
12027 "bl _GLOBAL_OFFSET_TABLE_@local-4"
12028 [(set_attr "type" "branch")
12029 (set_attr "length" "4")])
12031 (define_insn "load_toc_v4_PIC_1"
12032 [(set (reg:SI LR_REGNO)
12033 (match_operand:SI 0 "immediate_operand" "s"))
12034 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
12035 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
12036 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
12037 "bcl 20,31,%0\\n%0:"
12038 [(set_attr "type" "branch")
12039 (set_attr "length" "4")])
12041 (define_insn "load_toc_v4_PIC_1b"
12042 [(set (reg:SI LR_REGNO)
12043 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
12044 (label_ref (match_operand 1 "" ""))]
12047 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12048 "bcl 20,31,$+8\;.long %0-$"
12049 [(set_attr "type" "branch")
12050 (set_attr "length" "8")])
12052 (define_insn "load_toc_v4_PIC_2"
12053 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12054 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12055 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
12056 (match_operand:SI 3 "immediate_operand" "s")))))]
12057 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12058 "{l|lwz} %0,%2-%3(%1)"
12059 [(set_attr "type" "load")])
12061 (define_insn "load_toc_v4_PIC_3b"
12062 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12063 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12065 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12066 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
12067 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12068 "{cau|addis} %0,%1,%2-%3@ha")
12070 (define_insn "load_toc_v4_PIC_3c"
12071 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12072 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12073 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12074 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
12075 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12076 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
12078 ;; If the TOC is shared over a translation unit, as happens with all
12079 ;; the kinds of PIC that we support, we need to restore the TOC
12080 ;; pointer only when jumping over units of translation.
12081 ;; On Darwin, we need to reload the picbase.
12083 (define_expand "builtin_setjmp_receiver"
12084 [(use (label_ref (match_operand 0 "" "")))]
12085 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
12086 || (TARGET_TOC && TARGET_MINIMAL_TOC)
12087 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
12091 if (DEFAULT_ABI == ABI_DARWIN)
12093 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
12094 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
12098 crtl->uses_pic_offset_table = 1;
12099 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
12100 CODE_LABEL_NUMBER (operands[0]));
12101 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
12103 emit_insn (gen_load_macho_picbase (tmplabrtx));
12104 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
12105 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
12109 rs6000_emit_load_toc_table (FALSE);
12113 ;; Elf specific ways of loading addresses for non-PIC code.
12114 ;; The output of this could be r0, but we make a very strong
12115 ;; preference for a base register because it will usually
12116 ;; be needed there.
12117 (define_insn "elf_high"
12118 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
12119 (high:SI (match_operand 1 "" "")))]
12120 "TARGET_ELF && ! TARGET_64BIT"
12121 "{liu|lis} %0,%1@ha")
12123 (define_insn "elf_low"
12124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12125 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
12126 (match_operand 2 "" "")))]
12127 "TARGET_ELF && ! TARGET_64BIT"
12129 {cal|la} %0,%2@l(%1)
12130 {ai|addic} %0,%1,%K2")
12132 ;; Largetoc support
12133 (define_insn "largetoc_high"
12134 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
12135 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12136 (high:DI (match_operand:DI 2 "" ""))))]
12137 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12138 "{cau|addis} %0,%1,%2@ha")
12140 (define_insn "largetoc_low"
12141 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12142 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12143 (match_operand:DI 2 "" "")))]
12144 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12145 "{cal %0,%2@l(%1)|addi %0,%1,%2@l}")
12147 ;; A function pointer under AIX is a pointer to a data area whose first word
12148 ;; contains the actual address of the function, whose second word contains a
12149 ;; pointer to its TOC, and whose third word contains a value to place in the
12150 ;; static chain register (r11). Note that if we load the static chain, our
12151 ;; "trampoline" need not have any executable code.
12153 (define_expand "call_indirect_aix32"
12154 [(set (match_dup 2)
12155 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
12156 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
12159 (mem:SI (plus:SI (match_dup 0)
12161 (parallel [(call (mem:SI (match_dup 2))
12162 (match_operand 1 "" ""))
12163 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
12165 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12166 (clobber (reg:SI LR_REGNO))])]
12169 { operands[2] = gen_reg_rtx (SImode); }")
12171 (define_expand "call_indirect_aix64"
12172 [(set (match_dup 2)
12173 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
12174 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
12177 (mem:DI (plus:DI (match_dup 0)
12179 (parallel [(call (mem:SI (match_dup 2))
12180 (match_operand 1 "" ""))
12181 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
12183 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12184 (clobber (reg:SI LR_REGNO))])]
12187 { operands[2] = gen_reg_rtx (DImode); }")
12189 (define_expand "call_value_indirect_aix32"
12190 [(set (match_dup 3)
12191 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12192 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
12195 (mem:SI (plus:SI (match_dup 1)
12197 (parallel [(set (match_operand 0 "" "")
12198 (call (mem:SI (match_dup 3))
12199 (match_operand 2 "" "")))
12200 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
12202 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12203 (clobber (reg:SI LR_REGNO))])]
12206 { operands[3] = gen_reg_rtx (SImode); }")
12208 (define_expand "call_value_indirect_aix64"
12209 [(set (match_dup 3)
12210 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12211 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
12214 (mem:DI (plus:DI (match_dup 1)
12216 (parallel [(set (match_operand 0 "" "")
12217 (call (mem:SI (match_dup 3))
12218 (match_operand 2 "" "")))
12219 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
12221 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12222 (clobber (reg:SI LR_REGNO))])]
12225 { operands[3] = gen_reg_rtx (DImode); }")
12227 ;; Now the definitions for the call and call_value insns
12228 (define_expand "call"
12229 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12230 (match_operand 1 "" ""))
12231 (use (match_operand 2 "" ""))
12232 (clobber (reg:SI LR_REGNO))])]
12237 if (MACHOPIC_INDIRECT)
12238 operands[0] = machopic_indirect_call_target (operands[0]);
12241 gcc_assert (GET_CODE (operands[0]) == MEM);
12242 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12244 operands[0] = XEXP (operands[0], 0);
12246 if (GET_CODE (operands[0]) != SYMBOL_REF
12247 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
12248 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
12250 if (INTVAL (operands[2]) & CALL_LONG)
12251 operands[0] = rs6000_longcall_ref (operands[0]);
12253 switch (DEFAULT_ABI)
12257 operands[0] = force_reg (Pmode, operands[0]);
12261 /* AIX function pointers are really pointers to a three word
12263 emit_call_insn (TARGET_32BIT
12264 ? gen_call_indirect_aix32 (force_reg (SImode,
12267 : gen_call_indirect_aix64 (force_reg (DImode,
12273 gcc_unreachable ();
12278 (define_expand "call_value"
12279 [(parallel [(set (match_operand 0 "" "")
12280 (call (mem:SI (match_operand 1 "address_operand" ""))
12281 (match_operand 2 "" "")))
12282 (use (match_operand 3 "" ""))
12283 (clobber (reg:SI LR_REGNO))])]
12288 if (MACHOPIC_INDIRECT)
12289 operands[1] = machopic_indirect_call_target (operands[1]);
12292 gcc_assert (GET_CODE (operands[1]) == MEM);
12293 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12295 operands[1] = XEXP (operands[1], 0);
12297 if (GET_CODE (operands[1]) != SYMBOL_REF
12298 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
12299 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
12301 if (INTVAL (operands[3]) & CALL_LONG)
12302 operands[1] = rs6000_longcall_ref (operands[1]);
12304 switch (DEFAULT_ABI)
12308 operands[1] = force_reg (Pmode, operands[1]);
12312 /* AIX function pointers are really pointers to a three word
12314 emit_call_insn (TARGET_32BIT
12315 ? gen_call_value_indirect_aix32 (operands[0],
12319 : gen_call_value_indirect_aix64 (operands[0],
12326 gcc_unreachable ();
12331 ;; Call to function in current module. No TOC pointer reload needed.
12332 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12333 ;; either the function was not prototyped, or it was prototyped as a
12334 ;; variable argument function. It is > 0 if FP registers were passed
12335 ;; and < 0 if they were not.
12337 (define_insn "*call_local32"
12338 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12339 (match_operand 1 "" "g,g"))
12340 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12341 (clobber (reg:SI LR_REGNO))]
12342 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12345 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12346 output_asm_insn (\"crxor 6,6,6\", operands);
12348 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12349 output_asm_insn (\"creqv 6,6,6\", operands);
12351 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12353 [(set_attr "type" "branch")
12354 (set_attr "length" "4,8")])
12356 (define_insn "*call_local64"
12357 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12358 (match_operand 1 "" "g,g"))
12359 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12360 (clobber (reg:SI LR_REGNO))]
12361 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12364 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12365 output_asm_insn (\"crxor 6,6,6\", operands);
12367 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12368 output_asm_insn (\"creqv 6,6,6\", operands);
12370 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12372 [(set_attr "type" "branch")
12373 (set_attr "length" "4,8")])
12375 (define_insn "*call_value_local32"
12376 [(set (match_operand 0 "" "")
12377 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12378 (match_operand 2 "" "g,g")))
12379 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12380 (clobber (reg:SI LR_REGNO))]
12381 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12384 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12385 output_asm_insn (\"crxor 6,6,6\", operands);
12387 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12388 output_asm_insn (\"creqv 6,6,6\", operands);
12390 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12392 [(set_attr "type" "branch")
12393 (set_attr "length" "4,8")])
12396 (define_insn "*call_value_local64"
12397 [(set (match_operand 0 "" "")
12398 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12399 (match_operand 2 "" "g,g")))
12400 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12401 (clobber (reg:SI LR_REGNO))]
12402 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12405 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12406 output_asm_insn (\"crxor 6,6,6\", operands);
12408 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12409 output_asm_insn (\"creqv 6,6,6\", operands);
12411 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12413 [(set_attr "type" "branch")
12414 (set_attr "length" "4,8")])
12416 ;; Call to function which may be in another module. Restore the TOC
12417 ;; pointer (r2) after the call unless this is System V.
12418 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12419 ;; either the function was not prototyped, or it was prototyped as a
12420 ;; variable argument function. It is > 0 if FP registers were passed
12421 ;; and < 0 if they were not.
12423 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
12424 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12425 (match_operand 1 "" "g,g"))
12426 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
12428 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12429 (clobber (reg:SI LR_REGNO))]
12430 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12432 "&& reload_completed"
12434 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
12435 (parallel [(call (mem:SI (match_dup 0))
12440 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12441 (clobber (reg:SI LR_REGNO))])]
12443 [(set_attr "type" "jmpreg")
12444 (set_attr "length" "12")])
12446 (define_insn "*call_indirect_nonlocal_aix32"
12447 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12448 (match_operand 1 "" "g,g"))
12452 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12453 (clobber (reg:SI LR_REGNO))]
12454 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12455 "b%T0l\;{l|lwz} 2,20(1)"
12456 [(set_attr "type" "jmpreg")
12457 (set_attr "length" "8")])
12459 (define_insn "*call_nonlocal_aix32"
12460 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12461 (match_operand 1 "" "g"))
12462 (use (match_operand:SI 2 "immediate_operand" "O"))
12463 (clobber (reg:SI LR_REGNO))]
12465 && DEFAULT_ABI == ABI_AIX
12466 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12468 [(set_attr "type" "branch")
12469 (set_attr "length" "8")])
12471 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
12472 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12473 (match_operand 1 "" "g,g"))
12474 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
12477 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12478 (clobber (reg:SI LR_REGNO))]
12479 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12481 "&& reload_completed"
12483 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
12484 (parallel [(call (mem:SI (match_dup 0))
12489 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12490 (clobber (reg:SI LR_REGNO))])]
12492 [(set_attr "type" "jmpreg")
12493 (set_attr "length" "12")])
12495 (define_insn "*call_indirect_nonlocal_aix64"
12496 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12497 (match_operand 1 "" "g,g"))
12501 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12502 (clobber (reg:SI LR_REGNO))]
12503 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12504 "b%T0l\;ld 2,40(1)"
12505 [(set_attr "type" "jmpreg")
12506 (set_attr "length" "8")])
12508 (define_insn "*call_nonlocal_aix64"
12509 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12510 (match_operand 1 "" "g"))
12511 (use (match_operand:SI 2 "immediate_operand" "O"))
12512 (clobber (reg:SI LR_REGNO))]
12514 && DEFAULT_ABI == ABI_AIX
12515 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12517 [(set_attr "type" "branch")
12518 (set_attr "length" "8")])
12520 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
12521 [(set (match_operand 0 "" "")
12522 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12523 (match_operand 2 "" "g,g")))
12524 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
12527 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12528 (clobber (reg:SI LR_REGNO))]
12529 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12531 "&& reload_completed"
12533 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
12534 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12539 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12540 (clobber (reg:SI LR_REGNO))])]
12542 [(set_attr "type" "jmpreg")
12543 (set_attr "length" "12")])
12545 (define_insn "*call_value_indirect_nonlocal_aix32"
12546 [(set (match_operand 0 "" "")
12547 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12548 (match_operand 2 "" "g,g")))
12552 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12553 (clobber (reg:SI LR_REGNO))]
12554 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12555 "b%T1l\;{l|lwz} 2,20(1)"
12556 [(set_attr "type" "jmpreg")
12557 (set_attr "length" "8")])
12559 (define_insn "*call_value_nonlocal_aix32"
12560 [(set (match_operand 0 "" "")
12561 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12562 (match_operand 2 "" "g")))
12563 (use (match_operand:SI 3 "immediate_operand" "O"))
12564 (clobber (reg:SI LR_REGNO))]
12566 && DEFAULT_ABI == ABI_AIX
12567 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12569 [(set_attr "type" "branch")
12570 (set_attr "length" "8")])
12572 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
12573 [(set (match_operand 0 "" "")
12574 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12575 (match_operand 2 "" "g,g")))
12576 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
12579 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12580 (clobber (reg:SI LR_REGNO))]
12581 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12583 "&& reload_completed"
12585 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
12586 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12591 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12592 (clobber (reg:SI LR_REGNO))])]
12594 [(set_attr "type" "jmpreg")
12595 (set_attr "length" "12")])
12597 (define_insn "*call_value_indirect_nonlocal_aix64"
12598 [(set (match_operand 0 "" "")
12599 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12600 (match_operand 2 "" "g,g")))
12604 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12605 (clobber (reg:SI LR_REGNO))]
12606 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12607 "b%T1l\;ld 2,40(1)"
12608 [(set_attr "type" "jmpreg")
12609 (set_attr "length" "8")])
12611 (define_insn "*call_value_nonlocal_aix64"
12612 [(set (match_operand 0 "" "")
12613 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12614 (match_operand 2 "" "g")))
12615 (use (match_operand:SI 3 "immediate_operand" "O"))
12616 (clobber (reg:SI LR_REGNO))]
12618 && DEFAULT_ABI == ABI_AIX
12619 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12621 [(set_attr "type" "branch")
12622 (set_attr "length" "8")])
12624 ;; A function pointer under System V is just a normal pointer
12625 ;; operands[0] is the function pointer
12626 ;; operands[1] is the stack size to clean up
12627 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12628 ;; which indicates how to set cr1
12630 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12631 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12632 (match_operand 1 "" "g,g,g,g"))
12633 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12634 (clobber (reg:SI LR_REGNO))]
12635 "DEFAULT_ABI == ABI_V4
12636 || DEFAULT_ABI == ABI_DARWIN"
12638 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12639 output_asm_insn ("crxor 6,6,6", operands);
12641 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12642 output_asm_insn ("creqv 6,6,6", operands);
12646 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12647 (set_attr "length" "4,4,8,8")])
12649 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12650 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12651 (match_operand 1 "" "g,g"))
12652 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12653 (clobber (reg:SI LR_REGNO))]
12654 "(DEFAULT_ABI == ABI_DARWIN
12655 || (DEFAULT_ABI == ABI_V4
12656 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12658 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12659 output_asm_insn ("crxor 6,6,6", operands);
12661 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12662 output_asm_insn ("creqv 6,6,6", operands);
12665 return output_call(insn, operands, 0, 2);
12667 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12669 gcc_assert (!TARGET_SECURE_PLT);
12670 return "bl %z0@plt";
12676 "DEFAULT_ABI == ABI_V4
12677 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12678 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12679 [(parallel [(call (mem:SI (match_dup 0))
12681 (use (match_dup 2))
12682 (use (match_dup 3))
12683 (clobber (reg:SI LR_REGNO))])]
12685 operands[3] = pic_offset_table_rtx;
12687 [(set_attr "type" "branch,branch")
12688 (set_attr "length" "4,8")])
12690 (define_insn "*call_nonlocal_sysv_secure<mode>"
12691 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12692 (match_operand 1 "" "g,g"))
12693 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12694 (use (match_operand:SI 3 "register_operand" "r,r"))
12695 (clobber (reg:SI LR_REGNO))]
12696 "(DEFAULT_ABI == ABI_V4
12697 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12698 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12700 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12701 output_asm_insn ("crxor 6,6,6", operands);
12703 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12704 output_asm_insn ("creqv 6,6,6", operands);
12707 /* The magic 32768 offset here and in the other sysv call insns
12708 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12709 See sysv4.h:toc_section. */
12710 return "bl %z0+32768@plt";
12712 return "bl %z0@plt";
12714 [(set_attr "type" "branch,branch")
12715 (set_attr "length" "4,8")])
12717 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12718 [(set (match_operand 0 "" "")
12719 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12720 (match_operand 2 "" "g,g,g,g")))
12721 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12722 (clobber (reg:SI LR_REGNO))]
12723 "DEFAULT_ABI == ABI_V4
12724 || DEFAULT_ABI == ABI_DARWIN"
12726 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12727 output_asm_insn ("crxor 6,6,6", operands);
12729 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12730 output_asm_insn ("creqv 6,6,6", operands);
12734 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12735 (set_attr "length" "4,4,8,8")])
12737 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12738 [(set (match_operand 0 "" "")
12739 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12740 (match_operand 2 "" "g,g")))
12741 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12742 (clobber (reg:SI LR_REGNO))]
12743 "(DEFAULT_ABI == ABI_DARWIN
12744 || (DEFAULT_ABI == ABI_V4
12745 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12747 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12748 output_asm_insn ("crxor 6,6,6", operands);
12750 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12751 output_asm_insn ("creqv 6,6,6", operands);
12754 return output_call(insn, operands, 1, 3);
12756 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12758 gcc_assert (!TARGET_SECURE_PLT);
12759 return "bl %z1@plt";
12765 "DEFAULT_ABI == ABI_V4
12766 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12767 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12768 [(parallel [(set (match_dup 0)
12769 (call (mem:SI (match_dup 1))
12771 (use (match_dup 3))
12772 (use (match_dup 4))
12773 (clobber (reg:SI LR_REGNO))])]
12775 operands[4] = pic_offset_table_rtx;
12777 [(set_attr "type" "branch,branch")
12778 (set_attr "length" "4,8")])
12780 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12781 [(set (match_operand 0 "" "")
12782 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12783 (match_operand 2 "" "g,g")))
12784 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12785 (use (match_operand:SI 4 "register_operand" "r,r"))
12786 (clobber (reg:SI LR_REGNO))]
12787 "(DEFAULT_ABI == ABI_V4
12788 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12789 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12791 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12792 output_asm_insn ("crxor 6,6,6", operands);
12794 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12795 output_asm_insn ("creqv 6,6,6", operands);
12798 return "bl %z1+32768@plt";
12800 return "bl %z1@plt";
12802 [(set_attr "type" "branch,branch")
12803 (set_attr "length" "4,8")])
12805 ;; Call subroutine returning any type.
12806 (define_expand "untyped_call"
12807 [(parallel [(call (match_operand 0 "" "")
12809 (match_operand 1 "" "")
12810 (match_operand 2 "" "")])]
12816 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12818 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12820 rtx set = XVECEXP (operands[2], 0, i);
12821 emit_move_insn (SET_DEST (set), SET_SRC (set));
12824 /* The optimizer does not know that the call sets the function value
12825 registers we stored in the result block. We avoid problems by
12826 claiming that all hard registers are used and clobbered at this
12828 emit_insn (gen_blockage ());
12833 ;; sibling call patterns
12834 (define_expand "sibcall"
12835 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12836 (match_operand 1 "" ""))
12837 (use (match_operand 2 "" ""))
12838 (use (reg:SI LR_REGNO))
12844 if (MACHOPIC_INDIRECT)
12845 operands[0] = machopic_indirect_call_target (operands[0]);
12848 gcc_assert (GET_CODE (operands[0]) == MEM);
12849 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12851 operands[0] = XEXP (operands[0], 0);
12854 ;; this and similar patterns must be marked as using LR, otherwise
12855 ;; dataflow will try to delete the store into it. This is true
12856 ;; even when the actual reg to jump to is in CTR, when LR was
12857 ;; saved and restored around the PIC-setting BCL.
12858 (define_insn "*sibcall_local32"
12859 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12860 (match_operand 1 "" "g,g"))
12861 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12862 (use (reg:SI LR_REGNO))
12864 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12867 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12868 output_asm_insn (\"crxor 6,6,6\", operands);
12870 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12871 output_asm_insn (\"creqv 6,6,6\", operands);
12873 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12875 [(set_attr "type" "branch")
12876 (set_attr "length" "4,8")])
12878 (define_insn "*sibcall_local64"
12879 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12880 (match_operand 1 "" "g,g"))
12881 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12882 (use (reg:SI LR_REGNO))
12884 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12887 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12888 output_asm_insn (\"crxor 6,6,6\", operands);
12890 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12891 output_asm_insn (\"creqv 6,6,6\", operands);
12893 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12895 [(set_attr "type" "branch")
12896 (set_attr "length" "4,8")])
12898 (define_insn "*sibcall_value_local32"
12899 [(set (match_operand 0 "" "")
12900 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12901 (match_operand 2 "" "g,g")))
12902 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12903 (use (reg:SI LR_REGNO))
12905 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12908 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12909 output_asm_insn (\"crxor 6,6,6\", operands);
12911 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12912 output_asm_insn (\"creqv 6,6,6\", operands);
12914 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12916 [(set_attr "type" "branch")
12917 (set_attr "length" "4,8")])
12920 (define_insn "*sibcall_value_local64"
12921 [(set (match_operand 0 "" "")
12922 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12923 (match_operand 2 "" "g,g")))
12924 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12925 (use (reg:SI LR_REGNO))
12927 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12930 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12931 output_asm_insn (\"crxor 6,6,6\", operands);
12933 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12934 output_asm_insn (\"creqv 6,6,6\", operands);
12936 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12938 [(set_attr "type" "branch")
12939 (set_attr "length" "4,8")])
12941 (define_insn "*sibcall_nonlocal_aix32"
12942 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12943 (match_operand 1 "" "g"))
12944 (use (match_operand:SI 2 "immediate_operand" "O"))
12945 (use (reg:SI LR_REGNO))
12948 && DEFAULT_ABI == ABI_AIX
12949 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12951 [(set_attr "type" "branch")
12952 (set_attr "length" "4")])
12954 (define_insn "*sibcall_nonlocal_aix64"
12955 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12956 (match_operand 1 "" "g"))
12957 (use (match_operand:SI 2 "immediate_operand" "O"))
12958 (use (reg:SI LR_REGNO))
12961 && DEFAULT_ABI == ABI_AIX
12962 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12964 [(set_attr "type" "branch")
12965 (set_attr "length" "4")])
12967 (define_insn "*sibcall_value_nonlocal_aix32"
12968 [(set (match_operand 0 "" "")
12969 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12970 (match_operand 2 "" "g")))
12971 (use (match_operand:SI 3 "immediate_operand" "O"))
12972 (use (reg:SI LR_REGNO))
12975 && DEFAULT_ABI == ABI_AIX
12976 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12978 [(set_attr "type" "branch")
12979 (set_attr "length" "4")])
12981 (define_insn "*sibcall_value_nonlocal_aix64"
12982 [(set (match_operand 0 "" "")
12983 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12984 (match_operand 2 "" "g")))
12985 (use (match_operand:SI 3 "immediate_operand" "O"))
12986 (use (reg:SI LR_REGNO))
12989 && DEFAULT_ABI == ABI_AIX
12990 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12992 [(set_attr "type" "branch")
12993 (set_attr "length" "4")])
12995 (define_insn "*sibcall_nonlocal_sysv<mode>"
12996 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12997 (match_operand 1 "" ""))
12998 (use (match_operand 2 "immediate_operand" "O,n"))
12999 (use (reg:SI LR_REGNO))
13001 "(DEFAULT_ABI == ABI_DARWIN
13002 || DEFAULT_ABI == ABI_V4)
13003 && (INTVAL (operands[2]) & CALL_LONG) == 0"
13006 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13007 output_asm_insn (\"crxor 6,6,6\", operands);
13009 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13010 output_asm_insn (\"creqv 6,6,6\", operands);
13012 if (DEFAULT_ABI == ABI_V4 && flag_pic)
13014 gcc_assert (!TARGET_SECURE_PLT);
13015 return \"b %z0@plt\";
13020 [(set_attr "type" "branch,branch")
13021 (set_attr "length" "4,8")])
13023 (define_expand "sibcall_value"
13024 [(parallel [(set (match_operand 0 "register_operand" "")
13025 (call (mem:SI (match_operand 1 "address_operand" ""))
13026 (match_operand 2 "" "")))
13027 (use (match_operand 3 "" ""))
13028 (use (reg:SI LR_REGNO))
13034 if (MACHOPIC_INDIRECT)
13035 operands[1] = machopic_indirect_call_target (operands[1]);
13038 gcc_assert (GET_CODE (operands[1]) == MEM);
13039 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
13041 operands[1] = XEXP (operands[1], 0);
13044 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
13045 [(set (match_operand 0 "" "")
13046 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
13047 (match_operand 2 "" "")))
13048 (use (match_operand:SI 3 "immediate_operand" "O,n"))
13049 (use (reg:SI LR_REGNO))
13051 "(DEFAULT_ABI == ABI_DARWIN
13052 || DEFAULT_ABI == ABI_V4)
13053 && (INTVAL (operands[3]) & CALL_LONG) == 0"
13056 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13057 output_asm_insn (\"crxor 6,6,6\", operands);
13059 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13060 output_asm_insn (\"creqv 6,6,6\", operands);
13062 if (DEFAULT_ABI == ABI_V4 && flag_pic)
13064 gcc_assert (!TARGET_SECURE_PLT);
13065 return \"b %z1@plt\";
13070 [(set_attr "type" "branch,branch")
13071 (set_attr "length" "4,8")])
13073 (define_expand "sibcall_epilogue"
13074 [(use (const_int 0))]
13075 "TARGET_SCHED_PROLOG"
13078 rs6000_emit_epilogue (TRUE);
13082 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13083 ;; all of memory. This blocks insns from being moved across this point.
13085 (define_insn "blockage"
13086 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
13090 (define_insn "probe_stack"
13091 [(set (match_operand 0 "memory_operand" "=m")
13092 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
13094 "{st%U0%X0|stw%U0%X0} 0,%0"
13095 [(set_attr "type" "store")
13096 (set_attr "length" "4")])
13098 (define_insn "probe_stack_range<P:mode>"
13099 [(set (match_operand:P 0 "register_operand" "=r")
13100 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
13101 (match_operand:P 2 "register_operand" "r")]
13102 UNSPECV_PROBE_STACK_RANGE))]
13104 "* return output_probe_stack_range (operands[0], operands[2]);"
13105 [(set_attr "type" "three")])
13107 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
13108 ;; signed & unsigned, and one type of branch.
13110 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
13111 ;; insns, and branches.
13113 (define_expand "cbranch<mode>4"
13114 [(use (match_operator 0 "rs6000_cbranch_operator"
13115 [(match_operand:GPR 1 "gpc_reg_operand" "")
13116 (match_operand:GPR 2 "reg_or_short_operand" "")]))
13117 (use (match_operand 3 ""))]
13121 /* Take care of the possibility that operands[2] might be negative but
13122 this might be a logical operation. That insn doesn't exist. */
13123 if (GET_CODE (operands[2]) == CONST_INT
13124 && INTVAL (operands[2]) < 0)
13126 operands[2] = force_reg (<MODE>mode, operands[2]);
13127 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
13128 GET_MODE (operands[0]),
13129 operands[1], operands[2]);
13132 rs6000_emit_cbranch (<MODE>mode, operands);
13136 (define_expand "cbranch<mode>4"
13137 [(use (match_operator 0 "rs6000_cbranch_operator"
13138 [(match_operand:FP 1 "gpc_reg_operand" "")
13139 (match_operand:FP 2 "gpc_reg_operand" "")]))
13140 (use (match_operand 3 ""))]
13144 rs6000_emit_cbranch (<MODE>mode, operands);
13148 (define_expand "cstore<mode>4"
13149 [(use (match_operator 1 "rs6000_cbranch_operator"
13150 [(match_operand:GPR 2 "gpc_reg_operand" "")
13151 (match_operand:GPR 3 "reg_or_short_operand" "")]))
13152 (clobber (match_operand:SI 0 "register_operand"))]
13156 /* Take care of the possibility that operands[3] might be negative but
13157 this might be a logical operation. That insn doesn't exist. */
13158 if (GET_CODE (operands[3]) == CONST_INT
13159 && INTVAL (operands[3]) < 0)
13161 operands[3] = force_reg (<MODE>mode, operands[3]);
13162 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
13163 GET_MODE (operands[1]),
13164 operands[2], operands[3]);
13167 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
13168 For SEQ, likewise, except that comparisons with zero should be done
13169 with an scc insns. However, due to the order that combine see the
13170 resulting insns, we must, in fact, allow SEQ for integers. Fail in
13171 the cases we don't want to handle or are best handled by portable
13173 if (GET_CODE (operands[1]) == NE)
13175 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
13176 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
13177 && operands[3] == const0_rtx)
13179 rs6000_emit_sCOND (<MODE>mode, operands);
13183 (define_expand "cstore<mode>4"
13184 [(use (match_operator 1 "rs6000_cbranch_operator"
13185 [(match_operand:FP 2 "gpc_reg_operand" "")
13186 (match_operand:FP 3 "gpc_reg_operand" "")]))
13187 (clobber (match_operand:SI 0 "register_operand"))]
13191 rs6000_emit_sCOND (<MODE>mode, operands);
13196 (define_expand "stack_protect_set"
13197 [(match_operand 0 "memory_operand" "")
13198 (match_operand 1 "memory_operand" "")]
13201 #ifdef TARGET_THREAD_SSP_OFFSET
13202 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13203 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13204 operands[1] = gen_rtx_MEM (Pmode, addr);
13207 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
13209 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
13213 (define_insn "stack_protect_setsi"
13214 [(set (match_operand:SI 0 "memory_operand" "=m")
13215 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13216 (set (match_scratch:SI 2 "=&r") (const_int 0))]
13218 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
13219 [(set_attr "type" "three")
13220 (set_attr "length" "12")])
13222 (define_insn "stack_protect_setdi"
13223 [(set (match_operand:DI 0 "memory_operand" "=m")
13224 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13225 (set (match_scratch:DI 2 "=&r") (const_int 0))]
13227 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
13228 [(set_attr "type" "three")
13229 (set_attr "length" "12")])
13231 (define_expand "stack_protect_test"
13232 [(match_operand 0 "memory_operand" "")
13233 (match_operand 1 "memory_operand" "")
13234 (match_operand 2 "" "")]
13237 rtx test, op0, op1;
13238 #ifdef TARGET_THREAD_SSP_OFFSET
13239 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13240 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13241 operands[1] = gen_rtx_MEM (Pmode, addr);
13244 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
13245 test = gen_rtx_EQ (VOIDmode, op0, op1);
13246 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
13250 (define_insn "stack_protect_testsi"
13251 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13252 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
13253 (match_operand:SI 2 "memory_operand" "m,m")]
13255 (set (match_scratch:SI 4 "=r,r") (const_int 0))
13256 (clobber (match_scratch:SI 3 "=&r,&r"))]
13259 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13260 {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"
13261 [(set_attr "length" "16,20")])
13263 (define_insn "stack_protect_testdi"
13264 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13265 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
13266 (match_operand:DI 2 "memory_operand" "m,m")]
13268 (set (match_scratch:DI 4 "=r,r") (const_int 0))
13269 (clobber (match_scratch:DI 3 "=&r,&r"))]
13272 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13273 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
13274 [(set_attr "length" "16,20")])
13277 ;; Here are the actual compare insns.
13278 (define_insn "*cmp<mode>_internal1"
13279 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13280 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
13281 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
13283 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
13284 [(set_attr "type" "cmp")])
13286 ;; If we are comparing a register for equality with a large constant,
13287 ;; we can do this with an XOR followed by a compare. But this is profitable
13288 ;; only if the large constant is only used for the comparison (and in this
13289 ;; case we already have a register to reuse as scratch).
13291 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
13292 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
13295 [(set (match_operand:SI 0 "register_operand")
13296 (match_operand:SI 1 "logical_const_operand" ""))
13297 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
13299 (match_operand:SI 2 "logical_const_operand" "")]))
13300 (set (match_operand:CC 4 "cc_reg_operand" "")
13301 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
13304 (if_then_else (match_operator 6 "equality_operator"
13305 [(match_dup 4) (const_int 0)])
13306 (match_operand 7 "" "")
13307 (match_operand 8 "" "")))]
13308 "peep2_reg_dead_p (3, operands[0])
13309 && peep2_reg_dead_p (4, operands[4])"
13310 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
13311 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
13312 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
13315 /* Get the constant we are comparing against, and see what it looks like
13316 when sign-extended from 16 to 32 bits. Then see what constant we could
13317 XOR with SEXTC to get the sign-extended value. */
13318 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
13320 operands[1], operands[2]);
13321 HOST_WIDE_INT c = INTVAL (cnst);
13322 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
13323 HOST_WIDE_INT xorv = c ^ sextc;
13325 operands[9] = GEN_INT (xorv);
13326 operands[10] = GEN_INT (sextc);
13329 (define_insn "*cmpsi_internal2"
13330 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13331 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13332 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
13334 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
13335 [(set_attr "type" "cmp")])
13337 (define_insn "*cmpdi_internal2"
13338 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13339 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
13340 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
13342 "cmpld%I2 %0,%1,%b2"
13343 [(set_attr "type" "cmp")])
13345 ;; The following two insns don't exist as single insns, but if we provide
13346 ;; them, we can swap an add and compare, which will enable us to overlap more
13347 ;; of the required delay between a compare and branch. We generate code for
13348 ;; them by splitting.
13351 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13352 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
13353 (match_operand:SI 2 "short_cint_operand" "i")))
13354 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13355 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13358 [(set_attr "length" "8")])
13361 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
13362 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13363 (match_operand:SI 2 "u_short_cint_operand" "i")))
13364 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13365 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13368 [(set_attr "length" "8")])
13371 [(set (match_operand:CC 3 "cc_reg_operand" "")
13372 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
13373 (match_operand:SI 2 "short_cint_operand" "")))
13374 (set (match_operand:SI 0 "gpc_reg_operand" "")
13375 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13377 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
13378 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13381 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
13382 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
13383 (match_operand:SI 2 "u_short_cint_operand" "")))
13384 (set (match_operand:SI 0 "gpc_reg_operand" "")
13385 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13387 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
13388 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13390 (define_insn "*cmpsf_internal1"
13391 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13392 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
13393 (match_operand:SF 2 "gpc_reg_operand" "f")))]
13394 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
13396 [(set_attr "type" "fpcompare")])
13398 (define_insn "*cmpdf_internal1"
13399 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13400 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
13401 (match_operand:DF 2 "gpc_reg_operand" "d")))]
13402 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
13403 && !VECTOR_UNIT_VSX_P (DFmode)"
13405 [(set_attr "type" "fpcompare")])
13407 ;; Only need to compare second words if first words equal
13408 (define_insn "*cmptf_internal1"
13409 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13410 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13411 (match_operand:TF 2 "gpc_reg_operand" "d")))]
13412 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
13413 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13414 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
13415 [(set_attr "type" "fpcompare")
13416 (set_attr "length" "12")])
13418 (define_insn_and_split "*cmptf_internal2"
13419 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13420 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13421 (match_operand:TF 2 "gpc_reg_operand" "d")))
13422 (clobber (match_scratch:DF 3 "=d"))
13423 (clobber (match_scratch:DF 4 "=d"))
13424 (clobber (match_scratch:DF 5 "=d"))
13425 (clobber (match_scratch:DF 6 "=d"))
13426 (clobber (match_scratch:DF 7 "=d"))
13427 (clobber (match_scratch:DF 8 "=d"))
13428 (clobber (match_scratch:DF 9 "=d"))
13429 (clobber (match_scratch:DF 10 "=d"))
13430 (clobber (match_scratch:GPR 11 "=b"))]
13431 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
13432 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13434 "&& reload_completed"
13435 [(set (match_dup 3) (match_dup 14))
13436 (set (match_dup 4) (match_dup 15))
13437 (set (match_dup 9) (abs:DF (match_dup 5)))
13438 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13439 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13440 (label_ref (match_dup 12))
13442 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13443 (set (pc) (label_ref (match_dup 13)))
13445 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13446 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13447 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13448 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13451 REAL_VALUE_TYPE rv;
13452 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
13453 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
13455 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13456 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13457 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13458 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13459 operands[12] = gen_label_rtx ();
13460 operands[13] = gen_label_rtx ();
13462 operands[14] = force_const_mem (DFmode,
13463 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13464 operands[15] = force_const_mem (DFmode,
13465 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13470 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13471 operands[14] = gen_const_mem (DFmode, tocref);
13472 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13473 operands[15] = gen_const_mem (DFmode, tocref);
13474 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13475 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13479 ;; Now we have the scc insns. We can do some combinations because of the
13480 ;; way the machine works.
13482 ;; Note that this is probably faster if we can put an insn between the
13483 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13484 ;; cases the insns below which don't use an intermediate CR field will
13485 ;; be used instead.
13487 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13488 (match_operator:SI 1 "scc_comparison_operator"
13489 [(match_operand 2 "cc_reg_operand" "y")
13492 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13493 [(set (attr "type")
13494 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13495 (const_string "mfcrf")
13497 (const_string "mfcr")))
13498 (set_attr "length" "8")])
13500 ;; Same as above, but get the GT bit.
13501 (define_insn "move_from_CR_gt_bit"
13502 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13503 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13504 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13505 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
13506 [(set_attr "type" "mfcr")
13507 (set_attr "length" "8")])
13509 ;; Same as above, but get the OV/ORDERED bit.
13510 (define_insn "move_from_CR_ov_bit"
13511 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13512 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
13514 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
13515 [(set_attr "type" "mfcr")
13516 (set_attr "length" "8")])
13519 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13520 (match_operator:DI 1 "scc_comparison_operator"
13521 [(match_operand 2 "cc_reg_operand" "y")
13524 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13525 [(set (attr "type")
13526 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13527 (const_string "mfcrf")
13529 (const_string "mfcr")))
13530 (set_attr "length" "8")])
13533 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13534 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13535 [(match_operand 2 "cc_reg_operand" "y,y")
13538 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13539 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13542 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
13544 [(set_attr "type" "delayed_compare")
13545 (set_attr "length" "8,16")])
13548 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13549 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13550 [(match_operand 2 "cc_reg_operand" "")
13553 (set (match_operand:SI 3 "gpc_reg_operand" "")
13554 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13555 "TARGET_32BIT && reload_completed"
13556 [(set (match_dup 3)
13557 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13559 (compare:CC (match_dup 3)
13564 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13565 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13566 [(match_operand 2 "cc_reg_operand" "y")
13568 (match_operand:SI 3 "const_int_operand" "n")))]
13572 int is_bit = ccr_bit (operands[1], 1);
13573 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13576 if (is_bit >= put_bit)
13577 count = is_bit - put_bit;
13579 count = 32 - (put_bit - is_bit);
13581 operands[4] = GEN_INT (count);
13582 operands[5] = GEN_INT (put_bit);
13584 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13586 [(set (attr "type")
13587 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13588 (const_string "mfcrf")
13590 (const_string "mfcr")))
13591 (set_attr "length" "8")])
13594 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13596 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13597 [(match_operand 2 "cc_reg_operand" "y,y")
13599 (match_operand:SI 3 "const_int_operand" "n,n"))
13601 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13602 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13607 int is_bit = ccr_bit (operands[1], 1);
13608 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13611 /* Force split for non-cc0 compare. */
13612 if (which_alternative == 1)
13615 if (is_bit >= put_bit)
13616 count = is_bit - put_bit;
13618 count = 32 - (put_bit - is_bit);
13620 operands[5] = GEN_INT (count);
13621 operands[6] = GEN_INT (put_bit);
13623 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13625 [(set_attr "type" "delayed_compare")
13626 (set_attr "length" "8,16")])
13629 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13631 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13632 [(match_operand 2 "cc_reg_operand" "")
13634 (match_operand:SI 3 "const_int_operand" ""))
13636 (set (match_operand:SI 4 "gpc_reg_operand" "")
13637 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13640 [(set (match_dup 4)
13641 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13644 (compare:CC (match_dup 4)
13648 ;; There is a 3 cycle delay between consecutive mfcr instructions
13649 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13652 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13653 (match_operator:SI 1 "scc_comparison_operator"
13654 [(match_operand 2 "cc_reg_operand" "y")
13656 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13657 (match_operator:SI 4 "scc_comparison_operator"
13658 [(match_operand 5 "cc_reg_operand" "y")
13660 "REGNO (operands[2]) != REGNO (operands[5])"
13661 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13662 [(set_attr "type" "mfcr")
13663 (set_attr "length" "12")])
13666 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13667 (match_operator:DI 1 "scc_comparison_operator"
13668 [(match_operand 2 "cc_reg_operand" "y")
13670 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13671 (match_operator:DI 4 "scc_comparison_operator"
13672 [(match_operand 5 "cc_reg_operand" "y")
13674 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13675 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13676 [(set_attr "type" "mfcr")
13677 (set_attr "length" "12")])
13679 ;; There are some scc insns that can be done directly, without a compare.
13680 ;; These are faster because they don't involve the communications between
13681 ;; the FXU and branch units. In fact, we will be replacing all of the
13682 ;; integer scc insns here or in the portable methods in emit_store_flag.
13684 ;; Also support (neg (scc ..)) since that construct is used to replace
13685 ;; branches, (plus (scc ..) ..) since that construct is common and
13686 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13687 ;; cases where it is no more expensive than (neg (scc ..)).
13689 ;; Have reload force a constant into a register for the simple insns that
13690 ;; otherwise won't accept constants. We do this because it is faster than
13691 ;; the cmp/mfcr sequence we would otherwise generate.
13693 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13696 (define_insn_and_split "*eq<mode>"
13697 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13698 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13699 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13703 [(set (match_dup 0)
13704 (clz:GPR (match_dup 3)))
13706 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13708 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13710 /* Use output operand as intermediate. */
13711 operands[3] = operands[0];
13713 if (logical_operand (operands[2], <MODE>mode))
13714 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13715 gen_rtx_XOR (<MODE>mode,
13716 operands[1], operands[2])));
13718 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13719 gen_rtx_PLUS (<MODE>mode, operands[1],
13720 negate_rtx (<MODE>mode,
13724 operands[3] = operands[1];
13726 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13729 (define_insn_and_split "*eq<mode>_compare"
13730 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13732 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13733 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13735 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13736 (eq:P (match_dup 1) (match_dup 2)))]
13737 "!TARGET_POWER && optimize_size"
13739 "!TARGET_POWER && optimize_size"
13740 [(set (match_dup 0)
13741 (clz:P (match_dup 4)))
13742 (parallel [(set (match_dup 3)
13743 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13746 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13748 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13750 /* Use output operand as intermediate. */
13751 operands[4] = operands[0];
13753 if (logical_operand (operands[2], <MODE>mode))
13754 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13755 gen_rtx_XOR (<MODE>mode,
13756 operands[1], operands[2])));
13758 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13759 gen_rtx_PLUS (<MODE>mode, operands[1],
13760 negate_rtx (<MODE>mode,
13764 operands[4] = operands[1];
13766 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13769 (define_insn "*eqsi_power"
13770 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13771 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13772 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13773 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13776 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13777 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13778 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13779 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13780 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13781 [(set_attr "type" "three,two,three,three,three")
13782 (set_attr "length" "12,8,12,12,12")])
13784 ;; We have insns of the form shown by the first define_insn below. If
13785 ;; there is something inside the comparison operation, we must split it.
13787 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13788 (plus:SI (match_operator 1 "comparison_operator"
13789 [(match_operand:SI 2 "" "")
13790 (match_operand:SI 3
13791 "reg_or_cint_operand" "")])
13792 (match_operand:SI 4 "gpc_reg_operand" "")))
13793 (clobber (match_operand:SI 5 "register_operand" ""))]
13794 "! gpc_reg_operand (operands[2], SImode)"
13795 [(set (match_dup 5) (match_dup 2))
13796 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13799 (define_insn "*plus_eqsi"
13800 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13801 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13802 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13803 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13806 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13807 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13808 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13809 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13810 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13811 [(set_attr "type" "three,two,three,three,three")
13812 (set_attr "length" "12,8,12,12,12")])
13814 (define_insn "*compare_plus_eqsi"
13815 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13818 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13819 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13820 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13822 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13823 "TARGET_32BIT && optimize_size"
13825 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13826 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13827 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13828 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13829 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13835 [(set_attr "type" "compare")
13836 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13839 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13842 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13843 (match_operand:SI 2 "scc_eq_operand" ""))
13844 (match_operand:SI 3 "gpc_reg_operand" ""))
13846 (clobber (match_scratch:SI 4 ""))]
13847 "TARGET_32BIT && optimize_size && reload_completed"
13848 [(set (match_dup 4)
13849 (plus:SI (eq:SI (match_dup 1)
13853 (compare:CC (match_dup 4)
13857 (define_insn "*plus_eqsi_compare"
13858 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13861 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13862 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13863 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13865 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13866 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13867 "TARGET_32BIT && optimize_size"
13869 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13870 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13871 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13872 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13873 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13879 [(set_attr "type" "compare")
13880 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13883 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13886 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13887 (match_operand:SI 2 "scc_eq_operand" ""))
13888 (match_operand:SI 3 "gpc_reg_operand" ""))
13890 (set (match_operand:SI 0 "gpc_reg_operand" "")
13891 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13892 "TARGET_32BIT && optimize_size && reload_completed"
13893 [(set (match_dup 0)
13894 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13896 (compare:CC (match_dup 0)
13900 (define_insn "*neg_eq0<mode>"
13901 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13902 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13905 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13906 [(set_attr "type" "two")
13907 (set_attr "length" "8")])
13909 (define_insn_and_split "*neg_eq<mode>"
13910 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13911 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13912 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13916 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13918 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13920 /* Use output operand as intermediate. */
13921 operands[3] = operands[0];
13923 if (logical_operand (operands[2], <MODE>mode))
13924 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13925 gen_rtx_XOR (<MODE>mode,
13926 operands[1], operands[2])));
13928 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13929 gen_rtx_PLUS (<MODE>mode, operands[1],
13930 negate_rtx (<MODE>mode,
13934 operands[3] = operands[1];
13937 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13938 ;; since it nabs/sr is just as fast.
13939 (define_insn "*ne0si"
13940 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13941 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13943 (clobber (match_scratch:SI 2 "=&r"))]
13944 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13945 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13946 [(set_attr "type" "two")
13947 (set_attr "length" "8")])
13949 (define_insn "*ne0di"
13950 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13951 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13953 (clobber (match_scratch:DI 2 "=&r"))]
13955 "addic %2,%1,-1\;subfe %0,%2,%1"
13956 [(set_attr "type" "two")
13957 (set_attr "length" "8")])
13959 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13960 (define_insn "*plus_ne0si"
13961 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13962 (plus:SI (lshiftrt:SI
13963 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13965 (match_operand:SI 2 "gpc_reg_operand" "r")))
13966 (clobber (match_scratch:SI 3 "=&r"))]
13968 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13969 [(set_attr "type" "two")
13970 (set_attr "length" "8")])
13972 (define_insn "*plus_ne0di"
13973 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13974 (plus:DI (lshiftrt:DI
13975 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13977 (match_operand:DI 2 "gpc_reg_operand" "r")))
13978 (clobber (match_scratch:DI 3 "=&r"))]
13980 "addic %3,%1,-1\;addze %0,%2"
13981 [(set_attr "type" "two")
13982 (set_attr "length" "8")])
13984 (define_insn "*compare_plus_ne0si"
13985 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13987 (plus:SI (lshiftrt:SI
13988 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13990 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13992 (clobber (match_scratch:SI 3 "=&r,&r"))
13993 (clobber (match_scratch:SI 4 "=X,&r"))]
13996 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13998 [(set_attr "type" "compare")
13999 (set_attr "length" "8,12")])
14002 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14004 (plus:SI (lshiftrt:SI
14005 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14007 (match_operand:SI 2 "gpc_reg_operand" ""))
14009 (clobber (match_scratch:SI 3 ""))
14010 (clobber (match_scratch:SI 4 ""))]
14011 "TARGET_32BIT && reload_completed"
14012 [(parallel [(set (match_dup 3)
14013 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
14016 (clobber (match_dup 4))])
14018 (compare:CC (match_dup 3)
14022 (define_insn "*compare_plus_ne0di"
14023 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14025 (plus:DI (lshiftrt:DI
14026 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14028 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14030 (clobber (match_scratch:DI 3 "=&r,&r"))]
14033 addic %3,%1,-1\;addze. %3,%2
14035 [(set_attr "type" "compare")
14036 (set_attr "length" "8,12")])
14039 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14041 (plus:DI (lshiftrt:DI
14042 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14044 (match_operand:DI 2 "gpc_reg_operand" ""))
14046 (clobber (match_scratch:DI 3 ""))]
14047 "TARGET_64BIT && reload_completed"
14048 [(set (match_dup 3)
14049 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
14053 (compare:CC (match_dup 3)
14057 (define_insn "*plus_ne0si_compare"
14058 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14060 (plus:SI (lshiftrt:SI
14061 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
14063 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14065 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14066 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14068 (clobber (match_scratch:SI 3 "=&r,&r"))]
14071 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
14073 [(set_attr "type" "compare")
14074 (set_attr "length" "8,12")])
14077 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14079 (plus:SI (lshiftrt:SI
14080 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14082 (match_operand:SI 2 "gpc_reg_operand" ""))
14084 (set (match_operand:SI 0 "gpc_reg_operand" "")
14085 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14087 (clobber (match_scratch:SI 3 ""))]
14088 "TARGET_32BIT && reload_completed"
14089 [(parallel [(set (match_dup 0)
14090 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14092 (clobber (match_dup 3))])
14094 (compare:CC (match_dup 0)
14098 (define_insn "*plus_ne0di_compare"
14099 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14101 (plus:DI (lshiftrt:DI
14102 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14104 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14106 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
14107 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14109 (clobber (match_scratch:DI 3 "=&r,&r"))]
14112 addic %3,%1,-1\;addze. %0,%2
14114 [(set_attr "type" "compare")
14115 (set_attr "length" "8,12")])
14118 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
14120 (plus:DI (lshiftrt:DI
14121 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14123 (match_operand:DI 2 "gpc_reg_operand" ""))
14125 (set (match_operand:DI 0 "gpc_reg_operand" "")
14126 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14128 (clobber (match_scratch:DI 3 ""))]
14129 "TARGET_64BIT && reload_completed"
14130 [(parallel [(set (match_dup 0)
14131 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14133 (clobber (match_dup 3))])
14135 (compare:CC (match_dup 0)
14140 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14141 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14142 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
14143 (clobber (match_scratch:SI 3 "=r,X"))]
14146 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
14147 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
14148 [(set_attr "length" "12")])
14151 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14153 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14154 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14156 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
14157 (le:SI (match_dup 1) (match_dup 2)))
14158 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
14161 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14162 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
14165 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
14166 (set_attr "length" "12,12,16,16")])
14169 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14171 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14172 (match_operand:SI 2 "reg_or_short_operand" ""))
14174 (set (match_operand:SI 0 "gpc_reg_operand" "")
14175 (le:SI (match_dup 1) (match_dup 2)))
14176 (clobber (match_scratch:SI 3 ""))]
14177 "TARGET_POWER && reload_completed"
14178 [(parallel [(set (match_dup 0)
14179 (le:SI (match_dup 1) (match_dup 2)))
14180 (clobber (match_dup 3))])
14182 (compare:CC (match_dup 0)
14187 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14188 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14189 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
14190 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
14193 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
14194 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
14195 [(set_attr "length" "12")])
14198 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14200 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14201 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14202 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14204 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14207 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14208 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
14211 [(set_attr "type" "compare")
14212 (set_attr "length" "12,12,16,16")])
14215 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14217 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14218 (match_operand:SI 2 "reg_or_short_operand" ""))
14219 (match_operand:SI 3 "gpc_reg_operand" ""))
14221 (clobber (match_scratch:SI 4 ""))]
14222 "TARGET_POWER && reload_completed"
14223 [(set (match_dup 4)
14224 (plus:SI (le:SI (match_dup 1) (match_dup 2))
14227 (compare:CC (match_dup 4)
14232 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14234 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14235 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14236 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14238 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14239 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14242 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14243 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
14246 [(set_attr "type" "compare")
14247 (set_attr "length" "12,12,16,16")])
14250 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14252 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14253 (match_operand:SI 2 "reg_or_short_operand" ""))
14254 (match_operand:SI 3 "gpc_reg_operand" ""))
14256 (set (match_operand:SI 0 "gpc_reg_operand" "")
14257 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14258 "TARGET_POWER && reload_completed"
14259 [(set (match_dup 0)
14260 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14262 (compare:CC (match_dup 0)
14267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14268 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14269 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
14272 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
14273 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
14274 [(set_attr "length" "12")])
14276 (define_insn "*leu<mode>"
14277 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14278 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14279 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14281 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14282 [(set_attr "type" "three")
14283 (set_attr "length" "12")])
14285 (define_insn "*leu<mode>_compare"
14286 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14288 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14289 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14291 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14292 (leu:P (match_dup 1) (match_dup 2)))]
14295 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14297 [(set_attr "type" "compare")
14298 (set_attr "length" "12,16")])
14301 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14303 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
14304 (match_operand:P 2 "reg_or_short_operand" ""))
14306 (set (match_operand:P 0 "gpc_reg_operand" "")
14307 (leu:P (match_dup 1) (match_dup 2)))]
14309 [(set (match_dup 0)
14310 (leu:P (match_dup 1) (match_dup 2)))
14312 (compare:CC (match_dup 0)
14316 (define_insn "*plus_leu<mode>"
14317 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14318 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14319 (match_operand:P 2 "reg_or_short_operand" "rI"))
14320 (match_operand:P 3 "gpc_reg_operand" "r")))]
14322 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
14323 [(set_attr "type" "two")
14324 (set_attr "length" "8")])
14327 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14329 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14330 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14331 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14333 (clobber (match_scratch:SI 4 "=&r,&r"))]
14336 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
14338 [(set_attr "type" "compare")
14339 (set_attr "length" "8,12")])
14342 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14344 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14345 (match_operand:SI 2 "reg_or_short_operand" ""))
14346 (match_operand:SI 3 "gpc_reg_operand" ""))
14348 (clobber (match_scratch:SI 4 ""))]
14349 "TARGET_32BIT && reload_completed"
14350 [(set (match_dup 4)
14351 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
14354 (compare:CC (match_dup 4)
14359 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14361 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14362 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14363 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14365 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14366 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14369 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
14371 [(set_attr "type" "compare")
14372 (set_attr "length" "8,12")])
14375 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14377 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14378 (match_operand:SI 2 "reg_or_short_operand" ""))
14379 (match_operand:SI 3 "gpc_reg_operand" ""))
14381 (set (match_operand:SI 0 "gpc_reg_operand" "")
14382 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14383 "TARGET_32BIT && reload_completed"
14384 [(set (match_dup 0)
14385 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14387 (compare:CC (match_dup 0)
14391 (define_insn "*neg_leu<mode>"
14392 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14393 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14394 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14396 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
14397 [(set_attr "type" "three")
14398 (set_attr "length" "12")])
14400 (define_insn "*and_neg_leu<mode>"
14401 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14403 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14404 (match_operand:P 2 "reg_or_short_operand" "rI")))
14405 (match_operand:P 3 "gpc_reg_operand" "r")))]
14407 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14408 [(set_attr "type" "three")
14409 (set_attr "length" "12")])
14412 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14415 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14416 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14417 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14419 (clobber (match_scratch:SI 4 "=&r,&r"))]
14422 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14424 [(set_attr "type" "compare")
14425 (set_attr "length" "12,16")])
14428 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14431 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14432 (match_operand:SI 2 "reg_or_short_operand" "")))
14433 (match_operand:SI 3 "gpc_reg_operand" ""))
14435 (clobber (match_scratch:SI 4 ""))]
14436 "TARGET_32BIT && reload_completed"
14437 [(set (match_dup 4)
14438 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14441 (compare:CC (match_dup 4)
14446 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14449 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14450 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14451 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14453 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14454 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14457 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14459 [(set_attr "type" "compare")
14460 (set_attr "length" "12,16")])
14463 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14466 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14467 (match_operand:SI 2 "reg_or_short_operand" "")))
14468 (match_operand:SI 3 "gpc_reg_operand" ""))
14470 (set (match_operand:SI 0 "gpc_reg_operand" "")
14471 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14472 "TARGET_32BIT && reload_completed"
14473 [(set (match_dup 0)
14474 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14477 (compare:CC (match_dup 0)
14482 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14483 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14484 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
14486 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14487 [(set_attr "length" "12")])
14490 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14492 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14493 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14495 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14496 (lt:SI (match_dup 1) (match_dup 2)))]
14499 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14501 [(set_attr "type" "delayed_compare")
14502 (set_attr "length" "12,16")])
14505 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14507 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14508 (match_operand:SI 2 "reg_or_short_operand" ""))
14510 (set (match_operand:SI 0 "gpc_reg_operand" "")
14511 (lt:SI (match_dup 1) (match_dup 2)))]
14512 "TARGET_POWER && reload_completed"
14513 [(set (match_dup 0)
14514 (lt:SI (match_dup 1) (match_dup 2)))
14516 (compare:CC (match_dup 0)
14521 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14522 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14523 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14524 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14526 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14527 [(set_attr "length" "12")])
14530 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14532 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14533 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14534 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14536 (clobber (match_scratch:SI 4 "=&r,&r"))]
14539 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14541 [(set_attr "type" "compare")
14542 (set_attr "length" "12,16")])
14545 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14547 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14548 (match_operand:SI 2 "reg_or_short_operand" ""))
14549 (match_operand:SI 3 "gpc_reg_operand" ""))
14551 (clobber (match_scratch:SI 4 ""))]
14552 "TARGET_POWER && reload_completed"
14553 [(set (match_dup 4)
14554 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14557 (compare:CC (match_dup 4)
14562 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14564 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14565 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14566 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14568 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14569 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14572 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14574 [(set_attr "type" "compare")
14575 (set_attr "length" "12,16")])
14578 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14580 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14581 (match_operand:SI 2 "reg_or_short_operand" ""))
14582 (match_operand:SI 3 "gpc_reg_operand" ""))
14584 (set (match_operand:SI 0 "gpc_reg_operand" "")
14585 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14586 "TARGET_POWER && reload_completed"
14587 [(set (match_dup 0)
14588 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14590 (compare:CC (match_dup 0)
14595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14596 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14597 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14599 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14600 [(set_attr "length" "12")])
14602 (define_insn_and_split "*ltu<mode>"
14603 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14604 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14605 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14609 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14610 (set (match_dup 0) (neg:P (match_dup 0)))]
14613 (define_insn_and_split "*ltu<mode>_compare"
14614 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14616 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14617 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14619 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14620 (ltu:P (match_dup 1) (match_dup 2)))]
14624 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14625 (parallel [(set (match_dup 3)
14626 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14627 (set (match_dup 0) (neg:P (match_dup 0)))])]
14630 (define_insn_and_split "*plus_ltu<mode>"
14631 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14632 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14633 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14634 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14637 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14638 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14639 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14642 (define_insn_and_split "*plus_ltu<mode>_compare"
14643 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14645 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14646 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14647 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14649 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14650 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14653 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14654 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14655 (parallel [(set (match_dup 4)
14656 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14658 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14661 (define_insn "*neg_ltu<mode>"
14662 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14663 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14664 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14667 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14668 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14669 [(set_attr "type" "two")
14670 (set_attr "length" "8")])
14673 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14674 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14675 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14676 (clobber (match_scratch:SI 3 "=r"))]
14678 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14679 [(set_attr "length" "12")])
14682 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14684 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14685 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14687 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14688 (ge:SI (match_dup 1) (match_dup 2)))
14689 (clobber (match_scratch:SI 3 "=r,r"))]
14692 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14694 [(set_attr "type" "compare")
14695 (set_attr "length" "12,16")])
14698 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14700 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14701 (match_operand:SI 2 "reg_or_short_operand" ""))
14703 (set (match_operand:SI 0 "gpc_reg_operand" "")
14704 (ge:SI (match_dup 1) (match_dup 2)))
14705 (clobber (match_scratch:SI 3 ""))]
14706 "TARGET_POWER && reload_completed"
14707 [(parallel [(set (match_dup 0)
14708 (ge:SI (match_dup 1) (match_dup 2)))
14709 (clobber (match_dup 3))])
14711 (compare:CC (match_dup 0)
14716 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14717 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14718 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14719 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14721 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14722 [(set_attr "length" "12")])
14725 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14727 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14728 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14729 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14731 (clobber (match_scratch:SI 4 "=&r,&r"))]
14734 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14736 [(set_attr "type" "compare")
14737 (set_attr "length" "12,16")])
14740 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14742 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14743 (match_operand:SI 2 "reg_or_short_operand" ""))
14744 (match_operand:SI 3 "gpc_reg_operand" ""))
14746 (clobber (match_scratch:SI 4 ""))]
14747 "TARGET_POWER && reload_completed"
14748 [(set (match_dup 4)
14749 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14752 (compare:CC (match_dup 4)
14757 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14759 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14760 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14761 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14763 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14764 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14767 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14769 [(set_attr "type" "compare")
14770 (set_attr "length" "12,16")])
14773 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14775 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14776 (match_operand:SI 2 "reg_or_short_operand" ""))
14777 (match_operand:SI 3 "gpc_reg_operand" ""))
14779 (set (match_operand:SI 0 "gpc_reg_operand" "")
14780 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14781 "TARGET_POWER && reload_completed"
14782 [(set (match_dup 0)
14783 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14785 (compare:CC (match_dup 0)
14790 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14791 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14792 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14794 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14795 [(set_attr "length" "12")])
14797 (define_insn "*geu<mode>"
14798 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14799 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14800 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14803 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14804 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14805 [(set_attr "type" "three")
14806 (set_attr "length" "12")])
14808 (define_insn "*geu<mode>_compare"
14809 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14811 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14812 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14814 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14815 (geu:P (match_dup 1) (match_dup 2)))]
14818 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14819 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14822 [(set_attr "type" "compare")
14823 (set_attr "length" "12,12,16,16")])
14826 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14828 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14829 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14831 (set (match_operand:P 0 "gpc_reg_operand" "")
14832 (geu:P (match_dup 1) (match_dup 2)))]
14834 [(set (match_dup 0)
14835 (geu:P (match_dup 1) (match_dup 2)))
14837 (compare:CC (match_dup 0)
14841 (define_insn "*plus_geu<mode>"
14842 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14843 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14844 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14845 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14848 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14849 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14850 [(set_attr "type" "two")
14851 (set_attr "length" "8")])
14854 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14856 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14857 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14858 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14860 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14863 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14864 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14867 [(set_attr "type" "compare")
14868 (set_attr "length" "8,8,12,12")])
14871 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14873 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14874 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14875 (match_operand:SI 3 "gpc_reg_operand" ""))
14877 (clobber (match_scratch:SI 4 ""))]
14878 "TARGET_32BIT && reload_completed"
14879 [(set (match_dup 4)
14880 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14883 (compare:CC (match_dup 4)
14888 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14890 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14891 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14892 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14894 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14895 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14898 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14899 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14902 [(set_attr "type" "compare")
14903 (set_attr "length" "8,8,12,12")])
14906 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14908 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14909 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14910 (match_operand:SI 3 "gpc_reg_operand" ""))
14912 (set (match_operand:SI 0 "gpc_reg_operand" "")
14913 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14914 "TARGET_32BIT && reload_completed"
14915 [(set (match_dup 0)
14916 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14918 (compare:CC (match_dup 0)
14922 (define_insn "*neg_geu<mode>"
14923 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14924 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14925 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14928 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14929 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14930 [(set_attr "type" "three")
14931 (set_attr "length" "12")])
14933 (define_insn "*and_neg_geu<mode>"
14934 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14936 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14937 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14938 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14941 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14942 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14943 [(set_attr "type" "three")
14944 (set_attr "length" "12")])
14947 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14950 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14951 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14952 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14954 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14957 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14958 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14961 [(set_attr "type" "compare")
14962 (set_attr "length" "12,12,16,16")])
14965 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14968 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14969 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14970 (match_operand:SI 3 "gpc_reg_operand" ""))
14972 (clobber (match_scratch:SI 4 ""))]
14973 "TARGET_32BIT && reload_completed"
14974 [(set (match_dup 4)
14975 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14978 (compare:CC (match_dup 4)
14983 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14986 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14987 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14988 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14990 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14991 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14994 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14995 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14998 [(set_attr "type" "compare")
14999 (set_attr "length" "12,12,16,16")])
15002 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15005 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15006 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
15007 (match_operand:SI 3 "gpc_reg_operand" ""))
15009 (set (match_operand:SI 0 "gpc_reg_operand" "")
15010 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
15011 "TARGET_32BIT && reload_completed"
15012 [(set (match_dup 0)
15013 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
15015 (compare:CC (match_dup 0)
15020 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15021 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15022 (match_operand:SI 2 "reg_or_short_operand" "r")))]
15024 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
15025 [(set_attr "length" "12")])
15028 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15030 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15031 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15033 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
15034 (gt:SI (match_dup 1) (match_dup 2)))]
15037 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
15039 [(set_attr "type" "delayed_compare")
15040 (set_attr "length" "12,16")])
15043 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15045 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15046 (match_operand:SI 2 "reg_or_short_operand" ""))
15048 (set (match_operand:SI 0 "gpc_reg_operand" "")
15049 (gt:SI (match_dup 1) (match_dup 2)))]
15050 "TARGET_POWER && reload_completed"
15051 [(set (match_dup 0)
15052 (gt:SI (match_dup 1) (match_dup 2)))
15054 (compare:CC (match_dup 0)
15058 (define_insn "*plus_gt0<mode>"
15059 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15060 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
15062 (match_operand:P 2 "gpc_reg_operand" "r")))]
15064 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
15065 [(set_attr "type" "three")
15066 (set_attr "length" "12")])
15069 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15071 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15073 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15075 (clobber (match_scratch:SI 3 "=&r,&r"))]
15078 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
15080 [(set_attr "type" "compare")
15081 (set_attr "length" "12,16")])
15084 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15086 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15088 (match_operand:SI 2 "gpc_reg_operand" ""))
15090 (clobber (match_scratch:SI 3 ""))]
15091 "TARGET_32BIT && reload_completed"
15092 [(set (match_dup 3)
15093 (plus:SI (gt:SI (match_dup 1) (const_int 0))
15096 (compare:CC (match_dup 3)
15101 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15103 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15105 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15107 (clobber (match_scratch:DI 3 "=&r,&r"))]
15110 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
15112 [(set_attr "type" "compare")
15113 (set_attr "length" "12,16")])
15116 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
15118 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15120 (match_operand:DI 2 "gpc_reg_operand" ""))
15122 (clobber (match_scratch:DI 3 ""))]
15123 "TARGET_64BIT && reload_completed"
15124 [(set (match_dup 3)
15125 (plus:DI (gt:DI (match_dup 1) (const_int 0))
15128 (compare:CC (match_dup 3)
15133 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15135 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15137 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15139 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15140 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15143 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
15145 [(set_attr "type" "compare")
15146 (set_attr "length" "12,16")])
15149 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15151 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15153 (match_operand:SI 2 "gpc_reg_operand" ""))
15155 (set (match_operand:SI 0 "gpc_reg_operand" "")
15156 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15157 "TARGET_32BIT && reload_completed"
15158 [(set (match_dup 0)
15159 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
15161 (compare:CC (match_dup 0)
15166 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15168 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15170 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15172 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
15173 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15176 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
15178 [(set_attr "type" "compare")
15179 (set_attr "length" "12,16")])
15182 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
15184 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15186 (match_operand:DI 2 "gpc_reg_operand" ""))
15188 (set (match_operand:DI 0 "gpc_reg_operand" "")
15189 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15190 "TARGET_64BIT && reload_completed"
15191 [(set (match_dup 0)
15192 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
15194 (compare:CC (match_dup 0)
15199 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
15200 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15201 (match_operand:SI 2 "reg_or_short_operand" "r"))
15202 (match_operand:SI 3 "gpc_reg_operand" "r")))]
15204 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
15205 [(set_attr "length" "12")])
15208 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15210 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15211 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15212 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15214 (clobber (match_scratch:SI 4 "=&r,&r"))]
15217 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
15219 [(set_attr "type" "compare")
15220 (set_attr "length" "12,16")])
15223 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15225 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15226 (match_operand:SI 2 "reg_or_short_operand" ""))
15227 (match_operand:SI 3 "gpc_reg_operand" ""))
15229 (clobber (match_scratch:SI 4 ""))]
15230 "TARGET_POWER && reload_completed"
15231 [(set (match_dup 4)
15232 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15234 (compare:CC (match_dup 4)
15239 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
15241 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15242 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15243 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15245 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15246 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15249 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
15251 [(set_attr "type" "compare")
15252 (set_attr "length" "12,16")])
15255 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15257 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15258 (match_operand:SI 2 "reg_or_short_operand" ""))
15259 (match_operand:SI 3 "gpc_reg_operand" ""))
15261 (set (match_operand:SI 0 "gpc_reg_operand" "")
15262 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15263 "TARGET_POWER && reload_completed"
15264 [(set (match_dup 0)
15265 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15267 (compare:CC (match_dup 0)
15272 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15273 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15274 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
15276 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
15277 [(set_attr "length" "12")])
15279 (define_insn_and_split "*gtu<mode>"
15280 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15281 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15282 (match_operand:P 2 "reg_or_short_operand" "rI")))]
15286 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15287 (set (match_dup 0) (neg:P (match_dup 0)))]
15290 (define_insn_and_split "*gtu<mode>_compare"
15291 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15293 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15294 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
15296 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
15297 (gtu:P (match_dup 1) (match_dup 2)))]
15301 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15302 (parallel [(set (match_dup 3)
15303 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
15304 (set (match_dup 0) (neg:P (match_dup 0)))])]
15307 (define_insn_and_split "*plus_gtu<mode>"
15308 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15309 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15310 (match_operand:P 2 "reg_or_short_operand" "rI"))
15311 (match_operand:P 3 "reg_or_short_operand" "rI")))]
15314 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15315 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15316 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
15319 (define_insn_and_split "*plus_gtu<mode>_compare"
15320 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15322 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
15323 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
15324 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
15326 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15327 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
15330 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15331 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15332 (parallel [(set (match_dup 4)
15333 (compare:CC (minus:P (match_dup 3) (match_dup 0))
15335 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
15338 (define_insn "*neg_gtu<mode>"
15339 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15340 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15341 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
15343 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
15344 [(set_attr "type" "two")
15345 (set_attr "length" "8")])
15348 ;; Define both directions of branch and return. If we need a reload
15349 ;; register, we'd rather use CR0 since it is much easier to copy a
15350 ;; register CC value to there.
15354 (if_then_else (match_operator 1 "branch_comparison_operator"
15356 "cc_reg_operand" "y")
15358 (label_ref (match_operand 0 "" ""))
15363 return output_cbranch (operands[1], \"%l0\", 0, insn);
15365 [(set_attr "type" "branch")])
15369 (if_then_else (match_operator 0 "branch_comparison_operator"
15371 "cc_reg_operand" "y")
15378 return output_cbranch (operands[0], NULL, 0, insn);
15380 [(set_attr "type" "jmpreg")
15381 (set_attr "length" "4")])
15385 (if_then_else (match_operator 1 "branch_comparison_operator"
15387 "cc_reg_operand" "y")
15390 (label_ref (match_operand 0 "" ""))))]
15394 return output_cbranch (operands[1], \"%l0\", 1, insn);
15396 [(set_attr "type" "branch")])
15400 (if_then_else (match_operator 0 "branch_comparison_operator"
15402 "cc_reg_operand" "y")
15409 return output_cbranch (operands[0], NULL, 1, insn);
15411 [(set_attr "type" "jmpreg")
15412 (set_attr "length" "4")])
15414 ;; Logic on condition register values.
15416 ; This pattern matches things like
15417 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
15418 ; (eq:SI (reg:CCFP 68) (const_int 0)))
15420 ; which are generated by the branch logic.
15421 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
15423 (define_insn "*cceq_ior_compare"
15424 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15425 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
15426 [(match_operator:SI 2
15427 "branch_positive_comparison_operator"
15429 "cc_reg_operand" "y,y")
15431 (match_operator:SI 4
15432 "branch_positive_comparison_operator"
15434 "cc_reg_operand" "0,y")
15438 "cr%q1 %E0,%j2,%j4"
15439 [(set_attr "type" "cr_logical,delayed_cr")])
15441 ; Why is the constant -1 here, but 1 in the previous pattern?
15442 ; Because ~1 has all but the low bit set.
15444 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15445 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
15446 [(not:SI (match_operator:SI 2
15447 "branch_positive_comparison_operator"
15449 "cc_reg_operand" "y,y")
15451 (match_operator:SI 4
15452 "branch_positive_comparison_operator"
15454 "cc_reg_operand" "0,y")
15458 "cr%q1 %E0,%j2,%j4"
15459 [(set_attr "type" "cr_logical,delayed_cr")])
15461 (define_insn "*cceq_rev_compare"
15462 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15463 (compare:CCEQ (match_operator:SI 1
15464 "branch_positive_comparison_operator"
15466 "cc_reg_operand" "0,y")
15470 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
15471 [(set_attr "type" "cr_logical,delayed_cr")])
15473 ;; If we are comparing the result of two comparisons, this can be done
15474 ;; using creqv or crxor.
15476 (define_insn_and_split ""
15477 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
15478 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
15479 [(match_operand 2 "cc_reg_operand" "y")
15481 (match_operator 3 "branch_comparison_operator"
15482 [(match_operand 4 "cc_reg_operand" "y")
15487 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
15491 int positive_1, positive_2;
15493 positive_1 = branch_positive_comparison_operator (operands[1],
15494 GET_MODE (operands[1]));
15495 positive_2 = branch_positive_comparison_operator (operands[3],
15496 GET_MODE (operands[3]));
15499 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
15500 GET_CODE (operands[1])),
15502 operands[2], const0_rtx);
15503 else if (GET_MODE (operands[1]) != SImode)
15504 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
15505 operands[2], const0_rtx);
15508 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
15509 GET_CODE (operands[3])),
15511 operands[4], const0_rtx);
15512 else if (GET_MODE (operands[3]) != SImode)
15513 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
15514 operands[4], const0_rtx);
15516 if (positive_1 == positive_2)
15518 operands[1] = gen_rtx_NOT (SImode, operands[1]);
15519 operands[5] = constm1_rtx;
15523 operands[5] = const1_rtx;
15527 ;; Unconditional branch and return.
15529 (define_insn "jump"
15531 (label_ref (match_operand 0 "" "")))]
15534 [(set_attr "type" "branch")])
15536 (define_insn "return"
15540 [(set_attr "type" "jmpreg")])
15542 (define_expand "indirect_jump"
15543 [(set (pc) (match_operand 0 "register_operand" ""))])
15545 (define_insn "*indirect_jump<mode>"
15546 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15551 [(set_attr "type" "jmpreg")])
15553 ;; Table jump for switch statements:
15554 (define_expand "tablejump"
15555 [(use (match_operand 0 "" ""))
15556 (use (label_ref (match_operand 1 "" "")))]
15561 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15563 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15567 (define_expand "tablejumpsi"
15568 [(set (match_dup 3)
15569 (plus:SI (match_operand:SI 0 "" "")
15571 (parallel [(set (pc) (match_dup 3))
15572 (use (label_ref (match_operand 1 "" "")))])]
15575 { operands[0] = force_reg (SImode, operands[0]);
15576 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15577 operands[3] = gen_reg_rtx (SImode);
15580 (define_expand "tablejumpdi"
15581 [(set (match_dup 4)
15582 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15584 (plus:DI (match_dup 4)
15586 (parallel [(set (pc) (match_dup 3))
15587 (use (label_ref (match_operand 1 "" "")))])]
15590 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15591 operands[3] = gen_reg_rtx (DImode);
15592 operands[4] = gen_reg_rtx (DImode);
15595 (define_insn "*tablejump<mode>_internal1"
15597 (match_operand:P 0 "register_operand" "c,*l"))
15598 (use (label_ref (match_operand 1 "" "")))]
15603 [(set_attr "type" "jmpreg")])
15608 "{cror 0,0,0|nop}")
15610 ;; Define the subtract-one-and-jump insns, starting with the template
15611 ;; so loop.c knows what to generate.
15613 (define_expand "doloop_end"
15614 [(use (match_operand 0 "" "")) ; loop pseudo
15615 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15616 (use (match_operand 2 "" "")) ; max iterations
15617 (use (match_operand 3 "" "")) ; loop level
15618 (use (match_operand 4 "" ""))] ; label
15622 /* Only use this on innermost loops. */
15623 if (INTVAL (operands[3]) > 1)
15627 if (GET_MODE (operands[0]) != DImode)
15629 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15633 if (GET_MODE (operands[0]) != SImode)
15635 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15640 (define_expand "ctr<mode>"
15641 [(parallel [(set (pc)
15642 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15644 (label_ref (match_operand 1 "" ""))
15647 (plus:P (match_dup 0)
15649 (clobber (match_scratch:CC 2 ""))
15650 (clobber (match_scratch:P 3 ""))])]
15654 ;; We need to be able to do this for any operand, including MEM, or we
15655 ;; will cause reload to blow up since we don't allow output reloads on
15657 ;; For the length attribute to be calculated correctly, the
15658 ;; label MUST be operand 0.
15660 (define_insn "*ctr<mode>_internal1"
15662 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15664 (label_ref (match_operand 0 "" ""))
15666 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15667 (plus:P (match_dup 1)
15669 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15670 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15674 if (which_alternative != 0)
15676 else if (get_attr_length (insn) == 4)
15677 return \"{bdn|bdnz} %l0\";
15679 return \"bdz $+8\;b %l0\";
15681 [(set_attr "type" "branch")
15682 (set_attr "length" "*,12,16,16")])
15684 (define_insn "*ctr<mode>_internal2"
15686 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15689 (label_ref (match_operand 0 "" ""))))
15690 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15691 (plus:P (match_dup 1)
15693 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15694 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15698 if (which_alternative != 0)
15700 else if (get_attr_length (insn) == 4)
15701 return \"bdz %l0\";
15703 return \"{bdn|bdnz} $+8\;b %l0\";
15705 [(set_attr "type" "branch")
15706 (set_attr "length" "*,12,16,16")])
15708 ;; Similar but use EQ
15710 (define_insn "*ctr<mode>_internal5"
15712 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15714 (label_ref (match_operand 0 "" ""))
15716 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15717 (plus:P (match_dup 1)
15719 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15720 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15724 if (which_alternative != 0)
15726 else if (get_attr_length (insn) == 4)
15727 return \"bdz %l0\";
15729 return \"{bdn|bdnz} $+8\;b %l0\";
15731 [(set_attr "type" "branch")
15732 (set_attr "length" "*,12,16,16")])
15734 (define_insn "*ctr<mode>_internal6"
15736 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15739 (label_ref (match_operand 0 "" ""))))
15740 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15741 (plus:P (match_dup 1)
15743 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15744 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15748 if (which_alternative != 0)
15750 else if (get_attr_length (insn) == 4)
15751 return \"{bdn|bdnz} %l0\";
15753 return \"bdz $+8\;b %l0\";
15755 [(set_attr "type" "branch")
15756 (set_attr "length" "*,12,16,16")])
15758 ;; Now the splitters if we could not allocate the CTR register
15762 (if_then_else (match_operator 2 "comparison_operator"
15763 [(match_operand:P 1 "gpc_reg_operand" "")
15765 (match_operand 5 "" "")
15766 (match_operand 6 "" "")))
15767 (set (match_operand:P 0 "gpc_reg_operand" "")
15768 (plus:P (match_dup 1) (const_int -1)))
15769 (clobber (match_scratch:CC 3 ""))
15770 (clobber (match_scratch:P 4 ""))]
15772 [(parallel [(set (match_dup 3)
15773 (compare:CC (plus:P (match_dup 1)
15777 (plus:P (match_dup 1)
15779 (set (pc) (if_then_else (match_dup 7)
15783 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15784 operands[3], const0_rtx); }")
15788 (if_then_else (match_operator 2 "comparison_operator"
15789 [(match_operand:P 1 "gpc_reg_operand" "")
15791 (match_operand 5 "" "")
15792 (match_operand 6 "" "")))
15793 (set (match_operand:P 0 "nonimmediate_operand" "")
15794 (plus:P (match_dup 1) (const_int -1)))
15795 (clobber (match_scratch:CC 3 ""))
15796 (clobber (match_scratch:P 4 ""))]
15797 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15798 [(parallel [(set (match_dup 3)
15799 (compare:CC (plus:P (match_dup 1)
15803 (plus:P (match_dup 1)
15807 (set (pc) (if_then_else (match_dup 7)
15811 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15812 operands[3], const0_rtx); }")
15814 (define_insn "trap"
15815 [(trap_if (const_int 1) (const_int 0))]
15818 [(set_attr "type" "trap")])
15820 (define_expand "ctrap<mode>4"
15821 [(trap_if (match_operator 0 "ordered_comparison_operator"
15822 [(match_operand:GPR 1 "register_operand")
15823 (match_operand:GPR 2 "reg_or_short_operand")])
15824 (match_operand 3 "zero_constant" ""))]
15829 [(trap_if (match_operator 0 "ordered_comparison_operator"
15830 [(match_operand:GPR 1 "register_operand" "r")
15831 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15834 "{t|t<wd>}%V0%I2 %1,%2"
15835 [(set_attr "type" "trap")])
15837 ;; Insns related to generating the function prologue and epilogue.
15839 (define_expand "prologue"
15840 [(use (const_int 0))]
15841 "TARGET_SCHED_PROLOG"
15844 rs6000_emit_prologue ();
15848 (define_insn "*movesi_from_cr_one"
15849 [(match_parallel 0 "mfcr_operation"
15850 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15851 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15852 (match_operand 3 "immediate_operand" "n")]
15853 UNSPEC_MOVESI_FROM_CR))])]
15859 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15861 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15862 operands[4] = GEN_INT (mask);
15863 output_asm_insn (\"mfcr %1,%4\", operands);
15867 [(set_attr "type" "mfcrf")])
15869 (define_insn "movesi_from_cr"
15870 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15871 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15872 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15873 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15874 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15875 UNSPEC_MOVESI_FROM_CR))]
15878 [(set_attr "type" "mfcr")])
15880 (define_insn "*stmw"
15881 [(match_parallel 0 "stmw_operation"
15882 [(set (match_operand:SI 1 "memory_operand" "=m")
15883 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15886 [(set_attr "type" "store_ux")])
15888 (define_insn "*save_gpregs_<mode>"
15889 [(match_parallel 0 "any_parallel_operand"
15890 [(clobber (reg:P 65))
15891 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15892 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15893 (set (match_operand:P 3 "memory_operand" "=m")
15894 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15897 [(set_attr "type" "branch")
15898 (set_attr "length" "4")])
15900 (define_insn "*save_fpregs_<mode>"
15901 [(match_parallel 0 "any_parallel_operand"
15902 [(clobber (reg:P 65))
15903 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15904 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15905 (set (match_operand:DF 3 "memory_operand" "=m")
15906 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15909 [(set_attr "type" "branch")
15910 (set_attr "length" "4")])
15912 ; These are to explain that changes to the stack pointer should
15913 ; not be moved over stores to stack memory.
15914 (define_insn "stack_tie"
15915 [(set (match_operand:BLK 0 "memory_operand" "+m")
15916 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15919 [(set_attr "length" "0")])
15921 ; Like stack_tie, but depend on both fp and sp based memory.
15922 (define_insn "frame_tie"
15923 [(set (match_operand:BLK 0 "memory_operand" "+m")
15924 (unspec:BLK [(match_dup 0)
15925 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
15928 [(set_attr "length" "0")])
15931 (define_expand "epilogue"
15932 [(use (const_int 0))]
15933 "TARGET_SCHED_PROLOG"
15936 rs6000_emit_epilogue (FALSE);
15940 ; On some processors, doing the mtcrf one CC register at a time is
15941 ; faster (like on the 604e). On others, doing them all at once is
15942 ; faster; for instance, on the 601 and 750.
15944 (define_expand "movsi_to_cr_one"
15945 [(set (match_operand:CC 0 "cc_reg_operand" "")
15946 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15947 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15949 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15951 (define_insn "*movsi_to_cr"
15952 [(match_parallel 0 "mtcrf_operation"
15953 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15954 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15955 (match_operand 3 "immediate_operand" "n")]
15956 UNSPEC_MOVESI_TO_CR))])]
15962 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15963 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15964 operands[4] = GEN_INT (mask);
15965 return \"mtcrf %4,%2\";
15967 [(set_attr "type" "mtcr")])
15969 (define_insn "*mtcrfsi"
15970 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15971 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15972 (match_operand 2 "immediate_operand" "n")]
15973 UNSPEC_MOVESI_TO_CR))]
15974 "GET_CODE (operands[0]) == REG
15975 && CR_REGNO_P (REGNO (operands[0]))
15976 && GET_CODE (operands[2]) == CONST_INT
15977 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15979 [(set_attr "type" "mtcr")])
15981 ; The load-multiple instructions have similar properties.
15982 ; Note that "load_multiple" is a name known to the machine-independent
15983 ; code that actually corresponds to the PowerPC load-string.
15985 (define_insn "*lmw"
15986 [(match_parallel 0 "lmw_operation"
15987 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15988 (match_operand:SI 2 "memory_operand" "m"))])]
15991 [(set_attr "type" "load_ux")
15992 (set_attr "cell_micro" "always")])
15994 (define_insn "*return_internal_<mode>"
15996 (use (match_operand:P 0 "register_operand" "lc"))]
15999 [(set_attr "type" "jmpreg")])
16001 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
16002 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
16004 (define_insn "*restore_gpregs_<mode>"
16005 [(match_parallel 0 "any_parallel_operand"
16006 [(clobber (match_operand:P 1 "register_operand" "=l"))
16007 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16008 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16009 (set (match_operand:P 4 "gpc_reg_operand" "=r")
16010 (match_operand:P 5 "memory_operand" "m"))])]
16013 [(set_attr "type" "branch")
16014 (set_attr "length" "4")])
16016 (define_insn "*return_and_restore_gpregs_<mode>"
16017 [(match_parallel 0 "any_parallel_operand"
16019 (clobber (match_operand:P 1 "register_operand" "=l"))
16020 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16021 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16022 (set (match_operand:P 4 "gpc_reg_operand" "=r")
16023 (match_operand:P 5 "memory_operand" "m"))])]
16026 [(set_attr "type" "branch")
16027 (set_attr "length" "4")])
16029 (define_insn "*return_and_restore_fpregs_<mode>"
16030 [(match_parallel 0 "any_parallel_operand"
16032 (clobber (match_operand:P 1 "register_operand" "=l"))
16033 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16034 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16035 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
16036 (match_operand:DF 5 "memory_operand" "m"))])]
16039 [(set_attr "type" "branch")
16040 (set_attr "length" "4")])
16042 (define_insn "*return_and_restore_fpregs_aix_<mode>"
16043 [(match_parallel 0 "any_parallel_operand"
16045 (use (match_operand:P 1 "register_operand" "l"))
16046 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16047 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16048 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
16049 (match_operand:DF 5 "memory_operand" "m"))])]
16052 [(set_attr "type" "branch")
16053 (set_attr "length" "4")])
16055 ; This is used in compiling the unwind routines.
16056 (define_expand "eh_return"
16057 [(use (match_operand 0 "general_operand" ""))]
16062 emit_insn (gen_eh_set_lr_si (operands[0]));
16064 emit_insn (gen_eh_set_lr_di (operands[0]));
16068 ; We can't expand this before we know where the link register is stored.
16069 (define_insn "eh_set_lr_<mode>"
16070 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
16072 (clobber (match_scratch:P 1 "=&b"))]
16077 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
16078 (clobber (match_scratch 1 ""))]
16083 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
16087 (define_insn "prefetch"
16088 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
16089 (match_operand:SI 1 "const_int_operand" "n")
16090 (match_operand:SI 2 "const_int_operand" "n"))]
16094 if (GET_CODE (operands[0]) == REG)
16095 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
16096 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
16098 [(set_attr "type" "load")])
16100 (define_insn "bpermd_<mode>"
16101 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
16102 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
16103 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
16106 [(set_attr "type" "integer")])
16109 ;; Builtin fma support. Handle
16110 ;; Note that the conditions for expansion are in the FMA_F iterator.
16112 (define_expand "fma<mode>4"
16113 [(set (match_operand:FMA_F 0 "register_operand" "")
16115 (match_operand:FMA_F 1 "register_operand" "")
16116 (match_operand:FMA_F 2 "register_operand" "")
16117 (match_operand:FMA_F 3 "register_operand" "")))]
16121 ; Altivec only has fma and nfms.
16122 (define_expand "fms<mode>4"
16123 [(set (match_operand:FMA_F 0 "register_operand" "")
16125 (match_operand:FMA_F 1 "register_operand" "")
16126 (match_operand:FMA_F 2 "register_operand" "")
16127 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
16128 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16131 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
16132 (define_expand "fnma<mode>4"
16133 [(set (match_operand:FMA_F 0 "register_operand" "")
16136 (match_operand:FMA_F 1 "register_operand" "")
16137 (match_operand:FMA_F 2 "register_operand" "")
16138 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
16139 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
16142 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
16143 (define_expand "fnms<mode>4"
16144 [(set (match_operand:FMA_F 0 "register_operand" "")
16147 (match_operand:FMA_F 1 "register_operand" "")
16148 (match_operand:FMA_F 2 "register_operand" "")
16149 (match_operand:FMA_F 3 "register_operand" ""))))]
16150 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16153 ; Not an official optab name, but used from builtins.
16154 (define_expand "nfma<mode>4"
16155 [(set (match_operand:FMA_F 0 "register_operand" "")
16158 (match_operand:FMA_F 1 "register_operand" "")
16159 (match_operand:FMA_F 2 "register_operand" "")
16160 (match_operand:FMA_F 3 "register_operand" ""))))]
16161 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16164 ; Not an official optab name, but used from builtins.
16165 (define_expand "nfms<mode>4"
16166 [(set (match_operand:FMA_F 0 "register_operand" "")
16169 (match_operand:FMA_F 1 "register_operand" "")
16170 (match_operand:FMA_F 2 "register_operand" "")
16171 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
16177 (include "sync.md")
16178 (include "vector.md")
16180 (include "altivec.md")
16183 (include "paired.md")