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)
109 ;; UNSPEC_VOLATILE usage
114 (UNSPECV_LL 1) ; load-locked
115 (UNSPECV_SC 2) ; store-conditional
116 (UNSPECV_EH_RR 9) ; eh_reg_restore
119 ;; Define an insn type attribute. This is used in function unit delay
121 (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"
122 (const_string "integer"))
124 ;; Define floating point instruction sub-types for use with Xfpu.md
125 (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"))
127 ;; Length (in bytes).
128 ; '(pc)' in the following doesn't include the instruction itself; it is
129 ; calculated as if the instruction had zero size.
130 (define_attr "length" ""
131 (if_then_else (eq_attr "type" "branch")
132 (if_then_else (and (ge (minus (match_dup 0) (pc))
134 (lt (minus (match_dup 0) (pc))
140 ;; Processor type -- this attribute must exactly match the processor_type
141 ;; enumeration in rs6000.h.
143 (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"
144 (const (symbol_ref "rs6000_cpu_attr")))
147 ;; If this instruction is microcoded on the CELL processor
148 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
149 (define_attr "cell_micro" "not,conditional,always"
150 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
151 (const_string "always")
152 (const_string "not")))
154 (automata_option "ndfa")
168 (include "e300c2c3.md")
169 (include "e500mc.md")
170 (include "e500mc64.md")
171 (include "power4.md")
172 (include "power5.md")
173 (include "power6.md")
174 (include "power7.md")
179 (include "predicates.md")
180 (include "constraints.md")
182 (include "darwin.md")
187 ; This mode iterator allows :GPR to be used to indicate the allowable size
188 ; of whole values in GPRs.
189 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
191 ; Any supported integer mode.
192 (define_mode_iterator INT [QI HI SI DI TI])
194 ; Any supported integer mode that fits in one register.
195 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
197 ; extend modes for DImode
198 (define_mode_iterator QHSI [QI HI SI])
200 ; SImode or DImode, even if DImode doesn't fit in GPRs.
201 (define_mode_iterator SDI [SI DI])
203 ; The size of a pointer. Also, the size of the value that a record-condition
204 ; (one with a '.') will compare; and the size used for arithmetic carries.
205 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
207 ; Any hardware-supported floating-point mode
208 (define_mode_iterator FP [
209 (SF "TARGET_HARD_FLOAT
210 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
211 (DF "TARGET_HARD_FLOAT
212 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
213 (TF "!TARGET_IEEEQUAD
215 && (TARGET_FPRS || TARGET_E500_DOUBLE)
216 && TARGET_LONG_DOUBLE_128")
220 ; These modes do not fit in integer registers in 32-bit mode.
221 (define_mode_iterator DIFD [DI DF DD])
223 ;; Iterator for reciprocal estimate instructions
224 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
226 ; Various instructions that come in SI and DI forms.
227 ; A generic w/d attribute, for things like cmpw/cmpd.
228 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
231 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
233 ;; ISEL/ISEL64 target selection
234 (define_mode_attr sel [(SI "") (DI "64")])
236 ;; Suffix for reload patterns
237 (define_mode_attr ptrsize [(SI "32bit")
240 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
241 (DI "TARGET_64BIT")])
243 (define_mode_attr mptrsize [(SI "si")
246 (define_mode_attr rreg [(SF "f")
252 ;; Start with fixed-point load and store insns. Here we put only the more
253 ;; complex forms. Basic data transfer is done later.
255 (define_expand "zero_extend<mode>di2"
256 [(set (match_operand:DI 0 "gpc_reg_operand" "")
257 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
261 (define_insn "*zero_extend<mode>di2_internal1"
262 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
263 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
267 rldicl %0,%1,0,<dbits>"
268 [(set_attr "type" "load,*")])
270 (define_insn "*zero_extend<mode>di2_internal2"
271 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
272 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
274 (clobber (match_scratch:DI 2 "=r,r"))]
277 rldicl. %2,%1,0,<dbits>
279 [(set_attr "type" "compare")
280 (set_attr "length" "4,8")])
283 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
284 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
286 (clobber (match_scratch:DI 2 ""))]
287 "TARGET_POWERPC64 && reload_completed"
289 (zero_extend:DI (match_dup 1)))
291 (compare:CC (match_dup 2)
295 (define_insn "*zero_extend<mode>di2_internal3"
296 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
297 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
299 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
300 (zero_extend:DI (match_dup 1)))]
303 rldicl. %0,%1,0,<dbits>
305 [(set_attr "type" "compare")
306 (set_attr "length" "4,8")])
309 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
310 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
312 (set (match_operand:DI 0 "gpc_reg_operand" "")
313 (zero_extend:DI (match_dup 1)))]
314 "TARGET_POWERPC64 && reload_completed"
316 (zero_extend:DI (match_dup 1)))
318 (compare:CC (match_dup 0)
322 (define_insn "extendqidi2"
323 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
324 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
327 [(set_attr "type" "exts")])
330 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
331 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
333 (clobber (match_scratch:DI 2 "=r,r"))]
338 [(set_attr "type" "compare")
339 (set_attr "length" "4,8")])
342 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
343 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
345 (clobber (match_scratch:DI 2 ""))]
346 "TARGET_POWERPC64 && reload_completed"
348 (sign_extend:DI (match_dup 1)))
350 (compare:CC (match_dup 2)
355 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
356 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
358 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
359 (sign_extend:DI (match_dup 1)))]
364 [(set_attr "type" "compare")
365 (set_attr "length" "4,8")])
368 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
369 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
371 (set (match_operand:DI 0 "gpc_reg_operand" "")
372 (sign_extend:DI (match_dup 1)))]
373 "TARGET_POWERPC64 && reload_completed"
375 (sign_extend:DI (match_dup 1)))
377 (compare:CC (match_dup 0)
381 (define_expand "extendhidi2"
382 [(set (match_operand:DI 0 "gpc_reg_operand" "")
383 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
388 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
389 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
390 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
394 [(set_attr "type" "load_ext,exts")])
397 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
398 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
399 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
401 [(set_attr "type" "exts")])
404 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
405 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
407 (clobber (match_scratch:DI 2 "=r,r"))]
412 [(set_attr "type" "compare")
413 (set_attr "length" "4,8")])
416 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
417 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
419 (clobber (match_scratch:DI 2 ""))]
420 "TARGET_POWERPC64 && reload_completed"
422 (sign_extend:DI (match_dup 1)))
424 (compare:CC (match_dup 2)
429 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
430 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
432 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
433 (sign_extend:DI (match_dup 1)))]
438 [(set_attr "type" "compare")
439 (set_attr "length" "4,8")])
442 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
443 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
445 (set (match_operand:DI 0 "gpc_reg_operand" "")
446 (sign_extend:DI (match_dup 1)))]
447 "TARGET_POWERPC64 && reload_completed"
449 (sign_extend:DI (match_dup 1)))
451 (compare:CC (match_dup 0)
455 (define_expand "extendsidi2"
456 [(set (match_operand:DI 0 "gpc_reg_operand" "")
457 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
462 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
463 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
464 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
468 [(set_attr "type" "load_ext,exts")])
471 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
472 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
473 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
475 [(set_attr "type" "exts")])
478 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
479 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
481 (clobber (match_scratch:DI 2 "=r,r"))]
486 [(set_attr "type" "compare")
487 (set_attr "length" "4,8")])
490 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
491 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
493 (clobber (match_scratch:DI 2 ""))]
494 "TARGET_POWERPC64 && reload_completed"
496 (sign_extend:DI (match_dup 1)))
498 (compare:CC (match_dup 2)
503 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
504 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
506 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
507 (sign_extend:DI (match_dup 1)))]
512 [(set_attr "type" "compare")
513 (set_attr "length" "4,8")])
516 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
517 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
519 (set (match_operand:DI 0 "gpc_reg_operand" "")
520 (sign_extend:DI (match_dup 1)))]
521 "TARGET_POWERPC64 && reload_completed"
523 (sign_extend:DI (match_dup 1)))
525 (compare:CC (match_dup 0)
529 (define_expand "zero_extendqisi2"
530 [(set (match_operand:SI 0 "gpc_reg_operand" "")
531 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
536 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
537 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
541 {rlinm|rlwinm} %0,%1,0,0xff"
542 [(set_attr "type" "load,*")])
545 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
546 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
548 (clobber (match_scratch:SI 2 "=r,r"))]
551 {andil.|andi.} %2,%1,0xff
553 [(set_attr "type" "fast_compare,compare")
554 (set_attr "length" "4,8")])
557 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
558 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
560 (clobber (match_scratch:SI 2 ""))]
563 (zero_extend:SI (match_dup 1)))
565 (compare:CC (match_dup 2)
570 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
571 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
573 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
574 (zero_extend:SI (match_dup 1)))]
577 {andil.|andi.} %0,%1,0xff
579 [(set_attr "type" "fast_compare,compare")
580 (set_attr "length" "4,8")])
583 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
584 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
586 (set (match_operand:SI 0 "gpc_reg_operand" "")
587 (zero_extend:SI (match_dup 1)))]
590 (zero_extend:SI (match_dup 1)))
592 (compare:CC (match_dup 0)
596 (define_expand "extendqisi2"
597 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
598 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
603 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
604 else if (TARGET_POWER)
605 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
607 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
611 (define_insn "extendqisi2_ppc"
612 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
613 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
616 [(set_attr "type" "exts")])
619 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
620 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
622 (clobber (match_scratch:SI 2 "=r,r"))]
627 [(set_attr "type" "compare")
628 (set_attr "length" "4,8")])
631 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
632 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
634 (clobber (match_scratch:SI 2 ""))]
635 "TARGET_POWERPC && reload_completed"
637 (sign_extend:SI (match_dup 1)))
639 (compare:CC (match_dup 2)
644 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
645 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
647 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
648 (sign_extend:SI (match_dup 1)))]
653 [(set_attr "type" "compare")
654 (set_attr "length" "4,8")])
657 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
658 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
660 (set (match_operand:SI 0 "gpc_reg_operand" "")
661 (sign_extend:SI (match_dup 1)))]
662 "TARGET_POWERPC && reload_completed"
664 (sign_extend:SI (match_dup 1)))
666 (compare:CC (match_dup 0)
670 (define_expand "extendqisi2_power"
671 [(parallel [(set (match_dup 2)
672 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
674 (clobber (scratch:SI))])
675 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
676 (ashiftrt:SI (match_dup 2)
678 (clobber (scratch:SI))])]
681 { operands[1] = gen_lowpart (SImode, operands[1]);
682 operands[2] = gen_reg_rtx (SImode); }")
684 (define_expand "extendqisi2_no_power"
686 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
688 (set (match_operand:SI 0 "gpc_reg_operand" "")
689 (ashiftrt:SI (match_dup 2)
691 "! TARGET_POWER && ! TARGET_POWERPC"
693 { operands[1] = gen_lowpart (SImode, operands[1]);
694 operands[2] = gen_reg_rtx (SImode); }")
696 (define_expand "zero_extendqihi2"
697 [(set (match_operand:HI 0 "gpc_reg_operand" "")
698 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
703 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
704 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
708 {rlinm|rlwinm} %0,%1,0,0xff"
709 [(set_attr "type" "load,*")])
712 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
713 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
715 (clobber (match_scratch:HI 2 "=r,r"))]
718 {andil.|andi.} %2,%1,0xff
720 [(set_attr "type" "fast_compare,compare")
721 (set_attr "length" "4,8")])
724 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
725 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
727 (clobber (match_scratch:HI 2 ""))]
730 (zero_extend:HI (match_dup 1)))
732 (compare:CC (match_dup 2)
737 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
738 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
740 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
741 (zero_extend:HI (match_dup 1)))]
744 {andil.|andi.} %0,%1,0xff
746 [(set_attr "type" "fast_compare,compare")
747 (set_attr "length" "4,8")])
750 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
751 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
753 (set (match_operand:HI 0 "gpc_reg_operand" "")
754 (zero_extend:HI (match_dup 1)))]
757 (zero_extend:HI (match_dup 1)))
759 (compare:CC (match_dup 0)
763 (define_expand "extendqihi2"
764 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
765 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
770 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
771 else if (TARGET_POWER)
772 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
774 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
778 (define_insn "extendqihi2_ppc"
779 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
780 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
783 [(set_attr "type" "exts")])
786 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
787 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
789 (clobber (match_scratch:HI 2 "=r,r"))]
794 [(set_attr "type" "compare")
795 (set_attr "length" "4,8")])
798 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
799 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
801 (clobber (match_scratch:HI 2 ""))]
802 "TARGET_POWERPC && reload_completed"
804 (sign_extend:HI (match_dup 1)))
806 (compare:CC (match_dup 2)
811 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
812 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
814 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
815 (sign_extend:HI (match_dup 1)))]
820 [(set_attr "type" "compare")
821 (set_attr "length" "4,8")])
824 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
825 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
827 (set (match_operand:HI 0 "gpc_reg_operand" "")
828 (sign_extend:HI (match_dup 1)))]
829 "TARGET_POWERPC && reload_completed"
831 (sign_extend:HI (match_dup 1)))
833 (compare:CC (match_dup 0)
837 (define_expand "extendqihi2_power"
838 [(parallel [(set (match_dup 2)
839 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
841 (clobber (scratch:SI))])
842 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
843 (ashiftrt:SI (match_dup 2)
845 (clobber (scratch:SI))])]
848 { operands[0] = gen_lowpart (SImode, operands[0]);
849 operands[1] = gen_lowpart (SImode, operands[1]);
850 operands[2] = gen_reg_rtx (SImode); }")
852 (define_expand "extendqihi2_no_power"
854 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
856 (set (match_operand:HI 0 "gpc_reg_operand" "")
857 (ashiftrt:SI (match_dup 2)
859 "! TARGET_POWER && ! TARGET_POWERPC"
861 { operands[0] = gen_lowpart (SImode, operands[0]);
862 operands[1] = gen_lowpart (SImode, operands[1]);
863 operands[2] = gen_reg_rtx (SImode); }")
865 (define_expand "zero_extendhisi2"
866 [(set (match_operand:SI 0 "gpc_reg_operand" "")
867 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
872 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
873 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
877 {rlinm|rlwinm} %0,%1,0,0xffff"
878 [(set_attr "type" "load,*")])
881 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
882 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
884 (clobber (match_scratch:SI 2 "=r,r"))]
887 {andil.|andi.} %2,%1,0xffff
889 [(set_attr "type" "fast_compare,compare")
890 (set_attr "length" "4,8")])
893 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
894 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
896 (clobber (match_scratch:SI 2 ""))]
899 (zero_extend:SI (match_dup 1)))
901 (compare:CC (match_dup 2)
906 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
907 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
909 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
910 (zero_extend:SI (match_dup 1)))]
913 {andil.|andi.} %0,%1,0xffff
915 [(set_attr "type" "fast_compare,compare")
916 (set_attr "length" "4,8")])
919 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
920 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
922 (set (match_operand:SI 0 "gpc_reg_operand" "")
923 (zero_extend:SI (match_dup 1)))]
926 (zero_extend:SI (match_dup 1)))
928 (compare:CC (match_dup 0)
932 (define_expand "extendhisi2"
933 [(set (match_operand:SI 0 "gpc_reg_operand" "")
934 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
939 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
940 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
941 "rs6000_gen_cell_microcode"
945 [(set_attr "type" "load_ext,exts")])
948 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
949 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
950 "!rs6000_gen_cell_microcode"
952 [(set_attr "type" "exts")])
955 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
956 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
958 (clobber (match_scratch:SI 2 "=r,r"))]
963 [(set_attr "type" "compare")
964 (set_attr "length" "4,8")])
967 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
968 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
970 (clobber (match_scratch:SI 2 ""))]
973 (sign_extend:SI (match_dup 1)))
975 (compare:CC (match_dup 2)
980 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
981 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
983 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
984 (sign_extend:SI (match_dup 1)))]
989 [(set_attr "type" "compare")
990 (set_attr "length" "4,8")])
992 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
994 (define_insn "*macchwc"
995 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
996 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
997 (match_operand:SI 2 "gpc_reg_operand" "r")
1000 (match_operand:HI 1 "gpc_reg_operand" "r")))
1001 (match_operand:SI 4 "gpc_reg_operand" "0"))
1003 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1004 (plus:SI (mult:SI (ashiftrt:SI
1011 "macchw. %0, %1, %2"
1012 [(set_attr "type" "imul3")])
1014 (define_insn "*macchw"
1015 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1016 (plus:SI (mult:SI (ashiftrt:SI
1017 (match_operand:SI 2 "gpc_reg_operand" "r")
1020 (match_operand:HI 1 "gpc_reg_operand" "r")))
1021 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1024 [(set_attr "type" "imul3")])
1026 (define_insn "*macchwuc"
1027 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1028 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1029 (match_operand:SI 2 "gpc_reg_operand" "r")
1032 (match_operand:HI 1 "gpc_reg_operand" "r")))
1033 (match_operand:SI 4 "gpc_reg_operand" "0"))
1035 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1036 (plus:SI (mult:SI (lshiftrt:SI
1043 "macchwu. %0, %1, %2"
1044 [(set_attr "type" "imul3")])
1046 (define_insn "*macchwu"
1047 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1048 (plus:SI (mult:SI (lshiftrt:SI
1049 (match_operand:SI 2 "gpc_reg_operand" "r")
1052 (match_operand:HI 1 "gpc_reg_operand" "r")))
1053 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1055 "macchwu %0, %1, %2"
1056 [(set_attr "type" "imul3")])
1058 (define_insn "*machhwc"
1059 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1060 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1061 (match_operand:SI 1 "gpc_reg_operand" "%r")
1064 (match_operand:SI 2 "gpc_reg_operand" "r")
1066 (match_operand:SI 4 "gpc_reg_operand" "0"))
1068 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1069 (plus:SI (mult:SI (ashiftrt:SI
1077 "machhw. %0, %1, %2"
1078 [(set_attr "type" "imul3")])
1080 (define_insn "*machhw"
1081 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1082 (plus:SI (mult:SI (ashiftrt:SI
1083 (match_operand:SI 1 "gpc_reg_operand" "%r")
1086 (match_operand:SI 2 "gpc_reg_operand" "r")
1088 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1091 [(set_attr "type" "imul3")])
1093 (define_insn "*machhwuc"
1094 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1095 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1096 (match_operand:SI 1 "gpc_reg_operand" "%r")
1099 (match_operand:SI 2 "gpc_reg_operand" "r")
1101 (match_operand:SI 4 "gpc_reg_operand" "0"))
1103 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1104 (plus:SI (mult:SI (lshiftrt:SI
1112 "machhwu. %0, %1, %2"
1113 [(set_attr "type" "imul3")])
1115 (define_insn "*machhwu"
1116 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1117 (plus:SI (mult:SI (lshiftrt:SI
1118 (match_operand:SI 1 "gpc_reg_operand" "%r")
1121 (match_operand:SI 2 "gpc_reg_operand" "r")
1123 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1125 "machhwu %0, %1, %2"
1126 [(set_attr "type" "imul3")])
1128 (define_insn "*maclhwc"
1129 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1130 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1131 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1133 (match_operand:HI 2 "gpc_reg_operand" "r")))
1134 (match_operand:SI 4 "gpc_reg_operand" "0"))
1136 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1137 (plus:SI (mult:SI (sign_extend:SI
1143 "maclhw. %0, %1, %2"
1144 [(set_attr "type" "imul3")])
1146 (define_insn "*maclhw"
1147 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1148 (plus:SI (mult:SI (sign_extend:SI
1149 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1151 (match_operand:HI 2 "gpc_reg_operand" "r")))
1152 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1155 [(set_attr "type" "imul3")])
1157 (define_insn "*maclhwuc"
1158 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1159 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1160 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1162 (match_operand:HI 2 "gpc_reg_operand" "r")))
1163 (match_operand:SI 4 "gpc_reg_operand" "0"))
1165 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1166 (plus:SI (mult:SI (zero_extend:SI
1172 "maclhwu. %0, %1, %2"
1173 [(set_attr "type" "imul3")])
1175 (define_insn "*maclhwu"
1176 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1177 (plus:SI (mult:SI (zero_extend:SI
1178 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1180 (match_operand:HI 2 "gpc_reg_operand" "r")))
1181 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1183 "maclhwu %0, %1, %2"
1184 [(set_attr "type" "imul3")])
1186 (define_insn "*nmacchwc"
1187 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1188 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1189 (mult:SI (ashiftrt:SI
1190 (match_operand:SI 2 "gpc_reg_operand" "r")
1193 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1195 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1196 (minus:SI (match_dup 4)
1197 (mult:SI (ashiftrt:SI
1203 "nmacchw. %0, %1, %2"
1204 [(set_attr "type" "imul3")])
1206 (define_insn "*nmacchw"
1207 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1208 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1209 (mult:SI (ashiftrt:SI
1210 (match_operand:SI 2 "gpc_reg_operand" "r")
1213 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1215 "nmacchw %0, %1, %2"
1216 [(set_attr "type" "imul3")])
1218 (define_insn "*nmachhwc"
1219 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1220 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1221 (mult:SI (ashiftrt:SI
1222 (match_operand:SI 1 "gpc_reg_operand" "%r")
1225 (match_operand:SI 2 "gpc_reg_operand" "r")
1228 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1229 (minus:SI (match_dup 4)
1230 (mult:SI (ashiftrt:SI
1237 "nmachhw. %0, %1, %2"
1238 [(set_attr "type" "imul3")])
1240 (define_insn "*nmachhw"
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 1 "gpc_reg_operand" "%r")
1247 (match_operand:SI 2 "gpc_reg_operand" "r")
1250 "nmachhw %0, %1, %2"
1251 [(set_attr "type" "imul3")])
1253 (define_insn "*nmaclhwc"
1254 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1255 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1256 (mult:SI (sign_extend:SI
1257 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1259 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1261 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1262 (minus:SI (match_dup 4)
1263 (mult:SI (sign_extend:SI
1268 "nmaclhw. %0, %1, %2"
1269 [(set_attr "type" "imul3")])
1271 (define_insn "*nmaclhw"
1272 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1273 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1274 (mult:SI (sign_extend:SI
1275 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1277 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1279 "nmaclhw %0, %1, %2"
1280 [(set_attr "type" "imul3")])
1282 (define_insn "*mulchwc"
1283 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1284 (compare:CC (mult:SI (ashiftrt:SI
1285 (match_operand:SI 2 "gpc_reg_operand" "r")
1288 (match_operand:HI 1 "gpc_reg_operand" "r")))
1290 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1291 (mult:SI (ashiftrt:SI
1297 "mulchw. %0, %1, %2"
1298 [(set_attr "type" "imul3")])
1300 (define_insn "*mulchw"
1301 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1302 (mult:SI (ashiftrt:SI
1303 (match_operand:SI 2 "gpc_reg_operand" "r")
1306 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1309 [(set_attr "type" "imul3")])
1311 (define_insn "*mulchwuc"
1312 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1313 (compare:CC (mult:SI (lshiftrt:SI
1314 (match_operand:SI 2 "gpc_reg_operand" "r")
1317 (match_operand:HI 1 "gpc_reg_operand" "r")))
1319 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1320 (mult:SI (lshiftrt:SI
1326 "mulchwu. %0, %1, %2"
1327 [(set_attr "type" "imul3")])
1329 (define_insn "*mulchwu"
1330 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1331 (mult:SI (lshiftrt:SI
1332 (match_operand:SI 2 "gpc_reg_operand" "r")
1335 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1337 "mulchwu %0, %1, %2"
1338 [(set_attr "type" "imul3")])
1340 (define_insn "*mulhhwc"
1341 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1342 (compare:CC (mult:SI (ashiftrt:SI
1343 (match_operand:SI 1 "gpc_reg_operand" "%r")
1346 (match_operand:SI 2 "gpc_reg_operand" "r")
1349 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1350 (mult:SI (ashiftrt:SI
1357 "mulhhw. %0, %1, %2"
1358 [(set_attr "type" "imul3")])
1360 (define_insn "*mulhhw"
1361 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1362 (mult:SI (ashiftrt:SI
1363 (match_operand:SI 1 "gpc_reg_operand" "%r")
1366 (match_operand:SI 2 "gpc_reg_operand" "r")
1370 [(set_attr "type" "imul3")])
1372 (define_insn "*mulhhwuc"
1373 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1374 (compare:CC (mult:SI (lshiftrt:SI
1375 (match_operand:SI 1 "gpc_reg_operand" "%r")
1378 (match_operand:SI 2 "gpc_reg_operand" "r")
1381 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1382 (mult:SI (lshiftrt:SI
1389 "mulhhwu. %0, %1, %2"
1390 [(set_attr "type" "imul3")])
1392 (define_insn "*mulhhwu"
1393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1394 (mult:SI (lshiftrt:SI
1395 (match_operand:SI 1 "gpc_reg_operand" "%r")
1398 (match_operand:SI 2 "gpc_reg_operand" "r")
1401 "mulhhwu %0, %1, %2"
1402 [(set_attr "type" "imul3")])
1404 (define_insn "*mullhwc"
1405 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1406 (compare:CC (mult:SI (sign_extend:SI
1407 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1409 (match_operand:HI 2 "gpc_reg_operand" "r")))
1411 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1412 (mult:SI (sign_extend:SI
1417 "mullhw. %0, %1, %2"
1418 [(set_attr "type" "imul3")])
1420 (define_insn "*mullhw"
1421 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1422 (mult:SI (sign_extend:SI
1423 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1425 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1428 [(set_attr "type" "imul3")])
1430 (define_insn "*mullhwuc"
1431 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1432 (compare:CC (mult:SI (zero_extend:SI
1433 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1435 (match_operand:HI 2 "gpc_reg_operand" "r")))
1437 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1438 (mult:SI (zero_extend:SI
1443 "mullhwu. %0, %1, %2"
1444 [(set_attr "type" "imul3")])
1446 (define_insn "*mullhwu"
1447 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1448 (mult:SI (zero_extend:SI
1449 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1451 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1453 "mullhwu %0, %1, %2"
1454 [(set_attr "type" "imul3")])
1456 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1457 (define_insn "dlmzb"
1458 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1459 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1460 (match_operand:SI 2 "gpc_reg_operand" "r")]
1462 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1463 (unspec:SI [(match_dup 1)
1467 "dlmzb. %0, %1, %2")
1469 (define_expand "strlensi"
1470 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1471 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1472 (match_operand:QI 2 "const_int_operand" "")
1473 (match_operand 3 "const_int_operand" "")]
1474 UNSPEC_DLMZB_STRLEN))
1475 (clobber (match_scratch:CC 4 "=x"))]
1476 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1478 rtx result = operands[0];
1479 rtx src = operands[1];
1480 rtx search_char = operands[2];
1481 rtx align = operands[3];
1482 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1483 rtx loop_label, end_label, mem, cr0, cond;
1484 if (search_char != const0_rtx
1485 || GET_CODE (align) != CONST_INT
1486 || INTVAL (align) < 8)
1488 word1 = gen_reg_rtx (SImode);
1489 word2 = gen_reg_rtx (SImode);
1490 scratch_dlmzb = gen_reg_rtx (SImode);
1491 scratch_string = gen_reg_rtx (Pmode);
1492 loop_label = gen_label_rtx ();
1493 end_label = gen_label_rtx ();
1494 addr = force_reg (Pmode, XEXP (src, 0));
1495 emit_move_insn (scratch_string, addr);
1496 emit_label (loop_label);
1497 mem = change_address (src, SImode, scratch_string);
1498 emit_move_insn (word1, mem);
1499 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1500 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1501 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1502 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1503 emit_jump_insn (gen_rtx_SET (VOIDmode,
1505 gen_rtx_IF_THEN_ELSE (VOIDmode,
1511 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1512 emit_jump_insn (gen_rtx_SET (VOIDmode,
1514 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1516 emit_label (end_label);
1517 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1518 emit_insn (gen_subsi3 (result, scratch_string, addr));
1519 emit_insn (gen_subsi3 (result, result, const1_rtx));
1524 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1525 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1527 (set (match_operand:SI 0 "gpc_reg_operand" "")
1528 (sign_extend:SI (match_dup 1)))]
1531 (sign_extend:SI (match_dup 1)))
1533 (compare:CC (match_dup 0)
1537 ;; Fixed-point arithmetic insns.
1539 (define_expand "add<mode>3"
1540 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1541 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1542 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1545 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1547 if (non_short_cint_operand (operands[2], DImode))
1550 else if (GET_CODE (operands[2]) == CONST_INT
1551 && ! add_operand (operands[2], <MODE>mode))
1553 rtx tmp = ((!can_create_pseudo_p ()
1554 || rtx_equal_p (operands[0], operands[1]))
1555 ? operands[0] : gen_reg_rtx (<MODE>mode));
1557 HOST_WIDE_INT val = INTVAL (operands[2]);
1558 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1559 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1561 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1564 /* The ordering here is important for the prolog expander.
1565 When space is allocated from the stack, adding 'low' first may
1566 produce a temporary deallocation (which would be bad). */
1567 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1568 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1573 ;; Discourage ai/addic because of carry but provide it in an alternative
1574 ;; allowing register zero as source.
1575 (define_insn "*add<mode>3_internal1"
1576 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1577 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1578 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1579 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1582 {cal %0,%2(%1)|addi %0,%1,%2}
1584 {cau|addis} %0,%1,%v2"
1585 [(set_attr "length" "4,4,4,4")])
1587 (define_insn "addsi3_high"
1588 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1589 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1590 (high:SI (match_operand 2 "" ""))))]
1591 "TARGET_MACHO && !TARGET_64BIT"
1592 "{cau|addis} %0,%1,ha16(%2)"
1593 [(set_attr "length" "4")])
1595 (define_insn "*add<mode>3_internal2"
1596 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1597 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1598 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1600 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1603 {cax.|add.} %3,%1,%2
1604 {ai.|addic.} %3,%1,%2
1607 [(set_attr "type" "fast_compare,compare,compare,compare")
1608 (set_attr "length" "4,4,8,8")])
1611 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1612 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1613 (match_operand:GPR 2 "reg_or_short_operand" ""))
1615 (clobber (match_scratch:GPR 3 ""))]
1618 (plus:GPR (match_dup 1)
1621 (compare:CC (match_dup 3)
1625 (define_insn "*add<mode>3_internal3"
1626 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1627 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1628 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1630 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1631 (plus:P (match_dup 1)
1635 {cax.|add.} %0,%1,%2
1636 {ai.|addic.} %0,%1,%2
1639 [(set_attr "type" "fast_compare,compare,compare,compare")
1640 (set_attr "length" "4,4,8,8")])
1643 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1644 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1645 (match_operand:P 2 "reg_or_short_operand" ""))
1647 (set (match_operand:P 0 "gpc_reg_operand" "")
1648 (plus:P (match_dup 1) (match_dup 2)))]
1651 (plus:P (match_dup 1)
1654 (compare:CC (match_dup 0)
1658 ;; Split an add that we can't do in one insn into two insns, each of which
1659 ;; does one 16-bit part. This is used by combine. Note that the low-order
1660 ;; add should be last in case the result gets used in an address.
1663 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1664 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1665 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1667 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1668 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1670 HOST_WIDE_INT val = INTVAL (operands[2]);
1671 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1672 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1674 operands[4] = GEN_INT (low);
1675 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1676 operands[3] = GEN_INT (rest);
1677 else if (can_create_pseudo_p ())
1679 operands[3] = gen_reg_rtx (DImode);
1680 emit_move_insn (operands[3], operands[2]);
1681 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1688 (define_insn "one_cmpl<mode>2"
1689 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1690 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1695 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1696 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1698 (clobber (match_scratch:P 2 "=r,r"))]
1703 [(set_attr "type" "fast_compare,compare")
1704 (set_attr "length" "4,8")])
1707 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1708 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1710 (clobber (match_scratch:P 2 ""))]
1713 (not:P (match_dup 1)))
1715 (compare:CC (match_dup 2)
1720 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1721 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1723 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1724 (not:P (match_dup 1)))]
1729 [(set_attr "type" "fast_compare,compare")
1730 (set_attr "length" "4,8")])
1733 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1734 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1736 (set (match_operand:P 0 "gpc_reg_operand" "")
1737 (not:P (match_dup 1)))]
1740 (not:P (match_dup 1)))
1742 (compare:CC (match_dup 0)
1747 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1748 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1749 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1751 "{sf%I1|subf%I1c} %0,%2,%1")
1754 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1755 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1756 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1763 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1764 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1765 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1767 (clobber (match_scratch:SI 3 "=r,r"))]
1770 {sf.|subfc.} %3,%2,%1
1772 [(set_attr "type" "compare")
1773 (set_attr "length" "4,8")])
1776 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1777 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1778 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1780 (clobber (match_scratch:P 3 "=r,r"))]
1785 [(set_attr "type" "fast_compare")
1786 (set_attr "length" "4,8")])
1789 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1790 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1791 (match_operand:P 2 "gpc_reg_operand" ""))
1793 (clobber (match_scratch:P 3 ""))]
1796 (minus:P (match_dup 1)
1799 (compare:CC (match_dup 3)
1804 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1805 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1806 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1808 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1809 (minus:SI (match_dup 1) (match_dup 2)))]
1812 {sf.|subfc.} %0,%2,%1
1814 [(set_attr "type" "compare")
1815 (set_attr "length" "4,8")])
1818 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1819 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1820 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1822 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1823 (minus:P (match_dup 1)
1829 [(set_attr "type" "fast_compare")
1830 (set_attr "length" "4,8")])
1833 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1834 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1835 (match_operand:P 2 "gpc_reg_operand" ""))
1837 (set (match_operand:P 0 "gpc_reg_operand" "")
1838 (minus:P (match_dup 1)
1842 (minus:P (match_dup 1)
1845 (compare:CC (match_dup 0)
1849 (define_expand "sub<mode>3"
1850 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1851 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1852 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1856 if (GET_CODE (operands[2]) == CONST_INT)
1858 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1859 negate_rtx (<MODE>mode, operands[2])));
1864 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1865 ;; instruction and some auxiliary computations. Then we just have a single
1866 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1869 (define_expand "sminsi3"
1871 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1872 (match_operand:SI 2 "reg_or_short_operand" ""))
1874 (minus:SI (match_dup 2) (match_dup 1))))
1875 (set (match_operand:SI 0 "gpc_reg_operand" "")
1876 (minus:SI (match_dup 2) (match_dup 3)))]
1877 "TARGET_POWER || TARGET_ISEL"
1882 operands[2] = force_reg (SImode, operands[2]);
1883 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1887 operands[3] = gen_reg_rtx (SImode);
1891 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1892 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1893 (match_operand:SI 2 "reg_or_short_operand" "")))
1894 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1897 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1899 (minus:SI (match_dup 2) (match_dup 1))))
1900 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1903 (define_expand "smaxsi3"
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 (plus:SI (match_dup 3) (match_dup 1)))]
1911 "TARGET_POWER || TARGET_ISEL"
1916 operands[2] = force_reg (SImode, operands[2]);
1917 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1920 operands[3] = gen_reg_rtx (SImode);
1924 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1925 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1926 (match_operand:SI 2 "reg_or_short_operand" "")))
1927 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1930 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1932 (minus:SI (match_dup 2) (match_dup 1))))
1933 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1936 (define_expand "uminsi3"
1937 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1939 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1941 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1943 (minus:SI (match_dup 4) (match_dup 3))))
1944 (set (match_operand:SI 0 "gpc_reg_operand" "")
1945 (minus:SI (match_dup 2) (match_dup 3)))]
1946 "TARGET_POWER || TARGET_ISEL"
1951 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1954 operands[3] = gen_reg_rtx (SImode);
1955 operands[4] = gen_reg_rtx (SImode);
1956 operands[5] = GEN_INT (-2147483647 - 1);
1959 (define_expand "umaxsi3"
1960 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1962 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1964 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1966 (minus:SI (match_dup 4) (match_dup 3))))
1967 (set (match_operand:SI 0 "gpc_reg_operand" "")
1968 (plus:SI (match_dup 3) (match_dup 1)))]
1969 "TARGET_POWER || TARGET_ISEL"
1974 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1977 operands[3] = gen_reg_rtx (SImode);
1978 operands[4] = gen_reg_rtx (SImode);
1979 operands[5] = GEN_INT (-2147483647 - 1);
1983 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1984 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1985 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1987 (minus:SI (match_dup 2) (match_dup 1))))]
1992 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1994 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1995 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1997 (minus:SI (match_dup 2) (match_dup 1)))
1999 (clobber (match_scratch:SI 3 "=r,r"))]
2004 [(set_attr "type" "delayed_compare")
2005 (set_attr "length" "4,8")])
2008 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2010 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2011 (match_operand:SI 2 "reg_or_short_operand" ""))
2013 (minus:SI (match_dup 2) (match_dup 1)))
2015 (clobber (match_scratch:SI 3 ""))]
2016 "TARGET_POWER && reload_completed"
2018 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2020 (minus:SI (match_dup 2) (match_dup 1))))
2022 (compare:CC (match_dup 3)
2027 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2029 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2030 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2032 (minus:SI (match_dup 2) (match_dup 1)))
2034 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2035 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2037 (minus:SI (match_dup 2) (match_dup 1))))]
2042 [(set_attr "type" "delayed_compare")
2043 (set_attr "length" "4,8")])
2046 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2048 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2049 (match_operand:SI 2 "reg_or_short_operand" ""))
2051 (minus:SI (match_dup 2) (match_dup 1)))
2053 (set (match_operand:SI 0 "gpc_reg_operand" "")
2054 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2056 (minus:SI (match_dup 2) (match_dup 1))))]
2057 "TARGET_POWER && reload_completed"
2059 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2061 (minus:SI (match_dup 2) (match_dup 1))))
2063 (compare:CC (match_dup 0)
2067 ;; We don't need abs with condition code because such comparisons should
2069 (define_expand "abssi2"
2070 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2071 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2077 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2080 else if (! TARGET_POWER)
2082 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2087 (define_insn "*abssi2_power"
2088 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2089 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2093 (define_insn_and_split "abs<mode>2_isel"
2094 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2095 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2096 (clobber (match_scratch:GPR 2 "=&b"))
2097 (clobber (match_scratch:CC 3 "=y"))]
2100 "&& reload_completed"
2101 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2103 (compare:CC (match_dup 1)
2106 (if_then_else:GPR (ge (match_dup 3)
2112 (define_insn_and_split "nabs<mode>2_isel"
2113 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2114 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2115 (clobber (match_scratch:GPR 2 "=&b"))
2116 (clobber (match_scratch:CC 3 "=y"))]
2119 "&& reload_completed"
2120 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2122 (compare:CC (match_dup 1)
2125 (if_then_else:GPR (ge (match_dup 3)
2131 (define_insn_and_split "abssi2_nopower"
2132 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2133 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2134 (clobber (match_scratch:SI 2 "=&r,&r"))]
2135 "! TARGET_POWER && ! TARGET_ISEL"
2137 "&& reload_completed"
2138 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2139 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2140 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2143 (define_insn "*nabs_power"
2144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2145 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2149 (define_insn_and_split "*nabs_nopower"
2150 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2151 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2152 (clobber (match_scratch:SI 2 "=&r,&r"))]
2155 "&& reload_completed"
2156 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2157 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2158 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2161 (define_expand "neg<mode>2"
2162 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2163 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2167 (define_insn "*neg<mode>2_internal"
2168 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2169 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2174 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2175 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2177 (clobber (match_scratch:P 2 "=r,r"))]
2182 [(set_attr "type" "fast_compare")
2183 (set_attr "length" "4,8")])
2186 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2187 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2189 (clobber (match_scratch:P 2 ""))]
2192 (neg:P (match_dup 1)))
2194 (compare:CC (match_dup 2)
2199 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2200 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2202 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2203 (neg:P (match_dup 1)))]
2208 [(set_attr "type" "fast_compare")
2209 (set_attr "length" "4,8")])
2212 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2213 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2215 (set (match_operand:P 0 "gpc_reg_operand" "")
2216 (neg:P (match_dup 1)))]
2219 (neg:P (match_dup 1)))
2221 (compare:CC (match_dup 0)
2225 (define_insn "clz<mode>2"
2226 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2227 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2229 "{cntlz|cntlz<wd>} %0,%1"
2230 [(set_attr "type" "cntlz")])
2232 (define_expand "ctz<mode>2"
2234 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2235 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2237 (clobber (scratch:CC))])
2238 (set (match_dup 4) (clz:GPR (match_dup 3)))
2239 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2240 (minus:GPR (match_dup 5) (match_dup 4)))]
2243 operands[2] = gen_reg_rtx (<MODE>mode);
2244 operands[3] = gen_reg_rtx (<MODE>mode);
2245 operands[4] = gen_reg_rtx (<MODE>mode);
2246 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2249 (define_expand "ffs<mode>2"
2251 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2252 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2254 (clobber (scratch:CC))])
2255 (set (match_dup 4) (clz:GPR (match_dup 3)))
2256 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2257 (minus:GPR (match_dup 5) (match_dup 4)))]
2260 operands[2] = gen_reg_rtx (<MODE>mode);
2261 operands[3] = gen_reg_rtx (<MODE>mode);
2262 operands[4] = gen_reg_rtx (<MODE>mode);
2263 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2266 (define_insn "popcntb<mode>2"
2267 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2268 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2273 (define_insn "popcntwsi2"
2274 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2275 (popcount:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2279 (define_insn "popcntddi2"
2280 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2281 (popcount:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
2282 "TARGET_POPCNTD && TARGET_POWERPC64"
2285 (define_expand "popcount<mode>2"
2286 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2287 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2288 "TARGET_POPCNTB || TARGET_POPCNTD"
2290 rs6000_emit_popcount (operands[0], operands[1]);
2294 (define_expand "parity<mode>2"
2295 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2296 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2299 rs6000_emit_parity (operands[0], operands[1]);
2303 ;; Since the hardware zeros the upper part of the register, save generating the
2304 ;; AND immediate if we are converting to unsigned
2305 (define_insn "*bswaphi2_extenddi"
2306 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2308 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2311 [(set_attr "length" "4")
2312 (set_attr "type" "load")])
2314 (define_insn "*bswaphi2_extendsi"
2315 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2317 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2320 [(set_attr "length" "4")
2321 (set_attr "type" "load")])
2323 (define_expand "bswaphi2"
2324 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2326 (match_operand:HI 1 "reg_or_mem_operand" "")))
2327 (clobber (match_scratch:SI 2 ""))])]
2330 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2331 operands[1] = force_reg (HImode, operands[1]);
2334 (define_insn "bswaphi2_internal"
2335 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2337 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2338 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2344 [(set_attr "length" "4,4,12")
2345 (set_attr "type" "load,store,*")])
2348 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2349 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2350 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2351 "TARGET_POWERPC && reload_completed"
2353 (zero_extract:SI (match_dup 4)
2357 (and:SI (ashift:SI (match_dup 4)
2359 (const_int 65280))) ;; 0xff00
2361 (ior:SI (match_dup 3)
2365 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2366 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2369 (define_insn "*bswapsi2_extenddi"
2370 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2372 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2375 [(set_attr "length" "4")
2376 (set_attr "type" "load")])
2378 (define_expand "bswapsi2"
2379 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2381 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2384 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2385 operands[1] = force_reg (SImode, operands[1]);
2388 (define_insn "*bswapsi2_internal"
2389 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2391 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2395 {stbrx|stwbrx} %1,%y0
2397 [(set_attr "length" "4,4,12")
2398 (set_attr "type" "load,store,*")])
2401 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2402 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2405 (rotate:SI (match_dup 1) (const_int 8)))
2406 (set (zero_extract:SI (match_dup 0)
2410 (set (zero_extract:SI (match_dup 0)
2413 (rotate:SI (match_dup 1)
2417 (define_expand "bswapdi2"
2418 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2420 (match_operand:DI 1 "reg_or_mem_operand" "")))
2421 (clobber (match_scratch:DI 2 ""))
2422 (clobber (match_scratch:DI 3 ""))
2423 (clobber (match_scratch:DI 4 ""))])]
2426 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2427 operands[1] = force_reg (DImode, operands[1]);
2429 if (!TARGET_POWERPC64)
2431 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2432 that uses 64-bit registers needs the same scratch registers as 64-bit
2434 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2439 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2440 (define_insn "*bswapdi2_ldbrx"
2441 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2442 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2443 (clobber (match_scratch:DI 2 "=X,X,&r"))
2444 (clobber (match_scratch:DI 3 "=X,X,&r"))
2445 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2446 "TARGET_POWERPC64 && TARGET_LDBRX
2447 && (REG_P (operands[0]) || REG_P (operands[1]))"
2452 [(set_attr "length" "4,4,36")
2453 (set_attr "type" "load,store,*")])
2455 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2456 (define_insn "*bswapdi2_64bit"
2457 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2458 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2459 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2460 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2461 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2462 "TARGET_POWERPC64 && !TARGET_LDBRX
2463 && (REG_P (operands[0]) || REG_P (operands[1]))"
2465 [(set_attr "length" "16,12,36")])
2468 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2469 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2470 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2471 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2472 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2473 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2477 rtx dest = operands[0];
2478 rtx src = operands[1];
2479 rtx op2 = operands[2];
2480 rtx op3 = operands[3];
2481 rtx op4 = operands[4];
2482 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2483 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2489 addr1 = XEXP (src, 0);
2490 if (GET_CODE (addr1) == PLUS)
2492 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2493 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2497 emit_move_insn (op2, GEN_INT (4));
2498 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2501 if (BYTES_BIG_ENDIAN)
2503 word_high = change_address (src, SImode, addr1);
2504 word_low = change_address (src, SImode, addr2);
2508 word_high = change_address (src, SImode, addr2);
2509 word_low = change_address (src, SImode, addr1);
2512 emit_insn (gen_bswapsi2 (op3_32, word_low));
2513 emit_insn (gen_bswapsi2 (op4_32, word_high));
2514 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2515 emit_insn (gen_iordi3 (dest, dest, op4));
2519 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2520 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2521 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2522 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2523 (clobber (match_operand:DI 4 "" ""))]
2524 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2528 rtx dest = operands[0];
2529 rtx src = operands[1];
2530 rtx op2 = operands[2];
2531 rtx op3 = operands[3];
2532 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2533 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2539 addr1 = XEXP (dest, 0);
2540 if (GET_CODE (addr1) == PLUS)
2542 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2543 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2547 emit_move_insn (op2, GEN_INT (4));
2548 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2551 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2552 if (BYTES_BIG_ENDIAN)
2554 word_high = change_address (dest, SImode, addr1);
2555 word_low = change_address (dest, SImode, addr2);
2556 emit_insn (gen_bswapsi2 (word_high, src_si));
2557 emit_insn (gen_bswapsi2 (word_low, op3_si));
2561 word_high = change_address (dest, SImode, addr2);
2562 word_low = change_address (dest, SImode, addr1);
2563 emit_insn (gen_bswapsi2 (word_low, src_si));
2564 emit_insn (gen_bswapsi2 (word_high, op3_si));
2569 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2570 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2571 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2572 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2573 (clobber (match_operand:DI 4 "" ""))]
2574 "TARGET_POWERPC64 && reload_completed"
2578 rtx dest = operands[0];
2579 rtx src = operands[1];
2580 rtx op2 = operands[2];
2581 rtx op3 = operands[3];
2582 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2583 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2584 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2585 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2587 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2588 emit_insn (gen_bswapsi2 (dest_si, src_si));
2589 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2590 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2591 emit_insn (gen_iordi3 (dest, dest, op3));
2594 (define_insn "bswapdi2_32bit"
2595 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2596 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2597 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2598 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2600 [(set_attr "length" "16,12,36")])
2603 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2604 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2605 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2606 "!TARGET_POWERPC64 && reload_completed"
2610 rtx dest = operands[0];
2611 rtx src = operands[1];
2612 rtx op2 = operands[2];
2613 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2614 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2620 addr1 = XEXP (src, 0);
2621 if (GET_CODE (addr1) == PLUS)
2623 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2624 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2628 emit_move_insn (op2, GEN_INT (4));
2629 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2632 if (BYTES_BIG_ENDIAN)
2634 word_high = change_address (src, SImode, addr1);
2635 word_low = change_address (src, SImode, addr2);
2639 word_high = change_address (src, SImode, addr2);
2640 word_low = change_address (src, SImode, addr1);
2643 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2644 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2648 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2649 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2650 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2651 "!TARGET_POWERPC64 && reload_completed"
2655 rtx dest = operands[0];
2656 rtx src = operands[1];
2657 rtx op2 = operands[2];
2658 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2659 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2665 addr1 = XEXP (dest, 0);
2666 if (GET_CODE (addr1) == PLUS)
2668 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2669 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2673 emit_move_insn (op2, GEN_INT (4));
2674 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2677 if (BYTES_BIG_ENDIAN)
2679 word_high = change_address (dest, SImode, addr1);
2680 word_low = change_address (dest, SImode, addr2);
2684 word_high = change_address (dest, SImode, addr2);
2685 word_low = change_address (dest, SImode, addr1);
2688 emit_insn (gen_bswapsi2 (word_high, src_low));
2689 emit_insn (gen_bswapsi2 (word_low, src_high));
2693 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2694 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2695 (clobber (match_operand:SI 2 "" ""))]
2696 "!TARGET_POWERPC64 && reload_completed"
2700 rtx dest = operands[0];
2701 rtx src = operands[1];
2702 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2703 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2704 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2705 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2707 emit_insn (gen_bswapsi2 (dest_high, src_low));
2708 emit_insn (gen_bswapsi2 (dest_low, src_high));
2711 (define_expand "mulsi3"
2712 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2713 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2714 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2719 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2721 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2725 (define_insn "mulsi3_mq"
2726 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2727 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2728 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2729 (clobber (match_scratch:SI 3 "=q,q"))]
2732 {muls|mullw} %0,%1,%2
2733 {muli|mulli} %0,%1,%2"
2735 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2736 (const_string "imul3")
2737 (match_operand:SI 2 "short_cint_operand" "")
2738 (const_string "imul2")]
2739 (const_string "imul")))])
2741 (define_insn "mulsi3_no_mq"
2742 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2743 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2744 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2747 {muls|mullw} %0,%1,%2
2748 {muli|mulli} %0,%1,%2"
2750 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2751 (const_string "imul3")
2752 (match_operand:SI 2 "short_cint_operand" "")
2753 (const_string "imul2")]
2754 (const_string "imul")))])
2756 (define_insn "*mulsi3_mq_internal1"
2757 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2758 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2759 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2761 (clobber (match_scratch:SI 3 "=r,r"))
2762 (clobber (match_scratch:SI 4 "=q,q"))]
2765 {muls.|mullw.} %3,%1,%2
2767 [(set_attr "type" "imul_compare")
2768 (set_attr "length" "4,8")])
2771 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2772 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2773 (match_operand:SI 2 "gpc_reg_operand" ""))
2775 (clobber (match_scratch:SI 3 ""))
2776 (clobber (match_scratch:SI 4 ""))]
2777 "TARGET_POWER && reload_completed"
2778 [(parallel [(set (match_dup 3)
2779 (mult:SI (match_dup 1) (match_dup 2)))
2780 (clobber (match_dup 4))])
2782 (compare:CC (match_dup 3)
2786 (define_insn "*mulsi3_no_mq_internal1"
2787 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2788 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2789 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2791 (clobber (match_scratch:SI 3 "=r,r"))]
2794 {muls.|mullw.} %3,%1,%2
2796 [(set_attr "type" "imul_compare")
2797 (set_attr "length" "4,8")])
2800 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2801 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2802 (match_operand:SI 2 "gpc_reg_operand" ""))
2804 (clobber (match_scratch:SI 3 ""))]
2805 "! TARGET_POWER && reload_completed"
2807 (mult:SI (match_dup 1) (match_dup 2)))
2809 (compare:CC (match_dup 3)
2813 (define_insn "*mulsi3_mq_internal2"
2814 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2815 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2816 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2818 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2819 (mult:SI (match_dup 1) (match_dup 2)))
2820 (clobber (match_scratch:SI 4 "=q,q"))]
2823 {muls.|mullw.} %0,%1,%2
2825 [(set_attr "type" "imul_compare")
2826 (set_attr "length" "4,8")])
2829 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2830 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2831 (match_operand:SI 2 "gpc_reg_operand" ""))
2833 (set (match_operand:SI 0 "gpc_reg_operand" "")
2834 (mult:SI (match_dup 1) (match_dup 2)))
2835 (clobber (match_scratch:SI 4 ""))]
2836 "TARGET_POWER && reload_completed"
2837 [(parallel [(set (match_dup 0)
2838 (mult:SI (match_dup 1) (match_dup 2)))
2839 (clobber (match_dup 4))])
2841 (compare:CC (match_dup 0)
2845 (define_insn "*mulsi3_no_mq_internal2"
2846 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2847 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2848 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2850 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2851 (mult:SI (match_dup 1) (match_dup 2)))]
2854 {muls.|mullw.} %0,%1,%2
2856 [(set_attr "type" "imul_compare")
2857 (set_attr "length" "4,8")])
2860 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2861 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2862 (match_operand:SI 2 "gpc_reg_operand" ""))
2864 (set (match_operand:SI 0 "gpc_reg_operand" "")
2865 (mult:SI (match_dup 1) (match_dup 2)))]
2866 "! TARGET_POWER && reload_completed"
2868 (mult:SI (match_dup 1) (match_dup 2)))
2870 (compare:CC (match_dup 0)
2874 ;; Operand 1 is divided by operand 2; quotient goes to operand
2875 ;; 0 and remainder to operand 3.
2876 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2878 (define_expand "divmodsi4"
2879 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2880 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2881 (match_operand:SI 2 "gpc_reg_operand" "")))
2882 (set (match_operand:SI 3 "register_operand" "")
2883 (mod:SI (match_dup 1) (match_dup 2)))])]
2884 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2887 if (! TARGET_POWER && ! TARGET_POWERPC)
2889 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2890 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2891 emit_insn (gen_divss_call ());
2892 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2893 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2898 (define_insn "*divmodsi4_internal"
2899 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2900 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2901 (match_operand:SI 2 "gpc_reg_operand" "r")))
2902 (set (match_operand:SI 3 "register_operand" "=q")
2903 (mod:SI (match_dup 1) (match_dup 2)))]
2906 [(set_attr "type" "idiv")])
2908 (define_expand "udiv<mode>3"
2909 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2910 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2911 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2912 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2915 if (! TARGET_POWER && ! TARGET_POWERPC)
2917 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2918 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2919 emit_insn (gen_quous_call ());
2920 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2923 else if (TARGET_POWER)
2925 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2930 (define_insn "udivsi3_mq"
2931 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2932 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2933 (match_operand:SI 2 "gpc_reg_operand" "r")))
2934 (clobber (match_scratch:SI 3 "=q"))]
2935 "TARGET_POWERPC && TARGET_POWER"
2937 [(set_attr "type" "idiv")])
2939 (define_insn "*udivsi3_no_mq"
2940 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2941 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2942 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2943 "TARGET_POWERPC && ! TARGET_POWER"
2946 (cond [(match_operand:SI 0 "" "")
2947 (const_string "idiv")]
2948 (const_string "ldiv")))])
2951 ;; For powers of two we can do srai/aze for divide and then adjust for
2952 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2953 ;; used; for PowerPC, force operands into register and do a normal divide;
2954 ;; for AIX common-mode, use quoss call on register operands.
2955 (define_expand "div<mode>3"
2956 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2957 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2958 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2962 if (GET_CODE (operands[2]) == CONST_INT
2963 && INTVAL (operands[2]) > 0
2964 && exact_log2 (INTVAL (operands[2])) >= 0)
2966 else if (TARGET_POWERPC)
2968 operands[2] = force_reg (<MODE>mode, operands[2]);
2971 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2975 else if (TARGET_POWER)
2979 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2980 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2981 emit_insn (gen_quoss_call ());
2982 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2987 (define_insn "divsi3_mq"
2988 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2989 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2990 (match_operand:SI 2 "gpc_reg_operand" "r")))
2991 (clobber (match_scratch:SI 3 "=q"))]
2992 "TARGET_POWERPC && TARGET_POWER"
2994 [(set_attr "type" "idiv")])
2996 (define_insn "*div<mode>3_no_mq"
2997 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2998 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2999 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3000 "TARGET_POWERPC && ! TARGET_POWER"
3003 (cond [(match_operand:SI 0 "" "")
3004 (const_string "idiv")]
3005 (const_string "ldiv")))])
3007 (define_expand "mod<mode>3"
3008 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
3009 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
3010 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3018 if (GET_CODE (operands[2]) != CONST_INT
3019 || INTVAL (operands[2]) <= 0
3020 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3023 temp1 = gen_reg_rtx (<MODE>mode);
3024 temp2 = gen_reg_rtx (<MODE>mode);
3026 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3027 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3028 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3033 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3034 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3035 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3037 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3038 [(set_attr "type" "two")
3039 (set_attr "length" "8")])
3042 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3043 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3044 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3046 (clobber (match_scratch:P 3 "=r,r"))]
3049 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3051 [(set_attr "type" "compare")
3052 (set_attr "length" "8,12")
3053 (set_attr "cell_micro" "not")])
3056 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3057 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3058 (match_operand:GPR 2 "exact_log2_cint_operand"
3061 (clobber (match_scratch:GPR 3 ""))]
3064 (div:<MODE> (match_dup 1) (match_dup 2)))
3066 (compare:CC (match_dup 3)
3071 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3072 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3073 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3075 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3076 (div:P (match_dup 1) (match_dup 2)))]
3079 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3081 [(set_attr "type" "compare")
3082 (set_attr "length" "8,12")
3083 (set_attr "cell_micro" "not")])
3086 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3087 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3088 (match_operand:GPR 2 "exact_log2_cint_operand"
3091 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3092 (div:GPR (match_dup 1) (match_dup 2)))]
3095 (div:<MODE> (match_dup 1) (match_dup 2)))
3097 (compare:CC (match_dup 0)
3102 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3105 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3107 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3108 (match_operand:SI 3 "gpc_reg_operand" "r")))
3109 (set (match_operand:SI 2 "register_operand" "=*q")
3112 (zero_extend:DI (match_dup 1)) (const_int 32))
3113 (zero_extend:DI (match_dup 4)))
3117 [(set_attr "type" "idiv")])
3119 ;; To do unsigned divide we handle the cases of the divisor looking like a
3120 ;; negative number. If it is a constant that is less than 2**31, we don't
3121 ;; have to worry about the branches. So make a few subroutines here.
3123 ;; First comes the normal case.
3124 (define_expand "udivmodsi4_normal"
3125 [(set (match_dup 4) (const_int 0))
3126 (parallel [(set (match_operand:SI 0 "" "")
3127 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3129 (zero_extend:DI (match_operand:SI 1 "" "")))
3130 (match_operand:SI 2 "" "")))
3131 (set (match_operand:SI 3 "" "")
3132 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3134 (zero_extend:DI (match_dup 1)))
3138 { operands[4] = gen_reg_rtx (SImode); }")
3140 ;; This handles the branches.
3141 (define_expand "udivmodsi4_tests"
3142 [(set (match_operand:SI 0 "" "") (const_int 0))
3143 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3144 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3145 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3146 (label_ref (match_operand:SI 4 "" "")) (pc)))
3147 (set (match_dup 0) (const_int 1))
3148 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3149 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3150 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3151 (label_ref (match_dup 4)) (pc)))]
3154 { operands[5] = gen_reg_rtx (CCUNSmode);
3155 operands[6] = gen_reg_rtx (CCmode);
3158 (define_expand "udivmodsi4"
3159 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3160 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3161 (match_operand:SI 2 "reg_or_cint_operand" "")))
3162 (set (match_operand:SI 3 "gpc_reg_operand" "")
3163 (umod:SI (match_dup 1) (match_dup 2)))])]
3171 if (! TARGET_POWERPC)
3173 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3174 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3175 emit_insn (gen_divus_call ());
3176 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3177 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3184 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3186 operands[2] = force_reg (SImode, operands[2]);
3187 label = gen_label_rtx ();
3188 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3189 operands[3], label));
3192 operands[2] = force_reg (SImode, operands[2]);
3194 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3202 ;; AIX architecture-independent common-mode multiply (DImode),
3203 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3204 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3205 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3206 ;; assumed unused if generating common-mode, so ignore.
3207 (define_insn "mulh_call"
3210 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3211 (sign_extend:DI (reg:SI 4)))
3213 (clobber (reg:SI LR_REGNO))]
3214 "! TARGET_POWER && ! TARGET_POWERPC"
3216 [(set_attr "type" "imul")])
3218 (define_insn "mull_call"
3220 (mult:DI (sign_extend:DI (reg:SI 3))
3221 (sign_extend:DI (reg:SI 4))))
3222 (clobber (reg:SI LR_REGNO))
3223 (clobber (reg:SI 0))]
3224 "! TARGET_POWER && ! TARGET_POWERPC"
3226 [(set_attr "type" "imul")])
3228 (define_insn "divss_call"
3230 (div:SI (reg:SI 3) (reg:SI 4)))
3232 (mod:SI (reg:SI 3) (reg:SI 4)))
3233 (clobber (reg:SI LR_REGNO))
3234 (clobber (reg:SI 0))]
3235 "! TARGET_POWER && ! TARGET_POWERPC"
3237 [(set_attr "type" "idiv")])
3239 (define_insn "divus_call"
3241 (udiv:SI (reg:SI 3) (reg:SI 4)))
3243 (umod:SI (reg:SI 3) (reg:SI 4)))
3244 (clobber (reg:SI LR_REGNO))
3245 (clobber (reg:SI 0))
3246 (clobber (match_scratch:CC 0 "=x"))
3247 (clobber (reg:CC CR1_REGNO))]
3248 "! TARGET_POWER && ! TARGET_POWERPC"
3250 [(set_attr "type" "idiv")])
3252 (define_insn "quoss_call"
3254 (div:SI (reg:SI 3) (reg:SI 4)))
3255 (clobber (reg:SI LR_REGNO))]
3256 "! TARGET_POWER && ! TARGET_POWERPC"
3258 [(set_attr "type" "idiv")])
3260 (define_insn "quous_call"
3262 (udiv:SI (reg:SI 3) (reg:SI 4)))
3263 (clobber (reg:SI LR_REGNO))
3264 (clobber (reg:SI 0))
3265 (clobber (match_scratch:CC 0 "=x"))
3266 (clobber (reg:CC CR1_REGNO))]
3267 "! TARGET_POWER && ! TARGET_POWERPC"
3269 [(set_attr "type" "idiv")])
3271 ;; Logical instructions
3272 ;; The logical instructions are mostly combined by using match_operator,
3273 ;; but the plain AND insns are somewhat different because there is no
3274 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3275 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3277 (define_expand "andsi3"
3279 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3280 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3281 (match_operand:SI 2 "and_operand" "")))
3282 (clobber (match_scratch:CC 3 ""))])]
3286 (define_insn "andsi3_mc"
3287 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3288 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3289 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3290 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3291 "rs6000_gen_cell_microcode"
3294 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3295 {andil.|andi.} %0,%1,%b2
3296 {andiu.|andis.} %0,%1,%u2"
3297 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3299 (define_insn "andsi3_nomc"
3300 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3301 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3302 (match_operand:SI 2 "and_operand" "?r,T")))
3303 (clobber (match_scratch:CC 3 "=X,X"))]
3304 "!rs6000_gen_cell_microcode"
3307 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3309 (define_insn "andsi3_internal0_nomc"
3310 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3311 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3312 (match_operand:SI 2 "and_operand" "?r,T")))]
3313 "!rs6000_gen_cell_microcode"
3316 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3319 ;; Note to set cr's other than cr0 we do the and immediate and then
3320 ;; the test again -- this avoids a mfcr which on the higher end
3321 ;; machines causes an execution serialization
3323 (define_insn "*andsi3_internal2_mc"
3324 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3325 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3326 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3328 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3329 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3330 "TARGET_32BIT && rs6000_gen_cell_microcode"
3333 {andil.|andi.} %3,%1,%b2
3334 {andiu.|andis.} %3,%1,%u2
3335 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3340 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3341 compare,compare,compare,compare")
3342 (set_attr "length" "4,4,4,4,8,8,8,8")])
3344 (define_insn "*andsi3_internal3_mc"
3345 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3346 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3347 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3349 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3350 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3351 "TARGET_64BIT && rs6000_gen_cell_microcode"
3354 {andil.|andi.} %3,%1,%b2
3355 {andiu.|andis.} %3,%1,%u2
3356 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3361 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3362 compare,compare,compare")
3363 (set_attr "length" "8,4,4,4,8,8,8,8")])
3366 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3367 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3368 (match_operand:GPR 2 "and_operand" ""))
3370 (clobber (match_scratch:GPR 3 ""))
3371 (clobber (match_scratch:CC 4 ""))]
3373 [(parallel [(set (match_dup 3)
3374 (and:<MODE> (match_dup 1)
3376 (clobber (match_dup 4))])
3378 (compare:CC (match_dup 3)
3382 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3383 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3386 [(set (match_operand:CC 0 "cc_reg_operand" "")
3387 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3388 (match_operand:SI 2 "gpc_reg_operand" ""))
3390 (clobber (match_scratch:SI 3 ""))
3391 (clobber (match_scratch:CC 4 ""))]
3392 "TARGET_POWERPC64 && reload_completed"
3393 [(parallel [(set (match_dup 3)
3394 (and:SI (match_dup 1)
3396 (clobber (match_dup 4))])
3398 (compare:CC (match_dup 3)
3402 (define_insn "*andsi3_internal4"
3403 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3404 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3405 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3407 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3408 (and:SI (match_dup 1)
3410 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3411 "TARGET_32BIT && rs6000_gen_cell_microcode"
3414 {andil.|andi.} %0,%1,%b2
3415 {andiu.|andis.} %0,%1,%u2
3416 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3421 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3422 compare,compare,compare,compare")
3423 (set_attr "length" "4,4,4,4,8,8,8,8")])
3425 (define_insn "*andsi3_internal5_mc"
3426 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3427 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3428 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3430 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3431 (and:SI (match_dup 1)
3433 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3434 "TARGET_64BIT && rs6000_gen_cell_microcode"
3437 {andil.|andi.} %0,%1,%b2
3438 {andiu.|andis.} %0,%1,%u2
3439 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3444 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3445 compare,compare,compare")
3446 (set_attr "length" "8,4,4,4,8,8,8,8")])
3449 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3450 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3451 (match_operand:SI 2 "and_operand" ""))
3453 (set (match_operand:SI 0 "gpc_reg_operand" "")
3454 (and:SI (match_dup 1)
3456 (clobber (match_scratch:CC 4 ""))]
3458 [(parallel [(set (match_dup 0)
3459 (and:SI (match_dup 1)
3461 (clobber (match_dup 4))])
3463 (compare:CC (match_dup 0)
3468 [(set (match_operand:CC 3 "cc_reg_operand" "")
3469 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3470 (match_operand:SI 2 "gpc_reg_operand" ""))
3472 (set (match_operand:SI 0 "gpc_reg_operand" "")
3473 (and:SI (match_dup 1)
3475 (clobber (match_scratch:CC 4 ""))]
3476 "TARGET_POWERPC64 && reload_completed"
3477 [(parallel [(set (match_dup 0)
3478 (and:SI (match_dup 1)
3480 (clobber (match_dup 4))])
3482 (compare:CC (match_dup 0)
3486 ;; Handle the PowerPC64 rlwinm corner case
3488 (define_insn_and_split "*andsi3_internal6"
3489 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3490 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3491 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3496 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3499 (rotate:SI (match_dup 0) (match_dup 5)))]
3502 int mb = extract_MB (operands[2]);
3503 int me = extract_ME (operands[2]);
3504 operands[3] = GEN_INT (me + 1);
3505 operands[5] = GEN_INT (32 - (me + 1));
3506 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3508 [(set_attr "length" "8")])
3510 (define_expand "iorsi3"
3511 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3512 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3513 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3517 if (GET_CODE (operands[2]) == CONST_INT
3518 && ! logical_operand (operands[2], SImode))
3520 HOST_WIDE_INT value = INTVAL (operands[2]);
3521 rtx tmp = ((!can_create_pseudo_p ()
3522 || rtx_equal_p (operands[0], operands[1]))
3523 ? operands[0] : gen_reg_rtx (SImode));
3525 emit_insn (gen_iorsi3 (tmp, operands[1],
3526 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3527 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3532 (define_expand "xorsi3"
3533 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3534 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3535 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3539 if (GET_CODE (operands[2]) == CONST_INT
3540 && ! logical_operand (operands[2], SImode))
3542 HOST_WIDE_INT value = INTVAL (operands[2]);
3543 rtx tmp = ((!can_create_pseudo_p ()
3544 || rtx_equal_p (operands[0], operands[1]))
3545 ? operands[0] : gen_reg_rtx (SImode));
3547 emit_insn (gen_xorsi3 (tmp, operands[1],
3548 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3549 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3554 (define_insn "*boolsi3_internal1"
3555 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3556 (match_operator:SI 3 "boolean_or_operator"
3557 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3558 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3562 {%q3il|%q3i} %0,%1,%b2
3563 {%q3iu|%q3is} %0,%1,%u2")
3565 (define_insn "*boolsi3_internal2"
3566 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3567 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3568 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3569 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3571 (clobber (match_scratch:SI 3 "=r,r"))]
3576 [(set_attr "type" "fast_compare,compare")
3577 (set_attr "length" "4,8")])
3580 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3581 (compare:CC (match_operator:SI 4 "boolean_operator"
3582 [(match_operand:SI 1 "gpc_reg_operand" "")
3583 (match_operand:SI 2 "gpc_reg_operand" "")])
3585 (clobber (match_scratch:SI 3 ""))]
3586 "TARGET_32BIT && reload_completed"
3587 [(set (match_dup 3) (match_dup 4))
3589 (compare:CC (match_dup 3)
3593 (define_insn "*boolsi3_internal3"
3594 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3595 (compare:CC (match_operator:SI 4 "boolean_operator"
3596 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3597 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3599 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3605 [(set_attr "type" "fast_compare,compare")
3606 (set_attr "length" "4,8")])
3609 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3610 (compare:CC (match_operator:SI 4 "boolean_operator"
3611 [(match_operand:SI 1 "gpc_reg_operand" "")
3612 (match_operand:SI 2 "gpc_reg_operand" "")])
3614 (set (match_operand:SI 0 "gpc_reg_operand" "")
3616 "TARGET_32BIT && reload_completed"
3617 [(set (match_dup 0) (match_dup 4))
3619 (compare:CC (match_dup 0)
3623 ;; Split a logical operation that we can't do in one insn into two insns,
3624 ;; each of which does one 16-bit part. This is used by combine.
3627 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3628 (match_operator:SI 3 "boolean_or_operator"
3629 [(match_operand:SI 1 "gpc_reg_operand" "")
3630 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3632 [(set (match_dup 0) (match_dup 4))
3633 (set (match_dup 0) (match_dup 5))]
3637 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3638 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3640 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3641 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3645 (define_insn "*boolcsi3_internal1"
3646 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3647 (match_operator:SI 3 "boolean_operator"
3648 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3649 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3653 (define_insn "*boolcsi3_internal2"
3654 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3655 (compare:CC (match_operator:SI 4 "boolean_operator"
3656 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3657 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3659 (clobber (match_scratch:SI 3 "=r,r"))]
3664 [(set_attr "type" "compare")
3665 (set_attr "length" "4,8")])
3668 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3669 (compare:CC (match_operator:SI 4 "boolean_operator"
3670 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3671 (match_operand:SI 2 "gpc_reg_operand" "")])
3673 (clobber (match_scratch:SI 3 ""))]
3674 "TARGET_32BIT && reload_completed"
3675 [(set (match_dup 3) (match_dup 4))
3677 (compare:CC (match_dup 3)
3681 (define_insn "*boolcsi3_internal3"
3682 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3683 (compare:CC (match_operator:SI 4 "boolean_operator"
3684 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3685 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3687 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3693 [(set_attr "type" "compare")
3694 (set_attr "length" "4,8")])
3697 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3698 (compare:CC (match_operator:SI 4 "boolean_operator"
3699 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3700 (match_operand:SI 2 "gpc_reg_operand" "")])
3702 (set (match_operand:SI 0 "gpc_reg_operand" "")
3704 "TARGET_32BIT && reload_completed"
3705 [(set (match_dup 0) (match_dup 4))
3707 (compare:CC (match_dup 0)
3711 (define_insn "*boolccsi3_internal1"
3712 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3713 (match_operator:SI 3 "boolean_operator"
3714 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3715 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3719 (define_insn "*boolccsi3_internal2"
3720 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3721 (compare:CC (match_operator:SI 4 "boolean_operator"
3722 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3723 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3725 (clobber (match_scratch:SI 3 "=r,r"))]
3730 [(set_attr "type" "fast_compare,compare")
3731 (set_attr "length" "4,8")])
3734 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3735 (compare:CC (match_operator:SI 4 "boolean_operator"
3736 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3737 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3739 (clobber (match_scratch:SI 3 ""))]
3740 "TARGET_32BIT && reload_completed"
3741 [(set (match_dup 3) (match_dup 4))
3743 (compare:CC (match_dup 3)
3747 (define_insn "*boolccsi3_internal3"
3748 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3749 (compare:CC (match_operator:SI 4 "boolean_operator"
3750 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3751 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3753 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3759 [(set_attr "type" "fast_compare,compare")
3760 (set_attr "length" "4,8")])
3763 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3764 (compare:CC (match_operator:SI 4 "boolean_operator"
3765 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3766 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3768 (set (match_operand:SI 0 "gpc_reg_operand" "")
3770 "TARGET_32BIT && reload_completed"
3771 [(set (match_dup 0) (match_dup 4))
3773 (compare:CC (match_dup 0)
3777 ;; maskir insn. We need four forms because things might be in arbitrary
3778 ;; orders. Don't define forms that only set CR fields because these
3779 ;; would modify an input register.
3781 (define_insn "*maskir_internal1"
3782 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3783 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3784 (match_operand:SI 1 "gpc_reg_operand" "0"))
3785 (and:SI (match_dup 2)
3786 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3790 (define_insn "*maskir_internal2"
3791 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3792 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3793 (match_operand:SI 1 "gpc_reg_operand" "0"))
3794 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3799 (define_insn "*maskir_internal3"
3800 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3801 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3802 (match_operand:SI 3 "gpc_reg_operand" "r"))
3803 (and:SI (not:SI (match_dup 2))
3804 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3808 (define_insn "*maskir_internal4"
3809 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3810 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3811 (match_operand:SI 2 "gpc_reg_operand" "r"))
3812 (and:SI (not:SI (match_dup 2))
3813 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3817 (define_insn "*maskir_internal5"
3818 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3820 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3821 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3822 (and:SI (match_dup 2)
3823 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3825 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3826 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3827 (and:SI (match_dup 2) (match_dup 3))))]
3832 [(set_attr "type" "compare")
3833 (set_attr "length" "4,8")])
3836 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3838 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3839 (match_operand:SI 1 "gpc_reg_operand" ""))
3840 (and:SI (match_dup 2)
3841 (match_operand:SI 3 "gpc_reg_operand" "")))
3843 (set (match_operand:SI 0 "gpc_reg_operand" "")
3844 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3845 (and:SI (match_dup 2) (match_dup 3))))]
3846 "TARGET_POWER && reload_completed"
3848 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3849 (and:SI (match_dup 2) (match_dup 3))))
3851 (compare:CC (match_dup 0)
3855 (define_insn "*maskir_internal6"
3856 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3858 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3859 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3860 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3863 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3864 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3865 (and:SI (match_dup 3) (match_dup 2))))]
3870 [(set_attr "type" "compare")
3871 (set_attr "length" "4,8")])
3874 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3876 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3877 (match_operand:SI 1 "gpc_reg_operand" ""))
3878 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3881 (set (match_operand:SI 0 "gpc_reg_operand" "")
3882 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3883 (and:SI (match_dup 3) (match_dup 2))))]
3884 "TARGET_POWER && reload_completed"
3886 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3887 (and:SI (match_dup 3) (match_dup 2))))
3889 (compare:CC (match_dup 0)
3893 (define_insn "*maskir_internal7"
3894 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3896 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3897 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3898 (and:SI (not:SI (match_dup 2))
3899 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3901 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3902 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3903 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3908 [(set_attr "type" "compare")
3909 (set_attr "length" "4,8")])
3912 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3914 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3915 (match_operand:SI 3 "gpc_reg_operand" ""))
3916 (and:SI (not:SI (match_dup 2))
3917 (match_operand:SI 1 "gpc_reg_operand" "")))
3919 (set (match_operand:SI 0 "gpc_reg_operand" "")
3920 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3921 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3922 "TARGET_POWER && reload_completed"
3924 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3925 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3927 (compare:CC (match_dup 0)
3931 (define_insn "*maskir_internal8"
3932 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3934 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3935 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3936 (and:SI (not:SI (match_dup 2))
3937 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3939 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3940 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3941 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3946 [(set_attr "type" "compare")
3947 (set_attr "length" "4,8")])
3950 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3952 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3953 (match_operand:SI 2 "gpc_reg_operand" ""))
3954 (and:SI (not:SI (match_dup 2))
3955 (match_operand:SI 1 "gpc_reg_operand" "")))
3957 (set (match_operand:SI 0 "gpc_reg_operand" "")
3958 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3959 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3960 "TARGET_POWER && reload_completed"
3962 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3963 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3965 (compare:CC (match_dup 0)
3969 ;; Rotate and shift insns, in all their variants. These support shifts,
3970 ;; field inserts and extracts, and various combinations thereof.
3971 (define_expand "insv"
3972 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3973 (match_operand:SI 1 "const_int_operand" "")
3974 (match_operand:SI 2 "const_int_operand" ""))
3975 (match_operand 3 "gpc_reg_operand" ""))]
3979 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3980 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3981 compiler if the address of the structure is taken later. Likewise, do
3982 not handle invalid E500 subregs. */
3983 if (GET_CODE (operands[0]) == SUBREG
3984 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3985 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3986 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3989 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3990 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3992 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3996 (define_insn "insvsi"
3997 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3998 (match_operand:SI 1 "const_int_operand" "i")
3999 (match_operand:SI 2 "const_int_operand" "i"))
4000 (match_operand:SI 3 "gpc_reg_operand" "r"))]
4004 int start = INTVAL (operands[2]) & 31;
4005 int size = INTVAL (operands[1]) & 31;
4007 operands[4] = GEN_INT (32 - start - size);
4008 operands[1] = GEN_INT (start + size - 1);
4009 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4011 [(set_attr "type" "insert_word")])
4013 (define_insn "*insvsi_internal1"
4014 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4015 (match_operand:SI 1 "const_int_operand" "i")
4016 (match_operand:SI 2 "const_int_operand" "i"))
4017 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4018 (match_operand:SI 4 "const_int_operand" "i")))]
4019 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4022 int shift = INTVAL (operands[4]) & 31;
4023 int start = INTVAL (operands[2]) & 31;
4024 int size = INTVAL (operands[1]) & 31;
4026 operands[4] = GEN_INT (shift - start - size);
4027 operands[1] = GEN_INT (start + size - 1);
4028 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4030 [(set_attr "type" "insert_word")])
4032 (define_insn "*insvsi_internal2"
4033 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4034 (match_operand:SI 1 "const_int_operand" "i")
4035 (match_operand:SI 2 "const_int_operand" "i"))
4036 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4037 (match_operand:SI 4 "const_int_operand" "i")))]
4038 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4041 int shift = INTVAL (operands[4]) & 31;
4042 int start = INTVAL (operands[2]) & 31;
4043 int size = INTVAL (operands[1]) & 31;
4045 operands[4] = GEN_INT (32 - shift - start - size);
4046 operands[1] = GEN_INT (start + size - 1);
4047 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4049 [(set_attr "type" "insert_word")])
4051 (define_insn "*insvsi_internal3"
4052 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4053 (match_operand:SI 1 "const_int_operand" "i")
4054 (match_operand:SI 2 "const_int_operand" "i"))
4055 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4056 (match_operand:SI 4 "const_int_operand" "i")))]
4057 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4060 int shift = INTVAL (operands[4]) & 31;
4061 int start = INTVAL (operands[2]) & 31;
4062 int size = INTVAL (operands[1]) & 31;
4064 operands[4] = GEN_INT (32 - shift - start - size);
4065 operands[1] = GEN_INT (start + size - 1);
4066 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4068 [(set_attr "type" "insert_word")])
4070 (define_insn "*insvsi_internal4"
4071 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4072 (match_operand:SI 1 "const_int_operand" "i")
4073 (match_operand:SI 2 "const_int_operand" "i"))
4074 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4075 (match_operand:SI 4 "const_int_operand" "i")
4076 (match_operand:SI 5 "const_int_operand" "i")))]
4077 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4080 int extract_start = INTVAL (operands[5]) & 31;
4081 int extract_size = INTVAL (operands[4]) & 31;
4082 int insert_start = INTVAL (operands[2]) & 31;
4083 int insert_size = INTVAL (operands[1]) & 31;
4085 /* Align extract field with insert field */
4086 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4087 operands[1] = GEN_INT (insert_start + insert_size - 1);
4088 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4090 [(set_attr "type" "insert_word")])
4092 ;; combine patterns for rlwimi
4093 (define_insn "*insvsi_internal5"
4094 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4095 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4096 (match_operand:SI 1 "mask_operand" "i"))
4097 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4098 (match_operand:SI 2 "const_int_operand" "i"))
4099 (match_operand:SI 5 "mask_operand" "i"))))]
4100 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4103 int me = extract_ME(operands[5]);
4104 int mb = extract_MB(operands[5]);
4105 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4106 operands[2] = GEN_INT(mb);
4107 operands[1] = GEN_INT(me);
4108 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4110 [(set_attr "type" "insert_word")])
4112 (define_insn "*insvsi_internal6"
4113 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4114 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4115 (match_operand:SI 2 "const_int_operand" "i"))
4116 (match_operand:SI 5 "mask_operand" "i"))
4117 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4118 (match_operand:SI 1 "mask_operand" "i"))))]
4119 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4122 int me = extract_ME(operands[5]);
4123 int mb = extract_MB(operands[5]);
4124 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4125 operands[2] = GEN_INT(mb);
4126 operands[1] = GEN_INT(me);
4127 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4129 [(set_attr "type" "insert_word")])
4131 (define_insn "insvdi"
4132 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4133 (match_operand:SI 1 "const_int_operand" "i")
4134 (match_operand:SI 2 "const_int_operand" "i"))
4135 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4139 int start = INTVAL (operands[2]) & 63;
4140 int size = INTVAL (operands[1]) & 63;
4142 operands[1] = GEN_INT (64 - start - size);
4143 return \"rldimi %0,%3,%H1,%H2\";
4145 [(set_attr "type" "insert_dword")])
4147 (define_insn "*insvdi_internal2"
4148 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4149 (match_operand:SI 1 "const_int_operand" "i")
4150 (match_operand:SI 2 "const_int_operand" "i"))
4151 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4152 (match_operand:SI 4 "const_int_operand" "i")))]
4154 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4157 int shift = INTVAL (operands[4]) & 63;
4158 int start = (INTVAL (operands[2]) & 63) - 32;
4159 int size = INTVAL (operands[1]) & 63;
4161 operands[4] = GEN_INT (64 - shift - start - size);
4162 operands[2] = GEN_INT (start);
4163 operands[1] = GEN_INT (start + size - 1);
4164 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4167 (define_insn "*insvdi_internal3"
4168 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4169 (match_operand:SI 1 "const_int_operand" "i")
4170 (match_operand:SI 2 "const_int_operand" "i"))
4171 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4172 (match_operand:SI 4 "const_int_operand" "i")))]
4174 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4177 int shift = INTVAL (operands[4]) & 63;
4178 int start = (INTVAL (operands[2]) & 63) - 32;
4179 int size = INTVAL (operands[1]) & 63;
4181 operands[4] = GEN_INT (64 - shift - start - size);
4182 operands[2] = GEN_INT (start);
4183 operands[1] = GEN_INT (start + size - 1);
4184 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4187 (define_expand "extzv"
4188 [(set (match_operand 0 "gpc_reg_operand" "")
4189 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4190 (match_operand:SI 2 "const_int_operand" "")
4191 (match_operand:SI 3 "const_int_operand" "")))]
4195 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4196 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4197 compiler if the address of the structure is taken later. */
4198 if (GET_CODE (operands[0]) == SUBREG
4199 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4202 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4203 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4205 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4209 (define_insn "extzvsi"
4210 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4211 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4212 (match_operand:SI 2 "const_int_operand" "i")
4213 (match_operand:SI 3 "const_int_operand" "i")))]
4217 int start = INTVAL (operands[3]) & 31;
4218 int size = INTVAL (operands[2]) & 31;
4220 if (start + size >= 32)
4221 operands[3] = const0_rtx;
4223 operands[3] = GEN_INT (start + size);
4224 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4227 (define_insn "*extzvsi_internal1"
4228 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4229 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4230 (match_operand:SI 2 "const_int_operand" "i,i")
4231 (match_operand:SI 3 "const_int_operand" "i,i"))
4233 (clobber (match_scratch:SI 4 "=r,r"))]
4237 int start = INTVAL (operands[3]) & 31;
4238 int size = INTVAL (operands[2]) & 31;
4240 /* Force split for non-cc0 compare. */
4241 if (which_alternative == 1)
4244 /* If the bit-field being tested fits in the upper or lower half of a
4245 word, it is possible to use andiu. or andil. to test it. This is
4246 useful because the condition register set-use delay is smaller for
4247 andi[ul]. than for rlinm. This doesn't work when the starting bit
4248 position is 0 because the LT and GT bits may be set wrong. */
4250 if ((start > 0 && start + size <= 16) || start >= 16)
4252 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4253 - (1 << (16 - (start & 15) - size))));
4255 return \"{andiu.|andis.} %4,%1,%3\";
4257 return \"{andil.|andi.} %4,%1,%3\";
4260 if (start + size >= 32)
4261 operands[3] = const0_rtx;
4263 operands[3] = GEN_INT (start + size);
4264 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4266 [(set_attr "type" "delayed_compare")
4267 (set_attr "length" "4,8")])
4270 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4271 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4272 (match_operand:SI 2 "const_int_operand" "")
4273 (match_operand:SI 3 "const_int_operand" ""))
4275 (clobber (match_scratch:SI 4 ""))]
4278 (zero_extract:SI (match_dup 1) (match_dup 2)
4281 (compare:CC (match_dup 4)
4285 (define_insn "*extzvsi_internal2"
4286 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4287 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4288 (match_operand:SI 2 "const_int_operand" "i,i")
4289 (match_operand:SI 3 "const_int_operand" "i,i"))
4291 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4292 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4296 int start = INTVAL (operands[3]) & 31;
4297 int size = INTVAL (operands[2]) & 31;
4299 /* Force split for non-cc0 compare. */
4300 if (which_alternative == 1)
4303 /* Since we are using the output value, we can't ignore any need for
4304 a shift. The bit-field must end at the LSB. */
4305 if (start >= 16 && start + size == 32)
4307 operands[3] = GEN_INT ((1 << size) - 1);
4308 return \"{andil.|andi.} %0,%1,%3\";
4311 if (start + size >= 32)
4312 operands[3] = const0_rtx;
4314 operands[3] = GEN_INT (start + size);
4315 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4317 [(set_attr "type" "delayed_compare")
4318 (set_attr "length" "4,8")])
4321 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4322 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4323 (match_operand:SI 2 "const_int_operand" "")
4324 (match_operand:SI 3 "const_int_operand" ""))
4326 (set (match_operand:SI 0 "gpc_reg_operand" "")
4327 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4330 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4332 (compare:CC (match_dup 0)
4336 (define_insn "extzvdi"
4337 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4338 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4339 (match_operand:SI 2 "const_int_operand" "i")
4340 (match_operand:SI 3 "const_int_operand" "i")))]
4344 int start = INTVAL (operands[3]) & 63;
4345 int size = INTVAL (operands[2]) & 63;
4347 if (start + size >= 64)
4348 operands[3] = const0_rtx;
4350 operands[3] = GEN_INT (start + size);
4351 operands[2] = GEN_INT (64 - size);
4352 return \"rldicl %0,%1,%3,%2\";
4355 (define_insn "*extzvdi_internal1"
4356 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4357 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4358 (match_operand:SI 2 "const_int_operand" "i")
4359 (match_operand:SI 3 "const_int_operand" "i"))
4361 (clobber (match_scratch:DI 4 "=r"))]
4362 "TARGET_64BIT && rs6000_gen_cell_microcode"
4365 int start = INTVAL (operands[3]) & 63;
4366 int size = INTVAL (operands[2]) & 63;
4368 if (start + size >= 64)
4369 operands[3] = const0_rtx;
4371 operands[3] = GEN_INT (start + size);
4372 operands[2] = GEN_INT (64 - size);
4373 return \"rldicl. %4,%1,%3,%2\";
4375 [(set_attr "type" "compare")])
4377 (define_insn "*extzvdi_internal2"
4378 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4379 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4380 (match_operand:SI 2 "const_int_operand" "i")
4381 (match_operand:SI 3 "const_int_operand" "i"))
4383 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4384 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4385 "TARGET_64BIT && rs6000_gen_cell_microcode"
4388 int start = INTVAL (operands[3]) & 63;
4389 int size = INTVAL (operands[2]) & 63;
4391 if (start + size >= 64)
4392 operands[3] = const0_rtx;
4394 operands[3] = GEN_INT (start + size);
4395 operands[2] = GEN_INT (64 - size);
4396 return \"rldicl. %0,%1,%3,%2\";
4398 [(set_attr "type" "compare")])
4400 (define_insn "rotlsi3"
4401 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4402 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4403 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4406 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4407 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4408 [(set_attr "type" "var_shift_rotate,integer")])
4410 (define_insn "*rotlsi3_64"
4411 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4413 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4414 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4417 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4418 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4419 [(set_attr "type" "var_shift_rotate,integer")])
4421 (define_insn "*rotlsi3_internal2"
4422 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4423 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4424 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4426 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4429 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4430 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4433 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4434 (set_attr "length" "4,4,8,8")])
4437 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4438 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4439 (match_operand:SI 2 "reg_or_cint_operand" ""))
4441 (clobber (match_scratch:SI 3 ""))]
4444 (rotate:SI (match_dup 1) (match_dup 2)))
4446 (compare:CC (match_dup 3)
4450 (define_insn "*rotlsi3_internal3"
4451 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4452 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4453 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4455 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4456 (rotate:SI (match_dup 1) (match_dup 2)))]
4459 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4460 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4463 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4464 (set_attr "length" "4,4,8,8")])
4467 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4468 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4469 (match_operand:SI 2 "reg_or_cint_operand" ""))
4471 (set (match_operand:SI 0 "gpc_reg_operand" "")
4472 (rotate:SI (match_dup 1) (match_dup 2)))]
4475 (rotate:SI (match_dup 1) (match_dup 2)))
4477 (compare:CC (match_dup 0)
4481 (define_insn "*rotlsi3_internal4"
4482 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4483 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4484 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4485 (match_operand:SI 3 "mask_operand" "n,n")))]
4488 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4489 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4490 [(set_attr "type" "var_shift_rotate,integer")])
4492 (define_insn "*rotlsi3_internal5"
4493 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4495 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4496 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4497 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4499 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4502 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4503 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4506 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4507 (set_attr "length" "4,4,8,8")])
4510 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4512 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4513 (match_operand:SI 2 "reg_or_cint_operand" ""))
4514 (match_operand:SI 3 "mask_operand" ""))
4516 (clobber (match_scratch:SI 4 ""))]
4519 (and:SI (rotate:SI (match_dup 1)
4523 (compare:CC (match_dup 4)
4527 (define_insn "*rotlsi3_internal6"
4528 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4530 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4531 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4532 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4534 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4535 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4538 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4539 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4542 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4543 (set_attr "length" "4,4,8,8")])
4546 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4548 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4549 (match_operand:SI 2 "reg_or_cint_operand" ""))
4550 (match_operand:SI 3 "mask_operand" ""))
4552 (set (match_operand:SI 0 "gpc_reg_operand" "")
4553 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4556 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4558 (compare:CC (match_dup 0)
4562 (define_insn "*rotlsi3_internal7"
4563 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4566 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4567 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4569 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4570 [(set (attr "cell_micro")
4571 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4572 (const_string "not")
4573 (const_string "always")))])
4575 (define_insn "*rotlsi3_internal8"
4576 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4577 (compare:CC (zero_extend:SI
4579 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4580 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4582 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4585 {rlnm.|rlwnm.} %3,%1,%2,0xff
4586 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4589 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4590 (set_attr "length" "4,4,8,8")])
4593 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4594 (compare:CC (zero_extend:SI
4596 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4597 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4599 (clobber (match_scratch:SI 3 ""))]
4602 (zero_extend:SI (subreg:QI
4603 (rotate:SI (match_dup 1)
4606 (compare:CC (match_dup 3)
4610 (define_insn "*rotlsi3_internal9"
4611 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4612 (compare:CC (zero_extend:SI
4614 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4615 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4617 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4618 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4621 {rlnm.|rlwnm.} %0,%1,%2,0xff
4622 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4625 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4626 (set_attr "length" "4,4,8,8")])
4629 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4630 (compare:CC (zero_extend:SI
4632 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4633 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4635 (set (match_operand:SI 0 "gpc_reg_operand" "")
4636 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4639 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4641 (compare:CC (match_dup 0)
4645 (define_insn "*rotlsi3_internal10"
4646 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4649 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4650 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4653 {rlnm|rlwnm} %0,%1,%2,0xffff
4654 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4655 [(set_attr "type" "var_shift_rotate,integer")])
4658 (define_insn "*rotlsi3_internal11"
4659 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4660 (compare:CC (zero_extend:SI
4662 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4663 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4665 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4668 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4669 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4672 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4673 (set_attr "length" "4,4,8,8")])
4676 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4677 (compare:CC (zero_extend:SI
4679 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4680 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4682 (clobber (match_scratch:SI 3 ""))]
4685 (zero_extend:SI (subreg:HI
4686 (rotate:SI (match_dup 1)
4689 (compare:CC (match_dup 3)
4693 (define_insn "*rotlsi3_internal12"
4694 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4695 (compare:CC (zero_extend:SI
4697 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4698 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4700 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4701 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4704 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4705 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4708 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4709 (set_attr "length" "4,4,8,8")])
4712 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4713 (compare:CC (zero_extend:SI
4715 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4716 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4718 (set (match_operand:SI 0 "gpc_reg_operand" "")
4719 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4722 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4724 (compare:CC (match_dup 0)
4728 ;; Note that we use "sle." instead of "sl." so that we can set
4729 ;; SHIFT_COUNT_TRUNCATED.
4731 (define_expand "ashlsi3"
4732 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4733 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4734 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4739 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4741 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4745 (define_insn "ashlsi3_power"
4746 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4747 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4748 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4749 (clobber (match_scratch:SI 3 "=q,X"))]
4753 {sli|slwi} %0,%1,%h2")
4755 (define_insn "ashlsi3_no_power"
4756 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4757 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4758 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4762 {sli|slwi} %0,%1,%h2"
4763 [(set_attr "type" "var_shift_rotate,shift")])
4765 (define_insn "*ashlsi3_64"
4766 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4768 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4769 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4773 {sli|slwi} %0,%1,%h2"
4774 [(set_attr "type" "var_shift_rotate,shift")])
4777 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4778 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4779 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4781 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4782 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4786 {sli.|slwi.} %3,%1,%h2
4789 [(set_attr "type" "delayed_compare")
4790 (set_attr "length" "4,4,8,8")])
4793 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4794 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4795 (match_operand:SI 2 "reg_or_cint_operand" ""))
4797 (clobber (match_scratch:SI 3 ""))
4798 (clobber (match_scratch:SI 4 ""))]
4799 "TARGET_POWER && reload_completed"
4800 [(parallel [(set (match_dup 3)
4801 (ashift:SI (match_dup 1) (match_dup 2)))
4802 (clobber (match_dup 4))])
4804 (compare:CC (match_dup 3)
4809 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4810 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4811 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4813 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4814 "! TARGET_POWER && TARGET_32BIT"
4817 {sli.|slwi.} %3,%1,%h2
4820 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4821 (set_attr "length" "4,4,8,8")])
4824 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4825 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4826 (match_operand:SI 2 "reg_or_cint_operand" ""))
4828 (clobber (match_scratch:SI 3 ""))]
4829 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4831 (ashift:SI (match_dup 1) (match_dup 2)))
4833 (compare:CC (match_dup 3)
4838 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4839 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4840 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4842 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4843 (ashift:SI (match_dup 1) (match_dup 2)))
4844 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4848 {sli.|slwi.} %0,%1,%h2
4851 [(set_attr "type" "delayed_compare")
4852 (set_attr "length" "4,4,8,8")])
4855 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4856 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4857 (match_operand:SI 2 "reg_or_cint_operand" ""))
4859 (set (match_operand:SI 0 "gpc_reg_operand" "")
4860 (ashift:SI (match_dup 1) (match_dup 2)))
4861 (clobber (match_scratch:SI 4 ""))]
4862 "TARGET_POWER && reload_completed"
4863 [(parallel [(set (match_dup 0)
4864 (ashift:SI (match_dup 1) (match_dup 2)))
4865 (clobber (match_dup 4))])
4867 (compare:CC (match_dup 0)
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 "! TARGET_POWER && TARGET_32BIT"
4881 {sli.|slwi.} %0,%1,%h2
4884 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4885 (set_attr "length" "4,4,8,8")])
4888 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4889 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4890 (match_operand:SI 2 "reg_or_cint_operand" ""))
4892 (set (match_operand:SI 0 "gpc_reg_operand" "")
4893 (ashift:SI (match_dup 1) (match_dup 2)))]
4894 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4896 (ashift:SI (match_dup 1) (match_dup 2)))
4898 (compare:CC (match_dup 0)
4902 (define_insn "rlwinm"
4903 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4904 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4905 (match_operand:SI 2 "const_int_operand" "i"))
4906 (match_operand:SI 3 "mask_operand" "n")))]
4907 "includes_lshift_p (operands[2], operands[3])"
4908 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4911 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4913 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4914 (match_operand:SI 2 "const_int_operand" "i,i"))
4915 (match_operand:SI 3 "mask_operand" "n,n"))
4917 (clobber (match_scratch:SI 4 "=r,r"))]
4918 "includes_lshift_p (operands[2], operands[3])"
4920 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4922 [(set_attr "type" "delayed_compare")
4923 (set_attr "length" "4,8")])
4926 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4928 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4929 (match_operand:SI 2 "const_int_operand" ""))
4930 (match_operand:SI 3 "mask_operand" ""))
4932 (clobber (match_scratch:SI 4 ""))]
4933 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4935 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4938 (compare:CC (match_dup 4)
4943 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4945 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4946 (match_operand:SI 2 "const_int_operand" "i,i"))
4947 (match_operand:SI 3 "mask_operand" "n,n"))
4949 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4950 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4951 "includes_lshift_p (operands[2], operands[3])"
4953 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4955 [(set_attr "type" "delayed_compare")
4956 (set_attr "length" "4,8")])
4959 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4961 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4962 (match_operand:SI 2 "const_int_operand" ""))
4963 (match_operand:SI 3 "mask_operand" ""))
4965 (set (match_operand:SI 0 "gpc_reg_operand" "")
4966 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4967 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4969 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4971 (compare:CC (match_dup 0)
4975 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4977 (define_expand "lshrsi3"
4978 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4979 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4980 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4985 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4987 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4991 (define_insn "lshrsi3_power"
4992 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4993 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4994 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4995 (clobber (match_scratch:SI 3 "=q,X,X"))]
5000 {s%A2i|s%A2wi} %0,%1,%h2")
5002 (define_insn "lshrsi3_no_power"
5003 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5004 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5005 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
5010 {sri|srwi} %0,%1,%h2"
5011 [(set_attr "type" "integer,var_shift_rotate,shift")])
5013 (define_insn "*lshrsi3_64"
5014 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5016 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5017 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5021 {sri|srwi} %0,%1,%h2"
5022 [(set_attr "type" "var_shift_rotate,shift")])
5025 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5026 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5027 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5029 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5030 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5035 {s%A2i.|s%A2wi.} %3,%1,%h2
5039 [(set_attr "type" "delayed_compare")
5040 (set_attr "length" "4,4,4,8,8,8")])
5043 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5044 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5045 (match_operand:SI 2 "reg_or_cint_operand" ""))
5047 (clobber (match_scratch:SI 3 ""))
5048 (clobber (match_scratch:SI 4 ""))]
5049 "TARGET_POWER && reload_completed"
5050 [(parallel [(set (match_dup 3)
5051 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5052 (clobber (match_dup 4))])
5054 (compare:CC (match_dup 3)
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" "O,r,i,O,r,i"))
5063 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5064 "! TARGET_POWER && TARGET_32BIT"
5068 {sri.|srwi.} %3,%1,%h2
5072 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5073 (set_attr "length" "4,4,4,8,8,8")])
5076 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5077 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5078 (match_operand:SI 2 "reg_or_cint_operand" ""))
5080 (clobber (match_scratch:SI 3 ""))]
5081 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5083 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5085 (compare:CC (match_dup 3)
5090 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5091 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5092 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5094 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5095 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5096 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5101 {s%A2i.|s%A2wi.} %0,%1,%h2
5105 [(set_attr "type" "delayed_compare")
5106 (set_attr "length" "4,4,4,8,8,8")])
5109 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5110 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5111 (match_operand:SI 2 "reg_or_cint_operand" ""))
5113 (set (match_operand:SI 0 "gpc_reg_operand" "")
5114 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5115 (clobber (match_scratch:SI 4 ""))]
5116 "TARGET_POWER && reload_completed"
5117 [(parallel [(set (match_dup 0)
5118 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5119 (clobber (match_dup 4))])
5121 (compare:CC (match_dup 0)
5126 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5127 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5128 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5130 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5131 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5132 "! TARGET_POWER && TARGET_32BIT"
5136 {sri.|srwi.} %0,%1,%h2
5140 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5141 (set_attr "length" "4,4,4,8,8,8")])
5144 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5145 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5146 (match_operand:SI 2 "reg_or_cint_operand" ""))
5148 (set (match_operand:SI 0 "gpc_reg_operand" "")
5149 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5150 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5152 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5154 (compare:CC (match_dup 0)
5159 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5160 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5161 (match_operand:SI 2 "const_int_operand" "i"))
5162 (match_operand:SI 3 "mask_operand" "n")))]
5163 "includes_rshift_p (operands[2], operands[3])"
5164 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5167 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5169 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5170 (match_operand:SI 2 "const_int_operand" "i,i"))
5171 (match_operand:SI 3 "mask_operand" "n,n"))
5173 (clobber (match_scratch:SI 4 "=r,r"))]
5174 "includes_rshift_p (operands[2], operands[3])"
5176 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5178 [(set_attr "type" "delayed_compare")
5179 (set_attr "length" "4,8")])
5182 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5184 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5185 (match_operand:SI 2 "const_int_operand" ""))
5186 (match_operand:SI 3 "mask_operand" ""))
5188 (clobber (match_scratch:SI 4 ""))]
5189 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5191 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5194 (compare:CC (match_dup 4)
5199 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5201 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5202 (match_operand:SI 2 "const_int_operand" "i,i"))
5203 (match_operand:SI 3 "mask_operand" "n,n"))
5205 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5206 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5207 "includes_rshift_p (operands[2], operands[3])"
5209 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5211 [(set_attr "type" "delayed_compare")
5212 (set_attr "length" "4,8")])
5215 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5217 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5218 (match_operand:SI 2 "const_int_operand" ""))
5219 (match_operand:SI 3 "mask_operand" ""))
5221 (set (match_operand:SI 0 "gpc_reg_operand" "")
5222 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5223 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5225 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5227 (compare:CC (match_dup 0)
5232 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5235 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5236 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5237 "includes_rshift_p (operands[2], GEN_INT (255))"
5238 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5241 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5245 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5246 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5248 (clobber (match_scratch:SI 3 "=r,r"))]
5249 "includes_rshift_p (operands[2], GEN_INT (255))"
5251 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5253 [(set_attr "type" "delayed_compare")
5254 (set_attr "length" "4,8")])
5257 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5261 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5262 (match_operand:SI 2 "const_int_operand" "")) 0))
5264 (clobber (match_scratch:SI 3 ""))]
5265 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5267 (zero_extend:SI (subreg:QI
5268 (lshiftrt:SI (match_dup 1)
5271 (compare:CC (match_dup 3)
5276 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5280 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5281 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5283 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5284 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5285 "includes_rshift_p (operands[2], GEN_INT (255))"
5287 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5289 [(set_attr "type" "delayed_compare")
5290 (set_attr "length" "4,8")])
5293 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5297 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5298 (match_operand:SI 2 "const_int_operand" "")) 0))
5300 (set (match_operand:SI 0 "gpc_reg_operand" "")
5301 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5302 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5304 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5306 (compare:CC (match_dup 0)
5311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5314 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5315 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5316 "includes_rshift_p (operands[2], GEN_INT (65535))"
5317 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5320 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5324 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5325 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5327 (clobber (match_scratch:SI 3 "=r,r"))]
5328 "includes_rshift_p (operands[2], GEN_INT (65535))"
5330 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5332 [(set_attr "type" "delayed_compare")
5333 (set_attr "length" "4,8")])
5336 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5340 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5341 (match_operand:SI 2 "const_int_operand" "")) 0))
5343 (clobber (match_scratch:SI 3 ""))]
5344 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5346 (zero_extend:SI (subreg:HI
5347 (lshiftrt:SI (match_dup 1)
5350 (compare:CC (match_dup 3)
5355 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5359 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5360 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5362 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5363 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5364 "includes_rshift_p (operands[2], GEN_INT (65535))"
5366 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5368 [(set_attr "type" "delayed_compare")
5369 (set_attr "length" "4,8")])
5372 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5376 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5377 (match_operand:SI 2 "const_int_operand" "")) 0))
5379 (set (match_operand:SI 0 "gpc_reg_operand" "")
5380 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5381 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5383 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5385 (compare:CC (match_dup 0)
5390 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5392 (match_operand:SI 1 "gpc_reg_operand" "r"))
5393 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5399 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5401 (match_operand:SI 1 "gpc_reg_operand" "r"))
5402 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5408 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5410 (match_operand:SI 1 "gpc_reg_operand" "r"))
5411 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5417 (define_expand "ashrsi3"
5418 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5419 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5420 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5425 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5427 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5431 (define_insn "ashrsi3_power"
5432 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5433 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5434 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5435 (clobber (match_scratch:SI 3 "=q,X"))]
5439 {srai|srawi} %0,%1,%h2"
5440 [(set_attr "type" "shift")])
5442 (define_insn "ashrsi3_no_power"
5443 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5444 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5445 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5449 {srai|srawi} %0,%1,%h2"
5450 [(set_attr "type" "var_shift_rotate,shift")])
5452 (define_insn "*ashrsi3_64"
5453 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5455 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5456 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5460 {srai|srawi} %0,%1,%h2"
5461 [(set_attr "type" "var_shift_rotate,shift")])
5464 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5465 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5466 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5468 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5469 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5473 {srai.|srawi.} %3,%1,%h2
5476 [(set_attr "type" "delayed_compare")
5477 (set_attr "length" "4,4,8,8")])
5480 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5481 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5482 (match_operand:SI 2 "reg_or_cint_operand" ""))
5484 (clobber (match_scratch:SI 3 ""))
5485 (clobber (match_scratch:SI 4 ""))]
5486 "TARGET_POWER && reload_completed"
5487 [(parallel [(set (match_dup 3)
5488 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5489 (clobber (match_dup 4))])
5491 (compare:CC (match_dup 3)
5496 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5497 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5498 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5500 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5503 {sra.|sraw.} %3,%1,%2
5504 {srai.|srawi.} %3,%1,%h2
5507 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5508 (set_attr "length" "4,4,8,8")])
5511 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5512 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5513 (match_operand:SI 2 "reg_or_cint_operand" ""))
5515 (clobber (match_scratch:SI 3 ""))]
5516 "! TARGET_POWER && reload_completed"
5518 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5520 (compare:CC (match_dup 3)
5525 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5526 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5527 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5529 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5530 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5531 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5535 {srai.|srawi.} %0,%1,%h2
5538 [(set_attr "type" "delayed_compare")
5539 (set_attr "length" "4,4,8,8")])
5542 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5543 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5544 (match_operand:SI 2 "reg_or_cint_operand" ""))
5546 (set (match_operand:SI 0 "gpc_reg_operand" "")
5547 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5548 (clobber (match_scratch:SI 4 ""))]
5549 "TARGET_POWER && reload_completed"
5550 [(parallel [(set (match_dup 0)
5551 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5552 (clobber (match_dup 4))])
5554 (compare:CC (match_dup 0)
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)))]
5567 {sra.|sraw.} %0,%1,%2
5568 {srai.|srawi.} %0,%1,%h2
5571 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5572 (set_attr "length" "4,4,8,8")])
5574 ;; Builtins to replace a division to generate FRE reciprocal estimate
5575 ;; instructions and the necessary fixup instructions
5576 (define_expand "recip<mode>3"
5577 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5578 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5579 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5580 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5582 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5586 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5587 ;; hardware division. This is only done before register allocation and with
5588 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5590 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5591 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5592 (match_operand 2 "gpc_reg_operand" "")))]
5593 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5594 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5595 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5598 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5602 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5603 ;; appropriate fixup.
5604 (define_expand "rsqrt<mode>2"
5605 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5606 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5607 "RS6000_RECIP_HAVE_RSQRT_P (<MODE>mode)"
5609 rs6000_emit_swrsqrt (operands[0], operands[1]);
5614 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5615 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5616 (match_operand:SI 2 "reg_or_cint_operand" ""))
5618 (set (match_operand:SI 0 "gpc_reg_operand" "")
5619 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5620 "! TARGET_POWER && reload_completed"
5622 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5624 (compare:CC (match_dup 0)
5628 ;; Floating-point insns, excluding normal data motion.
5630 ;; PowerPC has a full set of single-precision floating point instructions.
5632 ;; For the POWER architecture, we pretend that we have both SFmode and
5633 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5634 ;; The only conversions we will do will be when storing to memory. In that
5635 ;; case, we will use the "frsp" instruction before storing.
5637 ;; Note that when we store into a single-precision memory location, we need to
5638 ;; use the frsp insn first. If the register being stored isn't dead, we
5639 ;; need a scratch register for the frsp. But this is difficult when the store
5640 ;; is done by reload. It is not incorrect to do the frsp on the register in
5641 ;; this case, we just lose precision that we would have otherwise gotten but
5642 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5644 (define_expand "extendsfdf2"
5645 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5646 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5647 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5650 (define_insn_and_split "*extendsfdf2_fpr"
5651 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5652 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5653 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5658 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5661 emit_note (NOTE_INSN_DELETED);
5664 [(set_attr "type" "fp,fp,fpload")])
5666 (define_expand "truncdfsf2"
5667 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5668 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5669 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5672 (define_insn "*truncdfsf2_fpr"
5673 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5674 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5675 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5677 [(set_attr "type" "fp")])
5679 (define_insn "aux_truncdfsf2"
5680 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5681 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5682 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5684 [(set_attr "type" "fp")])
5686 (define_expand "negsf2"
5687 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5688 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5689 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5692 (define_insn "*negsf2"
5693 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5694 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5695 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5697 [(set_attr "type" "fp")])
5699 (define_expand "abssf2"
5700 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5701 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5702 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5705 (define_insn "*abssf2"
5706 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5707 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5708 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5710 [(set_attr "type" "fp")])
5713 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5714 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5715 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5717 [(set_attr "type" "fp")])
5719 (define_expand "addsf3"
5720 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5721 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5722 (match_operand:SF 2 "gpc_reg_operand" "")))]
5723 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5727 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5728 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5729 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5730 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5732 [(set_attr "type" "fp")
5733 (set_attr "fp_type" "fp_addsub_s")])
5736 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5737 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5738 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5739 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5740 "{fa|fadd} %0,%1,%2"
5741 [(set_attr "type" "fp")])
5743 (define_expand "subsf3"
5744 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5745 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5746 (match_operand:SF 2 "gpc_reg_operand" "")))]
5747 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5751 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5752 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5753 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5754 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5756 [(set_attr "type" "fp")
5757 (set_attr "fp_type" "fp_addsub_s")])
5760 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5761 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5762 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5763 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5764 "{fs|fsub} %0,%1,%2"
5765 [(set_attr "type" "fp")])
5767 (define_expand "mulsf3"
5768 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5769 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5770 (match_operand:SF 2 "gpc_reg_operand" "")))]
5771 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5775 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5776 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5777 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5778 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5780 [(set_attr "type" "fp")
5781 (set_attr "fp_type" "fp_mul_s")])
5784 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5785 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5786 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5787 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5788 "{fm|fmul} %0,%1,%2"
5789 [(set_attr "type" "dmul")])
5791 (define_expand "divsf3"
5792 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5793 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5794 (match_operand:SF 2 "gpc_reg_operand" "")))]
5795 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5799 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5800 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5801 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5802 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5803 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5805 [(set_attr "type" "sdiv")])
5808 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5809 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5810 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5811 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5812 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5813 "{fd|fdiv} %0,%1,%2"
5814 [(set_attr "type" "ddiv")])
5817 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5818 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5821 [(set_attr "type" "fp")])
5823 (define_insn "*fmaddsf4_powerpc"
5824 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5825 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5826 (match_operand:SF 2 "gpc_reg_operand" "f"))
5827 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5828 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5829 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5830 "fmadds %0,%1,%2,%3"
5831 [(set_attr "type" "fp")
5832 (set_attr "fp_type" "fp_maddsub_s")])
5834 (define_insn "*fmaddsf4_power"
5835 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5836 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5837 (match_operand:SF 2 "gpc_reg_operand" "f"))
5838 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5839 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5840 "{fma|fmadd} %0,%1,%2,%3"
5841 [(set_attr "type" "dmul")])
5843 (define_insn "*fmsubsf4_powerpc"
5844 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5845 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5846 (match_operand:SF 2 "gpc_reg_operand" "f"))
5847 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5848 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5849 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5850 "fmsubs %0,%1,%2,%3"
5851 [(set_attr "type" "fp")
5852 (set_attr "fp_type" "fp_maddsub_s")])
5854 (define_insn "*fmsubsf4_power"
5855 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5856 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5857 (match_operand:SF 2 "gpc_reg_operand" "f"))
5858 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5859 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5860 "{fms|fmsub} %0,%1,%2,%3"
5861 [(set_attr "type" "dmul")])
5863 (define_insn "*fnmaddsf4_powerpc_1"
5864 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5865 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5866 (match_operand:SF 2 "gpc_reg_operand" "f"))
5867 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5868 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5869 && TARGET_SINGLE_FLOAT"
5870 "fnmadds %0,%1,%2,%3"
5871 [(set_attr "type" "fp")
5872 (set_attr "fp_type" "fp_maddsub_s")])
5874 (define_insn "*fnmaddsf4_powerpc_2"
5875 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5876 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5877 (match_operand:SF 2 "gpc_reg_operand" "f"))
5878 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5879 "TARGET_POWERPC && TARGET_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5880 && ! HONOR_SIGNED_ZEROS (SFmode)"
5881 "fnmadds %0,%1,%2,%3"
5882 [(set_attr "type" "fp")
5883 (set_attr "fp_type" "fp_maddsub_s")])
5885 (define_insn "*fnmaddsf4_power_1"
5886 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5887 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5888 (match_operand:SF 2 "gpc_reg_operand" "f"))
5889 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5890 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5891 "{fnma|fnmadd} %0,%1,%2,%3"
5892 [(set_attr "type" "dmul")])
5894 (define_insn "*fnmaddsf4_power_2"
5895 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5896 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5897 (match_operand:SF 2 "gpc_reg_operand" "f"))
5898 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5899 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5900 && ! HONOR_SIGNED_ZEROS (SFmode)"
5901 "{fnma|fnmadd} %0,%1,%2,%3"
5902 [(set_attr "type" "dmul")])
5904 (define_insn "*fnmsubsf4_powerpc_1"
5905 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5906 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5907 (match_operand:SF 2 "gpc_reg_operand" "f"))
5908 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5909 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5910 && TARGET_SINGLE_FLOAT"
5911 "fnmsubs %0,%1,%2,%3"
5912 [(set_attr "type" "fp")
5913 (set_attr "fp_type" "fp_maddsub_s")])
5915 (define_insn "*fnmsubsf4_powerpc_2"
5916 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5917 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5918 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5919 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5920 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5921 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5922 "fnmsubs %0,%1,%2,%3"
5923 [(set_attr "type" "fp")
5924 (set_attr "fp_type" "fp_maddsub_s")])
5926 (define_insn "*fnmsubsf4_power_1"
5927 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5928 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5929 (match_operand:SF 2 "gpc_reg_operand" "f"))
5930 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5931 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5932 "{fnms|fnmsub} %0,%1,%2,%3"
5933 [(set_attr "type" "dmul")])
5935 (define_insn "*fnmsubsf4_power_2"
5936 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5937 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5938 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5939 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5940 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5941 && ! HONOR_SIGNED_ZEROS (SFmode)"
5942 "{fnms|fnmsub} %0,%1,%2,%3"
5943 [(set_attr "type" "dmul")])
5945 (define_expand "sqrtsf2"
5946 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5947 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5948 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5949 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5950 && !TARGET_SIMPLE_FPU"
5954 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5955 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5956 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5957 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5959 [(set_attr "type" "ssqrt")])
5962 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5963 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5964 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5965 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5967 [(set_attr "type" "dsqrt")])
5969 (define_insn "*rsqrtsf_internal1"
5970 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5971 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5975 [(set_attr "type" "fp")])
5977 (define_expand "copysignsf3"
5979 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5981 (neg:SF (abs:SF (match_dup 1))))
5982 (set (match_operand:SF 0 "gpc_reg_operand" "")
5983 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5987 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5988 && ((TARGET_PPC_GFXOPT
5989 && !HONOR_NANS (SFmode)
5990 && !HONOR_SIGNED_ZEROS (SFmode))
5991 || VECTOR_UNIT_VSX_P (DFmode))"
5993 if (VECTOR_UNIT_VSX_P (DFmode))
5995 emit_insn (gen_vsx_copysignsf3 (operands[0], operands[1], operands[2],
5996 CONST0_RTX (SFmode)));
5999 operands[3] = gen_reg_rtx (SFmode);
6000 operands[4] = gen_reg_rtx (SFmode);
6001 operands[5] = CONST0_RTX (SFmode);
6004 (define_expand "copysigndf3"
6006 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
6008 (neg:DF (abs:DF (match_dup 1))))
6009 (set (match_operand:DF 0 "gpc_reg_operand" "")
6010 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
6014 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6015 && ((TARGET_PPC_GFXOPT
6016 && !HONOR_NANS (DFmode)
6017 && !HONOR_SIGNED_ZEROS (DFmode))
6018 || VECTOR_UNIT_VSX_P (DFmode))"
6020 if (VECTOR_UNIT_VSX_P (DFmode))
6022 emit_insn (gen_vsx_copysigndf3 (operands[0], operands[1],
6023 operands[2], CONST0_RTX (DFmode)));
6026 operands[3] = gen_reg_rtx (DFmode);
6027 operands[4] = gen_reg_rtx (DFmode);
6028 operands[5] = CONST0_RTX (DFmode);
6031 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
6032 ;; fsel instruction and some auxiliary computations. Then we just have a
6033 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
6035 (define_expand "smaxsf3"
6036 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6037 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6038 (match_operand:SF 2 "gpc_reg_operand" ""))
6041 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6042 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6043 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6045 (define_expand "sminsf3"
6046 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6047 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6048 (match_operand:SF 2 "gpc_reg_operand" ""))
6051 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6052 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6053 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6056 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6057 (match_operator:SF 3 "min_max_operator"
6058 [(match_operand:SF 1 "gpc_reg_operand" "")
6059 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6060 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6061 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6064 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6065 operands[1], operands[2]);
6069 (define_expand "mov<mode>cc"
6070 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6071 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6072 (match_operand:GPR 2 "gpc_reg_operand" "")
6073 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6077 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6083 ;; We use the BASE_REGS for the isel input operands because, if rA is
6084 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6085 ;; because we may switch the operands and rB may end up being rA.
6087 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6088 ;; leave out the mode in operand 4 and use one pattern, but reload can
6089 ;; change the mode underneath our feet and then gets confused trying
6090 ;; to reload the value.
6091 (define_insn "isel_signed_<mode>"
6092 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6094 (match_operator 1 "comparison_operator"
6095 [(match_operand:CC 4 "cc_reg_operand" "y")
6097 (match_operand:GPR 2 "gpc_reg_operand" "b")
6098 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6101 { return output_isel (operands); }"
6102 [(set_attr "type" "isel")
6103 (set_attr "length" "4")])
6105 (define_insn "isel_unsigned_<mode>"
6106 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6108 (match_operator 1 "comparison_operator"
6109 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6111 (match_operand:GPR 2 "gpc_reg_operand" "b")
6112 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6115 { return output_isel (operands); }"
6116 [(set_attr "type" "isel")
6117 (set_attr "length" "4")])
6119 (define_expand "movsfcc"
6120 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6121 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6122 (match_operand:SF 2 "gpc_reg_operand" "")
6123 (match_operand:SF 3 "gpc_reg_operand" "")))]
6124 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6127 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6133 (define_insn "*fselsfsf4"
6134 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6135 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6136 (match_operand:SF 4 "zero_fp_constant" "F"))
6137 (match_operand:SF 2 "gpc_reg_operand" "f")
6138 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6139 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6141 [(set_attr "type" "fp")])
6143 (define_insn "*fseldfsf4"
6144 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6145 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6146 (match_operand:DF 4 "zero_fp_constant" "F"))
6147 (match_operand:SF 2 "gpc_reg_operand" "f")
6148 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6149 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6151 [(set_attr "type" "fp")])
6153 (define_expand "negdf2"
6154 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6155 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6156 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6159 (define_insn "*negdf2_fpr"
6160 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6161 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6162 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6163 && !VECTOR_UNIT_VSX_P (DFmode)"
6165 [(set_attr "type" "fp")])
6167 (define_expand "absdf2"
6168 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6169 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6170 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6173 (define_insn "*absdf2_fpr"
6174 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6175 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6176 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6177 && !VECTOR_UNIT_VSX_P (DFmode)"
6179 [(set_attr "type" "fp")])
6181 (define_insn "*nabsdf2_fpr"
6182 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6183 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6184 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6185 && !VECTOR_UNIT_VSX_P (DFmode)"
6187 [(set_attr "type" "fp")])
6189 (define_expand "adddf3"
6190 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6191 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6192 (match_operand:DF 2 "gpc_reg_operand" "")))]
6193 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6196 (define_insn "*adddf3_fpr"
6197 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6198 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6199 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6200 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6201 && !VECTOR_UNIT_VSX_P (DFmode)"
6202 "{fa|fadd} %0,%1,%2"
6203 [(set_attr "type" "fp")
6204 (set_attr "fp_type" "fp_addsub_d")])
6206 (define_expand "subdf3"
6207 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6208 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6209 (match_operand:DF 2 "gpc_reg_operand" "")))]
6210 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6213 (define_insn "*subdf3_fpr"
6214 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6215 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6216 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6217 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6218 && !VECTOR_UNIT_VSX_P (DFmode)"
6219 "{fs|fsub} %0,%1,%2"
6220 [(set_attr "type" "fp")
6221 (set_attr "fp_type" "fp_addsub_d")])
6223 (define_expand "muldf3"
6224 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6225 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6226 (match_operand:DF 2 "gpc_reg_operand" "")))]
6227 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6230 (define_insn "*muldf3_fpr"
6231 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6232 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6233 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6234 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6235 && !VECTOR_UNIT_VSX_P (DFmode)"
6236 "{fm|fmul} %0,%1,%2"
6237 [(set_attr "type" "dmul")
6238 (set_attr "fp_type" "fp_mul_d")])
6240 (define_expand "divdf3"
6241 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6242 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6243 (match_operand:DF 2 "gpc_reg_operand" "")))]
6245 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6246 && !TARGET_SIMPLE_FPU"
6249 (define_insn "*divdf3_fpr"
6250 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6251 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6252 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6253 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6254 && !VECTOR_UNIT_VSX_P (DFmode)"
6255 "{fd|fdiv} %0,%1,%2"
6256 [(set_attr "type" "ddiv")])
6258 (define_insn "*fred_fpr"
6259 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6260 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6261 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
6263 [(set_attr "type" "fp")])
6265 (define_insn "*rsqrtdf_internal1"
6266 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6267 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
6269 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
6271 [(set_attr "type" "fp")])
6273 (define_insn "*fmadddf4_fpr"
6274 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6275 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6276 (match_operand:DF 2 "gpc_reg_operand" "d"))
6277 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6278 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6279 && VECTOR_UNIT_NONE_P (DFmode)"
6280 "{fma|fmadd} %0,%1,%2,%3"
6281 [(set_attr "type" "dmul")
6282 (set_attr "fp_type" "fp_maddsub_d")])
6284 (define_insn "*fmsubdf4_fpr"
6285 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6286 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6287 (match_operand:DF 2 "gpc_reg_operand" "d"))
6288 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6289 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6290 && VECTOR_UNIT_NONE_P (DFmode)"
6291 "{fms|fmsub} %0,%1,%2,%3"
6292 [(set_attr "type" "dmul")
6293 (set_attr "fp_type" "fp_maddsub_d")])
6295 (define_insn "*fnmadddf4_fpr_1"
6296 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6297 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6298 (match_operand:DF 2 "gpc_reg_operand" "d"))
6299 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6300 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6301 && VECTOR_UNIT_NONE_P (DFmode)"
6302 "{fnma|fnmadd} %0,%1,%2,%3"
6303 [(set_attr "type" "dmul")
6304 (set_attr "fp_type" "fp_maddsub_d")])
6306 (define_insn "*fnmadddf4_fpr_2"
6307 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6308 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d"))
6309 (match_operand:DF 2 "gpc_reg_operand" "d"))
6310 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6311 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6312 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6313 "{fnma|fnmadd} %0,%1,%2,%3"
6314 [(set_attr "type" "dmul")
6315 (set_attr "fp_type" "fp_maddsub_d")])
6317 (define_insn "*fnmsubdf4_fpr_1"
6318 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6319 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6320 (match_operand:DF 2 "gpc_reg_operand" "d"))
6321 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6322 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6323 && VECTOR_UNIT_NONE_P (DFmode)"
6324 "{fnms|fnmsub} %0,%1,%2,%3"
6325 [(set_attr "type" "dmul")
6326 (set_attr "fp_type" "fp_maddsub_d")])
6328 (define_insn "*fnmsubdf4_fpr_2"
6329 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6330 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "d")
6331 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6332 (match_operand:DF 2 "gpc_reg_operand" "d"))))]
6333 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6334 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6335 "{fnms|fnmsub} %0,%1,%2,%3"
6336 [(set_attr "type" "dmul")
6337 (set_attr "fp_type" "fp_maddsub_d")])
6339 (define_expand "sqrtdf2"
6340 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6341 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6342 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6343 && TARGET_DOUBLE_FLOAT"
6346 (define_insn "*sqrtdf2_fpr"
6347 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6348 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6349 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6350 && TARGET_DOUBLE_FLOAT
6351 && !VECTOR_UNIT_VSX_P (DFmode)"
6353 [(set_attr "type" "dsqrt")])
6355 ;; The conditional move instructions allow us to perform max and min
6356 ;; operations even when
6358 (define_expand "smaxdf3"
6359 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6360 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6361 (match_operand:DF 2 "gpc_reg_operand" ""))
6364 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6365 && !flag_trapping_math"
6366 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6368 (define_expand "smindf3"
6369 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6370 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6371 (match_operand:DF 2 "gpc_reg_operand" ""))
6374 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6375 && !flag_trapping_math"
6376 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6379 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6380 (match_operator:DF 3 "min_max_operator"
6381 [(match_operand:DF 1 "gpc_reg_operand" "")
6382 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6383 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6384 && !flag_trapping_math"
6387 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6388 operands[1], operands[2]);
6392 (define_expand "movdfcc"
6393 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6394 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6395 (match_operand:DF 2 "gpc_reg_operand" "")
6396 (match_operand:DF 3 "gpc_reg_operand" "")))]
6397 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6400 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6406 (define_insn "*fseldfdf4"
6407 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6408 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6409 (match_operand:DF 4 "zero_fp_constant" "F"))
6410 (match_operand:DF 2 "gpc_reg_operand" "d")
6411 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6412 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6414 [(set_attr "type" "fp")])
6416 (define_insn "*fselsfdf4"
6417 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6418 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6419 (match_operand:SF 4 "zero_fp_constant" "F"))
6420 (match_operand:DF 2 "gpc_reg_operand" "d")
6421 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6422 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6424 [(set_attr "type" "fp")])
6426 ;; Conversions to and from floating-point.
6428 (define_expand "fixuns_truncsfsi2"
6429 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6430 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6431 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6434 (define_expand "fix_truncsfsi2"
6435 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6436 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6437 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6440 (define_expand "fixuns_truncdfsi2"
6441 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6442 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
6443 "TARGET_HARD_FLOAT && TARGET_E500_DOUBLE"
6446 (define_expand "fixuns_truncdfdi2"
6447 [(set (match_operand:DI 0 "register_operand" "")
6448 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
6449 "TARGET_HARD_FLOAT && TARGET_VSX"
6452 ; For each of these conversions, there is a define_expand, a define_insn
6453 ; with a '#' template, and a define_split (with C code). The idea is
6454 ; to allow constant folding with the template of the define_insn,
6455 ; then to have the insns split later (between sched1 and final).
6457 (define_expand "floatsidf2"
6458 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6459 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6462 (clobber (match_dup 4))
6463 (clobber (match_dup 5))
6464 (clobber (match_dup 6))])]
6466 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6469 if (TARGET_E500_DOUBLE)
6471 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6474 if (TARGET_POWERPC64)
6476 rtx x = convert_to_mode (DImode, operands[1], 0);
6477 emit_insn (gen_floatdidf2 (operands[0], x));
6481 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6482 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6483 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6484 operands[5] = gen_reg_rtx (DFmode);
6485 operands[6] = gen_reg_rtx (SImode);
6488 (define_insn_and_split "*floatsidf2_internal"
6489 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6490 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6491 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6492 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6493 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6494 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6495 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6496 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6502 rtx lowword, highword;
6503 gcc_assert (MEM_P (operands[4]));
6504 highword = adjust_address (operands[4], SImode, 0);
6505 lowword = adjust_address (operands[4], SImode, 4);
6506 if (! WORDS_BIG_ENDIAN)
6509 tmp = highword; highword = lowword; lowword = tmp;
6512 emit_insn (gen_xorsi3 (operands[6], operands[1],
6513 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6514 emit_move_insn (lowword, operands[6]);
6515 emit_move_insn (highword, operands[2]);
6516 emit_move_insn (operands[5], operands[4]);
6517 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6520 [(set_attr "length" "24")])
6522 (define_expand "floatunssisf2"
6523 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6524 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6525 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6528 (define_expand "floatunssidf2"
6529 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6530 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6533 (clobber (match_dup 4))
6534 (clobber (match_dup 5))])]
6535 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6538 if (TARGET_E500_DOUBLE)
6540 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6543 if (TARGET_POWERPC64)
6545 rtx x = convert_to_mode (DImode, operands[1], 1);
6546 emit_insn (gen_floatdidf2 (operands[0], x));
6550 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6551 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6552 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6553 operands[5] = gen_reg_rtx (DFmode);
6556 (define_insn_and_split "*floatunssidf2_internal"
6557 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6558 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6559 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6560 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6561 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6562 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6563 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6569 rtx lowword, highword;
6570 gcc_assert (MEM_P (operands[4]));
6571 highword = adjust_address (operands[4], SImode, 0);
6572 lowword = adjust_address (operands[4], SImode, 4);
6573 if (! WORDS_BIG_ENDIAN)
6576 tmp = highword; highword = lowword; lowword = tmp;
6579 emit_move_insn (lowword, operands[1]);
6580 emit_move_insn (highword, operands[2]);
6581 emit_move_insn (operands[5], operands[4]);
6582 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6585 [(set_attr "length" "20")])
6587 (define_expand "fix_truncdfsi2"
6588 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
6589 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
6590 (clobber (match_dup 2))
6591 (clobber (match_dup 3))])]
6592 "(TARGET_POWER2 || TARGET_POWERPC)
6593 && TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6596 if (TARGET_E500_DOUBLE)
6598 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
6601 operands[2] = gen_reg_rtx (DImode);
6602 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6603 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
6605 operands[3] = gen_reg_rtx (DImode);
6606 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
6607 operands[2], operands[3]));
6610 if (TARGET_PPC_GFXOPT)
6612 rtx orig_dest = operands[0];
6613 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
6614 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
6615 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
6617 if (operands[0] != orig_dest)
6618 emit_move_insn (orig_dest, operands[0]);
6621 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
6624 (define_insn_and_split "*fix_truncdfsi2_internal"
6625 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6626 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6627 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6628 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6629 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6630 && TARGET_DOUBLE_FLOAT"
6637 gcc_assert (MEM_P (operands[3]));
6638 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6640 emit_insn (gen_fctiwz (operands[2], operands[1]));
6641 emit_move_insn (operands[3], operands[2]);
6642 emit_move_insn (operands[0], lowword);
6645 [(set_attr "length" "16")])
6647 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6648 [(set (match_operand:SI 0 "memory_operand" "=Z")
6649 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6650 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))]
6651 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6652 && TARGET_DOUBLE_FLOAT
6653 && TARGET_PPC_GFXOPT"
6659 emit_insn (gen_fctiwz (operands[2], operands[1]));
6660 emit_insn (gen_stfiwx (operands[0], operands[2]));
6663 [(set_attr "length" "16")])
6665 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6666 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6667 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6668 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6669 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6670 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6671 && TARGET_DOUBLE_FLOAT"
6674 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6675 (set (match_dup 3) (match_dup 2))
6676 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6678 [(set_attr "length" "12")])
6680 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6681 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6682 ; because the first makes it clear that operand 0 is not live
6683 ; before the instruction.
6684 (define_insn "fctiwz"
6685 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6686 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "d"))]
6688 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6689 && TARGET_DOUBLE_FLOAT"
6690 "{fcirz|fctiwz} %0,%1"
6691 [(set_attr "type" "fp")])
6693 (define_expand "btruncdf2"
6694 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6695 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIZ))]
6696 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6699 (define_insn "*btruncdf2_fpr"
6700 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6701 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6702 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6703 && !VECTOR_UNIT_VSX_P (DFmode)"
6705 [(set_attr "type" "fp")])
6707 (define_insn "btruncsf2"
6708 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6709 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6710 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6712 [(set_attr "type" "fp")])
6714 (define_expand "ceildf2"
6715 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6716 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIP))]
6717 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6720 (define_insn "*ceildf2_fpr"
6721 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6722 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIP))]
6723 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6724 && !VECTOR_UNIT_VSX_P (DFmode)"
6726 [(set_attr "type" "fp")])
6728 (define_insn "ceilsf2"
6729 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6730 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6731 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6733 [(set_attr "type" "fp")])
6735 (define_expand "floordf2"
6736 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6737 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIM))]
6738 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6741 (define_insn "*floordf2_fpr"
6742 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6743 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIM))]
6744 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6745 && !VECTOR_UNIT_VSX_P (DFmode)"
6747 [(set_attr "type" "fp")])
6749 (define_insn "floorsf2"
6750 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6751 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6752 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6754 [(set_attr "type" "fp")])
6756 ;; No VSX equivalent to frin
6757 (define_insn "rounddf2"
6758 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6759 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIN))]
6760 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6762 [(set_attr "type" "fp")])
6764 (define_insn "roundsf2"
6765 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6766 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6767 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6769 [(set_attr "type" "fp")])
6771 (define_expand "ftruncdf2"
6772 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6773 (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6774 "VECTOR_UNIT_VSX_P (DFmode)"
6777 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6778 (define_insn "stfiwx"
6779 [(set (match_operand:SI 0 "memory_operand" "=Z")
6780 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6784 [(set_attr "type" "fpstore")])
6786 (define_expand "floatsisf2"
6787 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6788 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6789 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6792 (define_expand "floatdidf2"
6793 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6794 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6795 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6796 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6799 (define_insn "*floatdidf2_fpr"
6800 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6801 (float:DF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))]
6802 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6803 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6804 && !VECTOR_UNIT_VSX_P (DFmode)"
6806 [(set_attr "type" "fp")])
6808 (define_expand "floatunsdidf2"
6809 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6810 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6814 (define_expand "fix_truncdfdi2"
6815 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6816 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "")))]
6817 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6818 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6821 (define_insn "*fix_truncdfdi2_fpr"
6822 [(set (match_operand:DI 0 "gpc_reg_operand" "=!d#r")
6823 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d")))]
6824 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6825 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6826 && !VECTOR_UNIT_VSX_P (DFmode)"
6828 [(set_attr "type" "fp")])
6830 (define_expand "floatdisf2"
6831 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6832 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6833 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6836 rtx val = operands[1];
6837 if (!flag_unsafe_math_optimizations)
6839 rtx label = gen_label_rtx ();
6840 val = gen_reg_rtx (DImode);
6841 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6844 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6848 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6849 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6850 ;; from double rounding.
6851 (define_insn_and_split "floatdisf2_internal1"
6852 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6853 (float:SF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))
6854 (clobber (match_scratch:DF 2 "=d"))]
6855 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6857 "&& reload_completed"
6859 (float:DF (match_dup 1)))
6861 (float_truncate:SF (match_dup 2)))]
6864 ;; Twiddles bits to avoid double rounding.
6865 ;; Bits that might be truncated when converting to DFmode are replaced
6866 ;; by a bit that won't be lost at that stage, but is below the SFmode
6867 ;; rounding position.
6868 (define_expand "floatdisf2_internal2"
6869 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6871 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6873 (clobber (scratch:CC))])
6874 (set (match_dup 3) (plus:DI (match_dup 3)
6876 (set (match_dup 0) (plus:DI (match_dup 0)
6878 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6880 (set (match_dup 0) (ior:DI (match_dup 0)
6882 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6884 (clobber (scratch:CC))])
6885 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6886 (label_ref (match_operand:DI 2 "" ""))
6888 (set (match_dup 0) (match_dup 1))]
6889 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6892 operands[3] = gen_reg_rtx (DImode);
6893 operands[4] = gen_reg_rtx (CCUNSmode);
6896 ;; Define the DImode operations that can be done in a small number
6897 ;; of instructions. The & constraints are to prevent the register
6898 ;; allocator from allocating registers that overlap with the inputs
6899 ;; (for example, having an input in 7,8 and an output in 6,7). We
6900 ;; also allow for the output being the same as one of the inputs.
6902 (define_insn "*adddi3_noppc64"
6903 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6904 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6905 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6906 "! TARGET_POWERPC64"
6909 if (WORDS_BIG_ENDIAN)
6910 return (GET_CODE (operands[2])) != CONST_INT
6911 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6912 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6914 return (GET_CODE (operands[2])) != CONST_INT
6915 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6916 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6918 [(set_attr "type" "two")
6919 (set_attr "length" "8")])
6921 (define_insn "*subdi3_noppc64"
6922 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6923 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6924 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6925 "! TARGET_POWERPC64"
6928 if (WORDS_BIG_ENDIAN)
6929 return (GET_CODE (operands[1]) != CONST_INT)
6930 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6931 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6933 return (GET_CODE (operands[1]) != CONST_INT)
6934 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6935 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6937 [(set_attr "type" "two")
6938 (set_attr "length" "8")])
6940 (define_insn "*negdi2_noppc64"
6941 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6942 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6943 "! TARGET_POWERPC64"
6946 return (WORDS_BIG_ENDIAN)
6947 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6948 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6950 [(set_attr "type" "two")
6951 (set_attr "length" "8")])
6953 (define_expand "mulsidi3"
6954 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6955 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6956 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6957 "! TARGET_POWERPC64"
6960 if (! TARGET_POWER && ! TARGET_POWERPC)
6962 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6963 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6964 emit_insn (gen_mull_call ());
6965 if (WORDS_BIG_ENDIAN)
6966 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6969 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6970 gen_rtx_REG (SImode, 3));
6971 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6972 gen_rtx_REG (SImode, 4));
6976 else if (TARGET_POWER)
6978 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6983 (define_insn "mulsidi3_mq"
6984 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6985 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6986 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6987 (clobber (match_scratch:SI 3 "=q"))]
6989 "mul %0,%1,%2\;mfmq %L0"
6990 [(set_attr "type" "imul")
6991 (set_attr "length" "8")])
6993 (define_insn "*mulsidi3_no_mq"
6994 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6995 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6996 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6997 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7000 return (WORDS_BIG_ENDIAN)
7001 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
7002 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
7004 [(set_attr "type" "imul")
7005 (set_attr "length" "8")])
7008 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7009 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7010 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7011 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7014 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
7015 (sign_extend:DI (match_dup 2)))
7018 (mult:SI (match_dup 1)
7022 int endian = (WORDS_BIG_ENDIAN == 0);
7023 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7024 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7027 (define_expand "umulsidi3"
7028 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7029 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7030 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7031 "TARGET_POWERPC && ! TARGET_POWERPC64"
7036 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7041 (define_insn "umulsidi3_mq"
7042 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7043 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7044 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7045 (clobber (match_scratch:SI 3 "=q"))]
7046 "TARGET_POWERPC && TARGET_POWER"
7049 return (WORDS_BIG_ENDIAN)
7050 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7051 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7053 [(set_attr "type" "imul")
7054 (set_attr "length" "8")])
7056 (define_insn "*umulsidi3_no_mq"
7057 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7058 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7059 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7060 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7063 return (WORDS_BIG_ENDIAN)
7064 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7065 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7067 [(set_attr "type" "imul")
7068 (set_attr "length" "8")])
7071 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7072 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7073 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7074 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7077 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7078 (zero_extend:DI (match_dup 2)))
7081 (mult:SI (match_dup 1)
7085 int endian = (WORDS_BIG_ENDIAN == 0);
7086 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7087 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7090 (define_expand "smulsi3_highpart"
7091 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7093 (lshiftrt:DI (mult:DI (sign_extend:DI
7094 (match_operand:SI 1 "gpc_reg_operand" ""))
7096 (match_operand:SI 2 "gpc_reg_operand" "")))
7101 if (! TARGET_POWER && ! TARGET_POWERPC)
7103 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7104 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7105 emit_insn (gen_mulh_call ());
7106 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7109 else if (TARGET_POWER)
7111 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7116 (define_insn "smulsi3_highpart_mq"
7117 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7119 (lshiftrt:DI (mult:DI (sign_extend:DI
7120 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7122 (match_operand:SI 2 "gpc_reg_operand" "r")))
7124 (clobber (match_scratch:SI 3 "=q"))]
7127 [(set_attr "type" "imul")])
7129 (define_insn "*smulsi3_highpart_no_mq"
7130 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7132 (lshiftrt:DI (mult:DI (sign_extend:DI
7133 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7135 (match_operand:SI 2 "gpc_reg_operand" "r")))
7137 "TARGET_POWERPC && ! TARGET_POWER"
7139 [(set_attr "type" "imul")])
7141 (define_expand "umulsi3_highpart"
7142 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7144 (lshiftrt:DI (mult:DI (zero_extend:DI
7145 (match_operand:SI 1 "gpc_reg_operand" ""))
7147 (match_operand:SI 2 "gpc_reg_operand" "")))
7154 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7159 (define_insn "umulsi3_highpart_mq"
7160 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7162 (lshiftrt:DI (mult:DI (zero_extend:DI
7163 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7165 (match_operand:SI 2 "gpc_reg_operand" "r")))
7167 (clobber (match_scratch:SI 3 "=q"))]
7168 "TARGET_POWERPC && TARGET_POWER"
7170 [(set_attr "type" "imul")])
7172 (define_insn "*umulsi3_highpart_no_mq"
7173 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7175 (lshiftrt:DI (mult:DI (zero_extend:DI
7176 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7178 (match_operand:SI 2 "gpc_reg_operand" "r")))
7180 "TARGET_POWERPC && ! TARGET_POWER"
7182 [(set_attr "type" "imul")])
7184 ;; If operands 0 and 2 are in the same register, we have a problem. But
7185 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7186 ;; why we have the strange constraints below.
7187 (define_insn "ashldi3_power"
7188 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7189 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7190 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7191 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7194 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7195 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7196 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7197 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7198 [(set_attr "length" "8")])
7200 (define_insn "lshrdi3_power"
7201 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7202 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7203 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7204 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7207 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7208 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7209 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7210 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7211 [(set_attr "length" "8")])
7213 ;; Shift by a variable amount is too complex to be worth open-coding. We
7214 ;; just handle shifts by constants.
7215 (define_insn "ashrdi3_power"
7216 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7217 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7218 (match_operand:SI 2 "const_int_operand" "M,i")))
7219 (clobber (match_scratch:SI 3 "=X,q"))]
7222 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7223 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7224 [(set_attr "type" "shift")
7225 (set_attr "length" "8")])
7227 (define_insn "ashrdi3_no_power"
7228 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7229 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7230 (match_operand:SI 2 "const_int_operand" "M,i")))]
7231 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7233 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7234 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7235 [(set_attr "type" "two,three")
7236 (set_attr "length" "8,12")])
7238 (define_insn "*ashrdisi3_noppc64"
7239 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7240 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7241 (const_int 32)) 4))]
7242 "TARGET_32BIT && !TARGET_POWERPC64"
7245 if (REGNO (operands[0]) == REGNO (operands[1]))
7248 return \"mr %0,%1\";
7250 [(set_attr "length" "4")])
7253 ;; PowerPC64 DImode operations.
7255 (define_expand "absdi2"
7256 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7257 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7262 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7264 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7268 (define_insn_and_split "absdi2_internal"
7269 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7270 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7271 (clobber (match_scratch:DI 2 "=&r,&r"))]
7272 "TARGET_POWERPC64 && !TARGET_ISEL"
7274 "&& reload_completed"
7275 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7276 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7277 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7280 (define_insn_and_split "*nabsdi2"
7281 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7282 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7283 (clobber (match_scratch:DI 2 "=&r,&r"))]
7284 "TARGET_POWERPC64 && !TARGET_ISEL"
7286 "&& reload_completed"
7287 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7288 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7289 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7292 (define_insn "muldi3"
7293 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7294 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7295 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7301 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7302 (const_string "imul3")
7303 (match_operand:SI 2 "short_cint_operand" "")
7304 (const_string "imul2")]
7305 (const_string "lmul")))])
7307 (define_insn "*muldi3_internal1"
7308 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7309 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7310 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7312 (clobber (match_scratch:DI 3 "=r,r"))]
7317 [(set_attr "type" "lmul_compare")
7318 (set_attr "length" "4,8")])
7321 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7322 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7323 (match_operand:DI 2 "gpc_reg_operand" ""))
7325 (clobber (match_scratch:DI 3 ""))]
7326 "TARGET_POWERPC64 && reload_completed"
7328 (mult:DI (match_dup 1) (match_dup 2)))
7330 (compare:CC (match_dup 3)
7334 (define_insn "*muldi3_internal2"
7335 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7336 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7337 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7339 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7340 (mult:DI (match_dup 1) (match_dup 2)))]
7345 [(set_attr "type" "lmul_compare")
7346 (set_attr "length" "4,8")])
7349 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7350 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7351 (match_operand:DI 2 "gpc_reg_operand" ""))
7353 (set (match_operand:DI 0 "gpc_reg_operand" "")
7354 (mult:DI (match_dup 1) (match_dup 2)))]
7355 "TARGET_POWERPC64 && reload_completed"
7357 (mult:DI (match_dup 1) (match_dup 2)))
7359 (compare:CC (match_dup 0)
7363 (define_insn "smuldi3_highpart"
7364 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7366 (lshiftrt:TI (mult:TI (sign_extend:TI
7367 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7369 (match_operand:DI 2 "gpc_reg_operand" "r")))
7373 [(set_attr "type" "lmul")])
7375 (define_insn "umuldi3_highpart"
7376 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7378 (lshiftrt:TI (mult:TI (zero_extend:TI
7379 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7381 (match_operand:DI 2 "gpc_reg_operand" "r")))
7385 [(set_attr "type" "lmul")])
7387 (define_insn "rotldi3"
7388 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7389 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7390 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7395 [(set_attr "type" "var_shift_rotate,integer")])
7397 (define_insn "*rotldi3_internal2"
7398 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7399 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7400 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7402 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7409 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7410 (set_attr "length" "4,4,8,8")])
7413 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7414 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7415 (match_operand:DI 2 "reg_or_cint_operand" ""))
7417 (clobber (match_scratch:DI 3 ""))]
7418 "TARGET_POWERPC64 && reload_completed"
7420 (rotate:DI (match_dup 1) (match_dup 2)))
7422 (compare:CC (match_dup 3)
7426 (define_insn "*rotldi3_internal3"
7427 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7428 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7429 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7431 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7432 (rotate:DI (match_dup 1) (match_dup 2)))]
7439 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7440 (set_attr "length" "4,4,8,8")])
7443 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7444 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7445 (match_operand:DI 2 "reg_or_cint_operand" ""))
7447 (set (match_operand:DI 0 "gpc_reg_operand" "")
7448 (rotate:DI (match_dup 1) (match_dup 2)))]
7449 "TARGET_POWERPC64 && reload_completed"
7451 (rotate:DI (match_dup 1) (match_dup 2)))
7453 (compare:CC (match_dup 0)
7457 (define_insn "*rotldi3_internal4"
7458 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7459 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7460 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7461 (match_operand:DI 3 "mask64_operand" "n,n")))]
7464 rldc%B3 %0,%1,%2,%S3
7465 rldic%B3 %0,%1,%H2,%S3"
7466 [(set_attr "type" "var_shift_rotate,integer")])
7468 (define_insn "*rotldi3_internal5"
7469 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7471 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7472 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7473 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7475 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7478 rldc%B3. %4,%1,%2,%S3
7479 rldic%B3. %4,%1,%H2,%S3
7482 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7483 (set_attr "length" "4,4,8,8")])
7486 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7488 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7489 (match_operand:DI 2 "reg_or_cint_operand" ""))
7490 (match_operand:DI 3 "mask64_operand" ""))
7492 (clobber (match_scratch:DI 4 ""))]
7493 "TARGET_POWERPC64 && reload_completed"
7495 (and:DI (rotate:DI (match_dup 1)
7499 (compare:CC (match_dup 4)
7503 (define_insn "*rotldi3_internal6"
7504 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7506 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7507 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7508 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7510 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7511 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7514 rldc%B3. %0,%1,%2,%S3
7515 rldic%B3. %0,%1,%H2,%S3
7518 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7519 (set_attr "length" "4,4,8,8")])
7522 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7524 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7525 (match_operand:DI 2 "reg_or_cint_operand" ""))
7526 (match_operand:DI 3 "mask64_operand" ""))
7528 (set (match_operand:DI 0 "gpc_reg_operand" "")
7529 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7530 "TARGET_POWERPC64 && reload_completed"
7532 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7534 (compare:CC (match_dup 0)
7538 (define_insn "*rotldi3_internal7"
7539 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7542 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7543 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7547 rldicl %0,%1,%H2,56"
7548 [(set_attr "type" "var_shift_rotate,integer")])
7550 (define_insn "*rotldi3_internal8"
7551 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7552 (compare:CC (zero_extend:DI
7554 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7555 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7557 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7561 rldicl. %3,%1,%H2,56
7564 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7565 (set_attr "length" "4,4,8,8")])
7568 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7569 (compare:CC (zero_extend:DI
7571 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7572 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7574 (clobber (match_scratch:DI 3 ""))]
7575 "TARGET_POWERPC64 && reload_completed"
7577 (zero_extend:DI (subreg:QI
7578 (rotate:DI (match_dup 1)
7581 (compare:CC (match_dup 3)
7585 (define_insn "*rotldi3_internal9"
7586 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7587 (compare:CC (zero_extend:DI
7589 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7590 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7592 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7593 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7597 rldicl. %0,%1,%H2,56
7600 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7601 (set_attr "length" "4,4,8,8")])
7604 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7605 (compare:CC (zero_extend:DI
7607 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7608 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7610 (set (match_operand:DI 0 "gpc_reg_operand" "")
7611 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7612 "TARGET_POWERPC64 && reload_completed"
7614 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7616 (compare:CC (match_dup 0)
7620 (define_insn "*rotldi3_internal10"
7621 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7624 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7625 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7629 rldicl %0,%1,%H2,48"
7630 [(set_attr "type" "var_shift_rotate,integer")])
7632 (define_insn "*rotldi3_internal11"
7633 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7634 (compare:CC (zero_extend:DI
7636 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7637 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7639 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7643 rldicl. %3,%1,%H2,48
7646 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7647 (set_attr "length" "4,4,8,8")])
7650 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7651 (compare:CC (zero_extend:DI
7653 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7654 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7656 (clobber (match_scratch:DI 3 ""))]
7657 "TARGET_POWERPC64 && reload_completed"
7659 (zero_extend:DI (subreg:HI
7660 (rotate:DI (match_dup 1)
7663 (compare:CC (match_dup 3)
7667 (define_insn "*rotldi3_internal12"
7668 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7669 (compare:CC (zero_extend:DI
7671 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7672 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7674 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7675 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7679 rldicl. %0,%1,%H2,48
7682 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7683 (set_attr "length" "4,4,8,8")])
7686 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7687 (compare:CC (zero_extend:DI
7689 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7690 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7692 (set (match_operand:DI 0 "gpc_reg_operand" "")
7693 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7694 "TARGET_POWERPC64 && reload_completed"
7696 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7698 (compare:CC (match_dup 0)
7702 (define_insn "*rotldi3_internal13"
7703 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7706 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7707 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7711 rldicl %0,%1,%H2,32"
7712 [(set_attr "type" "var_shift_rotate,integer")])
7714 (define_insn "*rotldi3_internal14"
7715 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7716 (compare:CC (zero_extend:DI
7718 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7719 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7721 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7725 rldicl. %3,%1,%H2,32
7728 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7729 (set_attr "length" "4,4,8,8")])
7732 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7733 (compare:CC (zero_extend:DI
7735 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7736 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7738 (clobber (match_scratch:DI 3 ""))]
7739 "TARGET_POWERPC64 && reload_completed"
7741 (zero_extend:DI (subreg:SI
7742 (rotate:DI (match_dup 1)
7745 (compare:CC (match_dup 3)
7749 (define_insn "*rotldi3_internal15"
7750 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7751 (compare:CC (zero_extend:DI
7753 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7754 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7756 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7757 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7761 rldicl. %0,%1,%H2,32
7764 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7765 (set_attr "length" "4,4,8,8")])
7768 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7769 (compare:CC (zero_extend:DI
7771 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7772 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7774 (set (match_operand:DI 0 "gpc_reg_operand" "")
7775 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7776 "TARGET_POWERPC64 && reload_completed"
7778 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7780 (compare:CC (match_dup 0)
7784 (define_expand "ashldi3"
7785 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7786 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7787 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7788 "TARGET_POWERPC64 || TARGET_POWER"
7791 if (TARGET_POWERPC64)
7793 else if (TARGET_POWER)
7795 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7802 (define_insn "*ashldi3_internal1"
7803 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7804 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7805 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7810 [(set_attr "type" "var_shift_rotate,shift")])
7812 (define_insn "*ashldi3_internal2"
7813 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7814 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7815 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7817 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7824 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7825 (set_attr "length" "4,4,8,8")])
7828 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7829 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7830 (match_operand:SI 2 "reg_or_cint_operand" ""))
7832 (clobber (match_scratch:DI 3 ""))]
7833 "TARGET_POWERPC64 && reload_completed"
7835 (ashift:DI (match_dup 1) (match_dup 2)))
7837 (compare:CC (match_dup 3)
7841 (define_insn "*ashldi3_internal3"
7842 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7843 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7844 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7846 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7847 (ashift:DI (match_dup 1) (match_dup 2)))]
7854 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7855 (set_attr "length" "4,4,8,8")])
7858 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7859 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7860 (match_operand:SI 2 "reg_or_cint_operand" ""))
7862 (set (match_operand:DI 0 "gpc_reg_operand" "")
7863 (ashift:DI (match_dup 1) (match_dup 2)))]
7864 "TARGET_POWERPC64 && reload_completed"
7866 (ashift:DI (match_dup 1) (match_dup 2)))
7868 (compare:CC (match_dup 0)
7872 (define_insn "*ashldi3_internal4"
7873 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7874 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7875 (match_operand:SI 2 "const_int_operand" "i"))
7876 (match_operand:DI 3 "const_int_operand" "n")))]
7877 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7878 "rldic %0,%1,%H2,%W3")
7880 (define_insn "ashldi3_internal5"
7881 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7883 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7884 (match_operand:SI 2 "const_int_operand" "i,i"))
7885 (match_operand:DI 3 "const_int_operand" "n,n"))
7887 (clobber (match_scratch:DI 4 "=r,r"))]
7888 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7890 rldic. %4,%1,%H2,%W3
7892 [(set_attr "type" "compare")
7893 (set_attr "length" "4,8")])
7896 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7898 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7899 (match_operand:SI 2 "const_int_operand" ""))
7900 (match_operand:DI 3 "const_int_operand" ""))
7902 (clobber (match_scratch:DI 4 ""))]
7903 "TARGET_POWERPC64 && reload_completed
7904 && includes_rldic_lshift_p (operands[2], operands[3])"
7906 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7909 (compare:CC (match_dup 4)
7913 (define_insn "*ashldi3_internal6"
7914 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7916 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7917 (match_operand:SI 2 "const_int_operand" "i,i"))
7918 (match_operand:DI 3 "const_int_operand" "n,n"))
7920 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7921 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7922 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7924 rldic. %0,%1,%H2,%W3
7926 [(set_attr "type" "compare")
7927 (set_attr "length" "4,8")])
7930 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7932 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7933 (match_operand:SI 2 "const_int_operand" ""))
7934 (match_operand:DI 3 "const_int_operand" ""))
7936 (set (match_operand:DI 0 "gpc_reg_operand" "")
7937 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7938 "TARGET_POWERPC64 && reload_completed
7939 && includes_rldic_lshift_p (operands[2], operands[3])"
7941 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7944 (compare:CC (match_dup 0)
7948 (define_insn "*ashldi3_internal7"
7949 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7950 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7951 (match_operand:SI 2 "const_int_operand" "i"))
7952 (match_operand:DI 3 "mask64_operand" "n")))]
7953 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7954 "rldicr %0,%1,%H2,%S3")
7956 (define_insn "ashldi3_internal8"
7957 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7959 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7960 (match_operand:SI 2 "const_int_operand" "i,i"))
7961 (match_operand:DI 3 "mask64_operand" "n,n"))
7963 (clobber (match_scratch:DI 4 "=r,r"))]
7964 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7966 rldicr. %4,%1,%H2,%S3
7968 [(set_attr "type" "compare")
7969 (set_attr "length" "4,8")])
7972 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7974 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7975 (match_operand:SI 2 "const_int_operand" ""))
7976 (match_operand:DI 3 "mask64_operand" ""))
7978 (clobber (match_scratch:DI 4 ""))]
7979 "TARGET_POWERPC64 && reload_completed
7980 && includes_rldicr_lshift_p (operands[2], operands[3])"
7982 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7985 (compare:CC (match_dup 4)
7989 (define_insn "*ashldi3_internal9"
7990 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7992 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7993 (match_operand:SI 2 "const_int_operand" "i,i"))
7994 (match_operand:DI 3 "mask64_operand" "n,n"))
7996 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7997 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7998 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8000 rldicr. %0,%1,%H2,%S3
8002 [(set_attr "type" "compare")
8003 (set_attr "length" "4,8")])
8006 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8008 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8009 (match_operand:SI 2 "const_int_operand" ""))
8010 (match_operand:DI 3 "mask64_operand" ""))
8012 (set (match_operand:DI 0 "gpc_reg_operand" "")
8013 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8014 "TARGET_POWERPC64 && reload_completed
8015 && includes_rldicr_lshift_p (operands[2], operands[3])"
8017 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8020 (compare:CC (match_dup 0)
8024 (define_expand "lshrdi3"
8025 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8026 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8027 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8028 "TARGET_POWERPC64 || TARGET_POWER"
8031 if (TARGET_POWERPC64)
8033 else if (TARGET_POWER)
8035 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8042 (define_insn "*lshrdi3_internal1"
8043 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8044 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8045 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8050 [(set_attr "type" "var_shift_rotate,shift")])
8052 (define_insn "*lshrdi3_internal2"
8053 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8054 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8055 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8057 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8064 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8065 (set_attr "length" "4,4,8,8")])
8068 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8069 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8070 (match_operand:SI 2 "reg_or_cint_operand" ""))
8072 (clobber (match_scratch:DI 3 ""))]
8073 "TARGET_POWERPC64 && reload_completed"
8075 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8077 (compare:CC (match_dup 3)
8081 (define_insn "*lshrdi3_internal3"
8082 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8083 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8084 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8086 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8087 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8094 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8095 (set_attr "length" "4,4,8,8")])
8098 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8099 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8100 (match_operand:SI 2 "reg_or_cint_operand" ""))
8102 (set (match_operand:DI 0 "gpc_reg_operand" "")
8103 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8104 "TARGET_POWERPC64 && reload_completed"
8106 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8108 (compare:CC (match_dup 0)
8112 (define_expand "ashrdi3"
8113 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8114 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8115 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8119 if (TARGET_POWERPC64)
8121 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8123 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8126 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8127 && WORDS_BIG_ENDIAN)
8129 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8136 (define_insn "*ashrdi3_internal1"
8137 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8138 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8139 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8144 [(set_attr "type" "var_shift_rotate,shift")])
8146 (define_insn "*ashrdi3_internal2"
8147 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8148 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8149 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8151 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8158 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8159 (set_attr "length" "4,4,8,8")])
8162 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8163 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8164 (match_operand:SI 2 "reg_or_cint_operand" ""))
8166 (clobber (match_scratch:DI 3 ""))]
8167 "TARGET_POWERPC64 && reload_completed"
8169 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8171 (compare:CC (match_dup 3)
8175 (define_insn "*ashrdi3_internal3"
8176 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8177 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8178 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8180 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8181 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8188 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8189 (set_attr "length" "4,4,8,8")])
8192 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8193 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8194 (match_operand:SI 2 "reg_or_cint_operand" ""))
8196 (set (match_operand:DI 0 "gpc_reg_operand" "")
8197 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8198 "TARGET_POWERPC64 && reload_completed"
8200 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8202 (compare:CC (match_dup 0)
8206 (define_expand "anddi3"
8208 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8209 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8210 (match_operand:DI 2 "and64_2_operand" "")))
8211 (clobber (match_scratch:CC 3 ""))])]
8215 (define_insn "anddi3_mc"
8216 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8217 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8218 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8219 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8220 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8223 rldic%B2 %0,%1,0,%S2
8224 rlwinm %0,%1,0,%m2,%M2
8228 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8229 (set_attr "length" "4,4,4,4,4,8")])
8231 (define_insn "anddi3_nomc"
8232 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8233 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8234 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8235 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8236 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8239 rldic%B2 %0,%1,0,%S2
8240 rlwinm %0,%1,0,%m2,%M2
8242 [(set_attr "length" "4,4,4,8")])
8245 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8246 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8247 (match_operand:DI 2 "mask64_2_operand" "")))
8248 (clobber (match_scratch:CC 3 ""))]
8250 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8251 && !mask_operand (operands[2], DImode)
8252 && !mask64_operand (operands[2], DImode)"
8254 (and:DI (rotate:DI (match_dup 1)
8258 (and:DI (rotate:DI (match_dup 0)
8262 build_mask64_2_operands (operands[2], &operands[4]);
8265 (define_insn "*anddi3_internal2_mc"
8266 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8267 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8268 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8270 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8271 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8272 "TARGET_64BIT && rs6000_gen_cell_microcode"
8275 rldic%B2. %3,%1,0,%S2
8276 rlwinm. %3,%1,0,%m2,%M2
8286 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8287 fast_compare,compare,compare,compare,compare,compare,\
8289 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8292 [(set (match_operand:CC 0 "cc_reg_operand" "")
8293 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8294 (match_operand:DI 2 "mask64_2_operand" ""))
8296 (clobber (match_scratch:DI 3 ""))
8297 (clobber (match_scratch:CC 4 ""))]
8298 "TARGET_64BIT && reload_completed
8299 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8300 && !mask_operand (operands[2], DImode)
8301 && !mask64_operand (operands[2], DImode)"
8303 (and:DI (rotate:DI (match_dup 1)
8306 (parallel [(set (match_dup 0)
8307 (compare:CC (and:DI (rotate:DI (match_dup 3)
8311 (clobber (match_dup 3))])]
8314 build_mask64_2_operands (operands[2], &operands[5]);
8317 (define_insn "*anddi3_internal3_mc"
8318 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8319 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8320 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8322 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8323 (and:DI (match_dup 1) (match_dup 2)))
8324 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8325 "TARGET_64BIT && rs6000_gen_cell_microcode"
8328 rldic%B2. %0,%1,0,%S2
8329 rlwinm. %0,%1,0,%m2,%M2
8339 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8340 fast_compare,compare,compare,compare,compare,compare,\
8342 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8345 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8346 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8347 (match_operand:DI 2 "and64_2_operand" ""))
8349 (set (match_operand:DI 0 "gpc_reg_operand" "")
8350 (and:DI (match_dup 1) (match_dup 2)))
8351 (clobber (match_scratch:CC 4 ""))]
8352 "TARGET_64BIT && reload_completed"
8353 [(parallel [(set (match_dup 0)
8354 (and:DI (match_dup 1) (match_dup 2)))
8355 (clobber (match_dup 4))])
8357 (compare:CC (match_dup 0)
8362 [(set (match_operand:CC 3 "cc_reg_operand" "")
8363 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8364 (match_operand:DI 2 "mask64_2_operand" ""))
8366 (set (match_operand:DI 0 "gpc_reg_operand" "")
8367 (and:DI (match_dup 1) (match_dup 2)))
8368 (clobber (match_scratch:CC 4 ""))]
8369 "TARGET_64BIT && reload_completed
8370 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8371 && !mask_operand (operands[2], DImode)
8372 && !mask64_operand (operands[2], DImode)"
8374 (and:DI (rotate:DI (match_dup 1)
8377 (parallel [(set (match_dup 3)
8378 (compare:CC (and:DI (rotate:DI (match_dup 0)
8383 (and:DI (rotate:DI (match_dup 0)
8388 build_mask64_2_operands (operands[2], &operands[5]);
8391 (define_expand "iordi3"
8392 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8393 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8394 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8398 if (non_logical_cint_operand (operands[2], DImode))
8400 HOST_WIDE_INT value;
8401 rtx tmp = ((!can_create_pseudo_p ()
8402 || rtx_equal_p (operands[0], operands[1]))
8403 ? operands[0] : gen_reg_rtx (DImode));
8405 if (GET_CODE (operands[2]) == CONST_INT)
8407 value = INTVAL (operands[2]);
8408 emit_insn (gen_iordi3 (tmp, operands[1],
8409 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8413 value = CONST_DOUBLE_LOW (operands[2]);
8414 emit_insn (gen_iordi3 (tmp, operands[1],
8415 immed_double_const (value
8416 & (~ (HOST_WIDE_INT) 0xffff),
8420 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8425 (define_expand "xordi3"
8426 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8427 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8428 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8432 if (non_logical_cint_operand (operands[2], DImode))
8434 HOST_WIDE_INT value;
8435 rtx tmp = ((!can_create_pseudo_p ()
8436 || rtx_equal_p (operands[0], operands[1]))
8437 ? operands[0] : gen_reg_rtx (DImode));
8439 if (GET_CODE (operands[2]) == CONST_INT)
8441 value = INTVAL (operands[2]);
8442 emit_insn (gen_xordi3 (tmp, operands[1],
8443 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8447 value = CONST_DOUBLE_LOW (operands[2]);
8448 emit_insn (gen_xordi3 (tmp, operands[1],
8449 immed_double_const (value
8450 & (~ (HOST_WIDE_INT) 0xffff),
8454 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8459 (define_insn "*booldi3_internal1"
8460 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8461 (match_operator:DI 3 "boolean_or_operator"
8462 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8463 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8470 (define_insn "*booldi3_internal2"
8471 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8472 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8473 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8474 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8476 (clobber (match_scratch:DI 3 "=r,r"))]
8481 [(set_attr "type" "fast_compare,compare")
8482 (set_attr "length" "4,8")])
8485 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8486 (compare:CC (match_operator:DI 4 "boolean_operator"
8487 [(match_operand:DI 1 "gpc_reg_operand" "")
8488 (match_operand:DI 2 "gpc_reg_operand" "")])
8490 (clobber (match_scratch:DI 3 ""))]
8491 "TARGET_POWERPC64 && reload_completed"
8492 [(set (match_dup 3) (match_dup 4))
8494 (compare:CC (match_dup 3)
8498 (define_insn "*booldi3_internal3"
8499 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8500 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8501 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8502 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8504 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8510 [(set_attr "type" "fast_compare,compare")
8511 (set_attr "length" "4,8")])
8514 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8515 (compare:CC (match_operator:DI 4 "boolean_operator"
8516 [(match_operand:DI 1 "gpc_reg_operand" "")
8517 (match_operand:DI 2 "gpc_reg_operand" "")])
8519 (set (match_operand:DI 0 "gpc_reg_operand" "")
8521 "TARGET_POWERPC64 && reload_completed"
8522 [(set (match_dup 0) (match_dup 4))
8524 (compare:CC (match_dup 0)
8528 ;; Split a logical operation that we can't do in one insn into two insns,
8529 ;; each of which does one 16-bit part. This is used by combine.
8532 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8533 (match_operator:DI 3 "boolean_or_operator"
8534 [(match_operand:DI 1 "gpc_reg_operand" "")
8535 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8537 [(set (match_dup 0) (match_dup 4))
8538 (set (match_dup 0) (match_dup 5))]
8543 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8545 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8546 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8548 i4 = GEN_INT (value & 0xffff);
8552 i3 = GEN_INT (INTVAL (operands[2])
8553 & (~ (HOST_WIDE_INT) 0xffff));
8554 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8556 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8558 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8562 (define_insn "*boolcdi3_internal1"
8563 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8564 (match_operator:DI 3 "boolean_operator"
8565 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8566 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8570 (define_insn "*boolcdi3_internal2"
8571 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8572 (compare:CC (match_operator:DI 4 "boolean_operator"
8573 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8574 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8576 (clobber (match_scratch:DI 3 "=r,r"))]
8581 [(set_attr "type" "fast_compare,compare")
8582 (set_attr "length" "4,8")])
8585 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8586 (compare:CC (match_operator:DI 4 "boolean_operator"
8587 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8588 (match_operand:DI 2 "gpc_reg_operand" "")])
8590 (clobber (match_scratch:DI 3 ""))]
8591 "TARGET_POWERPC64 && reload_completed"
8592 [(set (match_dup 3) (match_dup 4))
8594 (compare:CC (match_dup 3)
8598 (define_insn "*boolcdi3_internal3"
8599 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8600 (compare:CC (match_operator:DI 4 "boolean_operator"
8601 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8602 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8604 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8610 [(set_attr "type" "fast_compare,compare")
8611 (set_attr "length" "4,8")])
8614 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8615 (compare:CC (match_operator:DI 4 "boolean_operator"
8616 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8617 (match_operand:DI 2 "gpc_reg_operand" "")])
8619 (set (match_operand:DI 0 "gpc_reg_operand" "")
8621 "TARGET_POWERPC64 && reload_completed"
8622 [(set (match_dup 0) (match_dup 4))
8624 (compare:CC (match_dup 0)
8628 (define_insn "*boolccdi3_internal1"
8629 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8630 (match_operator:DI 3 "boolean_operator"
8631 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8632 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8636 (define_insn "*boolccdi3_internal2"
8637 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8638 (compare:CC (match_operator:DI 4 "boolean_operator"
8639 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8640 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8642 (clobber (match_scratch:DI 3 "=r,r"))]
8647 [(set_attr "type" "fast_compare,compare")
8648 (set_attr "length" "4,8")])
8651 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8652 (compare:CC (match_operator:DI 4 "boolean_operator"
8653 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8654 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8656 (clobber (match_scratch:DI 3 ""))]
8657 "TARGET_POWERPC64 && reload_completed"
8658 [(set (match_dup 3) (match_dup 4))
8660 (compare:CC (match_dup 3)
8664 (define_insn "*boolccdi3_internal3"
8665 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8666 (compare:CC (match_operator:DI 4 "boolean_operator"
8667 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8668 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8670 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8676 [(set_attr "type" "fast_compare,compare")
8677 (set_attr "length" "4,8")])
8680 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8681 (compare:CC (match_operator:DI 4 "boolean_operator"
8682 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8683 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8685 (set (match_operand:DI 0 "gpc_reg_operand" "")
8687 "TARGET_POWERPC64 && reload_completed"
8688 [(set (match_dup 0) (match_dup 4))
8690 (compare:CC (match_dup 0)
8694 (define_expand "smindi3"
8695 [(match_operand:DI 0 "gpc_reg_operand" "")
8696 (match_operand:DI 1 "gpc_reg_operand" "")
8697 (match_operand:DI 2 "gpc_reg_operand" "")]
8701 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
8705 (define_expand "smaxdi3"
8706 [(match_operand:DI 0 "gpc_reg_operand" "")
8707 (match_operand:DI 1 "gpc_reg_operand" "")
8708 (match_operand:DI 2 "gpc_reg_operand" "")]
8712 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
8716 (define_expand "umindi3"
8717 [(match_operand:DI 0 "gpc_reg_operand" "")
8718 (match_operand:DI 1 "gpc_reg_operand" "")
8719 (match_operand:DI 2 "gpc_reg_operand" "")]
8723 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
8727 (define_expand "umaxdi3"
8728 [(match_operand:DI 0 "gpc_reg_operand" "")
8729 (match_operand:DI 1 "gpc_reg_operand" "")
8730 (match_operand:DI 2 "gpc_reg_operand" "")]
8734 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
8739 ;; Now define ways of moving data around.
8741 ;; Set up a register with a value from the GOT table
8743 (define_expand "movsi_got"
8744 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8745 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8746 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8747 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8750 if (GET_CODE (operands[1]) == CONST)
8752 rtx offset = const0_rtx;
8753 HOST_WIDE_INT value;
8755 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8756 value = INTVAL (offset);
8759 rtx tmp = (!can_create_pseudo_p ()
8761 : gen_reg_rtx (Pmode));
8762 emit_insn (gen_movsi_got (tmp, operands[1]));
8763 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8768 operands[2] = rs6000_got_register (operands[1]);
8771 (define_insn "*movsi_got_internal"
8772 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8773 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8774 (match_operand:SI 2 "gpc_reg_operand" "b")]
8776 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8777 "{l|lwz} %0,%a1@got(%2)"
8778 [(set_attr "type" "load")])
8780 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8781 ;; didn't get allocated to a hard register.
8783 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8784 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8785 (match_operand:SI 2 "memory_operand" "")]
8787 "DEFAULT_ABI == ABI_V4
8789 && (reload_in_progress || reload_completed)"
8790 [(set (match_dup 0) (match_dup 2))
8791 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8795 ;; For SI, we special-case integers that can't be loaded in one insn. We
8796 ;; do the load 16-bits at a time. We could do this by loading from memory,
8797 ;; and this is even supposed to be faster, but it is simpler not to get
8798 ;; integers in the TOC.
8799 (define_insn "movsi_low"
8800 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8801 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8802 (match_operand 2 "" ""))))]
8803 "TARGET_MACHO && ! TARGET_64BIT"
8804 "{l|lwz} %0,lo16(%2)(%1)"
8805 [(set_attr "type" "load")
8806 (set_attr "length" "4")])
8808 (define_insn "*movsi_internal1"
8809 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8810 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8811 "!TARGET_SINGLE_FPU &&
8812 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8816 {l%U1%X1|lwz%U1%X1} %0,%1
8817 {st%U0%X0|stw%U0%X0} %1,%0
8827 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8828 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8830 (define_insn "*movsi_internal1_single"
8831 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
8832 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
8833 "TARGET_SINGLE_FPU &&
8834 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8838 {l%U1%X1|lwz%U1%X1} %0,%1
8839 {st%U0%X0|stw%U0%X0} %1,%0
8851 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
8852 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
8854 ;; Split a load of a large constant into the appropriate two-insn
8858 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8859 (match_operand:SI 1 "const_int_operand" ""))]
8860 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8861 && (INTVAL (operands[1]) & 0xffff) != 0"
8865 (ior:SI (match_dup 0)
8868 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8870 if (tem == operands[0])
8876 (define_insn "*mov<mode>_internal2"
8877 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8878 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8880 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8883 {cmpi|cmp<wd>i} %2,%0,0
8886 [(set_attr "type" "cmp,compare,cmp")
8887 (set_attr "length" "4,4,8")])
8890 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8891 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8893 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8895 [(set (match_dup 0) (match_dup 1))
8897 (compare:CC (match_dup 0)
8901 (define_insn "*movhi_internal"
8902 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8903 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8904 "gpc_reg_operand (operands[0], HImode)
8905 || gpc_reg_operand (operands[1], HImode)"
8915 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8917 (define_expand "mov<mode>"
8918 [(set (match_operand:INT 0 "general_operand" "")
8919 (match_operand:INT 1 "any_operand" ""))]
8921 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8923 (define_insn "*movqi_internal"
8924 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8925 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8926 "gpc_reg_operand (operands[0], QImode)
8927 || gpc_reg_operand (operands[1], QImode)"
8937 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8939 ;; Here is how to move condition codes around. When we store CC data in
8940 ;; an integer register or memory, we store just the high-order 4 bits.
8941 ;; This lets us not shift in the most common case of CR0.
8942 (define_expand "movcc"
8943 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8944 (match_operand:CC 1 "nonimmediate_operand" ""))]
8948 (define_insn "*movcc_internal1"
8949 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8950 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8951 "register_operand (operands[0], CCmode)
8952 || register_operand (operands[1], CCmode)"
8956 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8959 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8965 {l%U1%X1|lwz%U1%X1} %0,%1
8966 {st%U0%U1|stw%U0%U1} %1,%0"
8968 (cond [(eq_attr "alternative" "0,3")
8969 (const_string "cr_logical")
8970 (eq_attr "alternative" "1,2")
8971 (const_string "mtcr")
8972 (eq_attr "alternative" "6,7,9")
8973 (const_string "integer")
8974 (eq_attr "alternative" "8")
8975 (const_string "mfjmpr")
8976 (eq_attr "alternative" "10")
8977 (const_string "mtjmpr")
8978 (eq_attr "alternative" "11")
8979 (const_string "load")
8980 (eq_attr "alternative" "12")
8981 (const_string "store")
8982 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8983 (const_string "mfcrf")
8985 (const_string "mfcr")))
8986 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8988 ;; For floating-point, we normally deal with the floating-point registers
8989 ;; unless -msoft-float is used. The sole exception is that parameter passing
8990 ;; can produce floating-point values in fixed-point registers. Unless the
8991 ;; value is a simple constant or already in memory, we deal with this by
8992 ;; allocating memory and copying the value explicitly via that memory location.
8993 (define_expand "movsf"
8994 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8995 (match_operand:SF 1 "any_operand" ""))]
8997 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
9000 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9001 (match_operand:SF 1 "const_double_operand" ""))]
9003 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9004 || (GET_CODE (operands[0]) == SUBREG
9005 && GET_CODE (SUBREG_REG (operands[0])) == REG
9006 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9007 [(set (match_dup 2) (match_dup 3))]
9013 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9014 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
9016 if (! TARGET_POWERPC64)
9017 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
9019 operands[2] = gen_lowpart (SImode, operands[0]);
9021 operands[3] = gen_int_mode (l, SImode);
9024 (define_insn "*movsf_hardfloat"
9025 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9026 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9027 "(gpc_reg_operand (operands[0], SFmode)
9028 || gpc_reg_operand (operands[1], SFmode))
9029 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9032 {l%U1%X1|lwz%U1%X1} %0,%1
9033 {st%U0%X0|stw%U0%X0} %1,%0
9043 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9044 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9046 (define_insn "*movsf_softfloat"
9047 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9048 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9049 "(gpc_reg_operand (operands[0], SFmode)
9050 || gpc_reg_operand (operands[1], SFmode))
9051 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9057 {l%U1%X1|lwz%U1%X1} %0,%1
9058 {st%U0%X0|stw%U0%X0} %1,%0
9065 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9066 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9069 (define_expand "movdf"
9070 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9071 (match_operand:DF 1 "any_operand" ""))]
9073 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9076 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9077 (match_operand:DF 1 "const_int_operand" ""))]
9078 "! TARGET_POWERPC64 && reload_completed
9079 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9080 || (GET_CODE (operands[0]) == SUBREG
9081 && GET_CODE (SUBREG_REG (operands[0])) == REG
9082 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9083 [(set (match_dup 2) (match_dup 4))
9084 (set (match_dup 3) (match_dup 1))]
9087 int endian = (WORDS_BIG_ENDIAN == 0);
9088 HOST_WIDE_INT value = INTVAL (operands[1]);
9090 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9091 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9092 #if HOST_BITS_PER_WIDE_INT == 32
9093 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9095 operands[4] = GEN_INT (value >> 32);
9096 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9101 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9102 (match_operand:DF 1 "const_double_operand" ""))]
9103 "! TARGET_POWERPC64 && reload_completed
9104 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9105 || (GET_CODE (operands[0]) == SUBREG
9106 && GET_CODE (SUBREG_REG (operands[0])) == REG
9107 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9108 [(set (match_dup 2) (match_dup 4))
9109 (set (match_dup 3) (match_dup 5))]
9112 int endian = (WORDS_BIG_ENDIAN == 0);
9116 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9117 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9119 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9120 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9121 operands[4] = gen_int_mode (l[endian], SImode);
9122 operands[5] = gen_int_mode (l[1 - endian], SImode);
9126 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9127 (match_operand:DF 1 "const_double_operand" ""))]
9128 "TARGET_POWERPC64 && reload_completed
9129 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9130 || (GET_CODE (operands[0]) == SUBREG
9131 && GET_CODE (SUBREG_REG (operands[0])) == REG
9132 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9133 [(set (match_dup 2) (match_dup 3))]
9136 int endian = (WORDS_BIG_ENDIAN == 0);
9139 #if HOST_BITS_PER_WIDE_INT >= 64
9143 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9144 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9146 operands[2] = gen_lowpart (DImode, operands[0]);
9147 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9148 #if HOST_BITS_PER_WIDE_INT >= 64
9149 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9150 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9152 operands[3] = gen_int_mode (val, DImode);
9154 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9158 ;; Don't have reload use general registers to load a constant. First,
9159 ;; it might not work if the output operand is the equivalent of
9160 ;; a non-offsettable memref, but also it is less efficient than loading
9161 ;; the constant into an FP register, since it will probably be used there.
9162 ;; The "??" is a kludge until we can figure out a more reasonable way
9163 ;; of handling these non-offsettable values.
9164 (define_insn "*movdf_hardfloat32"
9165 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9166 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9167 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9168 && (gpc_reg_operand (operands[0], DFmode)
9169 || gpc_reg_operand (operands[1], DFmode))"
9172 switch (which_alternative)
9182 return \"xxlor %x0,%x1,%x1\";
9185 return \"lxsd%U1x %x0,%y1\";
9188 return \"stxsd%U0x %x1,%y0\";
9190 return \"fmr %0,%1\";
9192 return \"lfd%U1%X1 %0,%1\";
9194 return \"stfd%U0%X0 %1,%0\";
9196 return \"xxlxor %x0,%x0,%x0\";
9203 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9204 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9206 (define_insn "*movdf_softfloat32"
9207 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9208 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9210 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9211 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9212 && (gpc_reg_operand (operands[0], DFmode)
9213 || gpc_reg_operand (operands[1], DFmode))"
9215 [(set_attr "type" "two,load,store,*,*,*")
9216 (set_attr "length" "8,8,8,8,12,16")])
9218 ; ld/std require word-aligned displacements -> 'Y' constraint.
9219 ; List Y->r and r->Y before r->r for reload.
9220 (define_insn "*movdf_hardfloat64_mfpgpr"
9221 [(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")
9222 (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"))]
9223 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9224 && TARGET_DOUBLE_FLOAT
9225 && (gpc_reg_operand (operands[0], DFmode)
9226 || gpc_reg_operand (operands[1], DFmode))"
9249 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9250 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9252 ; ld/std require word-aligned displacements -> 'Y' constraint.
9253 ; List Y->r and r->Y before r->r for reload.
9254 (define_insn "*movdf_hardfloat64"
9255 [(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")
9256 (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"))]
9257 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9258 && TARGET_DOUBLE_FLOAT
9259 && (gpc_reg_operand (operands[0], DFmode)
9260 || gpc_reg_operand (operands[1], DFmode))"
9281 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9282 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9284 (define_insn "*movdf_softfloat64"
9285 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9286 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9287 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9288 && (gpc_reg_operand (operands[0], DFmode)
9289 || gpc_reg_operand (operands[1], DFmode))"
9300 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9301 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9303 (define_expand "movtf"
9304 [(set (match_operand:TF 0 "general_operand" "")
9305 (match_operand:TF 1 "any_operand" ""))]
9306 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9307 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9309 ; It's important to list the o->f and f->o moves before f->f because
9310 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9311 ; which doesn't make progress. Likewise r->Y must be before r->r.
9312 (define_insn_and_split "*movtf_internal"
9313 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9314 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9316 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9317 && (gpc_reg_operand (operands[0], TFmode)
9318 || gpc_reg_operand (operands[1], TFmode))"
9320 "&& reload_completed"
9322 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9323 [(set_attr "length" "8,8,8,20,20,16")])
9325 (define_insn_and_split "*movtf_softfloat"
9326 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9327 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9329 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9330 && (gpc_reg_operand (operands[0], TFmode)
9331 || gpc_reg_operand (operands[1], TFmode))"
9333 "&& reload_completed"
9335 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9336 [(set_attr "length" "20,20,16")])
9338 (define_expand "extenddftf2"
9339 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9340 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9342 && TARGET_HARD_FLOAT
9343 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9344 && TARGET_LONG_DOUBLE_128"
9346 if (TARGET_E500_DOUBLE)
9347 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9349 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9353 (define_expand "extenddftf2_fprs"
9354 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9355 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9356 (use (match_dup 2))])]
9358 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9359 && TARGET_LONG_DOUBLE_128"
9361 operands[2] = CONST0_RTX (DFmode);
9362 /* Generate GOT reference early for SVR4 PIC. */
9363 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9364 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9367 (define_insn_and_split "*extenddftf2_internal"
9368 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9369 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9370 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9372 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9373 && TARGET_LONG_DOUBLE_128"
9375 "&& reload_completed"
9378 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9379 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9380 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9382 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9387 (define_expand "extendsftf2"
9388 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9389 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9391 && TARGET_HARD_FLOAT
9392 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9393 && TARGET_LONG_DOUBLE_128"
9395 rtx tmp = gen_reg_rtx (DFmode);
9396 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9397 emit_insn (gen_extenddftf2 (operands[0], tmp));
9401 (define_expand "trunctfdf2"
9402 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9403 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9405 && TARGET_HARD_FLOAT
9406 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9407 && TARGET_LONG_DOUBLE_128"
9410 (define_insn_and_split "trunctfdf2_internal1"
9411 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9412 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9413 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9414 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9418 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9421 emit_note (NOTE_INSN_DELETED);
9424 [(set_attr "type" "fp")])
9426 (define_insn "trunctfdf2_internal2"
9427 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9428 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9429 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9430 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9431 && TARGET_LONG_DOUBLE_128"
9433 [(set_attr "type" "fp")
9434 (set_attr "fp_type" "fp_addsub_d")])
9436 (define_expand "trunctfsf2"
9437 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9438 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9440 && TARGET_HARD_FLOAT
9441 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9442 && TARGET_LONG_DOUBLE_128"
9444 if (TARGET_E500_DOUBLE)
9445 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9447 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9451 (define_insn_and_split "trunctfsf2_fprs"
9452 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9453 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9454 (clobber (match_scratch:DF 2 "=d"))]
9456 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9457 && TARGET_LONG_DOUBLE_128"
9459 "&& reload_completed"
9461 (float_truncate:DF (match_dup 1)))
9463 (float_truncate:SF (match_dup 2)))]
9466 (define_expand "floatsitf2"
9467 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9468 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9470 && TARGET_HARD_FLOAT
9471 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9472 && TARGET_LONG_DOUBLE_128"
9474 rtx tmp = gen_reg_rtx (DFmode);
9475 expand_float (tmp, operands[1], false);
9476 emit_insn (gen_extenddftf2 (operands[0], tmp));
9480 ; fadd, but rounding towards zero.
9481 ; This is probably not the optimal code sequence.
9482 (define_insn "fix_trunc_helper"
9483 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9484 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9485 UNSPEC_FIX_TRUNC_TF))
9486 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9487 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9488 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9489 [(set_attr "type" "fp")
9490 (set_attr "length" "20")])
9492 (define_expand "fix_trunctfsi2"
9493 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9494 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9496 && (TARGET_POWER2 || TARGET_POWERPC)
9497 && TARGET_HARD_FLOAT
9498 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9499 && TARGET_LONG_DOUBLE_128"
9501 if (TARGET_E500_DOUBLE)
9502 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9504 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9508 (define_expand "fix_trunctfsi2_fprs"
9509 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9510 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9511 (clobber (match_dup 2))
9512 (clobber (match_dup 3))
9513 (clobber (match_dup 4))
9514 (clobber (match_dup 5))])]
9516 && (TARGET_POWER2 || TARGET_POWERPC)
9517 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9519 operands[2] = gen_reg_rtx (DFmode);
9520 operands[3] = gen_reg_rtx (DFmode);
9521 operands[4] = gen_reg_rtx (DImode);
9522 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
9525 (define_insn_and_split "*fix_trunctfsi2_internal"
9526 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9527 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9528 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9529 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9530 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9531 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9533 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9539 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9541 gcc_assert (MEM_P (operands[5]));
9542 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9544 emit_insn (gen_fctiwz (operands[4], operands[2]));
9545 emit_move_insn (operands[5], operands[4]);
9546 emit_move_insn (operands[0], lowword);
9550 (define_expand "negtf2"
9551 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9552 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9554 && TARGET_HARD_FLOAT
9555 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9556 && TARGET_LONG_DOUBLE_128"
9559 (define_insn "negtf2_internal"
9560 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9561 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9563 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9566 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9567 return \"fneg %L0,%L1\;fneg %0,%1\";
9569 return \"fneg %0,%1\;fneg %L0,%L1\";
9571 [(set_attr "type" "fp")
9572 (set_attr "length" "8")])
9574 (define_expand "abstf2"
9575 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9576 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9578 && TARGET_HARD_FLOAT
9579 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9580 && TARGET_LONG_DOUBLE_128"
9583 rtx label = gen_label_rtx ();
9584 if (TARGET_E500_DOUBLE)
9586 if (flag_finite_math_only && !flag_trapping_math)
9587 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9589 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9592 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9597 (define_expand "abstf2_internal"
9598 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9599 (match_operand:TF 1 "gpc_reg_operand" ""))
9600 (set (match_dup 3) (match_dup 5))
9601 (set (match_dup 5) (abs:DF (match_dup 5)))
9602 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9603 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9604 (label_ref (match_operand 2 "" ""))
9606 (set (match_dup 6) (neg:DF (match_dup 6)))]
9608 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9609 && TARGET_LONG_DOUBLE_128"
9612 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9613 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9614 operands[3] = gen_reg_rtx (DFmode);
9615 operands[4] = gen_reg_rtx (CCFPmode);
9616 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9617 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9620 ;; Next come the multi-word integer load and store and the load and store
9623 ; List r->r after r->"o<>", otherwise reload will try to reload a
9624 ; non-offsettable address by using r->r which won't make progress.
9625 (define_insn "*movdi_internal32"
9626 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
9627 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
9629 && (gpc_reg_operand (operands[0], DImode)
9630 || gpc_reg_operand (operands[1], DImode))"
9639 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
9642 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9643 (match_operand:DI 1 "const_int_operand" ""))]
9644 "! TARGET_POWERPC64 && reload_completed"
9645 [(set (match_dup 2) (match_dup 4))
9646 (set (match_dup 3) (match_dup 1))]
9649 HOST_WIDE_INT value = INTVAL (operands[1]);
9650 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9652 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9654 #if HOST_BITS_PER_WIDE_INT == 32
9655 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9657 operands[4] = GEN_INT (value >> 32);
9658 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9663 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9664 (match_operand:DIFD 1 "input_operand" ""))]
9665 "reload_completed && !TARGET_POWERPC64
9666 && gpr_or_gpr_p (operands[0], operands[1])"
9668 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9670 (define_insn "*movdi_mfpgpr"
9671 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
9672 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
9673 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9674 && (gpc_reg_operand (operands[0], DImode)
9675 || gpc_reg_operand (operands[1], DImode))"
9692 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
9693 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
9695 (define_insn "*movdi_internal64"
9696 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
9697 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
9698 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
9699 && (gpc_reg_operand (operands[0], DImode)
9700 || gpc_reg_operand (operands[1], DImode))"
9715 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9716 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9718 ;; immediate value valid for a single instruction hiding in a const_double
9720 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9721 (match_operand:DI 1 "const_double_operand" "F"))]
9722 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9723 && GET_CODE (operands[1]) == CONST_DOUBLE
9724 && num_insns_constant (operands[1], DImode) == 1"
9727 return ((unsigned HOST_WIDE_INT)
9728 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9729 ? \"li %0,%1\" : \"lis %0,%v1\";
9732 ;; Generate all one-bits and clear left or right.
9733 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9735 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9736 (match_operand:DI 1 "mask64_operand" ""))]
9737 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9738 [(set (match_dup 0) (const_int -1))
9740 (and:DI (rotate:DI (match_dup 0)
9745 ;; Split a load of a large constant into the appropriate five-instruction
9746 ;; sequence. Handle anything in a constant number of insns.
9747 ;; When non-easy constants can go in the TOC, this should use
9748 ;; easy_fp_constant predicate.
9750 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9751 (match_operand:DI 1 "const_int_operand" ""))]
9752 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9753 [(set (match_dup 0) (match_dup 2))
9754 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9756 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9758 if (tem == operands[0])
9765 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9766 (match_operand:DI 1 "const_double_operand" ""))]
9767 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9768 [(set (match_dup 0) (match_dup 2))
9769 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9771 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9773 if (tem == operands[0])
9779 ;; TImode is similar, except that we usually want to compute the address into
9780 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9781 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9783 ;; We say that MQ is clobbered in the last alternative because the first
9784 ;; alternative would never get used otherwise since it would need a reload
9785 ;; while the 2nd alternative would not. We put memory cases first so they
9786 ;; are preferred. Otherwise, we'd try to reload the output instead of
9787 ;; giving the SCRATCH mq.
9789 (define_insn "*movti_power"
9790 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9791 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9792 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9793 "TARGET_POWER && ! TARGET_POWERPC64
9794 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9797 switch (which_alternative)
9804 return \"{stsi|stswi} %1,%P0,16\";
9809 /* If the address is not used in the output, we can use lsi. Otherwise,
9810 fall through to generating four loads. */
9812 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9813 return \"{lsi|lswi} %0,%P1,16\";
9814 /* ... fall through ... */
9820 [(set_attr "type" "store,store,*,load,load,*")])
9822 (define_insn "*movti_string"
9823 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9824 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9825 "! TARGET_POWER && ! TARGET_POWERPC64
9826 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9829 switch (which_alternative)
9835 return \"{stsi|stswi} %1,%P0,16\";
9840 /* If the address is not used in the output, we can use lsi. Otherwise,
9841 fall through to generating four loads. */
9843 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9844 return \"{lsi|lswi} %0,%P1,16\";
9845 /* ... fall through ... */
9851 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
9852 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
9853 (const_string "always")
9854 (const_string "conditional")))])
9856 (define_insn "*movti_ppc64"
9857 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9858 (match_operand:TI 1 "input_operand" "r,r,m"))]
9859 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9860 || gpc_reg_operand (operands[1], TImode)))
9861 && VECTOR_MEM_NONE_P (TImode)"
9863 [(set_attr "type" "*,store,load")])
9866 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9867 (match_operand:TI 1 "const_double_operand" ""))]
9868 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
9869 [(set (match_dup 2) (match_dup 4))
9870 (set (match_dup 3) (match_dup 5))]
9873 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9875 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9877 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9879 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9880 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9882 else if (GET_CODE (operands[1]) == CONST_INT)
9884 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9885 operands[5] = operands[1];
9892 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9893 (match_operand:TI 1 "input_operand" ""))]
9894 "reload_completed && VECTOR_MEM_NONE_P (TImode)
9895 && gpr_or_gpr_p (operands[0], operands[1])"
9897 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9899 (define_expand "load_multiple"
9900 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9901 (match_operand:SI 1 "" ""))
9902 (use (match_operand:SI 2 "" ""))])]
9903 "TARGET_STRING && !TARGET_POWERPC64"
9911 /* Support only loading a constant number of fixed-point registers from
9912 memory and only bother with this if more than two; the machine
9913 doesn't support more than eight. */
9914 if (GET_CODE (operands[2]) != CONST_INT
9915 || INTVAL (operands[2]) <= 2
9916 || INTVAL (operands[2]) > 8
9917 || GET_CODE (operands[1]) != MEM
9918 || GET_CODE (operands[0]) != REG
9919 || REGNO (operands[0]) >= 32)
9922 count = INTVAL (operands[2]);
9923 regno = REGNO (operands[0]);
9925 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9926 op1 = replace_equiv_address (operands[1],
9927 force_reg (SImode, XEXP (operands[1], 0)));
9929 for (i = 0; i < count; i++)
9930 XVECEXP (operands[3], 0, i)
9931 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9932 adjust_address_nv (op1, SImode, i * 4));
9935 (define_insn "*ldmsi8"
9936 [(match_parallel 0 "load_multiple_operation"
9937 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9938 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9939 (set (match_operand:SI 3 "gpc_reg_operand" "")
9940 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9941 (set (match_operand:SI 4 "gpc_reg_operand" "")
9942 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9943 (set (match_operand:SI 5 "gpc_reg_operand" "")
9944 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9945 (set (match_operand:SI 6 "gpc_reg_operand" "")
9946 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9947 (set (match_operand:SI 7 "gpc_reg_operand" "")
9948 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9949 (set (match_operand:SI 8 "gpc_reg_operand" "")
9950 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9951 (set (match_operand:SI 9 "gpc_reg_operand" "")
9952 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9953 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9955 { return rs6000_output_load_multiple (operands); }"
9956 [(set_attr "type" "load_ux")
9957 (set_attr "length" "32")])
9959 (define_insn "*ldmsi7"
9960 [(match_parallel 0 "load_multiple_operation"
9961 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9962 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9963 (set (match_operand:SI 3 "gpc_reg_operand" "")
9964 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9965 (set (match_operand:SI 4 "gpc_reg_operand" "")
9966 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9967 (set (match_operand:SI 5 "gpc_reg_operand" "")
9968 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9969 (set (match_operand:SI 6 "gpc_reg_operand" "")
9970 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9971 (set (match_operand:SI 7 "gpc_reg_operand" "")
9972 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9973 (set (match_operand:SI 8 "gpc_reg_operand" "")
9974 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9975 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9977 { return rs6000_output_load_multiple (operands); }"
9978 [(set_attr "type" "load_ux")
9979 (set_attr "length" "32")])
9981 (define_insn "*ldmsi6"
9982 [(match_parallel 0 "load_multiple_operation"
9983 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9984 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9985 (set (match_operand:SI 3 "gpc_reg_operand" "")
9986 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9987 (set (match_operand:SI 4 "gpc_reg_operand" "")
9988 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9989 (set (match_operand:SI 5 "gpc_reg_operand" "")
9990 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9991 (set (match_operand:SI 6 "gpc_reg_operand" "")
9992 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9993 (set (match_operand:SI 7 "gpc_reg_operand" "")
9994 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9995 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9997 { return rs6000_output_load_multiple (operands); }"
9998 [(set_attr "type" "load_ux")
9999 (set_attr "length" "32")])
10001 (define_insn "*ldmsi5"
10002 [(match_parallel 0 "load_multiple_operation"
10003 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10004 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10005 (set (match_operand:SI 3 "gpc_reg_operand" "")
10006 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10007 (set (match_operand:SI 4 "gpc_reg_operand" "")
10008 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10009 (set (match_operand:SI 5 "gpc_reg_operand" "")
10010 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10011 (set (match_operand:SI 6 "gpc_reg_operand" "")
10012 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10013 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10015 { return rs6000_output_load_multiple (operands); }"
10016 [(set_attr "type" "load_ux")
10017 (set_attr "length" "32")])
10019 (define_insn "*ldmsi4"
10020 [(match_parallel 0 "load_multiple_operation"
10021 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10022 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10023 (set (match_operand:SI 3 "gpc_reg_operand" "")
10024 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10025 (set (match_operand:SI 4 "gpc_reg_operand" "")
10026 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10027 (set (match_operand:SI 5 "gpc_reg_operand" "")
10028 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10029 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10031 { return rs6000_output_load_multiple (operands); }"
10032 [(set_attr "type" "load_ux")
10033 (set_attr "length" "32")])
10035 (define_insn "*ldmsi3"
10036 [(match_parallel 0 "load_multiple_operation"
10037 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10038 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10039 (set (match_operand:SI 3 "gpc_reg_operand" "")
10040 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10041 (set (match_operand:SI 4 "gpc_reg_operand" "")
10042 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10043 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10045 { return rs6000_output_load_multiple (operands); }"
10046 [(set_attr "type" "load_ux")
10047 (set_attr "length" "32")])
10049 (define_expand "store_multiple"
10050 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10051 (match_operand:SI 1 "" ""))
10052 (clobber (scratch:SI))
10053 (use (match_operand:SI 2 "" ""))])]
10054 "TARGET_STRING && !TARGET_POWERPC64"
10063 /* Support only storing a constant number of fixed-point registers to
10064 memory and only bother with this if more than two; the machine
10065 doesn't support more than eight. */
10066 if (GET_CODE (operands[2]) != CONST_INT
10067 || INTVAL (operands[2]) <= 2
10068 || INTVAL (operands[2]) > 8
10069 || GET_CODE (operands[0]) != MEM
10070 || GET_CODE (operands[1]) != REG
10071 || REGNO (operands[1]) >= 32)
10074 count = INTVAL (operands[2]);
10075 regno = REGNO (operands[1]);
10077 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10078 to = force_reg (SImode, XEXP (operands[0], 0));
10079 op0 = replace_equiv_address (operands[0], to);
10081 XVECEXP (operands[3], 0, 0)
10082 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10083 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10084 gen_rtx_SCRATCH (SImode));
10086 for (i = 1; i < count; i++)
10087 XVECEXP (operands[3], 0, i + 1)
10088 = gen_rtx_SET (VOIDmode,
10089 adjust_address_nv (op0, SImode, i * 4),
10090 gen_rtx_REG (SImode, regno + i));
10093 (define_insn "*stmsi8"
10094 [(match_parallel 0 "store_multiple_operation"
10095 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10096 (match_operand:SI 2 "gpc_reg_operand" "r"))
10097 (clobber (match_scratch:SI 3 "=X"))
10098 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10099 (match_operand:SI 4 "gpc_reg_operand" "r"))
10100 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10101 (match_operand:SI 5 "gpc_reg_operand" "r"))
10102 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10103 (match_operand:SI 6 "gpc_reg_operand" "r"))
10104 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10105 (match_operand:SI 7 "gpc_reg_operand" "r"))
10106 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10107 (match_operand:SI 8 "gpc_reg_operand" "r"))
10108 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10109 (match_operand:SI 9 "gpc_reg_operand" "r"))
10110 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10111 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10112 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10113 "{stsi|stswi} %2,%1,%O0"
10114 [(set_attr "type" "store_ux")
10115 (set_attr "cell_micro" "always")])
10117 (define_insn "*stmsi7"
10118 [(match_parallel 0 "store_multiple_operation"
10119 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10120 (match_operand:SI 2 "gpc_reg_operand" "r"))
10121 (clobber (match_scratch:SI 3 "=X"))
10122 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10123 (match_operand:SI 4 "gpc_reg_operand" "r"))
10124 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10125 (match_operand:SI 5 "gpc_reg_operand" "r"))
10126 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10127 (match_operand:SI 6 "gpc_reg_operand" "r"))
10128 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10129 (match_operand:SI 7 "gpc_reg_operand" "r"))
10130 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10131 (match_operand:SI 8 "gpc_reg_operand" "r"))
10132 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10133 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10134 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10135 "{stsi|stswi} %2,%1,%O0"
10136 [(set_attr "type" "store_ux")
10137 (set_attr "cell_micro" "always")])
10139 (define_insn "*stmsi6"
10140 [(match_parallel 0 "store_multiple_operation"
10141 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10142 (match_operand:SI 2 "gpc_reg_operand" "r"))
10143 (clobber (match_scratch:SI 3 "=X"))
10144 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10145 (match_operand:SI 4 "gpc_reg_operand" "r"))
10146 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10147 (match_operand:SI 5 "gpc_reg_operand" "r"))
10148 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10149 (match_operand:SI 6 "gpc_reg_operand" "r"))
10150 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10151 (match_operand:SI 7 "gpc_reg_operand" "r"))
10152 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10153 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10154 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10155 "{stsi|stswi} %2,%1,%O0"
10156 [(set_attr "type" "store_ux")
10157 (set_attr "cell_micro" "always")])
10159 (define_insn "*stmsi5"
10160 [(match_parallel 0 "store_multiple_operation"
10161 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10162 (match_operand:SI 2 "gpc_reg_operand" "r"))
10163 (clobber (match_scratch:SI 3 "=X"))
10164 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10165 (match_operand:SI 4 "gpc_reg_operand" "r"))
10166 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10167 (match_operand:SI 5 "gpc_reg_operand" "r"))
10168 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10169 (match_operand:SI 6 "gpc_reg_operand" "r"))
10170 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10171 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10172 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10173 "{stsi|stswi} %2,%1,%O0"
10174 [(set_attr "type" "store_ux")
10175 (set_attr "cell_micro" "always")])
10177 (define_insn "*stmsi4"
10178 [(match_parallel 0 "store_multiple_operation"
10179 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10180 (match_operand:SI 2 "gpc_reg_operand" "r"))
10181 (clobber (match_scratch:SI 3 "=X"))
10182 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10183 (match_operand:SI 4 "gpc_reg_operand" "r"))
10184 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10185 (match_operand:SI 5 "gpc_reg_operand" "r"))
10186 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10187 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10188 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10189 "{stsi|stswi} %2,%1,%O0"
10190 [(set_attr "type" "store_ux")
10191 (set_attr "cell_micro" "always")])
10193 (define_insn "*stmsi3"
10194 [(match_parallel 0 "store_multiple_operation"
10195 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10196 (match_operand:SI 2 "gpc_reg_operand" "r"))
10197 (clobber (match_scratch:SI 3 "=X"))
10198 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10199 (match_operand:SI 4 "gpc_reg_operand" "r"))
10200 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10201 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10202 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10203 "{stsi|stswi} %2,%1,%O0"
10204 [(set_attr "type" "store_ux")
10205 (set_attr "cell_micro" "always")])
10207 (define_insn "*stmsi8_power"
10208 [(match_parallel 0 "store_multiple_operation"
10209 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10210 (match_operand:SI 2 "gpc_reg_operand" "r"))
10211 (clobber (match_scratch:SI 3 "=q"))
10212 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10213 (match_operand:SI 4 "gpc_reg_operand" "r"))
10214 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10215 (match_operand:SI 5 "gpc_reg_operand" "r"))
10216 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10217 (match_operand:SI 6 "gpc_reg_operand" "r"))
10218 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10219 (match_operand:SI 7 "gpc_reg_operand" "r"))
10220 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10221 (match_operand:SI 8 "gpc_reg_operand" "r"))
10222 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10223 (match_operand:SI 9 "gpc_reg_operand" "r"))
10224 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10225 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10226 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10227 "{stsi|stswi} %2,%1,%O0"
10228 [(set_attr "type" "store_ux")
10229 (set_attr "cell_micro" "always")])
10231 (define_insn "*stmsi7_power"
10232 [(match_parallel 0 "store_multiple_operation"
10233 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10234 (match_operand:SI 2 "gpc_reg_operand" "r"))
10235 (clobber (match_scratch:SI 3 "=q"))
10236 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10237 (match_operand:SI 4 "gpc_reg_operand" "r"))
10238 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10239 (match_operand:SI 5 "gpc_reg_operand" "r"))
10240 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10241 (match_operand:SI 6 "gpc_reg_operand" "r"))
10242 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10243 (match_operand:SI 7 "gpc_reg_operand" "r"))
10244 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10245 (match_operand:SI 8 "gpc_reg_operand" "r"))
10246 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10247 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10248 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10249 "{stsi|stswi} %2,%1,%O0"
10250 [(set_attr "type" "store_ux")
10251 (set_attr "cell_micro" "always")])
10253 (define_insn "*stmsi6_power"
10254 [(match_parallel 0 "store_multiple_operation"
10255 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10256 (match_operand:SI 2 "gpc_reg_operand" "r"))
10257 (clobber (match_scratch:SI 3 "=q"))
10258 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10259 (match_operand:SI 4 "gpc_reg_operand" "r"))
10260 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10261 (match_operand:SI 5 "gpc_reg_operand" "r"))
10262 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10263 (match_operand:SI 6 "gpc_reg_operand" "r"))
10264 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10265 (match_operand:SI 7 "gpc_reg_operand" "r"))
10266 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10267 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10268 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10269 "{stsi|stswi} %2,%1,%O0"
10270 [(set_attr "type" "store_ux")
10271 (set_attr "cell_micro" "always")])
10273 (define_insn "*stmsi5_power"
10274 [(match_parallel 0 "store_multiple_operation"
10275 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10276 (match_operand:SI 2 "gpc_reg_operand" "r"))
10277 (clobber (match_scratch:SI 3 "=q"))
10278 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10279 (match_operand:SI 4 "gpc_reg_operand" "r"))
10280 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10281 (match_operand:SI 5 "gpc_reg_operand" "r"))
10282 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10283 (match_operand:SI 6 "gpc_reg_operand" "r"))
10284 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10285 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10286 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10287 "{stsi|stswi} %2,%1,%O0"
10288 [(set_attr "type" "store_ux")
10289 (set_attr "cell_micro" "always")])
10291 (define_insn "*stmsi4_power"
10292 [(match_parallel 0 "store_multiple_operation"
10293 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10294 (match_operand:SI 2 "gpc_reg_operand" "r"))
10295 (clobber (match_scratch:SI 3 "=q"))
10296 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10297 (match_operand:SI 4 "gpc_reg_operand" "r"))
10298 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10299 (match_operand:SI 5 "gpc_reg_operand" "r"))
10300 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10301 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10302 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10303 "{stsi|stswi} %2,%1,%O0"
10304 [(set_attr "type" "store_ux")
10305 (set_attr "cell_micro" "always")])
10307 (define_insn "*stmsi3_power"
10308 [(match_parallel 0 "store_multiple_operation"
10309 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10310 (match_operand:SI 2 "gpc_reg_operand" "r"))
10311 (clobber (match_scratch:SI 3 "=q"))
10312 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10313 (match_operand:SI 4 "gpc_reg_operand" "r"))
10314 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10315 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10316 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10317 "{stsi|stswi} %2,%1,%O0"
10318 [(set_attr "type" "store_ux")
10319 (set_attr "cell_micro" "always")])
10321 (define_expand "setmemsi"
10322 [(parallel [(set (match_operand:BLK 0 "" "")
10323 (match_operand 2 "const_int_operand" ""))
10324 (use (match_operand:SI 1 "" ""))
10325 (use (match_operand:SI 3 "" ""))])]
10329 /* If value to set is not zero, use the library routine. */
10330 if (operands[2] != const0_rtx)
10333 if (expand_block_clear (operands))
10339 ;; String/block move insn.
10340 ;; Argument 0 is the destination
10341 ;; Argument 1 is the source
10342 ;; Argument 2 is the length
10343 ;; Argument 3 is the alignment
10345 (define_expand "movmemsi"
10346 [(parallel [(set (match_operand:BLK 0 "" "")
10347 (match_operand:BLK 1 "" ""))
10348 (use (match_operand:SI 2 "" ""))
10349 (use (match_operand:SI 3 "" ""))])]
10353 if (expand_block_move (operands))
10359 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10360 ;; register allocator doesn't have a clue about allocating 8 word registers.
10361 ;; rD/rS = r5 is preferred, efficient form.
10362 (define_expand "movmemsi_8reg"
10363 [(parallel [(set (match_operand 0 "" "")
10364 (match_operand 1 "" ""))
10365 (use (match_operand 2 "" ""))
10366 (use (match_operand 3 "" ""))
10367 (clobber (reg:SI 5))
10368 (clobber (reg:SI 6))
10369 (clobber (reg:SI 7))
10370 (clobber (reg:SI 8))
10371 (clobber (reg:SI 9))
10372 (clobber (reg:SI 10))
10373 (clobber (reg:SI 11))
10374 (clobber (reg:SI 12))
10375 (clobber (match_scratch:SI 4 ""))])]
10380 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10381 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10382 (use (match_operand:SI 2 "immediate_operand" "i"))
10383 (use (match_operand:SI 3 "immediate_operand" "i"))
10384 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10385 (clobber (reg:SI 6))
10386 (clobber (reg:SI 7))
10387 (clobber (reg:SI 8))
10388 (clobber (reg:SI 9))
10389 (clobber (reg:SI 10))
10390 (clobber (reg:SI 11))
10391 (clobber (reg:SI 12))
10392 (clobber (match_scratch:SI 5 "=q"))]
10393 "TARGET_STRING && TARGET_POWER
10394 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10395 || INTVAL (operands[2]) == 0)
10396 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10397 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10398 && REGNO (operands[4]) == 5"
10399 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10400 [(set_attr "type" "store_ux")
10401 (set_attr "cell_micro" "always")
10402 (set_attr "length" "8")])
10405 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10406 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10407 (use (match_operand:SI 2 "immediate_operand" "i"))
10408 (use (match_operand:SI 3 "immediate_operand" "i"))
10409 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10410 (clobber (reg:SI 6))
10411 (clobber (reg:SI 7))
10412 (clobber (reg:SI 8))
10413 (clobber (reg:SI 9))
10414 (clobber (reg:SI 10))
10415 (clobber (reg:SI 11))
10416 (clobber (reg:SI 12))
10417 (clobber (match_scratch:SI 5 "=X"))]
10418 "TARGET_STRING && ! TARGET_POWER
10419 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10420 || INTVAL (operands[2]) == 0)
10421 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10422 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10423 && REGNO (operands[4]) == 5"
10424 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10425 [(set_attr "type" "store_ux")
10426 (set_attr "cell_micro" "always")
10427 (set_attr "length" "8")])
10429 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10430 ;; register allocator doesn't have a clue about allocating 6 word registers.
10431 ;; rD/rS = r5 is preferred, efficient form.
10432 (define_expand "movmemsi_6reg"
10433 [(parallel [(set (match_operand 0 "" "")
10434 (match_operand 1 "" ""))
10435 (use (match_operand 2 "" ""))
10436 (use (match_operand 3 "" ""))
10437 (clobber (reg:SI 5))
10438 (clobber (reg:SI 6))
10439 (clobber (reg:SI 7))
10440 (clobber (reg:SI 8))
10441 (clobber (reg:SI 9))
10442 (clobber (reg:SI 10))
10443 (clobber (match_scratch:SI 4 ""))])]
10448 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10449 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10450 (use (match_operand:SI 2 "immediate_operand" "i"))
10451 (use (match_operand:SI 3 "immediate_operand" "i"))
10452 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10453 (clobber (reg:SI 6))
10454 (clobber (reg:SI 7))
10455 (clobber (reg:SI 8))
10456 (clobber (reg:SI 9))
10457 (clobber (reg:SI 10))
10458 (clobber (match_scratch:SI 5 "=q"))]
10459 "TARGET_STRING && TARGET_POWER
10460 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10461 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10462 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10463 && REGNO (operands[4]) == 5"
10464 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10465 [(set_attr "type" "store_ux")
10466 (set_attr "cell_micro" "always")
10467 (set_attr "length" "8")])
10470 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10471 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10472 (use (match_operand:SI 2 "immediate_operand" "i"))
10473 (use (match_operand:SI 3 "immediate_operand" "i"))
10474 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10475 (clobber (reg:SI 6))
10476 (clobber (reg:SI 7))
10477 (clobber (reg:SI 8))
10478 (clobber (reg:SI 9))
10479 (clobber (reg:SI 10))
10480 (clobber (match_scratch:SI 5 "=X"))]
10481 "TARGET_STRING && ! TARGET_POWER
10482 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10483 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10484 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10485 && REGNO (operands[4]) == 5"
10486 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10487 [(set_attr "type" "store_ux")
10488 (set_attr "cell_micro" "always")
10489 (set_attr "length" "8")])
10491 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10492 ;; problems with TImode.
10493 ;; rD/rS = r5 is preferred, efficient form.
10494 (define_expand "movmemsi_4reg"
10495 [(parallel [(set (match_operand 0 "" "")
10496 (match_operand 1 "" ""))
10497 (use (match_operand 2 "" ""))
10498 (use (match_operand 3 "" ""))
10499 (clobber (reg:SI 5))
10500 (clobber (reg:SI 6))
10501 (clobber (reg:SI 7))
10502 (clobber (reg:SI 8))
10503 (clobber (match_scratch:SI 4 ""))])]
10508 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10509 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10510 (use (match_operand:SI 2 "immediate_operand" "i"))
10511 (use (match_operand:SI 3 "immediate_operand" "i"))
10512 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10513 (clobber (reg:SI 6))
10514 (clobber (reg:SI 7))
10515 (clobber (reg:SI 8))
10516 (clobber (match_scratch:SI 5 "=q"))]
10517 "TARGET_STRING && TARGET_POWER
10518 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10519 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10520 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10521 && REGNO (operands[4]) == 5"
10522 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10523 [(set_attr "type" "store_ux")
10524 (set_attr "cell_micro" "always")
10525 (set_attr "length" "8")])
10528 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10529 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10530 (use (match_operand:SI 2 "immediate_operand" "i"))
10531 (use (match_operand:SI 3 "immediate_operand" "i"))
10532 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10533 (clobber (reg:SI 6))
10534 (clobber (reg:SI 7))
10535 (clobber (reg:SI 8))
10536 (clobber (match_scratch:SI 5 "=X"))]
10537 "TARGET_STRING && ! TARGET_POWER
10538 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10539 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10540 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10541 && REGNO (operands[4]) == 5"
10542 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10543 [(set_attr "type" "store_ux")
10544 (set_attr "cell_micro" "always")
10545 (set_attr "length" "8")])
10547 ;; Move up to 8 bytes at a time.
10548 (define_expand "movmemsi_2reg"
10549 [(parallel [(set (match_operand 0 "" "")
10550 (match_operand 1 "" ""))
10551 (use (match_operand 2 "" ""))
10552 (use (match_operand 3 "" ""))
10553 (clobber (match_scratch:DI 4 ""))
10554 (clobber (match_scratch:SI 5 ""))])]
10555 "TARGET_STRING && ! TARGET_POWERPC64"
10559 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10560 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10561 (use (match_operand:SI 2 "immediate_operand" "i"))
10562 (use (match_operand:SI 3 "immediate_operand" "i"))
10563 (clobber (match_scratch:DI 4 "=&r"))
10564 (clobber (match_scratch:SI 5 "=q"))]
10565 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
10566 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10567 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10568 [(set_attr "type" "store_ux")
10569 (set_attr "cell_micro" "always")
10570 (set_attr "length" "8")])
10573 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10574 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10575 (use (match_operand:SI 2 "immediate_operand" "i"))
10576 (use (match_operand:SI 3 "immediate_operand" "i"))
10577 (clobber (match_scratch:DI 4 "=&r"))
10578 (clobber (match_scratch:SI 5 "=X"))]
10579 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
10580 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10581 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10582 [(set_attr "type" "store_ux")
10583 (set_attr "cell_micro" "always")
10584 (set_attr "length" "8")])
10586 ;; Move up to 4 bytes at a time.
10587 (define_expand "movmemsi_1reg"
10588 [(parallel [(set (match_operand 0 "" "")
10589 (match_operand 1 "" ""))
10590 (use (match_operand 2 "" ""))
10591 (use (match_operand 3 "" ""))
10592 (clobber (match_scratch:SI 4 ""))
10593 (clobber (match_scratch:SI 5 ""))])]
10598 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10599 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10600 (use (match_operand:SI 2 "immediate_operand" "i"))
10601 (use (match_operand:SI 3 "immediate_operand" "i"))
10602 (clobber (match_scratch:SI 4 "=&r"))
10603 (clobber (match_scratch:SI 5 "=q"))]
10604 "TARGET_STRING && TARGET_POWER
10605 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10606 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10607 [(set_attr "type" "store_ux")
10608 (set_attr "cell_micro" "always")
10609 (set_attr "length" "8")])
10612 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10613 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10614 (use (match_operand:SI 2 "immediate_operand" "i"))
10615 (use (match_operand:SI 3 "immediate_operand" "i"))
10616 (clobber (match_scratch:SI 4 "=&r"))
10617 (clobber (match_scratch:SI 5 "=X"))]
10618 "TARGET_STRING && ! TARGET_POWER
10619 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10620 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10621 [(set_attr "type" "store_ux")
10622 (set_attr "cell_micro" "always")
10623 (set_attr "length" "8")])
10625 ;; Define insns that do load or store with update. Some of these we can
10626 ;; get by using pre-decrement or pre-increment, but the hardware can also
10627 ;; do cases where the increment is not the size of the object.
10629 ;; In all these cases, we use operands 0 and 1 for the register being
10630 ;; incremented because those are the operands that local-alloc will
10631 ;; tie and these are the pair most likely to be tieable (and the ones
10632 ;; that will benefit the most).
10634 (define_insn "*movdi_update1"
10635 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10636 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10637 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10638 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10639 (plus:DI (match_dup 1) (match_dup 2)))]
10640 "TARGET_POWERPC64 && TARGET_UPDATE
10641 && (!avoiding_indexed_address_p (DImode)
10642 || !gpc_reg_operand (operands[2], DImode))"
10646 [(set_attr "type" "load_ux,load_u")])
10648 (define_insn "movdi_<mode>_update"
10649 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10650 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10651 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10652 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10653 (plus:P (match_dup 1) (match_dup 2)))]
10654 "TARGET_POWERPC64 && TARGET_UPDATE
10655 && (!avoiding_indexed_address_p (Pmode)
10656 || !gpc_reg_operand (operands[2], Pmode)
10657 || (REG_P (operands[0])
10658 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10662 [(set_attr "type" "store_ux,store_u")])
10664 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10665 ;; needed for stack allocation, even if the user passes -mno-update.
10666 (define_insn "movdi_<mode>_update_stack"
10667 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10668 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10669 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10670 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10671 (plus:P (match_dup 1) (match_dup 2)))]
10676 [(set_attr "type" "store_ux,store_u")])
10678 (define_insn "*movsi_update1"
10679 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10680 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10681 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10682 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10683 (plus:SI (match_dup 1) (match_dup 2)))]
10685 && (!avoiding_indexed_address_p (SImode)
10686 || !gpc_reg_operand (operands[2], SImode))"
10688 {lux|lwzux} %3,%0,%2
10689 {lu|lwzu} %3,%2(%0)"
10690 [(set_attr "type" "load_ux,load_u")])
10692 (define_insn "*movsi_update2"
10693 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10695 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10696 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10697 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10698 (plus:DI (match_dup 1) (match_dup 2)))]
10699 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10700 && !avoiding_indexed_address_p (DImode)"
10702 [(set_attr "type" "load_ext_ux")])
10704 (define_insn "movsi_update"
10705 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10706 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10707 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10708 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10709 (plus:SI (match_dup 1) (match_dup 2)))]
10711 && (!avoiding_indexed_address_p (SImode)
10712 || !gpc_reg_operand (operands[2], SImode)
10713 || (REG_P (operands[0])
10714 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10716 {stux|stwux} %3,%0,%2
10717 {stu|stwu} %3,%2(%0)"
10718 [(set_attr "type" "store_ux,store_u")])
10720 ;; This is an unconditional pattern; needed for stack allocation, even
10721 ;; if the user passes -mno-update.
10722 (define_insn "movsi_update_stack"
10723 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10724 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10725 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10726 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10727 (plus:SI (match_dup 1) (match_dup 2)))]
10730 {stux|stwux} %3,%0,%2
10731 {stu|stwu} %3,%2(%0)"
10732 [(set_attr "type" "store_ux,store_u")])
10734 (define_insn "*movhi_update1"
10735 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10736 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10737 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10738 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10739 (plus:SI (match_dup 1) (match_dup 2)))]
10741 && (!avoiding_indexed_address_p (SImode)
10742 || !gpc_reg_operand (operands[2], SImode))"
10746 [(set_attr "type" "load_ux,load_u")])
10748 (define_insn "*movhi_update2"
10749 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10751 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10752 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10753 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10754 (plus:SI (match_dup 1) (match_dup 2)))]
10756 && (!avoiding_indexed_address_p (SImode)
10757 || !gpc_reg_operand (operands[2], SImode))"
10761 [(set_attr "type" "load_ux,load_u")])
10763 (define_insn "*movhi_update3"
10764 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10766 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10767 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10768 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10769 (plus:SI (match_dup 1) (match_dup 2)))]
10770 "TARGET_UPDATE && rs6000_gen_cell_microcode
10771 && (!avoiding_indexed_address_p (SImode)
10772 || !gpc_reg_operand (operands[2], SImode))"
10776 [(set_attr "type" "load_ext_ux,load_ext_u")])
10778 (define_insn "*movhi_update4"
10779 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10780 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10781 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10782 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10783 (plus:SI (match_dup 1) (match_dup 2)))]
10785 && (!avoiding_indexed_address_p (SImode)
10786 || !gpc_reg_operand (operands[2], SImode))"
10790 [(set_attr "type" "store_ux,store_u")])
10792 (define_insn "*movqi_update1"
10793 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10794 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10795 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10796 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10797 (plus:SI (match_dup 1) (match_dup 2)))]
10799 && (!avoiding_indexed_address_p (SImode)
10800 || !gpc_reg_operand (operands[2], SImode))"
10804 [(set_attr "type" "load_ux,load_u")])
10806 (define_insn "*movqi_update2"
10807 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10809 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10810 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10811 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10812 (plus:SI (match_dup 1) (match_dup 2)))]
10814 && (!avoiding_indexed_address_p (SImode)
10815 || !gpc_reg_operand (operands[2], SImode))"
10819 [(set_attr "type" "load_ux,load_u")])
10821 (define_insn "*movqi_update3"
10822 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10823 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10824 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10825 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10826 (plus:SI (match_dup 1) (match_dup 2)))]
10828 && (!avoiding_indexed_address_p (SImode)
10829 || !gpc_reg_operand (operands[2], SImode))"
10833 [(set_attr "type" "store_ux,store_u")])
10835 (define_insn "*movsf_update1"
10836 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10837 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10838 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10839 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10840 (plus:SI (match_dup 1) (match_dup 2)))]
10841 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10842 && (!avoiding_indexed_address_p (SImode)
10843 || !gpc_reg_operand (operands[2], SImode))"
10847 [(set_attr "type" "fpload_ux,fpload_u")])
10849 (define_insn "*movsf_update2"
10850 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10851 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10852 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10853 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10854 (plus:SI (match_dup 1) (match_dup 2)))]
10855 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10856 && (!avoiding_indexed_address_p (SImode)
10857 || !gpc_reg_operand (operands[2], SImode))"
10861 [(set_attr "type" "fpstore_ux,fpstore_u")])
10863 (define_insn "*movsf_update3"
10864 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10865 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10866 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10867 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10868 (plus:SI (match_dup 1) (match_dup 2)))]
10869 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10870 && (!avoiding_indexed_address_p (SImode)
10871 || !gpc_reg_operand (operands[2], SImode))"
10873 {lux|lwzux} %3,%0,%2
10874 {lu|lwzu} %3,%2(%0)"
10875 [(set_attr "type" "load_ux,load_u")])
10877 (define_insn "*movsf_update4"
10878 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10879 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10880 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10881 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10882 (plus:SI (match_dup 1) (match_dup 2)))]
10883 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10884 && (!avoiding_indexed_address_p (SImode)
10885 || !gpc_reg_operand (operands[2], SImode))"
10887 {stux|stwux} %3,%0,%2
10888 {stu|stwu} %3,%2(%0)"
10889 [(set_attr "type" "store_ux,store_u")])
10891 (define_insn "*movdf_update1"
10892 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10893 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10894 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10895 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10896 (plus:SI (match_dup 1) (match_dup 2)))]
10897 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10898 && (!avoiding_indexed_address_p (SImode)
10899 || !gpc_reg_operand (operands[2], SImode))"
10903 [(set_attr "type" "fpload_ux,fpload_u")])
10905 (define_insn "*movdf_update2"
10906 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10907 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10908 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10909 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10910 (plus:SI (match_dup 1) (match_dup 2)))]
10911 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10912 && (!avoiding_indexed_address_p (SImode)
10913 || !gpc_reg_operand (operands[2], SImode))"
10917 [(set_attr "type" "fpstore_ux,fpstore_u")])
10919 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10921 (define_insn "*lfq_power2"
10922 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10923 (match_operand:V2DF 1 "memory_operand" ""))]
10925 && TARGET_HARD_FLOAT && TARGET_FPRS"
10929 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10930 (match_operand:DF 1 "memory_operand" ""))
10931 (set (match_operand:DF 2 "gpc_reg_operand" "")
10932 (match_operand:DF 3 "memory_operand" ""))]
10934 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10935 && registers_ok_for_quad_peep (operands[0], operands[2])
10936 && mems_ok_for_quad_peep (operands[1], operands[3])"
10937 [(set (match_dup 0)
10939 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10940 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10942 (define_insn "*stfq_power2"
10943 [(set (match_operand:V2DF 0 "memory_operand" "")
10944 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10946 && TARGET_HARD_FLOAT && TARGET_FPRS"
10947 "stfq%U0%X0 %1,%0")
10951 [(set (match_operand:DF 0 "memory_operand" "")
10952 (match_operand:DF 1 "gpc_reg_operand" ""))
10953 (set (match_operand:DF 2 "memory_operand" "")
10954 (match_operand:DF 3 "gpc_reg_operand" ""))]
10956 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10957 && registers_ok_for_quad_peep (operands[1], operands[3])
10958 && mems_ok_for_quad_peep (operands[0], operands[2])"
10959 [(set (match_dup 0)
10961 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10962 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10964 ;; After inserting conditional returns we can sometimes have
10965 ;; unnecessary register moves. Unfortunately we cannot have a
10966 ;; modeless peephole here, because some single SImode sets have early
10967 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10968 ;; sequences, using get_attr_length here will smash the operands
10969 ;; array. Neither is there an early_cobbler_p predicate.
10970 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10972 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10973 (match_operand:DF 1 "any_operand" ""))
10974 (set (match_operand:DF 2 "gpc_reg_operand" "")
10976 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10977 && peep2_reg_dead_p (2, operands[0])"
10978 [(set (match_dup 2) (match_dup 1))])
10981 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10982 (match_operand:SF 1 "any_operand" ""))
10983 (set (match_operand:SF 2 "gpc_reg_operand" "")
10985 "peep2_reg_dead_p (2, operands[0])"
10986 [(set (match_dup 2) (match_dup 1))])
10991 ;; Mode attributes for different ABIs.
10992 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10993 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10994 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10995 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10997 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10998 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10999 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11000 (match_operand 4 "" "g")))
11001 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11002 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11004 (clobber (reg:SI LR_REGNO))]
11005 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11006 "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
11007 "&& TARGET_TLS_MARKERS"
11008 [(set (match_dup 0)
11009 (unspec:TLSmode [(match_dup 1)
11012 (parallel [(set (match_dup 0)
11013 (call (mem:TLSmode (match_dup 3))
11015 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11016 (clobber (reg:SI LR_REGNO))])]
11018 [(set_attr "type" "two")
11019 (set_attr "length" "12")])
11021 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11022 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11023 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11024 (match_operand 4 "" "g")))
11025 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11026 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11028 (clobber (reg:SI LR_REGNO))]
11029 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11033 if (TARGET_SECURE_PLT && flag_pic == 2)
11034 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11036 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11039 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11041 "&& TARGET_TLS_MARKERS"
11042 [(set (match_dup 0)
11043 (unspec:TLSmode [(match_dup 1)
11046 (parallel [(set (match_dup 0)
11047 (call (mem:TLSmode (match_dup 3))
11049 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11050 (clobber (reg:SI LR_REGNO))])]
11052 [(set_attr "type" "two")
11053 (set_attr "length" "8")])
11055 (define_insn "*tls_gd<TLSmode:tls_abi_suffix>"
11056 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11057 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11058 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11060 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11061 "addi %0,%1,%2@got@tlsgd"
11062 [(set_attr "length" "4")])
11064 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11065 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11066 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11067 (match_operand 2 "" "g")))
11068 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11070 (clobber (reg:SI LR_REGNO))]
11071 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11072 "bl %z1(%3@tlsgd)\;%."
11073 [(set_attr "type" "branch")
11074 (set_attr "length" "8")])
11076 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11077 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11078 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11079 (match_operand 2 "" "g")))
11080 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11082 (clobber (reg:SI LR_REGNO))]
11083 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11087 if (TARGET_SECURE_PLT && flag_pic == 2)
11088 return "bl %z1+32768(%3@tlsgd)@plt";
11089 return "bl %z1(%3@tlsgd)@plt";
11091 return "bl %z1(%3@tlsgd)";
11093 [(set_attr "type" "branch")
11094 (set_attr "length" "4")])
11096 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11097 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11098 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11099 (match_operand 3 "" "g")))
11100 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11102 (clobber (reg:SI LR_REGNO))]
11103 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11104 "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
11105 "&& TARGET_TLS_MARKERS"
11106 [(set (match_dup 0)
11107 (unspec:TLSmode [(match_dup 1)]
11109 (parallel [(set (match_dup 0)
11110 (call (mem:TLSmode (match_dup 2))
11112 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11113 (clobber (reg:SI LR_REGNO))])]
11115 [(set_attr "length" "12")])
11117 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11118 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11119 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11120 (match_operand 3 "" "g")))
11121 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11123 (clobber (reg:SI LR_REGNO))]
11124 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11128 if (TARGET_SECURE_PLT && flag_pic == 2)
11129 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11131 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11134 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11136 "&& TARGET_TLS_MARKERS"
11137 [(set (match_dup 0)
11138 (unspec:TLSmode [(match_dup 1)]
11140 (parallel [(set (match_dup 0)
11141 (call (mem:TLSmode (match_dup 2))
11143 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11144 (clobber (reg:SI LR_REGNO))])]
11146 [(set_attr "length" "8")])
11148 (define_insn "*tls_ld<TLSmode:tls_abi_suffix>"
11149 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11150 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11152 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11153 "addi %0,%1,%&@got@tlsld"
11154 [(set_attr "length" "4")])
11156 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11157 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11158 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11159 (match_operand 2 "" "g")))
11160 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11161 (clobber (reg:SI LR_REGNO))]
11162 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11163 "bl %z1(%&@tlsld)\;%."
11164 [(set_attr "type" "branch")
11165 (set_attr "length" "8")])
11167 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11168 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11169 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11170 (match_operand 2 "" "g")))
11171 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11172 (clobber (reg:SI LR_REGNO))]
11173 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11177 if (TARGET_SECURE_PLT && flag_pic == 2)
11178 return "bl %z1+32768(%&@tlsld)@plt";
11179 return "bl %z1(%&@tlsld)@plt";
11181 return "bl %z1(%&@tlsld)";
11183 [(set_attr "type" "branch")
11184 (set_attr "length" "4")])
11186 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11187 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11188 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11189 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11190 UNSPEC_TLSDTPREL))]
11192 "addi %0,%1,%2@dtprel")
11194 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11195 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11196 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11197 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11198 UNSPEC_TLSDTPRELHA))]
11200 "addis %0,%1,%2@dtprel@ha")
11202 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11203 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11204 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11205 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11206 UNSPEC_TLSDTPRELLO))]
11208 "addi %0,%1,%2@dtprel@l")
11210 (define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11211 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11212 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11213 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11214 UNSPEC_TLSGOTDTPREL))]
11216 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
11218 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11219 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11220 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11221 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11224 "addi %0,%1,%2@tprel")
11226 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11227 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11228 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11229 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11230 UNSPEC_TLSTPRELHA))]
11232 "addis %0,%1,%2@tprel@ha")
11234 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11235 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11236 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11237 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11238 UNSPEC_TLSTPRELLO))]
11240 "addi %0,%1,%2@tprel@l")
11242 ;; "b" output constraint here and on tls_tls input to support linker tls
11243 ;; optimization. The linker may edit the instructions emitted by a
11244 ;; tls_got_tprel/tls_tls pair to addis,addi.
11245 (define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11246 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11247 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11248 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11249 UNSPEC_TLSGOTTPREL))]
11251 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
11253 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11254 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11255 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11256 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11259 "add %0,%1,%2@tls")
11262 ;; Next come insns related to the calling sequence.
11264 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11265 ;; We move the back-chain and decrement the stack pointer.
11267 (define_expand "allocate_stack"
11268 [(set (match_operand 0 "gpc_reg_operand" "")
11269 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11271 (minus (reg 1) (match_dup 1)))]
11274 { rtx chain = gen_reg_rtx (Pmode);
11275 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11277 rtx insn, par, set, mem;
11279 emit_move_insn (chain, stack_bot);
11281 /* Check stack bounds if necessary. */
11282 if (crtl->limit_stack)
11285 available = expand_binop (Pmode, sub_optab,
11286 stack_pointer_rtx, stack_limit_rtx,
11287 NULL_RTX, 1, OPTAB_WIDEN);
11288 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11291 if (GET_CODE (operands[1]) != CONST_INT
11292 || INTVAL (operands[1]) < -32767
11293 || INTVAL (operands[1]) > 32768)
11295 neg_op0 = gen_reg_rtx (Pmode);
11297 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11299 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11302 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11304 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11305 : gen_movdi_di_update_stack))
11306 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11308 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11309 it now and set the alias set/attributes. The above gen_*_update
11310 calls will generate a PARALLEL with the MEM set being the first
11312 par = PATTERN (insn);
11313 gcc_assert (GET_CODE (par) == PARALLEL);
11314 set = XVECEXP (par, 0, 0);
11315 gcc_assert (GET_CODE (set) == SET);
11316 mem = SET_DEST (set);
11317 gcc_assert (MEM_P (mem));
11318 MEM_NOTRAP_P (mem) = 1;
11319 set_mem_alias_set (mem, get_frame_alias_set ());
11321 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11325 ;; These patterns say how to save and restore the stack pointer. We need not
11326 ;; save the stack pointer at function level since we are careful to
11327 ;; preserve the backchain. At block level, we have to restore the backchain
11328 ;; when we restore the stack pointer.
11330 ;; For nonlocal gotos, we must save both the stack pointer and its
11331 ;; backchain and restore both. Note that in the nonlocal case, the
11332 ;; save area is a memory location.
11334 (define_expand "save_stack_function"
11335 [(match_operand 0 "any_operand" "")
11336 (match_operand 1 "any_operand" "")]
11340 (define_expand "restore_stack_function"
11341 [(match_operand 0 "any_operand" "")
11342 (match_operand 1 "any_operand" "")]
11346 ;; Adjust stack pointer (op0) to a new value (op1).
11347 ;; First copy old stack backchain to new location, and ensure that the
11348 ;; scheduler won't reorder the sp assignment before the backchain write.
11349 (define_expand "restore_stack_block"
11350 [(set (match_dup 2) (match_dup 3))
11351 (set (match_dup 4) (match_dup 2))
11352 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11353 (set (match_operand 0 "register_operand" "")
11354 (match_operand 1 "register_operand" ""))]
11358 operands[1] = force_reg (Pmode, operands[1]);
11359 operands[2] = gen_reg_rtx (Pmode);
11360 operands[3] = gen_frame_mem (Pmode, operands[0]);
11361 operands[4] = gen_frame_mem (Pmode, operands[1]);
11362 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11365 (define_expand "save_stack_nonlocal"
11366 [(set (match_dup 3) (match_dup 4))
11367 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11368 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11372 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11374 /* Copy the backchain to the first word, sp to the second. */
11375 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11376 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11377 operands[3] = gen_reg_rtx (Pmode);
11378 operands[4] = gen_frame_mem (Pmode, operands[1]);
11381 (define_expand "restore_stack_nonlocal"
11382 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11383 (set (match_dup 3) (match_dup 4))
11384 (set (match_dup 5) (match_dup 2))
11385 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11386 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11390 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11392 /* Restore the backchain from the first word, sp from the second. */
11393 operands[2] = gen_reg_rtx (Pmode);
11394 operands[3] = gen_reg_rtx (Pmode);
11395 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11396 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11397 operands[5] = gen_frame_mem (Pmode, operands[3]);
11398 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11401 ;; TOC register handling.
11403 ;; Code to initialize the TOC register...
11405 (define_insn "load_toc_aix_si"
11406 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11407 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11408 (use (reg:SI 2))])]
11409 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11413 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11414 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11415 operands[2] = gen_rtx_REG (Pmode, 2);
11416 return \"{l|lwz} %0,%1(%2)\";
11418 [(set_attr "type" "load")])
11420 (define_insn "load_toc_aix_di"
11421 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11422 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11423 (use (reg:DI 2))])]
11424 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11428 #ifdef TARGET_RELOCATABLE
11429 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11430 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11432 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11435 strcat (buf, \"@toc\");
11436 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11437 operands[2] = gen_rtx_REG (Pmode, 2);
11438 return \"ld %0,%1(%2)\";
11440 [(set_attr "type" "load")])
11442 (define_insn "load_toc_v4_pic_si"
11443 [(set (reg:SI LR_REGNO)
11444 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11445 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11446 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11447 [(set_attr "type" "branch")
11448 (set_attr "length" "4")])
11450 (define_insn "load_toc_v4_PIC_1"
11451 [(set (reg:SI LR_REGNO)
11452 (match_operand:SI 0 "immediate_operand" "s"))
11453 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11454 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11455 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11456 "bcl 20,31,%0\\n%0:"
11457 [(set_attr "type" "branch")
11458 (set_attr "length" "4")])
11460 (define_insn "load_toc_v4_PIC_1b"
11461 [(set (reg:SI LR_REGNO)
11462 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11463 (label_ref (match_operand 1 "" ""))]
11466 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11467 "bcl 20,31,$+8\;.long %0-$"
11468 [(set_attr "type" "branch")
11469 (set_attr "length" "8")])
11471 (define_insn "load_toc_v4_PIC_2"
11472 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11473 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11474 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11475 (match_operand:SI 3 "immediate_operand" "s")))))]
11476 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11477 "{l|lwz} %0,%2-%3(%1)"
11478 [(set_attr "type" "load")])
11480 (define_insn "load_toc_v4_PIC_3b"
11481 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
11482 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11484 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11485 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11486 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11487 "{cau|addis} %0,%1,%2-%3@ha")
11489 (define_insn "load_toc_v4_PIC_3c"
11490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11491 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11492 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11493 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11494 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11495 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
11497 ;; If the TOC is shared over a translation unit, as happens with all
11498 ;; the kinds of PIC that we support, we need to restore the TOC
11499 ;; pointer only when jumping over units of translation.
11500 ;; On Darwin, we need to reload the picbase.
11502 (define_expand "builtin_setjmp_receiver"
11503 [(use (label_ref (match_operand 0 "" "")))]
11504 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11505 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11506 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11510 if (DEFAULT_ABI == ABI_DARWIN)
11512 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11513 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11517 crtl->uses_pic_offset_table = 1;
11518 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11519 CODE_LABEL_NUMBER (operands[0]));
11520 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11522 emit_insn (gen_load_macho_picbase (tmplabrtx));
11523 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11524 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11528 rs6000_emit_load_toc_table (FALSE);
11532 ;; Elf specific ways of loading addresses for non-PIC code.
11533 ;; The output of this could be r0, but we make a very strong
11534 ;; preference for a base register because it will usually
11535 ;; be needed there.
11536 (define_insn "elf_high"
11537 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11538 (high:SI (match_operand 1 "" "")))]
11539 "TARGET_ELF && ! TARGET_64BIT"
11540 "{liu|lis} %0,%1@ha")
11542 (define_insn "elf_low"
11543 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11544 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11545 (match_operand 2 "" "")))]
11546 "TARGET_ELF && ! TARGET_64BIT"
11548 {cal|la} %0,%2@l(%1)
11549 {ai|addic} %0,%1,%K2")
11551 ;; A function pointer under AIX is a pointer to a data area whose first word
11552 ;; contains the actual address of the function, whose second word contains a
11553 ;; pointer to its TOC, and whose third word contains a value to place in the
11554 ;; static chain register (r11). Note that if we load the static chain, our
11555 ;; "trampoline" need not have any executable code.
11557 (define_expand "call_indirect_aix32"
11558 [(set (match_dup 2)
11559 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
11560 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11563 (mem:SI (plus:SI (match_dup 0)
11565 (parallel [(call (mem:SI (match_dup 2))
11566 (match_operand 1 "" ""))
11567 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
11569 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11570 (clobber (reg:SI LR_REGNO))])]
11573 { operands[2] = gen_reg_rtx (SImode); }")
11575 (define_expand "call_indirect_aix64"
11576 [(set (match_dup 2)
11577 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
11578 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11581 (mem:DI (plus:DI (match_dup 0)
11583 (parallel [(call (mem:SI (match_dup 2))
11584 (match_operand 1 "" ""))
11585 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
11587 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11588 (clobber (reg:SI LR_REGNO))])]
11591 { operands[2] = gen_reg_rtx (DImode); }")
11593 (define_expand "call_value_indirect_aix32"
11594 [(set (match_dup 3)
11595 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11596 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11599 (mem:SI (plus:SI (match_dup 1)
11601 (parallel [(set (match_operand 0 "" "")
11602 (call (mem:SI (match_dup 3))
11603 (match_operand 2 "" "")))
11604 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
11606 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11607 (clobber (reg:SI LR_REGNO))])]
11610 { operands[3] = gen_reg_rtx (SImode); }")
11612 (define_expand "call_value_indirect_aix64"
11613 [(set (match_dup 3)
11614 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11615 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11618 (mem:DI (plus:DI (match_dup 1)
11620 (parallel [(set (match_operand 0 "" "")
11621 (call (mem:SI (match_dup 3))
11622 (match_operand 2 "" "")))
11623 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
11625 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11626 (clobber (reg:SI LR_REGNO))])]
11629 { operands[3] = gen_reg_rtx (DImode); }")
11631 ;; Now the definitions for the call and call_value insns
11632 (define_expand "call"
11633 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11634 (match_operand 1 "" ""))
11635 (use (match_operand 2 "" ""))
11636 (clobber (reg:SI LR_REGNO))])]
11641 if (MACHOPIC_INDIRECT)
11642 operands[0] = machopic_indirect_call_target (operands[0]);
11645 gcc_assert (GET_CODE (operands[0]) == MEM);
11646 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11648 operands[0] = XEXP (operands[0], 0);
11650 if (GET_CODE (operands[0]) != SYMBOL_REF
11651 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11652 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11654 if (INTVAL (operands[2]) & CALL_LONG)
11655 operands[0] = rs6000_longcall_ref (operands[0]);
11657 switch (DEFAULT_ABI)
11661 operands[0] = force_reg (Pmode, operands[0]);
11665 /* AIX function pointers are really pointers to a three word
11667 emit_call_insn (TARGET_32BIT
11668 ? gen_call_indirect_aix32 (force_reg (SImode,
11671 : gen_call_indirect_aix64 (force_reg (DImode,
11677 gcc_unreachable ();
11682 (define_expand "call_value"
11683 [(parallel [(set (match_operand 0 "" "")
11684 (call (mem:SI (match_operand 1 "address_operand" ""))
11685 (match_operand 2 "" "")))
11686 (use (match_operand 3 "" ""))
11687 (clobber (reg:SI LR_REGNO))])]
11692 if (MACHOPIC_INDIRECT)
11693 operands[1] = machopic_indirect_call_target (operands[1]);
11696 gcc_assert (GET_CODE (operands[1]) == MEM);
11697 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11699 operands[1] = XEXP (operands[1], 0);
11701 if (GET_CODE (operands[1]) != SYMBOL_REF
11702 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11703 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11705 if (INTVAL (operands[3]) & CALL_LONG)
11706 operands[1] = rs6000_longcall_ref (operands[1]);
11708 switch (DEFAULT_ABI)
11712 operands[1] = force_reg (Pmode, operands[1]);
11716 /* AIX function pointers are really pointers to a three word
11718 emit_call_insn (TARGET_32BIT
11719 ? gen_call_value_indirect_aix32 (operands[0],
11723 : gen_call_value_indirect_aix64 (operands[0],
11730 gcc_unreachable ();
11735 ;; Call to function in current module. No TOC pointer reload needed.
11736 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11737 ;; either the function was not prototyped, or it was prototyped as a
11738 ;; variable argument function. It is > 0 if FP registers were passed
11739 ;; and < 0 if they were not.
11741 (define_insn "*call_local32"
11742 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11743 (match_operand 1 "" "g,g"))
11744 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11745 (clobber (reg:SI LR_REGNO))]
11746 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11749 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11750 output_asm_insn (\"crxor 6,6,6\", operands);
11752 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11753 output_asm_insn (\"creqv 6,6,6\", operands);
11755 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11757 [(set_attr "type" "branch")
11758 (set_attr "length" "4,8")])
11760 (define_insn "*call_local64"
11761 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11762 (match_operand 1 "" "g,g"))
11763 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11764 (clobber (reg:SI LR_REGNO))]
11765 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11768 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11769 output_asm_insn (\"crxor 6,6,6\", operands);
11771 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11772 output_asm_insn (\"creqv 6,6,6\", operands);
11774 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11776 [(set_attr "type" "branch")
11777 (set_attr "length" "4,8")])
11779 (define_insn "*call_value_local32"
11780 [(set (match_operand 0 "" "")
11781 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11782 (match_operand 2 "" "g,g")))
11783 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11784 (clobber (reg:SI LR_REGNO))]
11785 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11788 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11789 output_asm_insn (\"crxor 6,6,6\", operands);
11791 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11792 output_asm_insn (\"creqv 6,6,6\", operands);
11794 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11796 [(set_attr "type" "branch")
11797 (set_attr "length" "4,8")])
11800 (define_insn "*call_value_local64"
11801 [(set (match_operand 0 "" "")
11802 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11803 (match_operand 2 "" "g,g")))
11804 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11805 (clobber (reg:SI LR_REGNO))]
11806 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11809 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11810 output_asm_insn (\"crxor 6,6,6\", operands);
11812 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11813 output_asm_insn (\"creqv 6,6,6\", operands);
11815 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11817 [(set_attr "type" "branch")
11818 (set_attr "length" "4,8")])
11820 ;; Call to function which may be in another module. Restore the TOC
11821 ;; pointer (r2) after the call unless this is System V.
11822 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11823 ;; either the function was not prototyped, or it was prototyped as a
11824 ;; variable argument function. It is > 0 if FP registers were passed
11825 ;; and < 0 if they were not.
11827 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
11828 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11829 (match_operand 1 "" "g,g"))
11830 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
11832 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11833 (clobber (reg:SI LR_REGNO))]
11834 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11836 "&& reload_completed"
11838 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
11839 (parallel [(call (mem:SI (match_dup 0))
11844 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11845 (clobber (reg:SI LR_REGNO))])]
11847 [(set_attr "type" "jmpreg")
11848 (set_attr "length" "12")])
11850 (define_insn "*call_indirect_nonlocal_aix32"
11851 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11852 (match_operand 1 "" "g,g"))
11856 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11857 (clobber (reg:SI LR_REGNO))]
11858 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11859 "b%T0l\;{l|lwz} 2,20(1)"
11860 [(set_attr "type" "jmpreg")
11861 (set_attr "length" "8")])
11863 (define_insn "*call_nonlocal_aix32"
11864 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11865 (match_operand 1 "" "g"))
11866 (use (match_operand:SI 2 "immediate_operand" "O"))
11867 (clobber (reg:SI LR_REGNO))]
11869 && DEFAULT_ABI == ABI_AIX
11870 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11872 [(set_attr "type" "branch")
11873 (set_attr "length" "8")])
11875 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
11876 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11877 (match_operand 1 "" "g,g"))
11878 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
11881 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11882 (clobber (reg:SI LR_REGNO))]
11883 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11885 "&& reload_completed"
11887 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
11888 (parallel [(call (mem:SI (match_dup 0))
11893 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11894 (clobber (reg:SI LR_REGNO))])]
11896 [(set_attr "type" "jmpreg")
11897 (set_attr "length" "12")])
11899 (define_insn "*call_indirect_nonlocal_aix64"
11900 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11901 (match_operand 1 "" "g,g"))
11905 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11906 (clobber (reg:SI LR_REGNO))]
11907 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11908 "b%T0l\;ld 2,40(1)"
11909 [(set_attr "type" "jmpreg")
11910 (set_attr "length" "8")])
11912 (define_insn "*call_nonlocal_aix64"
11913 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11914 (match_operand 1 "" "g"))
11915 (use (match_operand:SI 2 "immediate_operand" "O"))
11916 (clobber (reg:SI LR_REGNO))]
11918 && DEFAULT_ABI == ABI_AIX
11919 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11921 [(set_attr "type" "branch")
11922 (set_attr "length" "8")])
11924 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
11925 [(set (match_operand 0 "" "")
11926 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11927 (match_operand 2 "" "g,g")))
11928 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
11931 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11932 (clobber (reg:SI LR_REGNO))]
11933 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11935 "&& reload_completed"
11937 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
11938 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
11943 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11944 (clobber (reg:SI LR_REGNO))])]
11946 [(set_attr "type" "jmpreg")
11947 (set_attr "length" "12")])
11949 (define_insn "*call_value_indirect_nonlocal_aix32"
11950 [(set (match_operand 0 "" "")
11951 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11952 (match_operand 2 "" "g,g")))
11956 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11957 (clobber (reg:SI LR_REGNO))]
11958 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11959 "b%T1l\;{l|lwz} 2,20(1)"
11960 [(set_attr "type" "jmpreg")
11961 (set_attr "length" "8")])
11963 (define_insn "*call_value_nonlocal_aix32"
11964 [(set (match_operand 0 "" "")
11965 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11966 (match_operand 2 "" "g")))
11967 (use (match_operand:SI 3 "immediate_operand" "O"))
11968 (clobber (reg:SI LR_REGNO))]
11970 && DEFAULT_ABI == ABI_AIX
11971 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11973 [(set_attr "type" "branch")
11974 (set_attr "length" "8")])
11976 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
11977 [(set (match_operand 0 "" "")
11978 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11979 (match_operand 2 "" "g,g")))
11980 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
11983 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11984 (clobber (reg:SI LR_REGNO))]
11985 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11987 "&& reload_completed"
11989 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
11990 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
11995 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11996 (clobber (reg:SI LR_REGNO))])]
11998 [(set_attr "type" "jmpreg")
11999 (set_attr "length" "12")])
12001 (define_insn "*call_value_indirect_nonlocal_aix64"
12002 [(set (match_operand 0 "" "")
12003 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12004 (match_operand 2 "" "g,g")))
12008 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12009 (clobber (reg:SI LR_REGNO))]
12010 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12011 "b%T1l\;ld 2,40(1)"
12012 [(set_attr "type" "jmpreg")
12013 (set_attr "length" "8")])
12015 (define_insn "*call_value_nonlocal_aix64"
12016 [(set (match_operand 0 "" "")
12017 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12018 (match_operand 2 "" "g")))
12019 (use (match_operand:SI 3 "immediate_operand" "O"))
12020 (clobber (reg:SI LR_REGNO))]
12022 && DEFAULT_ABI == ABI_AIX
12023 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12025 [(set_attr "type" "branch")
12026 (set_attr "length" "8")])
12028 ;; A function pointer under System V is just a normal pointer
12029 ;; operands[0] is the function pointer
12030 ;; operands[1] is the stack size to clean up
12031 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12032 ;; which indicates how to set cr1
12034 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12035 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12036 (match_operand 1 "" "g,g,g,g"))
12037 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12038 (clobber (reg:SI LR_REGNO))]
12039 "DEFAULT_ABI == ABI_V4
12040 || DEFAULT_ABI == ABI_DARWIN"
12042 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12043 output_asm_insn ("crxor 6,6,6", operands);
12045 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12046 output_asm_insn ("creqv 6,6,6", operands);
12050 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12051 (set_attr "length" "4,4,8,8")])
12053 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12054 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12055 (match_operand 1 "" "g,g"))
12056 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12057 (clobber (reg:SI LR_REGNO))]
12058 "(DEFAULT_ABI == ABI_DARWIN
12059 || (DEFAULT_ABI == ABI_V4
12060 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12062 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12063 output_asm_insn ("crxor 6,6,6", operands);
12065 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12066 output_asm_insn ("creqv 6,6,6", operands);
12069 return output_call(insn, operands, 0, 2);
12071 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12073 gcc_assert (!TARGET_SECURE_PLT);
12074 return "bl %z0@plt";
12080 "DEFAULT_ABI == ABI_V4
12081 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12082 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12083 [(parallel [(call (mem:SI (match_dup 0))
12085 (use (match_dup 2))
12086 (use (match_dup 3))
12087 (clobber (reg:SI LR_REGNO))])]
12089 operands[3] = pic_offset_table_rtx;
12091 [(set_attr "type" "branch,branch")
12092 (set_attr "length" "4,8")])
12094 (define_insn "*call_nonlocal_sysv_secure<mode>"
12095 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12096 (match_operand 1 "" "g,g"))
12097 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12098 (use (match_operand:SI 3 "register_operand" "r,r"))
12099 (clobber (reg:SI LR_REGNO))]
12100 "(DEFAULT_ABI == ABI_V4
12101 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12102 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12104 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12105 output_asm_insn ("crxor 6,6,6", operands);
12107 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12108 output_asm_insn ("creqv 6,6,6", operands);
12111 /* The magic 32768 offset here and in the other sysv call insns
12112 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12113 See sysv4.h:toc_section. */
12114 return "bl %z0+32768@plt";
12116 return "bl %z0@plt";
12118 [(set_attr "type" "branch,branch")
12119 (set_attr "length" "4,8")])
12121 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12122 [(set (match_operand 0 "" "")
12123 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12124 (match_operand 2 "" "g,g,g,g")))
12125 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12126 (clobber (reg:SI LR_REGNO))]
12127 "DEFAULT_ABI == ABI_V4
12128 || DEFAULT_ABI == ABI_DARWIN"
12130 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12131 output_asm_insn ("crxor 6,6,6", operands);
12133 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12134 output_asm_insn ("creqv 6,6,6", operands);
12138 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12139 (set_attr "length" "4,4,8,8")])
12141 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12142 [(set (match_operand 0 "" "")
12143 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12144 (match_operand 2 "" "g,g")))
12145 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12146 (clobber (reg:SI LR_REGNO))]
12147 "(DEFAULT_ABI == ABI_DARWIN
12148 || (DEFAULT_ABI == ABI_V4
12149 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12151 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12152 output_asm_insn ("crxor 6,6,6", operands);
12154 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12155 output_asm_insn ("creqv 6,6,6", operands);
12158 return output_call(insn, operands, 1, 3);
12160 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12162 gcc_assert (!TARGET_SECURE_PLT);
12163 return "bl %z1@plt";
12169 "DEFAULT_ABI == ABI_V4
12170 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12171 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12172 [(parallel [(set (match_dup 0)
12173 (call (mem:SI (match_dup 1))
12175 (use (match_dup 3))
12176 (use (match_dup 4))
12177 (clobber (reg:SI LR_REGNO))])]
12179 operands[4] = pic_offset_table_rtx;
12181 [(set_attr "type" "branch,branch")
12182 (set_attr "length" "4,8")])
12184 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12185 [(set (match_operand 0 "" "")
12186 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12187 (match_operand 2 "" "g,g")))
12188 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12189 (use (match_operand:SI 4 "register_operand" "r,r"))
12190 (clobber (reg:SI LR_REGNO))]
12191 "(DEFAULT_ABI == ABI_V4
12192 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12193 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12195 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12196 output_asm_insn ("crxor 6,6,6", operands);
12198 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12199 output_asm_insn ("creqv 6,6,6", operands);
12202 return "bl %z1+32768@plt";
12204 return "bl %z1@plt";
12206 [(set_attr "type" "branch,branch")
12207 (set_attr "length" "4,8")])
12209 ;; Call subroutine returning any type.
12210 (define_expand "untyped_call"
12211 [(parallel [(call (match_operand 0 "" "")
12213 (match_operand 1 "" "")
12214 (match_operand 2 "" "")])]
12220 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12222 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12224 rtx set = XVECEXP (operands[2], 0, i);
12225 emit_move_insn (SET_DEST (set), SET_SRC (set));
12228 /* The optimizer does not know that the call sets the function value
12229 registers we stored in the result block. We avoid problems by
12230 claiming that all hard registers are used and clobbered at this
12232 emit_insn (gen_blockage ());
12237 ;; sibling call patterns
12238 (define_expand "sibcall"
12239 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12240 (match_operand 1 "" ""))
12241 (use (match_operand 2 "" ""))
12242 (use (reg:SI LR_REGNO))
12248 if (MACHOPIC_INDIRECT)
12249 operands[0] = machopic_indirect_call_target (operands[0]);
12252 gcc_assert (GET_CODE (operands[0]) == MEM);
12253 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12255 operands[0] = XEXP (operands[0], 0);
12258 ;; this and similar patterns must be marked as using LR, otherwise
12259 ;; dataflow will try to delete the store into it. This is true
12260 ;; even when the actual reg to jump to is in CTR, when LR was
12261 ;; saved and restored around the PIC-setting BCL.
12262 (define_insn "*sibcall_local32"
12263 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12264 (match_operand 1 "" "g,g"))
12265 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12266 (use (reg:SI LR_REGNO))
12268 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12271 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12272 output_asm_insn (\"crxor 6,6,6\", operands);
12274 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12275 output_asm_insn (\"creqv 6,6,6\", operands);
12277 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12279 [(set_attr "type" "branch")
12280 (set_attr "length" "4,8")])
12282 (define_insn "*sibcall_local64"
12283 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12284 (match_operand 1 "" "g,g"))
12285 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12286 (use (reg:SI LR_REGNO))
12288 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12291 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12292 output_asm_insn (\"crxor 6,6,6\", operands);
12294 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12295 output_asm_insn (\"creqv 6,6,6\", operands);
12297 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12299 [(set_attr "type" "branch")
12300 (set_attr "length" "4,8")])
12302 (define_insn "*sibcall_value_local32"
12303 [(set (match_operand 0 "" "")
12304 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12305 (match_operand 2 "" "g,g")))
12306 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12307 (use (reg:SI LR_REGNO))
12309 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12312 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12313 output_asm_insn (\"crxor 6,6,6\", operands);
12315 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12316 output_asm_insn (\"creqv 6,6,6\", operands);
12318 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12320 [(set_attr "type" "branch")
12321 (set_attr "length" "4,8")])
12324 (define_insn "*sibcall_value_local64"
12325 [(set (match_operand 0 "" "")
12326 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12327 (match_operand 2 "" "g,g")))
12328 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12329 (use (reg:SI LR_REGNO))
12331 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12334 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12335 output_asm_insn (\"crxor 6,6,6\", operands);
12337 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12338 output_asm_insn (\"creqv 6,6,6\", operands);
12340 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12342 [(set_attr "type" "branch")
12343 (set_attr "length" "4,8")])
12345 (define_insn "*sibcall_nonlocal_aix32"
12346 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12347 (match_operand 1 "" "g"))
12348 (use (match_operand:SI 2 "immediate_operand" "O"))
12349 (use (reg:SI LR_REGNO))
12352 && DEFAULT_ABI == ABI_AIX
12353 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12355 [(set_attr "type" "branch")
12356 (set_attr "length" "4")])
12358 (define_insn "*sibcall_nonlocal_aix64"
12359 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12360 (match_operand 1 "" "g"))
12361 (use (match_operand:SI 2 "immediate_operand" "O"))
12362 (use (reg:SI LR_REGNO))
12365 && DEFAULT_ABI == ABI_AIX
12366 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12368 [(set_attr "type" "branch")
12369 (set_attr "length" "4")])
12371 (define_insn "*sibcall_value_nonlocal_aix32"
12372 [(set (match_operand 0 "" "")
12373 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12374 (match_operand 2 "" "g")))
12375 (use (match_operand:SI 3 "immediate_operand" "O"))
12376 (use (reg:SI LR_REGNO))
12379 && DEFAULT_ABI == ABI_AIX
12380 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12382 [(set_attr "type" "branch")
12383 (set_attr "length" "4")])
12385 (define_insn "*sibcall_value_nonlocal_aix64"
12386 [(set (match_operand 0 "" "")
12387 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12388 (match_operand 2 "" "g")))
12389 (use (match_operand:SI 3 "immediate_operand" "O"))
12390 (use (reg:SI LR_REGNO))
12393 && DEFAULT_ABI == ABI_AIX
12394 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12396 [(set_attr "type" "branch")
12397 (set_attr "length" "4")])
12399 (define_insn "*sibcall_nonlocal_sysv<mode>"
12400 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12401 (match_operand 1 "" ""))
12402 (use (match_operand 2 "immediate_operand" "O,n"))
12403 (use (reg:SI LR_REGNO))
12405 "(DEFAULT_ABI == ABI_DARWIN
12406 || DEFAULT_ABI == ABI_V4)
12407 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12410 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12411 output_asm_insn (\"crxor 6,6,6\", operands);
12413 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12414 output_asm_insn (\"creqv 6,6,6\", operands);
12416 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12418 gcc_assert (!TARGET_SECURE_PLT);
12419 return \"b %z0@plt\";
12424 [(set_attr "type" "branch,branch")
12425 (set_attr "length" "4,8")])
12427 (define_expand "sibcall_value"
12428 [(parallel [(set (match_operand 0 "register_operand" "")
12429 (call (mem:SI (match_operand 1 "address_operand" ""))
12430 (match_operand 2 "" "")))
12431 (use (match_operand 3 "" ""))
12432 (use (reg:SI LR_REGNO))
12438 if (MACHOPIC_INDIRECT)
12439 operands[1] = machopic_indirect_call_target (operands[1]);
12442 gcc_assert (GET_CODE (operands[1]) == MEM);
12443 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12445 operands[1] = XEXP (operands[1], 0);
12448 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12449 [(set (match_operand 0 "" "")
12450 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12451 (match_operand 2 "" "")))
12452 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12453 (use (reg:SI LR_REGNO))
12455 "(DEFAULT_ABI == ABI_DARWIN
12456 || DEFAULT_ABI == ABI_V4)
12457 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12460 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12461 output_asm_insn (\"crxor 6,6,6\", operands);
12463 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12464 output_asm_insn (\"creqv 6,6,6\", operands);
12466 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12468 gcc_assert (!TARGET_SECURE_PLT);
12469 return \"b %z1@plt\";
12474 [(set_attr "type" "branch,branch")
12475 (set_attr "length" "4,8")])
12477 (define_expand "sibcall_epilogue"
12478 [(use (const_int 0))]
12479 "TARGET_SCHED_PROLOG"
12482 rs6000_emit_epilogue (TRUE);
12486 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12487 ;; all of memory. This blocks insns from being moved across this point.
12489 (define_insn "blockage"
12490 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12494 (define_insn "probe_stack"
12495 [(set (match_operand 0 "memory_operand" "=m")
12496 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12498 "{st%U0%X0|stw%U0%X0} 0,%0"
12499 [(set_attr "type" "store")
12500 (set_attr "length" "4")])
12502 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12503 ;; signed & unsigned, and one type of branch.
12505 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12506 ;; insns, and branches.
12508 (define_expand "cbranch<mode>4"
12509 [(use (match_operator 0 "rs6000_cbranch_operator"
12510 [(match_operand:GPR 1 "gpc_reg_operand" "")
12511 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12512 (use (match_operand 3 ""))]
12516 /* Take care of the possibility that operands[2] might be negative but
12517 this might be a logical operation. That insn doesn't exist. */
12518 if (GET_CODE (operands[2]) == CONST_INT
12519 && INTVAL (operands[2]) < 0)
12521 operands[2] = force_reg (<MODE>mode, operands[2]);
12522 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12523 GET_MODE (operands[0]),
12524 operands[1], operands[2]);
12527 rs6000_emit_cbranch (<MODE>mode, operands);
12531 (define_expand "cbranch<mode>4"
12532 [(use (match_operator 0 "rs6000_cbranch_operator"
12533 [(match_operand:FP 1 "gpc_reg_operand" "")
12534 (match_operand:FP 2 "gpc_reg_operand" "")]))
12535 (use (match_operand 3 ""))]
12539 rs6000_emit_cbranch (<MODE>mode, operands);
12543 (define_expand "cstore<mode>4"
12544 [(use (match_operator 1 "rs6000_cbranch_operator"
12545 [(match_operand:GPR 2 "gpc_reg_operand" "")
12546 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12547 (clobber (match_operand:SI 0 "register_operand"))]
12551 /* Take care of the possibility that operands[3] might be negative but
12552 this might be a logical operation. That insn doesn't exist. */
12553 if (GET_CODE (operands[3]) == CONST_INT
12554 && INTVAL (operands[3]) < 0)
12556 operands[3] = force_reg (<MODE>mode, operands[3]);
12557 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12558 GET_MODE (operands[1]),
12559 operands[2], operands[3]);
12562 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12563 For SEQ, likewise, except that comparisons with zero should be done
12564 with an scc insns. However, due to the order that combine see the
12565 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12566 the cases we don't want to handle or are best handled by portable
12568 if (GET_CODE (operands[1]) == NE)
12570 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12571 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12572 && operands[3] == const0_rtx)
12574 rs6000_emit_sCOND (<MODE>mode, operands);
12578 (define_expand "cstore<mode>4"
12579 [(use (match_operator 1 "rs6000_cbranch_operator"
12580 [(match_operand:FP 2 "gpc_reg_operand" "")
12581 (match_operand:FP 3 "gpc_reg_operand" "")]))
12582 (clobber (match_operand:SI 0 "register_operand"))]
12586 rs6000_emit_sCOND (<MODE>mode, operands);
12591 (define_expand "stack_protect_set"
12592 [(match_operand 0 "memory_operand" "")
12593 (match_operand 1 "memory_operand" "")]
12596 #ifdef TARGET_THREAD_SSP_OFFSET
12597 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12598 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12599 operands[1] = gen_rtx_MEM (Pmode, addr);
12602 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12604 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12608 (define_insn "stack_protect_setsi"
12609 [(set (match_operand:SI 0 "memory_operand" "=m")
12610 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12611 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12613 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
12614 [(set_attr "type" "three")
12615 (set_attr "length" "12")])
12617 (define_insn "stack_protect_setdi"
12618 [(set (match_operand:DI 0 "memory_operand" "=m")
12619 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12620 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12622 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
12623 [(set_attr "type" "three")
12624 (set_attr "length" "12")])
12626 (define_expand "stack_protect_test"
12627 [(match_operand 0 "memory_operand" "")
12628 (match_operand 1 "memory_operand" "")
12629 (match_operand 2 "" "")]
12632 rtx test, op0, op1;
12633 #ifdef TARGET_THREAD_SSP_OFFSET
12634 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12635 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12636 operands[1] = gen_rtx_MEM (Pmode, addr);
12639 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12640 test = gen_rtx_EQ (VOIDmode, op0, op1);
12641 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12645 (define_insn "stack_protect_testsi"
12646 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12647 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12648 (match_operand:SI 2 "memory_operand" "m,m")]
12650 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12651 (clobber (match_scratch:SI 3 "=&r,&r"))]
12654 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12655 {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"
12656 [(set_attr "length" "16,20")])
12658 (define_insn "stack_protect_testdi"
12659 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12660 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
12661 (match_operand:DI 2 "memory_operand" "m,m")]
12663 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12664 (clobber (match_scratch:DI 3 "=&r,&r"))]
12667 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12668 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
12669 [(set_attr "length" "16,20")])
12672 ;; Here are the actual compare insns.
12673 (define_insn "*cmp<mode>_internal1"
12674 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12675 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12676 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12678 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
12679 [(set_attr "type" "cmp")])
12681 ;; If we are comparing a register for equality with a large constant,
12682 ;; we can do this with an XOR followed by a compare. But this is profitable
12683 ;; only if the large constant is only used for the comparison (and in this
12684 ;; case we already have a register to reuse as scratch).
12686 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12687 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12690 [(set (match_operand:SI 0 "register_operand")
12691 (match_operand:SI 1 "logical_const_operand" ""))
12692 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12694 (match_operand:SI 2 "logical_const_operand" "")]))
12695 (set (match_operand:CC 4 "cc_reg_operand" "")
12696 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12699 (if_then_else (match_operator 6 "equality_operator"
12700 [(match_dup 4) (const_int 0)])
12701 (match_operand 7 "" "")
12702 (match_operand 8 "" "")))]
12703 "peep2_reg_dead_p (3, operands[0])
12704 && peep2_reg_dead_p (4, operands[4])"
12705 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12706 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12707 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12710 /* Get the constant we are comparing against, and see what it looks like
12711 when sign-extended from 16 to 32 bits. Then see what constant we could
12712 XOR with SEXTC to get the sign-extended value. */
12713 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12715 operands[1], operands[2]);
12716 HOST_WIDE_INT c = INTVAL (cnst);
12717 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12718 HOST_WIDE_INT xorv = c ^ sextc;
12720 operands[9] = GEN_INT (xorv);
12721 operands[10] = GEN_INT (sextc);
12724 (define_insn "*cmpsi_internal2"
12725 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12726 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12727 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12729 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
12730 [(set_attr "type" "cmp")])
12732 (define_insn "*cmpdi_internal2"
12733 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12734 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12735 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12737 "cmpld%I2 %0,%1,%b2"
12738 [(set_attr "type" "cmp")])
12740 ;; The following two insns don't exist as single insns, but if we provide
12741 ;; them, we can swap an add and compare, which will enable us to overlap more
12742 ;; of the required delay between a compare and branch. We generate code for
12743 ;; them by splitting.
12746 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12747 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12748 (match_operand:SI 2 "short_cint_operand" "i")))
12749 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12750 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12753 [(set_attr "length" "8")])
12756 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12757 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12758 (match_operand:SI 2 "u_short_cint_operand" "i")))
12759 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12760 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12763 [(set_attr "length" "8")])
12766 [(set (match_operand:CC 3 "cc_reg_operand" "")
12767 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12768 (match_operand:SI 2 "short_cint_operand" "")))
12769 (set (match_operand:SI 0 "gpc_reg_operand" "")
12770 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12772 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12773 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12776 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12777 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12778 (match_operand:SI 2 "u_short_cint_operand" "")))
12779 (set (match_operand:SI 0 "gpc_reg_operand" "")
12780 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12782 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12783 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12785 (define_insn "*cmpsf_internal1"
12786 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12787 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12788 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12789 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12791 [(set_attr "type" "fpcompare")])
12793 (define_insn "*cmpdf_internal1"
12794 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12795 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12796 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12797 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12798 && !VECTOR_UNIT_VSX_P (DFmode)"
12800 [(set_attr "type" "fpcompare")])
12802 ;; Only need to compare second words if first words equal
12803 (define_insn "*cmptf_internal1"
12804 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12805 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12806 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12807 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12808 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12809 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12810 [(set_attr "type" "fpcompare")
12811 (set_attr "length" "12")])
12813 (define_insn_and_split "*cmptf_internal2"
12814 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12815 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12816 (match_operand:TF 2 "gpc_reg_operand" "d")))
12817 (clobber (match_scratch:DF 3 "=d"))
12818 (clobber (match_scratch:DF 4 "=d"))
12819 (clobber (match_scratch:DF 5 "=d"))
12820 (clobber (match_scratch:DF 6 "=d"))
12821 (clobber (match_scratch:DF 7 "=d"))
12822 (clobber (match_scratch:DF 8 "=d"))
12823 (clobber (match_scratch:DF 9 "=d"))
12824 (clobber (match_scratch:DF 10 "=d"))]
12825 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12826 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12828 "&& reload_completed"
12829 [(set (match_dup 3) (match_dup 13))
12830 (set (match_dup 4) (match_dup 14))
12831 (set (match_dup 9) (abs:DF (match_dup 5)))
12832 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12833 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12834 (label_ref (match_dup 11))
12836 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12837 (set (pc) (label_ref (match_dup 12)))
12839 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12840 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12841 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12842 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
12845 REAL_VALUE_TYPE rv;
12846 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12847 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12849 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12850 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12851 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12852 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12853 operands[11] = gen_label_rtx ();
12854 operands[12] = gen_label_rtx ();
12856 operands[13] = force_const_mem (DFmode,
12857 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12858 operands[14] = force_const_mem (DFmode,
12859 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12863 operands[13] = gen_const_mem (DFmode,
12864 create_TOC_reference (XEXP (operands[13], 0)));
12865 operands[14] = gen_const_mem (DFmode,
12866 create_TOC_reference (XEXP (operands[14], 0)));
12867 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12868 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12872 ;; Now we have the scc insns. We can do some combinations because of the
12873 ;; way the machine works.
12875 ;; Note that this is probably faster if we can put an insn between the
12876 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12877 ;; cases the insns below which don't use an intermediate CR field will
12878 ;; be used instead.
12880 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12881 (match_operator:SI 1 "scc_comparison_operator"
12882 [(match_operand 2 "cc_reg_operand" "y")
12885 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12886 [(set (attr "type")
12887 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12888 (const_string "mfcrf")
12890 (const_string "mfcr")))
12891 (set_attr "length" "8")])
12893 ;; Same as above, but get the GT bit.
12894 (define_insn "move_from_CR_gt_bit"
12895 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12896 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12897 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12898 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12899 [(set_attr "type" "mfcr")
12900 (set_attr "length" "8")])
12902 ;; Same as above, but get the OV/ORDERED bit.
12903 (define_insn "move_from_CR_ov_bit"
12904 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12905 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12907 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12908 [(set_attr "type" "mfcr")
12909 (set_attr "length" "8")])
12912 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12913 (match_operator:DI 1 "scc_comparison_operator"
12914 [(match_operand 2 "cc_reg_operand" "y")
12917 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12918 [(set (attr "type")
12919 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12920 (const_string "mfcrf")
12922 (const_string "mfcr")))
12923 (set_attr "length" "8")])
12926 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12927 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12928 [(match_operand 2 "cc_reg_operand" "y,y")
12931 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12932 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12935 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12937 [(set_attr "type" "delayed_compare")
12938 (set_attr "length" "8,16")])
12941 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12942 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12943 [(match_operand 2 "cc_reg_operand" "")
12946 (set (match_operand:SI 3 "gpc_reg_operand" "")
12947 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12948 "TARGET_32BIT && reload_completed"
12949 [(set (match_dup 3)
12950 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12952 (compare:CC (match_dup 3)
12957 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12958 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12959 [(match_operand 2 "cc_reg_operand" "y")
12961 (match_operand:SI 3 "const_int_operand" "n")))]
12965 int is_bit = ccr_bit (operands[1], 1);
12966 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12969 if (is_bit >= put_bit)
12970 count = is_bit - put_bit;
12972 count = 32 - (put_bit - is_bit);
12974 operands[4] = GEN_INT (count);
12975 operands[5] = GEN_INT (put_bit);
12977 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12979 [(set (attr "type")
12980 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12981 (const_string "mfcrf")
12983 (const_string "mfcr")))
12984 (set_attr "length" "8")])
12987 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12989 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12990 [(match_operand 2 "cc_reg_operand" "y,y")
12992 (match_operand:SI 3 "const_int_operand" "n,n"))
12994 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12995 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13000 int is_bit = ccr_bit (operands[1], 1);
13001 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13004 /* Force split for non-cc0 compare. */
13005 if (which_alternative == 1)
13008 if (is_bit >= put_bit)
13009 count = is_bit - put_bit;
13011 count = 32 - (put_bit - is_bit);
13013 operands[5] = GEN_INT (count);
13014 operands[6] = GEN_INT (put_bit);
13016 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13018 [(set_attr "type" "delayed_compare")
13019 (set_attr "length" "8,16")])
13022 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13024 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13025 [(match_operand 2 "cc_reg_operand" "")
13027 (match_operand:SI 3 "const_int_operand" ""))
13029 (set (match_operand:SI 4 "gpc_reg_operand" "")
13030 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13033 [(set (match_dup 4)
13034 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13037 (compare:CC (match_dup 4)
13041 ;; There is a 3 cycle delay between consecutive mfcr instructions
13042 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13045 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13046 (match_operator:SI 1 "scc_comparison_operator"
13047 [(match_operand 2 "cc_reg_operand" "y")
13049 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13050 (match_operator:SI 4 "scc_comparison_operator"
13051 [(match_operand 5 "cc_reg_operand" "y")
13053 "REGNO (operands[2]) != REGNO (operands[5])"
13054 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13055 [(set_attr "type" "mfcr")
13056 (set_attr "length" "12")])
13059 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13060 (match_operator:DI 1 "scc_comparison_operator"
13061 [(match_operand 2 "cc_reg_operand" "y")
13063 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13064 (match_operator:DI 4 "scc_comparison_operator"
13065 [(match_operand 5 "cc_reg_operand" "y")
13067 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13068 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13069 [(set_attr "type" "mfcr")
13070 (set_attr "length" "12")])
13072 ;; There are some scc insns that can be done directly, without a compare.
13073 ;; These are faster because they don't involve the communications between
13074 ;; the FXU and branch units. In fact, we will be replacing all of the
13075 ;; integer scc insns here or in the portable methods in emit_store_flag.
13077 ;; Also support (neg (scc ..)) since that construct is used to replace
13078 ;; branches, (plus (scc ..) ..) since that construct is common and
13079 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13080 ;; cases where it is no more expensive than (neg (scc ..)).
13082 ;; Have reload force a constant into a register for the simple insns that
13083 ;; otherwise won't accept constants. We do this because it is faster than
13084 ;; the cmp/mfcr sequence we would otherwise generate.
13086 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13089 (define_insn_and_split "*eq<mode>"
13090 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13091 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13092 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13096 [(set (match_dup 0)
13097 (clz:GPR (match_dup 3)))
13099 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13101 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13103 /* Use output operand as intermediate. */
13104 operands[3] = operands[0];
13106 if (logical_operand (operands[2], <MODE>mode))
13107 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13108 gen_rtx_XOR (<MODE>mode,
13109 operands[1], operands[2])));
13111 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13112 gen_rtx_PLUS (<MODE>mode, operands[1],
13113 negate_rtx (<MODE>mode,
13117 operands[3] = operands[1];
13119 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13122 (define_insn_and_split "*eq<mode>_compare"
13123 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13125 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13126 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13128 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13129 (eq:P (match_dup 1) (match_dup 2)))]
13130 "!TARGET_POWER && optimize_size"
13132 "!TARGET_POWER && optimize_size"
13133 [(set (match_dup 0)
13134 (clz:P (match_dup 4)))
13135 (parallel [(set (match_dup 3)
13136 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13139 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13141 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13143 /* Use output operand as intermediate. */
13144 operands[4] = operands[0];
13146 if (logical_operand (operands[2], <MODE>mode))
13147 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13148 gen_rtx_XOR (<MODE>mode,
13149 operands[1], operands[2])));
13151 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13152 gen_rtx_PLUS (<MODE>mode, operands[1],
13153 negate_rtx (<MODE>mode,
13157 operands[4] = operands[1];
13159 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13162 (define_insn "*eqsi_power"
13163 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13164 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13165 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13166 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13169 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13170 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13171 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13172 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13173 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13174 [(set_attr "type" "three,two,three,three,three")
13175 (set_attr "length" "12,8,12,12,12")])
13177 ;; We have insns of the form shown by the first define_insn below. If
13178 ;; there is something inside the comparison operation, we must split it.
13180 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13181 (plus:SI (match_operator 1 "comparison_operator"
13182 [(match_operand:SI 2 "" "")
13183 (match_operand:SI 3
13184 "reg_or_cint_operand" "")])
13185 (match_operand:SI 4 "gpc_reg_operand" "")))
13186 (clobber (match_operand:SI 5 "register_operand" ""))]
13187 "! gpc_reg_operand (operands[2], SImode)"
13188 [(set (match_dup 5) (match_dup 2))
13189 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13192 (define_insn "*plus_eqsi"
13193 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13194 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13195 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13196 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13199 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13200 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13201 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13202 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13203 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13204 [(set_attr "type" "three,two,three,three,three")
13205 (set_attr "length" "12,8,12,12,12")])
13207 (define_insn "*compare_plus_eqsi"
13208 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13211 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13212 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13213 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13215 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13216 "TARGET_32BIT && optimize_size"
13218 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13219 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13220 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13221 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13222 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13228 [(set_attr "type" "compare")
13229 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13232 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13235 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13236 (match_operand:SI 2 "scc_eq_operand" ""))
13237 (match_operand:SI 3 "gpc_reg_operand" ""))
13239 (clobber (match_scratch:SI 4 ""))]
13240 "TARGET_32BIT && optimize_size && reload_completed"
13241 [(set (match_dup 4)
13242 (plus:SI (eq:SI (match_dup 1)
13246 (compare:CC (match_dup 4)
13250 (define_insn "*plus_eqsi_compare"
13251 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13254 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13255 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13256 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13258 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13259 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13260 "TARGET_32BIT && optimize_size"
13262 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13263 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13264 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13265 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13266 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13272 [(set_attr "type" "compare")
13273 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13276 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13279 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13280 (match_operand:SI 2 "scc_eq_operand" ""))
13281 (match_operand:SI 3 "gpc_reg_operand" ""))
13283 (set (match_operand:SI 0 "gpc_reg_operand" "")
13284 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13285 "TARGET_32BIT && optimize_size && reload_completed"
13286 [(set (match_dup 0)
13287 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13289 (compare:CC (match_dup 0)
13293 (define_insn "*neg_eq0<mode>"
13294 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13295 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13298 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13299 [(set_attr "type" "two")
13300 (set_attr "length" "8")])
13302 (define_insn_and_split "*neg_eq<mode>"
13303 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13304 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13305 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13309 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13311 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13313 /* Use output operand as intermediate. */
13314 operands[3] = operands[0];
13316 if (logical_operand (operands[2], <MODE>mode))
13317 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13318 gen_rtx_XOR (<MODE>mode,
13319 operands[1], operands[2])));
13321 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13322 gen_rtx_PLUS (<MODE>mode, operands[1],
13323 negate_rtx (<MODE>mode,
13327 operands[3] = operands[1];
13330 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13331 ;; since it nabs/sr is just as fast.
13332 (define_insn "*ne0si"
13333 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13334 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13336 (clobber (match_scratch:SI 2 "=&r"))]
13337 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13338 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13339 [(set_attr "type" "two")
13340 (set_attr "length" "8")])
13342 (define_insn "*ne0di"
13343 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13344 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13346 (clobber (match_scratch:DI 2 "=&r"))]
13348 "addic %2,%1,-1\;subfe %0,%2,%1"
13349 [(set_attr "type" "two")
13350 (set_attr "length" "8")])
13352 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13353 (define_insn "*plus_ne0si"
13354 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13355 (plus:SI (lshiftrt:SI
13356 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13358 (match_operand:SI 2 "gpc_reg_operand" "r")))
13359 (clobber (match_scratch:SI 3 "=&r"))]
13361 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13362 [(set_attr "type" "two")
13363 (set_attr "length" "8")])
13365 (define_insn "*plus_ne0di"
13366 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13367 (plus:DI (lshiftrt:DI
13368 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13370 (match_operand:DI 2 "gpc_reg_operand" "r")))
13371 (clobber (match_scratch:DI 3 "=&r"))]
13373 "addic %3,%1,-1\;addze %0,%2"
13374 [(set_attr "type" "two")
13375 (set_attr "length" "8")])
13377 (define_insn "*compare_plus_ne0si"
13378 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13380 (plus:SI (lshiftrt:SI
13381 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13383 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13385 (clobber (match_scratch:SI 3 "=&r,&r"))
13386 (clobber (match_scratch:SI 4 "=X,&r"))]
13389 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13391 [(set_attr "type" "compare")
13392 (set_attr "length" "8,12")])
13395 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13397 (plus:SI (lshiftrt:SI
13398 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13400 (match_operand:SI 2 "gpc_reg_operand" ""))
13402 (clobber (match_scratch:SI 3 ""))
13403 (clobber (match_scratch:SI 4 ""))]
13404 "TARGET_32BIT && reload_completed"
13405 [(parallel [(set (match_dup 3)
13406 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
13409 (clobber (match_dup 4))])
13411 (compare:CC (match_dup 3)
13415 (define_insn "*compare_plus_ne0di"
13416 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13418 (plus:DI (lshiftrt:DI
13419 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13421 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13423 (clobber (match_scratch:DI 3 "=&r,&r"))]
13426 addic %3,%1,-1\;addze. %3,%2
13428 [(set_attr "type" "compare")
13429 (set_attr "length" "8,12")])
13432 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13434 (plus:DI (lshiftrt:DI
13435 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13437 (match_operand:DI 2 "gpc_reg_operand" ""))
13439 (clobber (match_scratch:DI 3 ""))]
13440 "TARGET_64BIT && reload_completed"
13441 [(set (match_dup 3)
13442 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
13446 (compare:CC (match_dup 3)
13450 (define_insn "*plus_ne0si_compare"
13451 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13453 (plus:SI (lshiftrt:SI
13454 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13456 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13458 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13459 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13461 (clobber (match_scratch:SI 3 "=&r,&r"))]
13464 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
13466 [(set_attr "type" "compare")
13467 (set_attr "length" "8,12")])
13470 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13472 (plus:SI (lshiftrt:SI
13473 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13475 (match_operand:SI 2 "gpc_reg_operand" ""))
13477 (set (match_operand:SI 0 "gpc_reg_operand" "")
13478 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13480 (clobber (match_scratch:SI 3 ""))]
13481 "TARGET_32BIT && reload_completed"
13482 [(parallel [(set (match_dup 0)
13483 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13485 (clobber (match_dup 3))])
13487 (compare:CC (match_dup 0)
13491 (define_insn "*plus_ne0di_compare"
13492 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13494 (plus:DI (lshiftrt:DI
13495 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13497 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13499 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13500 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13502 (clobber (match_scratch:DI 3 "=&r,&r"))]
13505 addic %3,%1,-1\;addze. %0,%2
13507 [(set_attr "type" "compare")
13508 (set_attr "length" "8,12")])
13511 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13513 (plus:DI (lshiftrt:DI
13514 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13516 (match_operand:DI 2 "gpc_reg_operand" ""))
13518 (set (match_operand:DI 0 "gpc_reg_operand" "")
13519 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13521 (clobber (match_scratch:DI 3 ""))]
13522 "TARGET_64BIT && reload_completed"
13523 [(parallel [(set (match_dup 0)
13524 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13526 (clobber (match_dup 3))])
13528 (compare:CC (match_dup 0)
13533 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13534 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13535 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
13536 (clobber (match_scratch:SI 3 "=r,X"))]
13539 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
13540 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
13541 [(set_attr "length" "12")])
13544 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13546 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13547 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13549 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
13550 (le:SI (match_dup 1) (match_dup 2)))
13551 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
13554 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13555 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
13558 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
13559 (set_attr "length" "12,12,16,16")])
13562 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13564 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13565 (match_operand:SI 2 "reg_or_short_operand" ""))
13567 (set (match_operand:SI 0 "gpc_reg_operand" "")
13568 (le:SI (match_dup 1) (match_dup 2)))
13569 (clobber (match_scratch:SI 3 ""))]
13570 "TARGET_POWER && reload_completed"
13571 [(parallel [(set (match_dup 0)
13572 (le:SI (match_dup 1) (match_dup 2)))
13573 (clobber (match_dup 3))])
13575 (compare:CC (match_dup 0)
13580 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13581 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13582 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
13583 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13586 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13587 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
13588 [(set_attr "length" "12")])
13591 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13593 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13594 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13595 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13597 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13600 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13601 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
13604 [(set_attr "type" "compare")
13605 (set_attr "length" "12,12,16,16")])
13608 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13610 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13611 (match_operand:SI 2 "reg_or_short_operand" ""))
13612 (match_operand:SI 3 "gpc_reg_operand" ""))
13614 (clobber (match_scratch:SI 4 ""))]
13615 "TARGET_POWER && reload_completed"
13616 [(set (match_dup 4)
13617 (plus:SI (le:SI (match_dup 1) (match_dup 2))
13620 (compare:CC (match_dup 4)
13625 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13627 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13628 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13629 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13631 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13632 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13635 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13636 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
13639 [(set_attr "type" "compare")
13640 (set_attr "length" "12,12,16,16")])
13643 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13645 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13646 (match_operand:SI 2 "reg_or_short_operand" ""))
13647 (match_operand:SI 3 "gpc_reg_operand" ""))
13649 (set (match_operand:SI 0 "gpc_reg_operand" "")
13650 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13651 "TARGET_POWER && reload_completed"
13652 [(set (match_dup 0)
13653 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13655 (compare:CC (match_dup 0)
13660 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13661 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13662 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
13665 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
13666 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
13667 [(set_attr "length" "12")])
13669 (define_insn "*leu<mode>"
13670 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13671 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13672 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13674 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13675 [(set_attr "type" "three")
13676 (set_attr "length" "12")])
13678 (define_insn "*leu<mode>_compare"
13679 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13681 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13682 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13684 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13685 (leu:P (match_dup 1) (match_dup 2)))]
13688 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13690 [(set_attr "type" "compare")
13691 (set_attr "length" "12,16")])
13694 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13696 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13697 (match_operand:P 2 "reg_or_short_operand" ""))
13699 (set (match_operand:P 0 "gpc_reg_operand" "")
13700 (leu:P (match_dup 1) (match_dup 2)))]
13702 [(set (match_dup 0)
13703 (leu:P (match_dup 1) (match_dup 2)))
13705 (compare:CC (match_dup 0)
13709 (define_insn "*plus_leu<mode>"
13710 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13711 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13712 (match_operand:P 2 "reg_or_short_operand" "rI"))
13713 (match_operand:P 3 "gpc_reg_operand" "r")))]
13715 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
13716 [(set_attr "type" "two")
13717 (set_attr "length" "8")])
13720 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13722 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13723 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13724 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13726 (clobber (match_scratch:SI 4 "=&r,&r"))]
13729 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
13731 [(set_attr "type" "compare")
13732 (set_attr "length" "8,12")])
13735 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13737 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13738 (match_operand:SI 2 "reg_or_short_operand" ""))
13739 (match_operand:SI 3 "gpc_reg_operand" ""))
13741 (clobber (match_scratch:SI 4 ""))]
13742 "TARGET_32BIT && reload_completed"
13743 [(set (match_dup 4)
13744 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13747 (compare:CC (match_dup 4)
13752 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13754 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13755 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13756 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13758 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13759 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13762 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
13764 [(set_attr "type" "compare")
13765 (set_attr "length" "8,12")])
13768 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13770 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13771 (match_operand:SI 2 "reg_or_short_operand" ""))
13772 (match_operand:SI 3 "gpc_reg_operand" ""))
13774 (set (match_operand:SI 0 "gpc_reg_operand" "")
13775 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13776 "TARGET_32BIT && reload_completed"
13777 [(set (match_dup 0)
13778 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13780 (compare:CC (match_dup 0)
13784 (define_insn "*neg_leu<mode>"
13785 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13786 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13787 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13789 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
13790 [(set_attr "type" "three")
13791 (set_attr "length" "12")])
13793 (define_insn "*and_neg_leu<mode>"
13794 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13796 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13797 (match_operand:P 2 "reg_or_short_operand" "rI")))
13798 (match_operand:P 3 "gpc_reg_operand" "r")))]
13800 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13801 [(set_attr "type" "three")
13802 (set_attr "length" "12")])
13805 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13808 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13809 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13810 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13812 (clobber (match_scratch:SI 4 "=&r,&r"))]
13815 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13817 [(set_attr "type" "compare")
13818 (set_attr "length" "12,16")])
13821 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13824 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13825 (match_operand:SI 2 "reg_or_short_operand" "")))
13826 (match_operand:SI 3 "gpc_reg_operand" ""))
13828 (clobber (match_scratch:SI 4 ""))]
13829 "TARGET_32BIT && reload_completed"
13830 [(set (match_dup 4)
13831 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13834 (compare:CC (match_dup 4)
13839 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13842 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13843 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13844 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13846 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13847 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13850 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13852 [(set_attr "type" "compare")
13853 (set_attr "length" "12,16")])
13856 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13859 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13860 (match_operand:SI 2 "reg_or_short_operand" "")))
13861 (match_operand:SI 3 "gpc_reg_operand" ""))
13863 (set (match_operand:SI 0 "gpc_reg_operand" "")
13864 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13865 "TARGET_32BIT && reload_completed"
13866 [(set (match_dup 0)
13867 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13870 (compare:CC (match_dup 0)
13875 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13876 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13877 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13879 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13880 [(set_attr "length" "12")])
13883 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13885 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13886 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13888 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13889 (lt:SI (match_dup 1) (match_dup 2)))]
13892 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13894 [(set_attr "type" "delayed_compare")
13895 (set_attr "length" "12,16")])
13898 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13900 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13901 (match_operand:SI 2 "reg_or_short_operand" ""))
13903 (set (match_operand:SI 0 "gpc_reg_operand" "")
13904 (lt:SI (match_dup 1) (match_dup 2)))]
13905 "TARGET_POWER && reload_completed"
13906 [(set (match_dup 0)
13907 (lt:SI (match_dup 1) (match_dup 2)))
13909 (compare:CC (match_dup 0)
13914 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13915 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13916 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13917 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13919 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13920 [(set_attr "length" "12")])
13923 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13925 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13926 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13927 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13929 (clobber (match_scratch:SI 4 "=&r,&r"))]
13932 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13934 [(set_attr "type" "compare")
13935 (set_attr "length" "12,16")])
13938 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13940 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13941 (match_operand:SI 2 "reg_or_short_operand" ""))
13942 (match_operand:SI 3 "gpc_reg_operand" ""))
13944 (clobber (match_scratch:SI 4 ""))]
13945 "TARGET_POWER && reload_completed"
13946 [(set (match_dup 4)
13947 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13950 (compare:CC (match_dup 4)
13955 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13957 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13958 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13959 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13961 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13962 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13965 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13967 [(set_attr "type" "compare")
13968 (set_attr "length" "12,16")])
13971 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13973 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13974 (match_operand:SI 2 "reg_or_short_operand" ""))
13975 (match_operand:SI 3 "gpc_reg_operand" ""))
13977 (set (match_operand:SI 0 "gpc_reg_operand" "")
13978 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13979 "TARGET_POWER && reload_completed"
13980 [(set (match_dup 0)
13981 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13983 (compare:CC (match_dup 0)
13988 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13989 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13990 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13992 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13993 [(set_attr "length" "12")])
13995 (define_insn_and_split "*ltu<mode>"
13996 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13997 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13998 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14002 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14003 (set (match_dup 0) (neg:P (match_dup 0)))]
14006 (define_insn_and_split "*ltu<mode>_compare"
14007 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14009 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14010 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14012 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14013 (ltu:P (match_dup 1) (match_dup 2)))]
14017 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14018 (parallel [(set (match_dup 3)
14019 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14020 (set (match_dup 0) (neg:P (match_dup 0)))])]
14023 (define_insn_and_split "*plus_ltu<mode>"
14024 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14025 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14026 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14027 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14030 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14031 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14032 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14035 (define_insn_and_split "*plus_ltu<mode>_compare"
14036 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14038 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14039 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14040 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14042 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14043 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14046 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14047 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14048 (parallel [(set (match_dup 4)
14049 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14051 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14054 (define_insn "*neg_ltu<mode>"
14055 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14056 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14057 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14060 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14061 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14062 [(set_attr "type" "two")
14063 (set_attr "length" "8")])
14066 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14067 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14068 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14069 (clobber (match_scratch:SI 3 "=r"))]
14071 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14072 [(set_attr "length" "12")])
14075 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14077 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14078 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14080 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14081 (ge:SI (match_dup 1) (match_dup 2)))
14082 (clobber (match_scratch:SI 3 "=r,r"))]
14085 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14087 [(set_attr "type" "compare")
14088 (set_attr "length" "12,16")])
14091 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14093 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14094 (match_operand:SI 2 "reg_or_short_operand" ""))
14096 (set (match_operand:SI 0 "gpc_reg_operand" "")
14097 (ge:SI (match_dup 1) (match_dup 2)))
14098 (clobber (match_scratch:SI 3 ""))]
14099 "TARGET_POWER && reload_completed"
14100 [(parallel [(set (match_dup 0)
14101 (ge:SI (match_dup 1) (match_dup 2)))
14102 (clobber (match_dup 3))])
14104 (compare:CC (match_dup 0)
14109 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14110 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14111 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14112 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14114 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14115 [(set_attr "length" "12")])
14118 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14120 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14121 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14122 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14124 (clobber (match_scratch:SI 4 "=&r,&r"))]
14127 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14129 [(set_attr "type" "compare")
14130 (set_attr "length" "12,16")])
14133 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14135 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14136 (match_operand:SI 2 "reg_or_short_operand" ""))
14137 (match_operand:SI 3 "gpc_reg_operand" ""))
14139 (clobber (match_scratch:SI 4 ""))]
14140 "TARGET_POWER && reload_completed"
14141 [(set (match_dup 4)
14142 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14145 (compare:CC (match_dup 4)
14150 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14152 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14153 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14154 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14156 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14157 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14160 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14162 [(set_attr "type" "compare")
14163 (set_attr "length" "12,16")])
14166 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14168 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14169 (match_operand:SI 2 "reg_or_short_operand" ""))
14170 (match_operand:SI 3 "gpc_reg_operand" ""))
14172 (set (match_operand:SI 0 "gpc_reg_operand" "")
14173 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14174 "TARGET_POWER && reload_completed"
14175 [(set (match_dup 0)
14176 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14178 (compare:CC (match_dup 0)
14183 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14184 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14185 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14187 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14188 [(set_attr "length" "12")])
14190 (define_insn "*geu<mode>"
14191 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14192 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14193 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14196 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14197 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14198 [(set_attr "type" "three")
14199 (set_attr "length" "12")])
14201 (define_insn "*geu<mode>_compare"
14202 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14204 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14205 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14207 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14208 (geu:P (match_dup 1) (match_dup 2)))]
14211 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14212 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14215 [(set_attr "type" "compare")
14216 (set_attr "length" "12,12,16,16")])
14219 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14221 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14222 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14224 (set (match_operand:P 0 "gpc_reg_operand" "")
14225 (geu:P (match_dup 1) (match_dup 2)))]
14227 [(set (match_dup 0)
14228 (geu:P (match_dup 1) (match_dup 2)))
14230 (compare:CC (match_dup 0)
14234 (define_insn "*plus_geu<mode>"
14235 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14236 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14237 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14238 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14241 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14242 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14243 [(set_attr "type" "two")
14244 (set_attr "length" "8")])
14247 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14249 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14250 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14251 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14253 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14256 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14257 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14260 [(set_attr "type" "compare")
14261 (set_attr "length" "8,8,12,12")])
14264 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14266 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14267 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14268 (match_operand:SI 3 "gpc_reg_operand" ""))
14270 (clobber (match_scratch:SI 4 ""))]
14271 "TARGET_32BIT && reload_completed"
14272 [(set (match_dup 4)
14273 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14276 (compare:CC (match_dup 4)
14281 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14283 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14284 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14285 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14287 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14288 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14291 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14292 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14295 [(set_attr "type" "compare")
14296 (set_attr "length" "8,8,12,12")])
14299 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14301 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14302 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14303 (match_operand:SI 3 "gpc_reg_operand" ""))
14305 (set (match_operand:SI 0 "gpc_reg_operand" "")
14306 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14307 "TARGET_32BIT && reload_completed"
14308 [(set (match_dup 0)
14309 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14311 (compare:CC (match_dup 0)
14315 (define_insn "*neg_geu<mode>"
14316 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14317 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14318 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14321 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14322 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14323 [(set_attr "type" "three")
14324 (set_attr "length" "12")])
14326 (define_insn "*and_neg_geu<mode>"
14327 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14329 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14330 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14331 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14334 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14335 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14336 [(set_attr "type" "three")
14337 (set_attr "length" "12")])
14340 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14343 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14344 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14345 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14347 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14350 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14351 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14354 [(set_attr "type" "compare")
14355 (set_attr "length" "12,12,16,16")])
14358 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14361 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14362 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14363 (match_operand:SI 3 "gpc_reg_operand" ""))
14365 (clobber (match_scratch:SI 4 ""))]
14366 "TARGET_32BIT && reload_completed"
14367 [(set (match_dup 4)
14368 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14371 (compare:CC (match_dup 4)
14376 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14379 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14380 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14381 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14383 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14384 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14387 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14388 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14391 [(set_attr "type" "compare")
14392 (set_attr "length" "12,12,16,16")])
14395 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14398 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14399 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14400 (match_operand:SI 3 "gpc_reg_operand" ""))
14402 (set (match_operand:SI 0 "gpc_reg_operand" "")
14403 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14404 "TARGET_32BIT && reload_completed"
14405 [(set (match_dup 0)
14406 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14408 (compare:CC (match_dup 0)
14413 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14414 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14415 (match_operand:SI 2 "reg_or_short_operand" "r")))]
14417 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14418 [(set_attr "length" "12")])
14421 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14423 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14424 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14426 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14427 (gt:SI (match_dup 1) (match_dup 2)))]
14430 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14432 [(set_attr "type" "delayed_compare")
14433 (set_attr "length" "12,16")])
14436 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14438 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14439 (match_operand:SI 2 "reg_or_short_operand" ""))
14441 (set (match_operand:SI 0 "gpc_reg_operand" "")
14442 (gt:SI (match_dup 1) (match_dup 2)))]
14443 "TARGET_POWER && reload_completed"
14444 [(set (match_dup 0)
14445 (gt:SI (match_dup 1) (match_dup 2)))
14447 (compare:CC (match_dup 0)
14451 (define_insn "*plus_gt0<mode>"
14452 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14453 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14455 (match_operand:P 2 "gpc_reg_operand" "r")))]
14457 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
14458 [(set_attr "type" "three")
14459 (set_attr "length" "12")])
14462 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14464 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14466 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14468 (clobber (match_scratch:SI 3 "=&r,&r"))]
14471 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
14473 [(set_attr "type" "compare")
14474 (set_attr "length" "12,16")])
14477 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14479 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14481 (match_operand:SI 2 "gpc_reg_operand" ""))
14483 (clobber (match_scratch:SI 3 ""))]
14484 "TARGET_32BIT && reload_completed"
14485 [(set (match_dup 3)
14486 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14489 (compare:CC (match_dup 3)
14494 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14496 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14498 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14500 (clobber (match_scratch:DI 3 "=&r,&r"))]
14503 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14505 [(set_attr "type" "compare")
14506 (set_attr "length" "12,16")])
14509 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14511 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14513 (match_operand:DI 2 "gpc_reg_operand" ""))
14515 (clobber (match_scratch:DI 3 ""))]
14516 "TARGET_64BIT && reload_completed"
14517 [(set (match_dup 3)
14518 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14521 (compare:CC (match_dup 3)
14526 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14528 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14530 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14532 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14533 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14536 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
14538 [(set_attr "type" "compare")
14539 (set_attr "length" "12,16")])
14542 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14544 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14546 (match_operand:SI 2 "gpc_reg_operand" ""))
14548 (set (match_operand:SI 0 "gpc_reg_operand" "")
14549 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14550 "TARGET_32BIT && reload_completed"
14551 [(set (match_dup 0)
14552 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14554 (compare:CC (match_dup 0)
14559 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14561 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14563 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14565 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14566 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14569 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14571 [(set_attr "type" "compare")
14572 (set_attr "length" "12,16")])
14575 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14577 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14579 (match_operand:DI 2 "gpc_reg_operand" ""))
14581 (set (match_operand:DI 0 "gpc_reg_operand" "")
14582 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14583 "TARGET_64BIT && reload_completed"
14584 [(set (match_dup 0)
14585 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14587 (compare:CC (match_dup 0)
14592 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14593 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14594 (match_operand:SI 2 "reg_or_short_operand" "r"))
14595 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14597 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14598 [(set_attr "length" "12")])
14601 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14603 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14604 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14605 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14607 (clobber (match_scratch:SI 4 "=&r,&r"))]
14610 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14612 [(set_attr "type" "compare")
14613 (set_attr "length" "12,16")])
14616 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14618 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14619 (match_operand:SI 2 "reg_or_short_operand" ""))
14620 (match_operand:SI 3 "gpc_reg_operand" ""))
14622 (clobber (match_scratch:SI 4 ""))]
14623 "TARGET_POWER && reload_completed"
14624 [(set (match_dup 4)
14625 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14627 (compare:CC (match_dup 4)
14632 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14634 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14635 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14636 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14638 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14639 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14642 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14644 [(set_attr "type" "compare")
14645 (set_attr "length" "12,16")])
14648 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14650 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14651 (match_operand:SI 2 "reg_or_short_operand" ""))
14652 (match_operand:SI 3 "gpc_reg_operand" ""))
14654 (set (match_operand:SI 0 "gpc_reg_operand" "")
14655 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14656 "TARGET_POWER && reload_completed"
14657 [(set (match_dup 0)
14658 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14660 (compare:CC (match_dup 0)
14665 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14666 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14667 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
14669 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14670 [(set_attr "length" "12")])
14672 (define_insn_and_split "*gtu<mode>"
14673 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14674 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14675 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14679 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14680 (set (match_dup 0) (neg:P (match_dup 0)))]
14683 (define_insn_and_split "*gtu<mode>_compare"
14684 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14686 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14687 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14689 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14690 (gtu:P (match_dup 1) (match_dup 2)))]
14694 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14695 (parallel [(set (match_dup 3)
14696 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14697 (set (match_dup 0) (neg:P (match_dup 0)))])]
14700 (define_insn_and_split "*plus_gtu<mode>"
14701 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14702 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14703 (match_operand:P 2 "reg_or_short_operand" "rI"))
14704 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14707 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14708 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14709 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14712 (define_insn_and_split "*plus_gtu<mode>_compare"
14713 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14715 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14716 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14717 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14719 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14720 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14723 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14724 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14725 (parallel [(set (match_dup 4)
14726 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14728 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14731 (define_insn "*neg_gtu<mode>"
14732 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14733 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14734 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14736 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
14737 [(set_attr "type" "two")
14738 (set_attr "length" "8")])
14741 ;; Define both directions of branch and return. If we need a reload
14742 ;; register, we'd rather use CR0 since it is much easier to copy a
14743 ;; register CC value to there.
14747 (if_then_else (match_operator 1 "branch_comparison_operator"
14749 "cc_reg_operand" "y")
14751 (label_ref (match_operand 0 "" ""))
14756 return output_cbranch (operands[1], \"%l0\", 0, insn);
14758 [(set_attr "type" "branch")])
14762 (if_then_else (match_operator 0 "branch_comparison_operator"
14764 "cc_reg_operand" "y")
14771 return output_cbranch (operands[0], NULL, 0, insn);
14773 [(set_attr "type" "jmpreg")
14774 (set_attr "length" "4")])
14778 (if_then_else (match_operator 1 "branch_comparison_operator"
14780 "cc_reg_operand" "y")
14783 (label_ref (match_operand 0 "" ""))))]
14787 return output_cbranch (operands[1], \"%l0\", 1, insn);
14789 [(set_attr "type" "branch")])
14793 (if_then_else (match_operator 0 "branch_comparison_operator"
14795 "cc_reg_operand" "y")
14802 return output_cbranch (operands[0], NULL, 1, insn);
14804 [(set_attr "type" "jmpreg")
14805 (set_attr "length" "4")])
14807 ;; Logic on condition register values.
14809 ; This pattern matches things like
14810 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14811 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14813 ; which are generated by the branch logic.
14814 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14816 (define_insn "*cceq_ior_compare"
14817 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14818 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14819 [(match_operator:SI 2
14820 "branch_positive_comparison_operator"
14822 "cc_reg_operand" "y,y")
14824 (match_operator:SI 4
14825 "branch_positive_comparison_operator"
14827 "cc_reg_operand" "0,y")
14831 "cr%q1 %E0,%j2,%j4"
14832 [(set_attr "type" "cr_logical,delayed_cr")])
14834 ; Why is the constant -1 here, but 1 in the previous pattern?
14835 ; Because ~1 has all but the low bit set.
14837 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14838 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14839 [(not:SI (match_operator:SI 2
14840 "branch_positive_comparison_operator"
14842 "cc_reg_operand" "y,y")
14844 (match_operator:SI 4
14845 "branch_positive_comparison_operator"
14847 "cc_reg_operand" "0,y")
14851 "cr%q1 %E0,%j2,%j4"
14852 [(set_attr "type" "cr_logical,delayed_cr")])
14854 (define_insn "*cceq_rev_compare"
14855 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14856 (compare:CCEQ (match_operator:SI 1
14857 "branch_positive_comparison_operator"
14859 "cc_reg_operand" "0,y")
14863 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14864 [(set_attr "type" "cr_logical,delayed_cr")])
14866 ;; If we are comparing the result of two comparisons, this can be done
14867 ;; using creqv or crxor.
14869 (define_insn_and_split ""
14870 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14871 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14872 [(match_operand 2 "cc_reg_operand" "y")
14874 (match_operator 3 "branch_comparison_operator"
14875 [(match_operand 4 "cc_reg_operand" "y")
14880 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14884 int positive_1, positive_2;
14886 positive_1 = branch_positive_comparison_operator (operands[1],
14887 GET_MODE (operands[1]));
14888 positive_2 = branch_positive_comparison_operator (operands[3],
14889 GET_MODE (operands[3]));
14892 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14893 GET_CODE (operands[1])),
14895 operands[2], const0_rtx);
14896 else if (GET_MODE (operands[1]) != SImode)
14897 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14898 operands[2], const0_rtx);
14901 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14902 GET_CODE (operands[3])),
14904 operands[4], const0_rtx);
14905 else if (GET_MODE (operands[3]) != SImode)
14906 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14907 operands[4], const0_rtx);
14909 if (positive_1 == positive_2)
14911 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14912 operands[5] = constm1_rtx;
14916 operands[5] = const1_rtx;
14920 ;; Unconditional branch and return.
14922 (define_insn "jump"
14924 (label_ref (match_operand 0 "" "")))]
14927 [(set_attr "type" "branch")])
14929 (define_insn "return"
14933 [(set_attr "type" "jmpreg")])
14935 (define_expand "indirect_jump"
14936 [(set (pc) (match_operand 0 "register_operand" ""))])
14938 (define_insn "*indirect_jump<mode>"
14939 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14944 [(set_attr "type" "jmpreg")])
14946 ;; Table jump for switch statements:
14947 (define_expand "tablejump"
14948 [(use (match_operand 0 "" ""))
14949 (use (label_ref (match_operand 1 "" "")))]
14954 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14956 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14960 (define_expand "tablejumpsi"
14961 [(set (match_dup 3)
14962 (plus:SI (match_operand:SI 0 "" "")
14964 (parallel [(set (pc) (match_dup 3))
14965 (use (label_ref (match_operand 1 "" "")))])]
14968 { operands[0] = force_reg (SImode, operands[0]);
14969 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14970 operands[3] = gen_reg_rtx (SImode);
14973 (define_expand "tablejumpdi"
14974 [(set (match_dup 4)
14975 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14977 (plus:DI (match_dup 4)
14979 (parallel [(set (pc) (match_dup 3))
14980 (use (label_ref (match_operand 1 "" "")))])]
14983 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14984 operands[3] = gen_reg_rtx (DImode);
14985 operands[4] = gen_reg_rtx (DImode);
14988 (define_insn "*tablejump<mode>_internal1"
14990 (match_operand:P 0 "register_operand" "c,*l"))
14991 (use (label_ref (match_operand 1 "" "")))]
14996 [(set_attr "type" "jmpreg")])
15001 "{cror 0,0,0|nop}")
15003 ;; Define the subtract-one-and-jump insns, starting with the template
15004 ;; so loop.c knows what to generate.
15006 (define_expand "doloop_end"
15007 [(use (match_operand 0 "" "")) ; loop pseudo
15008 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15009 (use (match_operand 2 "" "")) ; max iterations
15010 (use (match_operand 3 "" "")) ; loop level
15011 (use (match_operand 4 "" ""))] ; label
15015 /* Only use this on innermost loops. */
15016 if (INTVAL (operands[3]) > 1)
15020 if (GET_MODE (operands[0]) != DImode)
15022 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15026 if (GET_MODE (operands[0]) != SImode)
15028 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15033 (define_expand "ctr<mode>"
15034 [(parallel [(set (pc)
15035 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15037 (label_ref (match_operand 1 "" ""))
15040 (plus:P (match_dup 0)
15042 (clobber (match_scratch:CC 2 ""))
15043 (clobber (match_scratch:P 3 ""))])]
15047 ;; We need to be able to do this for any operand, including MEM, or we
15048 ;; will cause reload to blow up since we don't allow output reloads on
15050 ;; For the length attribute to be calculated correctly, the
15051 ;; label MUST be operand 0.
15053 (define_insn "*ctr<mode>_internal1"
15055 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15057 (label_ref (match_operand 0 "" ""))
15059 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15060 (plus:P (match_dup 1)
15062 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15063 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15067 if (which_alternative != 0)
15069 else if (get_attr_length (insn) == 4)
15070 return \"{bdn|bdnz} %l0\";
15072 return \"bdz $+8\;b %l0\";
15074 [(set_attr "type" "branch")
15075 (set_attr "length" "*,12,16,16")])
15077 (define_insn "*ctr<mode>_internal2"
15079 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15082 (label_ref (match_operand 0 "" ""))))
15083 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15084 (plus:P (match_dup 1)
15086 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15087 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15091 if (which_alternative != 0)
15093 else if (get_attr_length (insn) == 4)
15094 return \"bdz %l0\";
15096 return \"{bdn|bdnz} $+8\;b %l0\";
15098 [(set_attr "type" "branch")
15099 (set_attr "length" "*,12,16,16")])
15101 ;; Similar but use EQ
15103 (define_insn "*ctr<mode>_internal5"
15105 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15107 (label_ref (match_operand 0 "" ""))
15109 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15110 (plus:P (match_dup 1)
15112 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15113 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15117 if (which_alternative != 0)
15119 else if (get_attr_length (insn) == 4)
15120 return \"bdz %l0\";
15122 return \"{bdn|bdnz} $+8\;b %l0\";
15124 [(set_attr "type" "branch")
15125 (set_attr "length" "*,12,16,16")])
15127 (define_insn "*ctr<mode>_internal6"
15129 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15132 (label_ref (match_operand 0 "" ""))))
15133 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15134 (plus:P (match_dup 1)
15136 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15137 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15141 if (which_alternative != 0)
15143 else if (get_attr_length (insn) == 4)
15144 return \"{bdn|bdnz} %l0\";
15146 return \"bdz $+8\;b %l0\";
15148 [(set_attr "type" "branch")
15149 (set_attr "length" "*,12,16,16")])
15151 ;; Now the splitters if we could not allocate the CTR register
15155 (if_then_else (match_operator 2 "comparison_operator"
15156 [(match_operand:P 1 "gpc_reg_operand" "")
15158 (match_operand 5 "" "")
15159 (match_operand 6 "" "")))
15160 (set (match_operand:P 0 "gpc_reg_operand" "")
15161 (plus:P (match_dup 1) (const_int -1)))
15162 (clobber (match_scratch:CC 3 ""))
15163 (clobber (match_scratch:P 4 ""))]
15165 [(parallel [(set (match_dup 3)
15166 (compare:CC (plus:P (match_dup 1)
15170 (plus:P (match_dup 1)
15172 (set (pc) (if_then_else (match_dup 7)
15176 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15177 operands[3], const0_rtx); }")
15181 (if_then_else (match_operator 2 "comparison_operator"
15182 [(match_operand:P 1 "gpc_reg_operand" "")
15184 (match_operand 5 "" "")
15185 (match_operand 6 "" "")))
15186 (set (match_operand:P 0 "nonimmediate_operand" "")
15187 (plus:P (match_dup 1) (const_int -1)))
15188 (clobber (match_scratch:CC 3 ""))
15189 (clobber (match_scratch:P 4 ""))]
15190 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15191 [(parallel [(set (match_dup 3)
15192 (compare:CC (plus:P (match_dup 1)
15196 (plus:P (match_dup 1)
15200 (set (pc) (if_then_else (match_dup 7)
15204 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15205 operands[3], const0_rtx); }")
15207 (define_insn "trap"
15208 [(trap_if (const_int 1) (const_int 0))]
15211 [(set_attr "type" "trap")])
15213 (define_expand "ctrap<mode>4"
15214 [(trap_if (match_operator 0 "ordered_comparison_operator"
15215 [(match_operand:GPR 1 "register_operand")
15216 (match_operand:GPR 2 "reg_or_short_operand")])
15217 (match_operand 3 "zero_constant" ""))]
15222 [(trap_if (match_operator 0 "ordered_comparison_operator"
15223 [(match_operand:GPR 1 "register_operand" "r")
15224 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15227 "{t|t<wd>}%V0%I2 %1,%2"
15228 [(set_attr "type" "trap")])
15230 ;; Insns related to generating the function prologue and epilogue.
15232 (define_expand "prologue"
15233 [(use (const_int 0))]
15234 "TARGET_SCHED_PROLOG"
15237 rs6000_emit_prologue ();
15241 (define_insn "*movesi_from_cr_one"
15242 [(match_parallel 0 "mfcr_operation"
15243 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15244 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15245 (match_operand 3 "immediate_operand" "n")]
15246 UNSPEC_MOVESI_FROM_CR))])]
15252 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15254 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15255 operands[4] = GEN_INT (mask);
15256 output_asm_insn (\"mfcr %1,%4\", operands);
15260 [(set_attr "type" "mfcrf")])
15262 (define_insn "movesi_from_cr"
15263 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15264 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15265 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15266 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15267 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15268 UNSPEC_MOVESI_FROM_CR))]
15271 [(set_attr "type" "mfcr")])
15273 (define_insn "*stmw"
15274 [(match_parallel 0 "stmw_operation"
15275 [(set (match_operand:SI 1 "memory_operand" "=m")
15276 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15279 [(set_attr "type" "store_ux")])
15281 (define_insn "*save_gpregs_<mode>"
15282 [(match_parallel 0 "any_parallel_operand"
15283 [(clobber (reg:P 65))
15284 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15285 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15286 (set (match_operand:P 3 "memory_operand" "=m")
15287 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15290 [(set_attr "type" "branch")
15291 (set_attr "length" "4")])
15293 (define_insn "*save_fpregs_<mode>"
15294 [(match_parallel 0 "any_parallel_operand"
15295 [(clobber (reg:P 65))
15296 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15297 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15298 (set (match_operand:DF 3 "memory_operand" "=m")
15299 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15302 [(set_attr "type" "branch")
15303 (set_attr "length" "4")])
15305 ; These are to explain that changes to the stack pointer should
15306 ; not be moved over stores to stack memory.
15307 (define_insn "stack_tie"
15308 [(set (match_operand:BLK 0 "memory_operand" "+m")
15309 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15312 [(set_attr "length" "0")])
15314 ; Like stack_tie, but depend on both fp and sp based memory.
15315 (define_insn "frame_tie"
15316 [(set (match_operand:BLK 0 "memory_operand" "+m")
15317 (unspec:BLK [(match_dup 0)
15318 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
15321 [(set_attr "length" "0")])
15324 (define_expand "epilogue"
15325 [(use (const_int 0))]
15326 "TARGET_SCHED_PROLOG"
15329 rs6000_emit_epilogue (FALSE);
15333 ; On some processors, doing the mtcrf one CC register at a time is
15334 ; faster (like on the 604e). On others, doing them all at once is
15335 ; faster; for instance, on the 601 and 750.
15337 (define_expand "movsi_to_cr_one"
15338 [(set (match_operand:CC 0 "cc_reg_operand" "")
15339 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15340 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15342 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15344 (define_insn "*movsi_to_cr"
15345 [(match_parallel 0 "mtcrf_operation"
15346 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15347 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15348 (match_operand 3 "immediate_operand" "n")]
15349 UNSPEC_MOVESI_TO_CR))])]
15355 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15356 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15357 operands[4] = GEN_INT (mask);
15358 return \"mtcrf %4,%2\";
15360 [(set_attr "type" "mtcr")])
15362 (define_insn "*mtcrfsi"
15363 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15364 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15365 (match_operand 2 "immediate_operand" "n")]
15366 UNSPEC_MOVESI_TO_CR))]
15367 "GET_CODE (operands[0]) == REG
15368 && CR_REGNO_P (REGNO (operands[0]))
15369 && GET_CODE (operands[2]) == CONST_INT
15370 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15372 [(set_attr "type" "mtcr")])
15374 ; The load-multiple instructions have similar properties.
15375 ; Note that "load_multiple" is a name known to the machine-independent
15376 ; code that actually corresponds to the PowerPC load-string.
15378 (define_insn "*lmw"
15379 [(match_parallel 0 "lmw_operation"
15380 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15381 (match_operand:SI 2 "memory_operand" "m"))])]
15384 [(set_attr "type" "load_ux")
15385 (set_attr "cell_micro" "always")])
15387 (define_insn "*return_internal_<mode>"
15389 (use (match_operand:P 0 "register_operand" "lc"))]
15392 [(set_attr "type" "jmpreg")])
15394 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15395 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15397 (define_insn "*restore_gpregs_<mode>"
15398 [(match_parallel 0 "any_parallel_operand"
15399 [(clobber (match_operand:P 1 "register_operand" "=l"))
15400 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15401 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15402 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15403 (match_operand:P 5 "memory_operand" "m"))])]
15406 [(set_attr "type" "branch")
15407 (set_attr "length" "4")])
15409 (define_insn "*return_and_restore_gpregs_<mode>"
15410 [(match_parallel 0 "any_parallel_operand"
15412 (clobber (match_operand:P 1 "register_operand" "=l"))
15413 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15414 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15415 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15416 (match_operand:P 5 "memory_operand" "m"))])]
15419 [(set_attr "type" "branch")
15420 (set_attr "length" "4")])
15422 (define_insn "*return_and_restore_fpregs_<mode>"
15423 [(match_parallel 0 "any_parallel_operand"
15425 (clobber (match_operand:P 1 "register_operand" "=l"))
15426 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15427 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15428 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15429 (match_operand:DF 5 "memory_operand" "m"))])]
15432 [(set_attr "type" "branch")
15433 (set_attr "length" "4")])
15435 (define_insn "*return_and_restore_fpregs_aix_<mode>"
15436 [(match_parallel 0 "any_parallel_operand"
15438 (use (match_operand:P 1 "register_operand" "l"))
15439 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15440 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15441 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15442 (match_operand:DF 5 "memory_operand" "m"))])]
15445 [(set_attr "type" "branch")
15446 (set_attr "length" "4")])
15448 ; This is used in compiling the unwind routines.
15449 (define_expand "eh_return"
15450 [(use (match_operand 0 "general_operand" ""))]
15455 emit_insn (gen_eh_set_lr_si (operands[0]));
15457 emit_insn (gen_eh_set_lr_di (operands[0]));
15461 ; We can't expand this before we know where the link register is stored.
15462 (define_insn "eh_set_lr_<mode>"
15463 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15465 (clobber (match_scratch:P 1 "=&b"))]
15470 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15471 (clobber (match_scratch 1 ""))]
15476 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15480 (define_insn "prefetch"
15481 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15482 (match_operand:SI 1 "const_int_operand" "n")
15483 (match_operand:SI 2 "const_int_operand" "n"))]
15487 if (GET_CODE (operands[0]) == REG)
15488 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15489 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15491 [(set_attr "type" "load")])
15493 (define_insn "bpermd_<mode>"
15494 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15495 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15496 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15499 [(set_attr "type" "integer")])
15503 (include "sync.md")
15504 (include "vector.md")
15506 (include "altivec.md")
15509 (include "paired.md")