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
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 2, 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 COPYING. If not, write to the
21 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 ;; MA 02110-1301, USA.
24 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
31 [(UNSPEC_FRSP 0) ; frsp for POWER machines
32 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
33 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
34 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
36 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
42 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
43 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
46 (UNSPEC_MOVESI_FROM_CR 19)
47 (UNSPEC_MOVESI_TO_CR 20)
49 (UNSPEC_TLSDTPRELHA 22)
50 (UNSPEC_TLSDTPRELLO 23)
51 (UNSPEC_TLSGOTDTPREL 24)
53 (UNSPEC_TLSTPRELHA 26)
54 (UNSPEC_TLSTPRELLO 27)
55 (UNSPEC_TLSGOTTPREL 28)
57 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
58 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
74 (UNSPEC_DLMZB_STRLEN 47)
78 ;; UNSPEC_VOLATILE usage
83 (UNSPECV_LL 1) ; load-locked
84 (UNSPECV_SC 2) ; store-conditional
85 (UNSPECV_EH_RR 9) ; eh_reg_restore
88 ;; Define an insn type attribute. This is used in function unit delay
90 (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"
91 (const_string "integer"))
94 ; '(pc)' in the following doesn't include the instruction itself; it is
95 ; calculated as if the instruction had zero size.
96 (define_attr "length" ""
97 (if_then_else (eq_attr "type" "branch")
98 (if_then_else (and (ge (minus (match_dup 0) (pc))
100 (lt (minus (match_dup 0) (pc))
106 ;; Processor type -- this attribute must exactly match the processor_type
107 ;; enumeration in rs6000.h.
109 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6"
110 (const (symbol_ref "rs6000_cpu_attr")))
112 (automata_option "ndfa")
125 (include "power4.md")
126 (include "power5.md")
127 (include "power6.md")
129 (include "predicates.md")
130 (include "constraints.md")
132 (include "darwin.md")
137 ; This mode macro allows :GPR to be used to indicate the allowable size
138 ; of whole values in GPRs.
139 (define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
141 ; Any supported integer mode.
142 (define_mode_macro INT [QI HI SI DI TI])
144 ; Any supported integer mode that fits in one register.
145 (define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
147 ; extend modes for DImode
148 (define_mode_macro QHSI [QI HI SI])
150 ; SImode or DImode, even if DImode doesn't fit in GPRs.
151 (define_mode_macro SDI [SI DI])
153 ; The size of a pointer. Also, the size of the value that a record-condition
154 ; (one with a '.') will compare.
155 (define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
157 ; Any hardware-supported floating-point mode
158 (define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
159 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
160 (TF "!TARGET_IEEEQUAD
161 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128")])
163 ; Various instructions that come in SI and DI forms.
164 ; A generic w/d attribute, for things like cmpw/cmpd.
165 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
168 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
171 ;; Start with fixed-point load and store insns. Here we put only the more
172 ;; complex forms. Basic data transfer is done later.
174 (define_expand "zero_extend<mode>di2"
175 [(set (match_operand:DI 0 "gpc_reg_operand" "")
176 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
180 (define_insn "*zero_extend<mode>di2_internal1"
181 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
182 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
186 rldicl %0,%1,0,<dbits>"
187 [(set_attr "type" "load,*")])
189 (define_insn "*zero_extend<mode>di2_internal2"
190 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
191 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
193 (clobber (match_scratch:DI 2 "=r,r"))]
196 rldicl. %2,%1,0,<dbits>
198 [(set_attr "type" "compare")
199 (set_attr "length" "4,8")])
202 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
203 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
205 (clobber (match_scratch:DI 2 ""))]
206 "TARGET_POWERPC64 && reload_completed"
208 (zero_extend:DI (match_dup 1)))
210 (compare:CC (match_dup 2)
214 (define_insn "*zero_extend<mode>di2_internal3"
215 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
216 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
218 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
219 (zero_extend:DI (match_dup 1)))]
222 rldicl. %0,%1,0,<dbits>
224 [(set_attr "type" "compare")
225 (set_attr "length" "4,8")])
228 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
229 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
231 (set (match_operand:DI 0 "gpc_reg_operand" "")
232 (zero_extend:DI (match_dup 1)))]
233 "TARGET_POWERPC64 && reload_completed"
235 (zero_extend:DI (match_dup 1)))
237 (compare:CC (match_dup 0)
241 (define_insn "extendqidi2"
242 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
243 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
246 [(set_attr "type" "exts")])
249 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
250 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
252 (clobber (match_scratch:DI 2 "=r,r"))]
257 [(set_attr "type" "compare")
258 (set_attr "length" "4,8")])
261 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
262 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
264 (clobber (match_scratch:DI 2 ""))]
265 "TARGET_POWERPC64 && reload_completed"
267 (sign_extend:DI (match_dup 1)))
269 (compare:CC (match_dup 2)
274 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
275 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
277 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
278 (sign_extend:DI (match_dup 1)))]
283 [(set_attr "type" "compare")
284 (set_attr "length" "4,8")])
287 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
288 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
290 (set (match_operand:DI 0 "gpc_reg_operand" "")
291 (sign_extend:DI (match_dup 1)))]
292 "TARGET_POWERPC64 && reload_completed"
294 (sign_extend:DI (match_dup 1)))
296 (compare:CC (match_dup 0)
300 (define_expand "extendhidi2"
301 [(set (match_operand:DI 0 "gpc_reg_operand" "")
302 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
307 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
308 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
313 [(set_attr "type" "load_ext,exts")])
316 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
317 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
319 (clobber (match_scratch:DI 2 "=r,r"))]
324 [(set_attr "type" "compare")
325 (set_attr "length" "4,8")])
328 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
329 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
331 (clobber (match_scratch:DI 2 ""))]
332 "TARGET_POWERPC64 && reload_completed"
334 (sign_extend:DI (match_dup 1)))
336 (compare:CC (match_dup 2)
341 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
342 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
344 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
345 (sign_extend:DI (match_dup 1)))]
350 [(set_attr "type" "compare")
351 (set_attr "length" "4,8")])
354 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
355 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
357 (set (match_operand:DI 0 "gpc_reg_operand" "")
358 (sign_extend:DI (match_dup 1)))]
359 "TARGET_POWERPC64 && reload_completed"
361 (sign_extend:DI (match_dup 1)))
363 (compare:CC (match_dup 0)
367 (define_expand "extendsidi2"
368 [(set (match_operand:DI 0 "gpc_reg_operand" "")
369 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
374 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
375 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
380 [(set_attr "type" "load_ext,exts")])
383 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
384 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
386 (clobber (match_scratch:DI 2 "=r,r"))]
391 [(set_attr "type" "compare")
392 (set_attr "length" "4,8")])
395 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
396 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
398 (clobber (match_scratch:DI 2 ""))]
399 "TARGET_POWERPC64 && reload_completed"
401 (sign_extend:DI (match_dup 1)))
403 (compare:CC (match_dup 2)
408 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
409 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
411 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
412 (sign_extend:DI (match_dup 1)))]
417 [(set_attr "type" "compare")
418 (set_attr "length" "4,8")])
421 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
422 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
424 (set (match_operand:DI 0 "gpc_reg_operand" "")
425 (sign_extend:DI (match_dup 1)))]
426 "TARGET_POWERPC64 && reload_completed"
428 (sign_extend:DI (match_dup 1)))
430 (compare:CC (match_dup 0)
434 (define_expand "zero_extendqisi2"
435 [(set (match_operand:SI 0 "gpc_reg_operand" "")
436 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
441 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
442 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
446 {rlinm|rlwinm} %0,%1,0,0xff"
447 [(set_attr "type" "load,*")])
450 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
451 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
453 (clobber (match_scratch:SI 2 "=r,r"))]
456 {andil.|andi.} %2,%1,0xff
458 [(set_attr "type" "compare")
459 (set_attr "length" "4,8")])
462 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
463 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
465 (clobber (match_scratch:SI 2 ""))]
468 (zero_extend:SI (match_dup 1)))
470 (compare:CC (match_dup 2)
475 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
476 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
478 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
479 (zero_extend:SI (match_dup 1)))]
482 {andil.|andi.} %0,%1,0xff
484 [(set_attr "type" "compare")
485 (set_attr "length" "4,8")])
488 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
489 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
491 (set (match_operand:SI 0 "gpc_reg_operand" "")
492 (zero_extend:SI (match_dup 1)))]
495 (zero_extend:SI (match_dup 1)))
497 (compare:CC (match_dup 0)
501 (define_expand "extendqisi2"
502 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
503 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
508 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
509 else if (TARGET_POWER)
510 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
512 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
516 (define_insn "extendqisi2_ppc"
517 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
518 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
521 [(set_attr "type" "exts")])
524 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
525 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
527 (clobber (match_scratch:SI 2 "=r,r"))]
532 [(set_attr "type" "compare")
533 (set_attr "length" "4,8")])
536 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
537 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
539 (clobber (match_scratch:SI 2 ""))]
540 "TARGET_POWERPC && reload_completed"
542 (sign_extend:SI (match_dup 1)))
544 (compare:CC (match_dup 2)
549 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
550 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
552 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
553 (sign_extend:SI (match_dup 1)))]
558 [(set_attr "type" "compare")
559 (set_attr "length" "4,8")])
562 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
563 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
565 (set (match_operand:SI 0 "gpc_reg_operand" "")
566 (sign_extend:SI (match_dup 1)))]
567 "TARGET_POWERPC && reload_completed"
569 (sign_extend:SI (match_dup 1)))
571 (compare:CC (match_dup 0)
575 (define_expand "extendqisi2_power"
576 [(parallel [(set (match_dup 2)
577 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
579 (clobber (scratch:SI))])
580 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
581 (ashiftrt:SI (match_dup 2)
583 (clobber (scratch:SI))])]
586 { operands[1] = gen_lowpart (SImode, operands[1]);
587 operands[2] = gen_reg_rtx (SImode); }")
589 (define_expand "extendqisi2_no_power"
591 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
593 (set (match_operand:SI 0 "gpc_reg_operand" "")
594 (ashiftrt:SI (match_dup 2)
596 "! TARGET_POWER && ! TARGET_POWERPC"
598 { operands[1] = gen_lowpart (SImode, operands[1]);
599 operands[2] = gen_reg_rtx (SImode); }")
601 (define_expand "zero_extendqihi2"
602 [(set (match_operand:HI 0 "gpc_reg_operand" "")
603 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
608 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
609 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
613 {rlinm|rlwinm} %0,%1,0,0xff"
614 [(set_attr "type" "load,*")])
617 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
618 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
620 (clobber (match_scratch:HI 2 "=r,r"))]
623 {andil.|andi.} %2,%1,0xff
625 [(set_attr "type" "compare")
626 (set_attr "length" "4,8")])
629 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
630 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
632 (clobber (match_scratch:HI 2 ""))]
635 (zero_extend:HI (match_dup 1)))
637 (compare:CC (match_dup 2)
642 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
643 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
645 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
646 (zero_extend:HI (match_dup 1)))]
649 {andil.|andi.} %0,%1,0xff
651 [(set_attr "type" "compare")
652 (set_attr "length" "4,8")])
655 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
656 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
658 (set (match_operand:HI 0 "gpc_reg_operand" "")
659 (zero_extend:HI (match_dup 1)))]
662 (zero_extend:HI (match_dup 1)))
664 (compare:CC (match_dup 0)
668 (define_expand "extendqihi2"
669 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
670 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
675 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
676 else if (TARGET_POWER)
677 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
679 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
683 (define_insn "extendqihi2_ppc"
684 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
685 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
688 [(set_attr "type" "exts")])
691 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
692 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
694 (clobber (match_scratch:HI 2 "=r,r"))]
699 [(set_attr "type" "compare")
700 (set_attr "length" "4,8")])
703 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
704 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
706 (clobber (match_scratch:HI 2 ""))]
707 "TARGET_POWERPC && reload_completed"
709 (sign_extend:HI (match_dup 1)))
711 (compare:CC (match_dup 2)
716 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
717 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
719 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
720 (sign_extend:HI (match_dup 1)))]
725 [(set_attr "type" "compare")
726 (set_attr "length" "4,8")])
729 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
730 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
732 (set (match_operand:HI 0 "gpc_reg_operand" "")
733 (sign_extend:HI (match_dup 1)))]
734 "TARGET_POWERPC && reload_completed"
736 (sign_extend:HI (match_dup 1)))
738 (compare:CC (match_dup 0)
742 (define_expand "extendqihi2_power"
743 [(parallel [(set (match_dup 2)
744 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
746 (clobber (scratch:SI))])
747 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
748 (ashiftrt:SI (match_dup 2)
750 (clobber (scratch:SI))])]
753 { operands[0] = gen_lowpart (SImode, operands[0]);
754 operands[1] = gen_lowpart (SImode, operands[1]);
755 operands[2] = gen_reg_rtx (SImode); }")
757 (define_expand "extendqihi2_no_power"
759 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
761 (set (match_operand:HI 0 "gpc_reg_operand" "")
762 (ashiftrt:SI (match_dup 2)
764 "! TARGET_POWER && ! TARGET_POWERPC"
766 { operands[0] = gen_lowpart (SImode, operands[0]);
767 operands[1] = gen_lowpart (SImode, operands[1]);
768 operands[2] = gen_reg_rtx (SImode); }")
770 (define_expand "zero_extendhisi2"
771 [(set (match_operand:SI 0 "gpc_reg_operand" "")
772 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
777 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
778 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
782 {rlinm|rlwinm} %0,%1,0,0xffff"
783 [(set_attr "type" "load,*")])
786 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
787 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
789 (clobber (match_scratch:SI 2 "=r,r"))]
792 {andil.|andi.} %2,%1,0xffff
794 [(set_attr "type" "compare")
795 (set_attr "length" "4,8")])
798 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
799 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
801 (clobber (match_scratch:SI 2 ""))]
804 (zero_extend:SI (match_dup 1)))
806 (compare:CC (match_dup 2)
811 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
812 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
814 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
815 (zero_extend:SI (match_dup 1)))]
818 {andil.|andi.} %0,%1,0xffff
820 [(set_attr "type" "compare")
821 (set_attr "length" "4,8")])
824 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
825 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
827 (set (match_operand:SI 0 "gpc_reg_operand" "")
828 (zero_extend:SI (match_dup 1)))]
831 (zero_extend:SI (match_dup 1)))
833 (compare:CC (match_dup 0)
837 (define_expand "extendhisi2"
838 [(set (match_operand:SI 0 "gpc_reg_operand" "")
839 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
844 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
845 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
850 [(set_attr "type" "load_ext,exts")])
853 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
854 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
856 (clobber (match_scratch:SI 2 "=r,r"))]
861 [(set_attr "type" "compare")
862 (set_attr "length" "4,8")])
865 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
866 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
868 (clobber (match_scratch:SI 2 ""))]
871 (sign_extend:SI (match_dup 1)))
873 (compare:CC (match_dup 2)
878 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
879 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
881 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
882 (sign_extend:SI (match_dup 1)))]
887 [(set_attr "type" "compare")
888 (set_attr "length" "4,8")])
890 ;; IBM 405 and 440 half-word multiplication operations.
892 (define_insn "*macchwc"
893 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
894 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
895 (match_operand:SI 2 "gpc_reg_operand" "r")
898 (match_operand:HI 1 "gpc_reg_operand" "r")))
899 (match_operand:SI 4 "gpc_reg_operand" "0"))
901 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
902 (plus:SI (mult:SI (ashiftrt:SI
910 [(set_attr "type" "imul3")])
912 (define_insn "*macchw"
913 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
914 (plus:SI (mult:SI (ashiftrt:SI
915 (match_operand:SI 2 "gpc_reg_operand" "r")
918 (match_operand:HI 1 "gpc_reg_operand" "r")))
919 (match_operand:SI 3 "gpc_reg_operand" "0")))]
922 [(set_attr "type" "imul3")])
924 (define_insn "*macchwuc"
925 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
926 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
927 (match_operand:SI 2 "gpc_reg_operand" "r")
930 (match_operand:HI 1 "gpc_reg_operand" "r")))
931 (match_operand:SI 4 "gpc_reg_operand" "0"))
933 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
934 (plus:SI (mult:SI (lshiftrt:SI
941 "macchwu. %0, %1, %2"
942 [(set_attr "type" "imul3")])
944 (define_insn "*macchwu"
945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
946 (plus:SI (mult:SI (lshiftrt:SI
947 (match_operand:SI 2 "gpc_reg_operand" "r")
950 (match_operand:HI 1 "gpc_reg_operand" "r")))
951 (match_operand:SI 3 "gpc_reg_operand" "0")))]
954 [(set_attr "type" "imul3")])
956 (define_insn "*machhwc"
957 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
958 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
959 (match_operand:SI 1 "gpc_reg_operand" "%r")
962 (match_operand:SI 2 "gpc_reg_operand" "r")
964 (match_operand:SI 4 "gpc_reg_operand" "0"))
966 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
967 (plus:SI (mult:SI (ashiftrt:SI
976 [(set_attr "type" "imul3")])
978 (define_insn "*machhw"
979 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
980 (plus:SI (mult:SI (ashiftrt:SI
981 (match_operand:SI 1 "gpc_reg_operand" "%r")
984 (match_operand:SI 2 "gpc_reg_operand" "r")
986 (match_operand:SI 3 "gpc_reg_operand" "0")))]
989 [(set_attr "type" "imul3")])
991 (define_insn "*machhwuc"
992 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
993 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
994 (match_operand:SI 1 "gpc_reg_operand" "%r")
997 (match_operand:SI 2 "gpc_reg_operand" "r")
999 (match_operand:SI 4 "gpc_reg_operand" "0"))
1001 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1002 (plus:SI (mult:SI (lshiftrt:SI
1010 "machhwu. %0, %1, %2"
1011 [(set_attr "type" "imul3")])
1013 (define_insn "*machhwu"
1014 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1015 (plus:SI (mult:SI (lshiftrt:SI
1016 (match_operand:SI 1 "gpc_reg_operand" "%r")
1019 (match_operand:SI 2 "gpc_reg_operand" "r")
1021 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1023 "machhwu %0, %1, %2"
1024 [(set_attr "type" "imul3")])
1026 (define_insn "*maclhwc"
1027 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1028 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1029 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1031 (match_operand:HI 2 "gpc_reg_operand" "r")))
1032 (match_operand:SI 4 "gpc_reg_operand" "0"))
1034 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1035 (plus:SI (mult:SI (sign_extend:SI
1041 "maclhw. %0, %1, %2"
1042 [(set_attr "type" "imul3")])
1044 (define_insn "*maclhw"
1045 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1046 (plus:SI (mult:SI (sign_extend:SI
1047 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1049 (match_operand:HI 2 "gpc_reg_operand" "r")))
1050 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1053 [(set_attr "type" "imul3")])
1055 (define_insn "*maclhwuc"
1056 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1057 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1058 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1060 (match_operand:HI 2 "gpc_reg_operand" "r")))
1061 (match_operand:SI 4 "gpc_reg_operand" "0"))
1063 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1064 (plus:SI (mult:SI (zero_extend:SI
1070 "maclhwu. %0, %1, %2"
1071 [(set_attr "type" "imul3")])
1073 (define_insn "*maclhwu"
1074 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1075 (plus:SI (mult:SI (zero_extend:SI
1076 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1078 (match_operand:HI 2 "gpc_reg_operand" "r")))
1079 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1081 "maclhwu %0, %1, %2"
1082 [(set_attr "type" "imul3")])
1084 (define_insn "*nmacchwc"
1085 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1086 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1087 (mult:SI (ashiftrt:SI
1088 (match_operand:SI 2 "gpc_reg_operand" "r")
1091 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1093 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1094 (minus:SI (match_dup 4)
1095 (mult:SI (ashiftrt:SI
1101 "nmacchw. %0, %1, %2"
1102 [(set_attr "type" "imul3")])
1104 (define_insn "*nmacchw"
1105 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1106 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1107 (mult:SI (ashiftrt:SI
1108 (match_operand:SI 2 "gpc_reg_operand" "r")
1111 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1113 "nmacchw %0, %1, %2"
1114 [(set_attr "type" "imul3")])
1116 (define_insn "*nmachhwc"
1117 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1118 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1119 (mult:SI (ashiftrt:SI
1120 (match_operand:SI 1 "gpc_reg_operand" "%r")
1123 (match_operand:SI 2 "gpc_reg_operand" "r")
1126 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1127 (minus:SI (match_dup 4)
1128 (mult:SI (ashiftrt:SI
1135 "nmachhw. %0, %1, %2"
1136 [(set_attr "type" "imul3")])
1138 (define_insn "*nmachhw"
1139 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1140 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1141 (mult:SI (ashiftrt:SI
1142 (match_operand:SI 1 "gpc_reg_operand" "%r")
1145 (match_operand:SI 2 "gpc_reg_operand" "r")
1148 "nmachhw %0, %1, %2"
1149 [(set_attr "type" "imul3")])
1151 (define_insn "*nmaclhwc"
1152 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1153 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1154 (mult:SI (sign_extend:SI
1155 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1157 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1159 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1160 (minus:SI (match_dup 4)
1161 (mult:SI (sign_extend:SI
1166 "nmaclhw. %0, %1, %2"
1167 [(set_attr "type" "imul3")])
1169 (define_insn "*nmaclhw"
1170 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1171 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1172 (mult:SI (sign_extend:SI
1173 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1175 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1177 "nmaclhw %0, %1, %2"
1178 [(set_attr "type" "imul3")])
1180 (define_insn "*mulchwc"
1181 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1182 (compare:CC (mult:SI (ashiftrt:SI
1183 (match_operand:SI 2 "gpc_reg_operand" "r")
1186 (match_operand:HI 1 "gpc_reg_operand" "r")))
1188 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1189 (mult:SI (ashiftrt:SI
1195 "mulchw. %0, %1, %2"
1196 [(set_attr "type" "imul3")])
1198 (define_insn "*mulchw"
1199 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1200 (mult:SI (ashiftrt:SI
1201 (match_operand:SI 2 "gpc_reg_operand" "r")
1204 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1207 [(set_attr "type" "imul3")])
1209 (define_insn "*mulchwuc"
1210 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1211 (compare:CC (mult:SI (lshiftrt:SI
1212 (match_operand:SI 2 "gpc_reg_operand" "r")
1215 (match_operand:HI 1 "gpc_reg_operand" "r")))
1217 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1218 (mult:SI (lshiftrt:SI
1224 "mulchwu. %0, %1, %2"
1225 [(set_attr "type" "imul3")])
1227 (define_insn "*mulchwu"
1228 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1229 (mult:SI (lshiftrt:SI
1230 (match_operand:SI 2 "gpc_reg_operand" "r")
1233 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1235 "mulchwu %0, %1, %2"
1236 [(set_attr "type" "imul3")])
1238 (define_insn "*mulhhwc"
1239 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1240 (compare:CC (mult:SI (ashiftrt:SI
1241 (match_operand:SI 1 "gpc_reg_operand" "%r")
1244 (match_operand:SI 2 "gpc_reg_operand" "r")
1247 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1248 (mult:SI (ashiftrt:SI
1255 "mulhhw. %0, %1, %2"
1256 [(set_attr "type" "imul3")])
1258 (define_insn "*mulhhw"
1259 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1260 (mult:SI (ashiftrt:SI
1261 (match_operand:SI 1 "gpc_reg_operand" "%r")
1264 (match_operand:SI 2 "gpc_reg_operand" "r")
1268 [(set_attr "type" "imul3")])
1270 (define_insn "*mulhhwuc"
1271 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1272 (compare:CC (mult:SI (lshiftrt:SI
1273 (match_operand:SI 1 "gpc_reg_operand" "%r")
1276 (match_operand:SI 2 "gpc_reg_operand" "r")
1279 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1280 (mult:SI (lshiftrt:SI
1287 "mulhhwu. %0, %1, %2"
1288 [(set_attr "type" "imul3")])
1290 (define_insn "*mulhhwu"
1291 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1292 (mult:SI (lshiftrt:SI
1293 (match_operand:SI 1 "gpc_reg_operand" "%r")
1296 (match_operand:SI 2 "gpc_reg_operand" "r")
1299 "mulhhwu %0, %1, %2"
1300 [(set_attr "type" "imul3")])
1302 (define_insn "*mullhwc"
1303 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1304 (compare:CC (mult:SI (sign_extend:SI
1305 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1307 (match_operand:HI 2 "gpc_reg_operand" "r")))
1309 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1310 (mult:SI (sign_extend:SI
1315 "mullhw. %0, %1, %2"
1316 [(set_attr "type" "imul3")])
1318 (define_insn "*mullhw"
1319 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1320 (mult:SI (sign_extend:SI
1321 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1323 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1326 [(set_attr "type" "imul3")])
1328 (define_insn "*mullhwuc"
1329 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1330 (compare:CC (mult:SI (zero_extend:SI
1331 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1333 (match_operand:HI 2 "gpc_reg_operand" "r")))
1335 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1336 (mult:SI (zero_extend:SI
1341 "mullhwu. %0, %1, %2"
1342 [(set_attr "type" "imul3")])
1344 (define_insn "*mullhwu"
1345 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1346 (mult:SI (zero_extend:SI
1347 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1349 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1351 "mullhwu %0, %1, %2"
1352 [(set_attr "type" "imul3")])
1354 ;; IBM 405 and 440 string-search dlmzb instruction support.
1355 (define_insn "dlmzb"
1356 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1357 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1358 (match_operand:SI 2 "gpc_reg_operand" "r")]
1360 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1361 (unspec:SI [(match_dup 1)
1365 "dlmzb. %0, %1, %2")
1367 (define_expand "strlensi"
1368 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1369 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1370 (match_operand:QI 2 "const_int_operand" "")
1371 (match_operand 3 "const_int_operand" "")]
1372 UNSPEC_DLMZB_STRLEN))
1373 (clobber (match_scratch:CC 4 "=x"))]
1374 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1376 rtx result = operands[0];
1377 rtx src = operands[1];
1378 rtx search_char = operands[2];
1379 rtx align = operands[3];
1380 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1381 rtx loop_label, end_label, mem, cr0, cond;
1382 if (search_char != const0_rtx
1383 || GET_CODE (align) != CONST_INT
1384 || INTVAL (align) < 8)
1386 word1 = gen_reg_rtx (SImode);
1387 word2 = gen_reg_rtx (SImode);
1388 scratch_dlmzb = gen_reg_rtx (SImode);
1389 scratch_string = gen_reg_rtx (Pmode);
1390 loop_label = gen_label_rtx ();
1391 end_label = gen_label_rtx ();
1392 addr = force_reg (Pmode, XEXP (src, 0));
1393 emit_move_insn (scratch_string, addr);
1394 emit_label (loop_label);
1395 mem = change_address (src, SImode, scratch_string);
1396 emit_move_insn (word1, mem);
1397 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1398 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1399 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1400 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1401 emit_jump_insn (gen_rtx_SET (VOIDmode,
1403 gen_rtx_IF_THEN_ELSE (VOIDmode,
1409 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1410 emit_jump_insn (gen_rtx_SET (VOIDmode,
1412 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1414 emit_label (end_label);
1415 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1416 emit_insn (gen_subsi3 (result, scratch_string, addr));
1417 emit_insn (gen_subsi3 (result, result, const1_rtx));
1422 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1423 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1425 (set (match_operand:SI 0 "gpc_reg_operand" "")
1426 (sign_extend:SI (match_dup 1)))]
1429 (sign_extend:SI (match_dup 1)))
1431 (compare:CC (match_dup 0)
1435 ;; Fixed-point arithmetic insns.
1437 (define_expand "add<mode>3"
1438 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1439 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1440 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1443 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1445 if (non_short_cint_operand (operands[2], DImode))
1448 else if (GET_CODE (operands[2]) == CONST_INT
1449 && ! add_operand (operands[2], <MODE>mode))
1451 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1452 ? operands[0] : gen_reg_rtx (<MODE>mode));
1454 HOST_WIDE_INT val = INTVAL (operands[2]);
1455 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1456 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1458 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1461 /* The ordering here is important for the prolog expander.
1462 When space is allocated from the stack, adding 'low' first may
1463 produce a temporary deallocation (which would be bad). */
1464 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1465 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1470 ;; Discourage ai/addic because of carry but provide it in an alternative
1471 ;; allowing register zero as source.
1472 (define_insn "*add<mode>3_internal1"
1473 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1474 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1475 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1479 {cal %0,%2(%1)|addi %0,%1,%2}
1481 {cau|addis} %0,%1,%v2"
1482 [(set_attr "length" "4,4,4,4")])
1484 (define_insn "addsi3_high"
1485 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1486 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1487 (high:SI (match_operand 2 "" ""))))]
1488 "TARGET_MACHO && !TARGET_64BIT"
1489 "{cau|addis} %0,%1,ha16(%2)"
1490 [(set_attr "length" "4")])
1492 (define_insn "*add<mode>3_internal2"
1493 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1494 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1495 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1497 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1500 {cax.|add.} %3,%1,%2
1501 {ai.|addic.} %3,%1,%2
1504 [(set_attr "type" "fast_compare,compare,compare,compare")
1505 (set_attr "length" "4,4,8,8")])
1508 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1509 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1510 (match_operand:GPR 2 "reg_or_short_operand" ""))
1512 (clobber (match_scratch:GPR 3 ""))]
1515 (plus:GPR (match_dup 1)
1518 (compare:CC (match_dup 3)
1522 (define_insn "*add<mode>3_internal3"
1523 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1524 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1525 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1527 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1528 (plus:P (match_dup 1)
1532 {cax.|add.} %0,%1,%2
1533 {ai.|addic.} %0,%1,%2
1536 [(set_attr "type" "fast_compare,compare,compare,compare")
1537 (set_attr "length" "4,4,8,8")])
1540 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1541 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1542 (match_operand:P 2 "reg_or_short_operand" ""))
1544 (set (match_operand:P 0 "gpc_reg_operand" "")
1545 (plus:P (match_dup 1) (match_dup 2)))]
1548 (plus:P (match_dup 1)
1551 (compare:CC (match_dup 0)
1555 ;; Split an add that we can't do in one insn into two insns, each of which
1556 ;; does one 16-bit part. This is used by combine. Note that the low-order
1557 ;; add should be last in case the result gets used in an address.
1560 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1561 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1562 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1564 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1565 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1567 HOST_WIDE_INT val = INTVAL (operands[2]);
1568 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1569 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1571 operands[4] = GEN_INT (low);
1572 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1573 operands[3] = GEN_INT (rest);
1574 else if (! no_new_pseudos)
1576 operands[3] = gen_reg_rtx (DImode);
1577 emit_move_insn (operands[3], operands[2]);
1578 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1585 (define_insn "one_cmpl<mode>2"
1586 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1587 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1592 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1593 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1595 (clobber (match_scratch:P 2 "=r,r"))]
1600 [(set_attr "type" "compare")
1601 (set_attr "length" "4,8")])
1604 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1605 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1607 (clobber (match_scratch:P 2 ""))]
1610 (not:P (match_dup 1)))
1612 (compare:CC (match_dup 2)
1617 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1618 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1620 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1621 (not:P (match_dup 1)))]
1626 [(set_attr "type" "compare")
1627 (set_attr "length" "4,8")])
1630 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1631 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1633 (set (match_operand:P 0 "gpc_reg_operand" "")
1634 (not:P (match_dup 1)))]
1637 (not:P (match_dup 1)))
1639 (compare:CC (match_dup 0)
1644 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1645 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1646 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1648 "{sf%I1|subf%I1c} %0,%2,%1")
1651 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1652 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1653 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1660 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1661 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1662 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1664 (clobber (match_scratch:SI 3 "=r,r"))]
1667 {sf.|subfc.} %3,%2,%1
1669 [(set_attr "type" "compare")
1670 (set_attr "length" "4,8")])
1673 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1674 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1675 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1677 (clobber (match_scratch:P 3 "=r,r"))]
1682 [(set_attr "type" "fast_compare")
1683 (set_attr "length" "4,8")])
1686 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1687 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1688 (match_operand:P 2 "gpc_reg_operand" ""))
1690 (clobber (match_scratch:P 3 ""))]
1693 (minus:P (match_dup 1)
1696 (compare:CC (match_dup 3)
1701 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1702 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1703 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1705 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1706 (minus:SI (match_dup 1) (match_dup 2)))]
1709 {sf.|subfc.} %0,%2,%1
1711 [(set_attr "type" "compare")
1712 (set_attr "length" "4,8")])
1715 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1716 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1717 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1719 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1720 (minus:P (match_dup 1)
1726 [(set_attr "type" "fast_compare")
1727 (set_attr "length" "4,8")])
1730 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1731 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1732 (match_operand:P 2 "gpc_reg_operand" ""))
1734 (set (match_operand:P 0 "gpc_reg_operand" "")
1735 (minus:P (match_dup 1)
1739 (minus:P (match_dup 1)
1742 (compare:CC (match_dup 0)
1746 (define_expand "sub<mode>3"
1747 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1748 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1749 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1753 if (GET_CODE (operands[2]) == CONST_INT)
1755 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1756 negate_rtx (<MODE>mode, operands[2])));
1761 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1762 ;; instruction and some auxiliary computations. Then we just have a single
1763 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1766 (define_expand "sminsi3"
1768 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1769 (match_operand:SI 2 "reg_or_short_operand" ""))
1771 (minus:SI (match_dup 2) (match_dup 1))))
1772 (set (match_operand:SI 0 "gpc_reg_operand" "")
1773 (minus:SI (match_dup 2) (match_dup 3)))]
1774 "TARGET_POWER || TARGET_ISEL"
1779 operands[2] = force_reg (SImode, operands[2]);
1780 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1784 operands[3] = gen_reg_rtx (SImode);
1788 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1789 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1790 (match_operand:SI 2 "reg_or_short_operand" "")))
1791 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1794 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1796 (minus:SI (match_dup 2) (match_dup 1))))
1797 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1800 (define_expand "smaxsi3"
1802 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1803 (match_operand:SI 2 "reg_or_short_operand" ""))
1805 (minus:SI (match_dup 2) (match_dup 1))))
1806 (set (match_operand:SI 0 "gpc_reg_operand" "")
1807 (plus:SI (match_dup 3) (match_dup 1)))]
1808 "TARGET_POWER || TARGET_ISEL"
1813 operands[2] = force_reg (SImode, operands[2]);
1814 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1817 operands[3] = gen_reg_rtx (SImode);
1821 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1822 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1823 (match_operand:SI 2 "reg_or_short_operand" "")))
1824 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1827 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1829 (minus:SI (match_dup 2) (match_dup 1))))
1830 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1833 (define_expand "uminsi3"
1834 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1836 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1838 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1840 (minus:SI (match_dup 4) (match_dup 3))))
1841 (set (match_operand:SI 0 "gpc_reg_operand" "")
1842 (minus:SI (match_dup 2) (match_dup 3)))]
1843 "TARGET_POWER || TARGET_ISEL"
1848 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1851 operands[3] = gen_reg_rtx (SImode);
1852 operands[4] = gen_reg_rtx (SImode);
1853 operands[5] = GEN_INT (-2147483647 - 1);
1856 (define_expand "umaxsi3"
1857 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1859 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1861 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1863 (minus:SI (match_dup 4) (match_dup 3))))
1864 (set (match_operand:SI 0 "gpc_reg_operand" "")
1865 (plus:SI (match_dup 3) (match_dup 1)))]
1866 "TARGET_POWER || TARGET_ISEL"
1871 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1874 operands[3] = gen_reg_rtx (SImode);
1875 operands[4] = gen_reg_rtx (SImode);
1876 operands[5] = GEN_INT (-2147483647 - 1);
1880 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1881 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1882 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1884 (minus:SI (match_dup 2) (match_dup 1))))]
1889 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1891 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1892 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1894 (minus:SI (match_dup 2) (match_dup 1)))
1896 (clobber (match_scratch:SI 3 "=r,r"))]
1901 [(set_attr "type" "delayed_compare")
1902 (set_attr "length" "4,8")])
1905 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1907 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1908 (match_operand:SI 2 "reg_or_short_operand" ""))
1910 (minus:SI (match_dup 2) (match_dup 1)))
1912 (clobber (match_scratch:SI 3 ""))]
1913 "TARGET_POWER && reload_completed"
1915 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1917 (minus:SI (match_dup 2) (match_dup 1))))
1919 (compare:CC (match_dup 3)
1924 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1926 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1927 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1929 (minus:SI (match_dup 2) (match_dup 1)))
1931 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1932 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1934 (minus:SI (match_dup 2) (match_dup 1))))]
1939 [(set_attr "type" "delayed_compare")
1940 (set_attr "length" "4,8")])
1943 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1945 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1946 (match_operand:SI 2 "reg_or_short_operand" ""))
1948 (minus:SI (match_dup 2) (match_dup 1)))
1950 (set (match_operand:SI 0 "gpc_reg_operand" "")
1951 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1953 (minus:SI (match_dup 2) (match_dup 1))))]
1954 "TARGET_POWER && reload_completed"
1956 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1958 (minus:SI (match_dup 2) (match_dup 1))))
1960 (compare:CC (match_dup 0)
1964 ;; We don't need abs with condition code because such comparisons should
1966 (define_expand "abssi2"
1967 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1968 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1974 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1977 else if (! TARGET_POWER)
1979 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1984 (define_insn "*abssi2_power"
1985 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1986 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1990 (define_insn_and_split "abssi2_isel"
1991 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1992 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1993 (clobber (match_scratch:SI 2 "=&b"))
1994 (clobber (match_scratch:CC 3 "=y"))]
1997 "&& reload_completed"
1998 [(set (match_dup 2) (neg:SI (match_dup 1)))
2000 (compare:CC (match_dup 1)
2003 (if_then_else:SI (ge (match_dup 3)
2009 (define_insn_and_split "abssi2_nopower"
2010 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2011 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2012 (clobber (match_scratch:SI 2 "=&r,&r"))]
2013 "! TARGET_POWER && ! TARGET_ISEL"
2015 "&& reload_completed"
2016 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2017 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2018 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2021 (define_insn "*nabs_power"
2022 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2023 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2027 (define_insn_and_split "*nabs_nopower"
2028 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2029 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2030 (clobber (match_scratch:SI 2 "=&r,&r"))]
2033 "&& reload_completed"
2034 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2035 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2036 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2039 (define_expand "neg<mode>2"
2040 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2041 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2045 (define_insn "*neg<mode>2_internal"
2046 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2047 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2052 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2053 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2055 (clobber (match_scratch:P 2 "=r,r"))]
2060 [(set_attr "type" "fast_compare")
2061 (set_attr "length" "4,8")])
2064 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2065 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2067 (clobber (match_scratch:P 2 ""))]
2070 (neg:P (match_dup 1)))
2072 (compare:CC (match_dup 2)
2077 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2078 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2080 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2081 (neg:P (match_dup 1)))]
2086 [(set_attr "type" "fast_compare")
2087 (set_attr "length" "4,8")])
2090 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2091 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2093 (set (match_operand:P 0 "gpc_reg_operand" "")
2094 (neg:P (match_dup 1)))]
2097 (neg:P (match_dup 1)))
2099 (compare:CC (match_dup 0)
2103 (define_insn "clz<mode>2"
2104 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2105 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2107 "{cntlz|cntlz<wd>} %0,%1"
2108 [(set_attr "type" "cntlz")])
2110 (define_expand "ctz<mode>2"
2112 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2113 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2115 (clobber (scratch:CC))])
2116 (set (match_dup 4) (clz:GPR (match_dup 3)))
2117 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2118 (minus:GPR (match_dup 5) (match_dup 4)))]
2121 operands[2] = gen_reg_rtx (<MODE>mode);
2122 operands[3] = gen_reg_rtx (<MODE>mode);
2123 operands[4] = gen_reg_rtx (<MODE>mode);
2124 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2127 (define_expand "ffs<mode>2"
2129 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2130 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2132 (clobber (scratch:CC))])
2133 (set (match_dup 4) (clz:GPR (match_dup 3)))
2134 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2135 (minus:GPR (match_dup 5) (match_dup 4)))]
2138 operands[2] = gen_reg_rtx (<MODE>mode);
2139 operands[3] = gen_reg_rtx (<MODE>mode);
2140 operands[4] = gen_reg_rtx (<MODE>mode);
2141 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2144 (define_expand "popcount<mode>2"
2146 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2149 (mult:GPR (match_dup 2) (match_dup 4)))
2150 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2151 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
2154 operands[2] = gen_reg_rtx (<MODE>mode);
2155 operands[3] = gen_reg_rtx (<MODE>mode);
2156 operands[4] = force_reg (<MODE>mode,
2157 <MODE>mode == SImode
2158 ? GEN_INT (0x01010101)
2159 : GEN_INT ((HOST_WIDE_INT)
2160 0x01010101 << 32 | 0x01010101));
2161 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 8);
2164 (define_insn "popcntb<mode>2"
2165 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2166 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2171 (define_expand "mulsi3"
2172 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2173 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2174 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2179 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2181 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2185 (define_insn "mulsi3_mq"
2186 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2187 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2188 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2189 (clobber (match_scratch:SI 3 "=q,q"))]
2192 {muls|mullw} %0,%1,%2
2193 {muli|mulli} %0,%1,%2"
2195 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2196 (const_string "imul3")
2197 (match_operand:SI 2 "short_cint_operand" "")
2198 (const_string "imul2")]
2199 (const_string "imul")))])
2201 (define_insn "mulsi3_no_mq"
2202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2203 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2204 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2207 {muls|mullw} %0,%1,%2
2208 {muli|mulli} %0,%1,%2"
2210 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2211 (const_string "imul3")
2212 (match_operand:SI 2 "short_cint_operand" "")
2213 (const_string "imul2")]
2214 (const_string "imul")))])
2216 (define_insn "*mulsi3_mq_internal1"
2217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2218 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2219 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2221 (clobber (match_scratch:SI 3 "=r,r"))
2222 (clobber (match_scratch:SI 4 "=q,q"))]
2225 {muls.|mullw.} %3,%1,%2
2227 [(set_attr "type" "imul_compare")
2228 (set_attr "length" "4,8")])
2231 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2232 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2233 (match_operand:SI 2 "gpc_reg_operand" ""))
2235 (clobber (match_scratch:SI 3 ""))
2236 (clobber (match_scratch:SI 4 ""))]
2237 "TARGET_POWER && reload_completed"
2238 [(parallel [(set (match_dup 3)
2239 (mult:SI (match_dup 1) (match_dup 2)))
2240 (clobber (match_dup 4))])
2242 (compare:CC (match_dup 3)
2246 (define_insn "*mulsi3_no_mq_internal1"
2247 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2248 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2249 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2251 (clobber (match_scratch:SI 3 "=r,r"))]
2254 {muls.|mullw.} %3,%1,%2
2256 [(set_attr "type" "imul_compare")
2257 (set_attr "length" "4,8")])
2260 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2261 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2262 (match_operand:SI 2 "gpc_reg_operand" ""))
2264 (clobber (match_scratch:SI 3 ""))]
2265 "! TARGET_POWER && reload_completed"
2267 (mult:SI (match_dup 1) (match_dup 2)))
2269 (compare:CC (match_dup 3)
2273 (define_insn "*mulsi3_mq_internal2"
2274 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2275 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2276 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2278 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2279 (mult:SI (match_dup 1) (match_dup 2)))
2280 (clobber (match_scratch:SI 4 "=q,q"))]
2283 {muls.|mullw.} %0,%1,%2
2285 [(set_attr "type" "imul_compare")
2286 (set_attr "length" "4,8")])
2289 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2290 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2291 (match_operand:SI 2 "gpc_reg_operand" ""))
2293 (set (match_operand:SI 0 "gpc_reg_operand" "")
2294 (mult:SI (match_dup 1) (match_dup 2)))
2295 (clobber (match_scratch:SI 4 ""))]
2296 "TARGET_POWER && reload_completed"
2297 [(parallel [(set (match_dup 0)
2298 (mult:SI (match_dup 1) (match_dup 2)))
2299 (clobber (match_dup 4))])
2301 (compare:CC (match_dup 0)
2305 (define_insn "*mulsi3_no_mq_internal2"
2306 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2307 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2308 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2310 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2311 (mult:SI (match_dup 1) (match_dup 2)))]
2314 {muls.|mullw.} %0,%1,%2
2316 [(set_attr "type" "imul_compare")
2317 (set_attr "length" "4,8")])
2320 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2321 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2322 (match_operand:SI 2 "gpc_reg_operand" ""))
2324 (set (match_operand:SI 0 "gpc_reg_operand" "")
2325 (mult:SI (match_dup 1) (match_dup 2)))]
2326 "! TARGET_POWER && reload_completed"
2328 (mult:SI (match_dup 1) (match_dup 2)))
2330 (compare:CC (match_dup 0)
2334 ;; Operand 1 is divided by operand 2; quotient goes to operand
2335 ;; 0 and remainder to operand 3.
2336 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2338 (define_expand "divmodsi4"
2339 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2340 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2341 (match_operand:SI 2 "gpc_reg_operand" "")))
2342 (set (match_operand:SI 3 "register_operand" "")
2343 (mod:SI (match_dup 1) (match_dup 2)))])]
2344 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2347 if (! TARGET_POWER && ! TARGET_POWERPC)
2349 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2350 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2351 emit_insn (gen_divss_call ());
2352 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2353 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2358 (define_insn "*divmodsi4_internal"
2359 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2360 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2361 (match_operand:SI 2 "gpc_reg_operand" "r")))
2362 (set (match_operand:SI 3 "register_operand" "=q")
2363 (mod:SI (match_dup 1) (match_dup 2)))]
2366 [(set_attr "type" "idiv")])
2368 (define_expand "udiv<mode>3"
2369 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2370 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2371 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2372 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2375 if (! TARGET_POWER && ! TARGET_POWERPC)
2377 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2378 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2379 emit_insn (gen_quous_call ());
2380 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2383 else if (TARGET_POWER)
2385 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2390 (define_insn "udivsi3_mq"
2391 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2392 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2393 (match_operand:SI 2 "gpc_reg_operand" "r")))
2394 (clobber (match_scratch:SI 3 "=q"))]
2395 "TARGET_POWERPC && TARGET_POWER"
2397 [(set_attr "type" "idiv")])
2399 (define_insn "*udivsi3_no_mq"
2400 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2401 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2402 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2403 "TARGET_POWERPC && ! TARGET_POWER"
2406 (cond [(match_operand:SI 0 "" "")
2407 (const_string "idiv")]
2408 (const_string "ldiv")))])
2411 ;; For powers of two we can do srai/aze for divide and then adjust for
2412 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2413 ;; used; for PowerPC, force operands into register and do a normal divide;
2414 ;; for AIX common-mode, use quoss call on register operands.
2415 (define_expand "div<mode>3"
2416 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2417 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2418 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2422 if (GET_CODE (operands[2]) == CONST_INT
2423 && INTVAL (operands[2]) > 0
2424 && exact_log2 (INTVAL (operands[2])) >= 0)
2426 else if (TARGET_POWERPC)
2428 operands[2] = force_reg (SImode, operands[2]);
2431 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2435 else if (TARGET_POWER)
2439 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2440 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2441 emit_insn (gen_quoss_call ());
2442 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2447 (define_insn "divsi3_mq"
2448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2449 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2450 (match_operand:SI 2 "gpc_reg_operand" "r")))
2451 (clobber (match_scratch:SI 3 "=q"))]
2452 "TARGET_POWERPC && TARGET_POWER"
2454 [(set_attr "type" "idiv")])
2456 (define_insn "*div<mode>3_no_mq"
2457 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2458 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2459 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2460 "TARGET_POWERPC && ! TARGET_POWER"
2463 (cond [(match_operand:SI 0 "" "")
2464 (const_string "idiv")]
2465 (const_string "ldiv")))])
2467 (define_expand "mod<mode>3"
2468 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2469 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2470 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2478 if (GET_CODE (operands[2]) != CONST_INT
2479 || INTVAL (operands[2]) <= 0
2480 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2483 temp1 = gen_reg_rtx (<MODE>mode);
2484 temp2 = gen_reg_rtx (<MODE>mode);
2486 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2487 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2488 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2493 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2494 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2495 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2497 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2498 [(set_attr "type" "two")
2499 (set_attr "length" "8")])
2502 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2503 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2504 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2506 (clobber (match_scratch:P 3 "=r,r"))]
2509 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2511 [(set_attr "type" "compare")
2512 (set_attr "length" "8,12")])
2515 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2516 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2517 (match_operand:GPR 2 "exact_log2_cint_operand"
2520 (clobber (match_scratch:GPR 3 ""))]
2523 (div:<MODE> (match_dup 1) (match_dup 2)))
2525 (compare:CC (match_dup 3)
2530 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2531 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2532 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2534 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2535 (div:P (match_dup 1) (match_dup 2)))]
2538 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2540 [(set_attr "type" "compare")
2541 (set_attr "length" "8,12")])
2544 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2545 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2546 (match_operand:GPR 2 "exact_log2_cint_operand"
2549 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2550 (div:GPR (match_dup 1) (match_dup 2)))]
2553 (div:<MODE> (match_dup 1) (match_dup 2)))
2555 (compare:CC (match_dup 0)
2560 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2563 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2565 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2566 (match_operand:SI 3 "gpc_reg_operand" "r")))
2567 (set (match_operand:SI 2 "register_operand" "=*q")
2570 (zero_extend:DI (match_dup 1)) (const_int 32))
2571 (zero_extend:DI (match_dup 4)))
2575 [(set_attr "type" "idiv")])
2577 ;; To do unsigned divide we handle the cases of the divisor looking like a
2578 ;; negative number. If it is a constant that is less than 2**31, we don't
2579 ;; have to worry about the branches. So make a few subroutines here.
2581 ;; First comes the normal case.
2582 (define_expand "udivmodsi4_normal"
2583 [(set (match_dup 4) (const_int 0))
2584 (parallel [(set (match_operand:SI 0 "" "")
2585 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2587 (zero_extend:DI (match_operand:SI 1 "" "")))
2588 (match_operand:SI 2 "" "")))
2589 (set (match_operand:SI 3 "" "")
2590 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2592 (zero_extend:DI (match_dup 1)))
2596 { operands[4] = gen_reg_rtx (SImode); }")
2598 ;; This handles the branches.
2599 (define_expand "udivmodsi4_tests"
2600 [(set (match_operand:SI 0 "" "") (const_int 0))
2601 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2602 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2603 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2604 (label_ref (match_operand:SI 4 "" "")) (pc)))
2605 (set (match_dup 0) (const_int 1))
2606 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2607 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2608 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2609 (label_ref (match_dup 4)) (pc)))]
2612 { operands[5] = gen_reg_rtx (CCUNSmode);
2613 operands[6] = gen_reg_rtx (CCmode);
2616 (define_expand "udivmodsi4"
2617 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2618 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2619 (match_operand:SI 2 "reg_or_cint_operand" "")))
2620 (set (match_operand:SI 3 "gpc_reg_operand" "")
2621 (umod:SI (match_dup 1) (match_dup 2)))])]
2629 if (! TARGET_POWERPC)
2631 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2632 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2633 emit_insn (gen_divus_call ());
2634 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2635 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2642 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2644 operands[2] = force_reg (SImode, operands[2]);
2645 label = gen_label_rtx ();
2646 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2647 operands[3], label));
2650 operands[2] = force_reg (SImode, operands[2]);
2652 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2660 ;; AIX architecture-independent common-mode multiply (DImode),
2661 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2662 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2663 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2664 ;; assumed unused if generating common-mode, so ignore.
2665 (define_insn "mulh_call"
2668 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2669 (sign_extend:DI (reg:SI 4)))
2671 (clobber (match_scratch:SI 0 "=l"))]
2672 "! TARGET_POWER && ! TARGET_POWERPC"
2674 [(set_attr "type" "imul")])
2676 (define_insn "mull_call"
2678 (mult:DI (sign_extend:DI (reg:SI 3))
2679 (sign_extend:DI (reg:SI 4))))
2680 (clobber (match_scratch:SI 0 "=l"))
2681 (clobber (reg:SI 0))]
2682 "! TARGET_POWER && ! TARGET_POWERPC"
2684 [(set_attr "type" "imul")])
2686 (define_insn "divss_call"
2688 (div:SI (reg:SI 3) (reg:SI 4)))
2690 (mod:SI (reg:SI 3) (reg:SI 4)))
2691 (clobber (match_scratch:SI 0 "=l"))
2692 (clobber (reg:SI 0))]
2693 "! TARGET_POWER && ! TARGET_POWERPC"
2695 [(set_attr "type" "idiv")])
2697 (define_insn "divus_call"
2699 (udiv:SI (reg:SI 3) (reg:SI 4)))
2701 (umod:SI (reg:SI 3) (reg:SI 4)))
2702 (clobber (match_scratch:SI 0 "=l"))
2703 (clobber (reg:SI 0))
2704 (clobber (match_scratch:CC 1 "=x"))
2705 (clobber (reg:CC 69))]
2706 "! TARGET_POWER && ! TARGET_POWERPC"
2708 [(set_attr "type" "idiv")])
2710 (define_insn "quoss_call"
2712 (div:SI (reg:SI 3) (reg:SI 4)))
2713 (clobber (match_scratch:SI 0 "=l"))]
2714 "! TARGET_POWER && ! TARGET_POWERPC"
2716 [(set_attr "type" "idiv")])
2718 (define_insn "quous_call"
2720 (udiv:SI (reg:SI 3) (reg:SI 4)))
2721 (clobber (match_scratch:SI 0 "=l"))
2722 (clobber (reg:SI 0))
2723 (clobber (match_scratch:CC 1 "=x"))
2724 (clobber (reg:CC 69))]
2725 "! TARGET_POWER && ! TARGET_POWERPC"
2727 [(set_attr "type" "idiv")])
2729 ;; Logical instructions
2730 ;; The logical instructions are mostly combined by using match_operator,
2731 ;; but the plain AND insns are somewhat different because there is no
2732 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2733 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2735 (define_insn "andsi3"
2736 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2737 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2738 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2739 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2743 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2744 {andil.|andi.} %0,%1,%b2
2745 {andiu.|andis.} %0,%1,%u2"
2746 [(set_attr "type" "*,*,compare,compare")])
2748 ;; Note to set cr's other than cr0 we do the and immediate and then
2749 ;; the test again -- this avoids a mfcr which on the higher end
2750 ;; machines causes an execution serialization
2752 (define_insn "*andsi3_internal2"
2753 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2754 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2755 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2757 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2758 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2762 {andil.|andi.} %3,%1,%b2
2763 {andiu.|andis.} %3,%1,%u2
2764 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2769 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2770 (set_attr "length" "4,4,4,4,8,8,8,8")])
2772 (define_insn "*andsi3_internal3"
2773 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2774 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2775 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2777 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2778 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2782 {andil.|andi.} %3,%1,%b2
2783 {andiu.|andis.} %3,%1,%u2
2784 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2789 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2790 (set_attr "length" "8,4,4,4,8,8,8,8")])
2793 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2794 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2795 (match_operand:GPR 2 "and_operand" ""))
2797 (clobber (match_scratch:GPR 3 ""))
2798 (clobber (match_scratch:CC 4 ""))]
2800 [(parallel [(set (match_dup 3)
2801 (and:<MODE> (match_dup 1)
2803 (clobber (match_dup 4))])
2805 (compare:CC (match_dup 3)
2809 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2810 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2813 [(set (match_operand:CC 0 "cc_reg_operand" "")
2814 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2815 (match_operand:SI 2 "gpc_reg_operand" ""))
2817 (clobber (match_scratch:SI 3 ""))
2818 (clobber (match_scratch:CC 4 ""))]
2819 "TARGET_POWERPC64 && reload_completed"
2820 [(parallel [(set (match_dup 3)
2821 (and:SI (match_dup 1)
2823 (clobber (match_dup 4))])
2825 (compare:CC (match_dup 3)
2829 (define_insn "*andsi3_internal4"
2830 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2831 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2832 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2834 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2835 (and:SI (match_dup 1)
2837 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2841 {andil.|andi.} %0,%1,%b2
2842 {andiu.|andis.} %0,%1,%u2
2843 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2848 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2849 (set_attr "length" "4,4,4,4,8,8,8,8")])
2851 (define_insn "*andsi3_internal5"
2852 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2853 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2854 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2856 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2857 (and:SI (match_dup 1)
2859 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2863 {andil.|andi.} %0,%1,%b2
2864 {andiu.|andis.} %0,%1,%u2
2865 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2870 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2871 (set_attr "length" "8,4,4,4,8,8,8,8")])
2874 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2875 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2876 (match_operand:SI 2 "and_operand" ""))
2878 (set (match_operand:SI 0 "gpc_reg_operand" "")
2879 (and:SI (match_dup 1)
2881 (clobber (match_scratch:CC 4 ""))]
2883 [(parallel [(set (match_dup 0)
2884 (and:SI (match_dup 1)
2886 (clobber (match_dup 4))])
2888 (compare:CC (match_dup 0)
2893 [(set (match_operand:CC 3 "cc_reg_operand" "")
2894 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2895 (match_operand:SI 2 "gpc_reg_operand" ""))
2897 (set (match_operand:SI 0 "gpc_reg_operand" "")
2898 (and:SI (match_dup 1)
2900 (clobber (match_scratch:CC 4 ""))]
2901 "TARGET_POWERPC64 && reload_completed"
2902 [(parallel [(set (match_dup 0)
2903 (and:SI (match_dup 1)
2905 (clobber (match_dup 4))])
2907 (compare:CC (match_dup 0)
2911 ;; Handle the PowerPC64 rlwinm corner case
2913 (define_insn_and_split "*andsi3_internal6"
2914 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2915 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2916 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2921 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2924 (rotate:SI (match_dup 0) (match_dup 5)))]
2927 int mb = extract_MB (operands[2]);
2928 int me = extract_ME (operands[2]);
2929 operands[3] = GEN_INT (me + 1);
2930 operands[5] = GEN_INT (32 - (me + 1));
2931 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2933 [(set_attr "length" "8")])
2935 (define_expand "iorsi3"
2936 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2937 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2938 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2942 if (GET_CODE (operands[2]) == CONST_INT
2943 && ! logical_operand (operands[2], SImode))
2945 HOST_WIDE_INT value = INTVAL (operands[2]);
2946 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2947 ? operands[0] : gen_reg_rtx (SImode));
2949 emit_insn (gen_iorsi3 (tmp, operands[1],
2950 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2951 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2956 (define_expand "xorsi3"
2957 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2958 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2959 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2963 if (GET_CODE (operands[2]) == CONST_INT
2964 && ! logical_operand (operands[2], SImode))
2966 HOST_WIDE_INT value = INTVAL (operands[2]);
2967 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2968 ? operands[0] : gen_reg_rtx (SImode));
2970 emit_insn (gen_xorsi3 (tmp, operands[1],
2971 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2972 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2977 (define_insn "*boolsi3_internal1"
2978 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2979 (match_operator:SI 3 "boolean_or_operator"
2980 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2981 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2985 {%q3il|%q3i} %0,%1,%b2
2986 {%q3iu|%q3is} %0,%1,%u2")
2988 (define_insn "*boolsi3_internal2"
2989 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2990 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2991 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2992 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2994 (clobber (match_scratch:SI 3 "=r,r"))]
2999 [(set_attr "type" "compare")
3000 (set_attr "length" "4,8")])
3003 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3004 (compare:CC (match_operator:SI 4 "boolean_operator"
3005 [(match_operand:SI 1 "gpc_reg_operand" "")
3006 (match_operand:SI 2 "gpc_reg_operand" "")])
3008 (clobber (match_scratch:SI 3 ""))]
3009 "TARGET_32BIT && reload_completed"
3010 [(set (match_dup 3) (match_dup 4))
3012 (compare:CC (match_dup 3)
3016 (define_insn "*boolsi3_internal3"
3017 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3018 (compare:CC (match_operator:SI 4 "boolean_operator"
3019 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3020 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3022 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3028 [(set_attr "type" "compare")
3029 (set_attr "length" "4,8")])
3032 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3033 (compare:CC (match_operator:SI 4 "boolean_operator"
3034 [(match_operand:SI 1 "gpc_reg_operand" "")
3035 (match_operand:SI 2 "gpc_reg_operand" "")])
3037 (set (match_operand:SI 0 "gpc_reg_operand" "")
3039 "TARGET_32BIT && reload_completed"
3040 [(set (match_dup 0) (match_dup 4))
3042 (compare:CC (match_dup 0)
3046 ;; Split a logical operation that we can't do in one insn into two insns,
3047 ;; each of which does one 16-bit part. This is used by combine.
3050 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3051 (match_operator:SI 3 "boolean_or_operator"
3052 [(match_operand:SI 1 "gpc_reg_operand" "")
3053 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3055 [(set (match_dup 0) (match_dup 4))
3056 (set (match_dup 0) (match_dup 5))]
3060 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3061 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3063 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3064 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3068 (define_insn "*boolcsi3_internal1"
3069 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3070 (match_operator:SI 3 "boolean_operator"
3071 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3072 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3076 (define_insn "*boolcsi3_internal2"
3077 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3078 (compare:CC (match_operator:SI 4 "boolean_operator"
3079 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3080 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3082 (clobber (match_scratch:SI 3 "=r,r"))]
3087 [(set_attr "type" "compare")
3088 (set_attr "length" "4,8")])
3091 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3092 (compare:CC (match_operator:SI 4 "boolean_operator"
3093 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3094 (match_operand:SI 2 "gpc_reg_operand" "")])
3096 (clobber (match_scratch:SI 3 ""))]
3097 "TARGET_32BIT && reload_completed"
3098 [(set (match_dup 3) (match_dup 4))
3100 (compare:CC (match_dup 3)
3104 (define_insn "*boolcsi3_internal3"
3105 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3106 (compare:CC (match_operator:SI 4 "boolean_operator"
3107 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3108 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3110 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3116 [(set_attr "type" "compare")
3117 (set_attr "length" "4,8")])
3120 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3121 (compare:CC (match_operator:SI 4 "boolean_operator"
3122 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3123 (match_operand:SI 2 "gpc_reg_operand" "")])
3125 (set (match_operand:SI 0 "gpc_reg_operand" "")
3127 "TARGET_32BIT && reload_completed"
3128 [(set (match_dup 0) (match_dup 4))
3130 (compare:CC (match_dup 0)
3134 (define_insn "*boolccsi3_internal1"
3135 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3136 (match_operator:SI 3 "boolean_operator"
3137 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3138 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3142 (define_insn "*boolccsi3_internal2"
3143 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3144 (compare:CC (match_operator:SI 4 "boolean_operator"
3145 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3146 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3148 (clobber (match_scratch:SI 3 "=r,r"))]
3153 [(set_attr "type" "compare")
3154 (set_attr "length" "4,8")])
3157 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3158 (compare:CC (match_operator:SI 4 "boolean_operator"
3159 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3160 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3162 (clobber (match_scratch:SI 3 ""))]
3163 "TARGET_32BIT && reload_completed"
3164 [(set (match_dup 3) (match_dup 4))
3166 (compare:CC (match_dup 3)
3170 (define_insn "*boolccsi3_internal3"
3171 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3172 (compare:CC (match_operator:SI 4 "boolean_operator"
3173 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3174 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3176 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3182 [(set_attr "type" "compare")
3183 (set_attr "length" "4,8")])
3186 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3187 (compare:CC (match_operator:SI 4 "boolean_operator"
3188 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3189 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3191 (set (match_operand:SI 0 "gpc_reg_operand" "")
3193 "TARGET_32BIT && reload_completed"
3194 [(set (match_dup 0) (match_dup 4))
3196 (compare:CC (match_dup 0)
3200 ;; maskir insn. We need four forms because things might be in arbitrary
3201 ;; orders. Don't define forms that only set CR fields because these
3202 ;; would modify an input register.
3204 (define_insn "*maskir_internal1"
3205 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3206 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3207 (match_operand:SI 1 "gpc_reg_operand" "0"))
3208 (and:SI (match_dup 2)
3209 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3213 (define_insn "*maskir_internal2"
3214 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3215 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3216 (match_operand:SI 1 "gpc_reg_operand" "0"))
3217 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3222 (define_insn "*maskir_internal3"
3223 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3224 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3225 (match_operand:SI 3 "gpc_reg_operand" "r"))
3226 (and:SI (not:SI (match_dup 2))
3227 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3231 (define_insn "*maskir_internal4"
3232 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3233 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3234 (match_operand:SI 2 "gpc_reg_operand" "r"))
3235 (and:SI (not:SI (match_dup 2))
3236 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3240 (define_insn "*maskir_internal5"
3241 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3243 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3244 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3245 (and:SI (match_dup 2)
3246 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3248 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3249 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3250 (and:SI (match_dup 2) (match_dup 3))))]
3255 [(set_attr "type" "compare")
3256 (set_attr "length" "4,8")])
3259 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3261 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3262 (match_operand:SI 1 "gpc_reg_operand" ""))
3263 (and:SI (match_dup 2)
3264 (match_operand:SI 3 "gpc_reg_operand" "")))
3266 (set (match_operand:SI 0 "gpc_reg_operand" "")
3267 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3268 (and:SI (match_dup 2) (match_dup 3))))]
3269 "TARGET_POWER && reload_completed"
3271 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3272 (and:SI (match_dup 2) (match_dup 3))))
3274 (compare:CC (match_dup 0)
3278 (define_insn "*maskir_internal6"
3279 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3281 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3282 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3283 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3286 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3287 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3288 (and:SI (match_dup 3) (match_dup 2))))]
3293 [(set_attr "type" "compare")
3294 (set_attr "length" "4,8")])
3297 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3299 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3300 (match_operand:SI 1 "gpc_reg_operand" ""))
3301 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3304 (set (match_operand:SI 0 "gpc_reg_operand" "")
3305 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3306 (and:SI (match_dup 3) (match_dup 2))))]
3307 "TARGET_POWER && reload_completed"
3309 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3310 (and:SI (match_dup 3) (match_dup 2))))
3312 (compare:CC (match_dup 0)
3316 (define_insn "*maskir_internal7"
3317 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3319 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3320 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3321 (and:SI (not:SI (match_dup 2))
3322 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3324 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3325 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3326 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3331 [(set_attr "type" "compare")
3332 (set_attr "length" "4,8")])
3335 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3337 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3338 (match_operand:SI 3 "gpc_reg_operand" ""))
3339 (and:SI (not:SI (match_dup 2))
3340 (match_operand:SI 1 "gpc_reg_operand" "")))
3342 (set (match_operand:SI 0 "gpc_reg_operand" "")
3343 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3344 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3345 "TARGET_POWER && reload_completed"
3347 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3348 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3350 (compare:CC (match_dup 0)
3354 (define_insn "*maskir_internal8"
3355 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3357 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3358 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3359 (and:SI (not:SI (match_dup 2))
3360 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3362 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3363 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3364 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3369 [(set_attr "type" "compare")
3370 (set_attr "length" "4,8")])
3373 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3375 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3376 (match_operand:SI 2 "gpc_reg_operand" ""))
3377 (and:SI (not:SI (match_dup 2))
3378 (match_operand:SI 1 "gpc_reg_operand" "")))
3380 (set (match_operand:SI 0 "gpc_reg_operand" "")
3381 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3382 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3383 "TARGET_POWER && reload_completed"
3385 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3386 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3388 (compare:CC (match_dup 0)
3392 ;; Rotate and shift insns, in all their variants. These support shifts,
3393 ;; field inserts and extracts, and various combinations thereof.
3394 (define_expand "insv"
3395 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3396 (match_operand:SI 1 "const_int_operand" "")
3397 (match_operand:SI 2 "const_int_operand" ""))
3398 (match_operand 3 "gpc_reg_operand" ""))]
3402 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3403 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3404 compiler if the address of the structure is taken later. */
3405 if (GET_CODE (operands[0]) == SUBREG
3406 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3409 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3410 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3412 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3416 (define_insn "insvsi"
3417 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3418 (match_operand:SI 1 "const_int_operand" "i")
3419 (match_operand:SI 2 "const_int_operand" "i"))
3420 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3424 int start = INTVAL (operands[2]) & 31;
3425 int size = INTVAL (operands[1]) & 31;
3427 operands[4] = GEN_INT (32 - start - size);
3428 operands[1] = GEN_INT (start + size - 1);
3429 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3431 [(set_attr "type" "insert_word")])
3433 (define_insn "*insvsi_internal1"
3434 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3435 (match_operand:SI 1 "const_int_operand" "i")
3436 (match_operand:SI 2 "const_int_operand" "i"))
3437 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3438 (match_operand:SI 4 "const_int_operand" "i")))]
3439 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3442 int shift = INTVAL (operands[4]) & 31;
3443 int start = INTVAL (operands[2]) & 31;
3444 int size = INTVAL (operands[1]) & 31;
3446 operands[4] = GEN_INT (shift - start - size);
3447 operands[1] = GEN_INT (start + size - 1);
3448 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3450 [(set_attr "type" "insert_word")])
3452 (define_insn "*insvsi_internal2"
3453 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3454 (match_operand:SI 1 "const_int_operand" "i")
3455 (match_operand:SI 2 "const_int_operand" "i"))
3456 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3457 (match_operand:SI 4 "const_int_operand" "i")))]
3458 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3461 int shift = INTVAL (operands[4]) & 31;
3462 int start = INTVAL (operands[2]) & 31;
3463 int size = INTVAL (operands[1]) & 31;
3465 operands[4] = GEN_INT (32 - shift - start - size);
3466 operands[1] = GEN_INT (start + size - 1);
3467 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3469 [(set_attr "type" "insert_word")])
3471 (define_insn "*insvsi_internal3"
3472 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3473 (match_operand:SI 1 "const_int_operand" "i")
3474 (match_operand:SI 2 "const_int_operand" "i"))
3475 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3476 (match_operand:SI 4 "const_int_operand" "i")))]
3477 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3480 int shift = INTVAL (operands[4]) & 31;
3481 int start = INTVAL (operands[2]) & 31;
3482 int size = INTVAL (operands[1]) & 31;
3484 operands[4] = GEN_INT (32 - shift - start - size);
3485 operands[1] = GEN_INT (start + size - 1);
3486 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3488 [(set_attr "type" "insert_word")])
3490 (define_insn "*insvsi_internal4"
3491 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3492 (match_operand:SI 1 "const_int_operand" "i")
3493 (match_operand:SI 2 "const_int_operand" "i"))
3494 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3495 (match_operand:SI 4 "const_int_operand" "i")
3496 (match_operand:SI 5 "const_int_operand" "i")))]
3497 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3500 int extract_start = INTVAL (operands[5]) & 31;
3501 int extract_size = INTVAL (operands[4]) & 31;
3502 int insert_start = INTVAL (operands[2]) & 31;
3503 int insert_size = INTVAL (operands[1]) & 31;
3505 /* Align extract field with insert field */
3506 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3507 operands[1] = GEN_INT (insert_start + insert_size - 1);
3508 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3510 [(set_attr "type" "insert_word")])
3512 ;; combine patterns for rlwimi
3513 (define_insn "*insvsi_internal5"
3514 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3515 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3516 (match_operand:SI 1 "mask_operand" "i"))
3517 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3518 (match_operand:SI 2 "const_int_operand" "i"))
3519 (match_operand:SI 5 "mask_operand" "i"))))]
3520 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3523 int me = extract_ME(operands[5]);
3524 int mb = extract_MB(operands[5]);
3525 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3526 operands[2] = GEN_INT(mb);
3527 operands[1] = GEN_INT(me);
3528 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3530 [(set_attr "type" "insert_word")])
3532 (define_insn "*insvsi_internal6"
3533 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3534 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3535 (match_operand:SI 2 "const_int_operand" "i"))
3536 (match_operand:SI 5 "mask_operand" "i"))
3537 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3538 (match_operand:SI 1 "mask_operand" "i"))))]
3539 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3542 int me = extract_ME(operands[5]);
3543 int mb = extract_MB(operands[5]);
3544 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3545 operands[2] = GEN_INT(mb);
3546 operands[1] = GEN_INT(me);
3547 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3549 [(set_attr "type" "insert_word")])
3551 (define_insn "insvdi"
3552 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3553 (match_operand:SI 1 "const_int_operand" "i")
3554 (match_operand:SI 2 "const_int_operand" "i"))
3555 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3559 int start = INTVAL (operands[2]) & 63;
3560 int size = INTVAL (operands[1]) & 63;
3562 operands[1] = GEN_INT (64 - start - size);
3563 return \"rldimi %0,%3,%H1,%H2\";
3565 [(set_attr "type" "insert_dword")])
3567 (define_insn "*insvdi_internal2"
3568 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3569 (match_operand:SI 1 "const_int_operand" "i")
3570 (match_operand:SI 2 "const_int_operand" "i"))
3571 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3572 (match_operand:SI 4 "const_int_operand" "i")))]
3574 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3577 int shift = INTVAL (operands[4]) & 63;
3578 int start = (INTVAL (operands[2]) & 63) - 32;
3579 int size = INTVAL (operands[1]) & 63;
3581 operands[4] = GEN_INT (64 - shift - start - size);
3582 operands[2] = GEN_INT (start);
3583 operands[1] = GEN_INT (start + size - 1);
3584 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3587 (define_insn "*insvdi_internal3"
3588 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3589 (match_operand:SI 1 "const_int_operand" "i")
3590 (match_operand:SI 2 "const_int_operand" "i"))
3591 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3592 (match_operand:SI 4 "const_int_operand" "i")))]
3594 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3597 int shift = INTVAL (operands[4]) & 63;
3598 int start = (INTVAL (operands[2]) & 63) - 32;
3599 int size = INTVAL (operands[1]) & 63;
3601 operands[4] = GEN_INT (64 - shift - start - size);
3602 operands[2] = GEN_INT (start);
3603 operands[1] = GEN_INT (start + size - 1);
3604 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3607 (define_expand "extzv"
3608 [(set (match_operand 0 "gpc_reg_operand" "")
3609 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3610 (match_operand:SI 2 "const_int_operand" "")
3611 (match_operand:SI 3 "const_int_operand" "")))]
3615 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3616 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3617 compiler if the address of the structure is taken later. */
3618 if (GET_CODE (operands[0]) == SUBREG
3619 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3622 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3623 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3625 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3629 (define_insn "extzvsi"
3630 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3631 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3632 (match_operand:SI 2 "const_int_operand" "i")
3633 (match_operand:SI 3 "const_int_operand" "i")))]
3637 int start = INTVAL (operands[3]) & 31;
3638 int size = INTVAL (operands[2]) & 31;
3640 if (start + size >= 32)
3641 operands[3] = const0_rtx;
3643 operands[3] = GEN_INT (start + size);
3644 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3647 (define_insn "*extzvsi_internal1"
3648 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3649 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3650 (match_operand:SI 2 "const_int_operand" "i,i")
3651 (match_operand:SI 3 "const_int_operand" "i,i"))
3653 (clobber (match_scratch:SI 4 "=r,r"))]
3657 int start = INTVAL (operands[3]) & 31;
3658 int size = INTVAL (operands[2]) & 31;
3660 /* Force split for non-cc0 compare. */
3661 if (which_alternative == 1)
3664 /* If the bit-field being tested fits in the upper or lower half of a
3665 word, it is possible to use andiu. or andil. to test it. This is
3666 useful because the condition register set-use delay is smaller for
3667 andi[ul]. than for rlinm. This doesn't work when the starting bit
3668 position is 0 because the LT and GT bits may be set wrong. */
3670 if ((start > 0 && start + size <= 16) || start >= 16)
3672 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3673 - (1 << (16 - (start & 15) - size))));
3675 return \"{andiu.|andis.} %4,%1,%3\";
3677 return \"{andil.|andi.} %4,%1,%3\";
3680 if (start + size >= 32)
3681 operands[3] = const0_rtx;
3683 operands[3] = GEN_INT (start + size);
3684 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3686 [(set_attr "type" "delayed_compare")
3687 (set_attr "length" "4,8")])
3690 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3691 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3692 (match_operand:SI 2 "const_int_operand" "")
3693 (match_operand:SI 3 "const_int_operand" ""))
3695 (clobber (match_scratch:SI 4 ""))]
3698 (zero_extract:SI (match_dup 1) (match_dup 2)
3701 (compare:CC (match_dup 4)
3705 (define_insn "*extzvsi_internal2"
3706 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3707 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3708 (match_operand:SI 2 "const_int_operand" "i,i")
3709 (match_operand:SI 3 "const_int_operand" "i,i"))
3711 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3712 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3716 int start = INTVAL (operands[3]) & 31;
3717 int size = INTVAL (operands[2]) & 31;
3719 /* Force split for non-cc0 compare. */
3720 if (which_alternative == 1)
3723 /* Since we are using the output value, we can't ignore any need for
3724 a shift. The bit-field must end at the LSB. */
3725 if (start >= 16 && start + size == 32)
3727 operands[3] = GEN_INT ((1 << size) - 1);
3728 return \"{andil.|andi.} %0,%1,%3\";
3731 if (start + size >= 32)
3732 operands[3] = const0_rtx;
3734 operands[3] = GEN_INT (start + size);
3735 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3737 [(set_attr "type" "delayed_compare")
3738 (set_attr "length" "4,8")])
3741 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3742 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3743 (match_operand:SI 2 "const_int_operand" "")
3744 (match_operand:SI 3 "const_int_operand" ""))
3746 (set (match_operand:SI 0 "gpc_reg_operand" "")
3747 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3750 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3752 (compare:CC (match_dup 0)
3756 (define_insn "extzvdi"
3757 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3758 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3759 (match_operand:SI 2 "const_int_operand" "i")
3760 (match_operand:SI 3 "const_int_operand" "i")))]
3764 int start = INTVAL (operands[3]) & 63;
3765 int size = INTVAL (operands[2]) & 63;
3767 if (start + size >= 64)
3768 operands[3] = const0_rtx;
3770 operands[3] = GEN_INT (start + size);
3771 operands[2] = GEN_INT (64 - size);
3772 return \"rldicl %0,%1,%3,%2\";
3775 (define_insn "*extzvdi_internal1"
3776 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3777 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3778 (match_operand:SI 2 "const_int_operand" "i")
3779 (match_operand:SI 3 "const_int_operand" "i"))
3781 (clobber (match_scratch:DI 4 "=r"))]
3785 int start = INTVAL (operands[3]) & 63;
3786 int size = INTVAL (operands[2]) & 63;
3788 if (start + size >= 64)
3789 operands[3] = const0_rtx;
3791 operands[3] = GEN_INT (start + size);
3792 operands[2] = GEN_INT (64 - size);
3793 return \"rldicl. %4,%1,%3,%2\";
3795 [(set_attr "type" "compare")])
3797 (define_insn "*extzvdi_internal2"
3798 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3799 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3800 (match_operand:SI 2 "const_int_operand" "i")
3801 (match_operand:SI 3 "const_int_operand" "i"))
3803 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3804 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3808 int start = INTVAL (operands[3]) & 63;
3809 int size = INTVAL (operands[2]) & 63;
3811 if (start + size >= 64)
3812 operands[3] = const0_rtx;
3814 operands[3] = GEN_INT (start + size);
3815 operands[2] = GEN_INT (64 - size);
3816 return \"rldicl. %0,%1,%3,%2\";
3818 [(set_attr "type" "compare")])
3820 (define_insn "rotlsi3"
3821 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3822 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3823 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3826 {rlnm|rlwnm} %0,%1,%2,0xffffffff
3827 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
3828 [(set_attr "type" "var_shift_rotate,integer")])
3830 (define_insn "*rotlsi3_internal2"
3831 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3832 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3833 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3835 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3838 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
3839 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
3842 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3843 (set_attr "length" "4,4,8,8")])
3846 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3847 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3848 (match_operand:SI 2 "reg_or_cint_operand" ""))
3850 (clobber (match_scratch:SI 3 ""))]
3853 (rotate:SI (match_dup 1) (match_dup 2)))
3855 (compare:CC (match_dup 3)
3859 (define_insn "*rotlsi3_internal3"
3860 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3861 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3862 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3864 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3865 (rotate:SI (match_dup 1) (match_dup 2)))]
3868 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
3869 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
3872 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3873 (set_attr "length" "4,4,8,8")])
3876 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3877 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3878 (match_operand:SI 2 "reg_or_cint_operand" ""))
3880 (set (match_operand:SI 0 "gpc_reg_operand" "")
3881 (rotate:SI (match_dup 1) (match_dup 2)))]
3884 (rotate:SI (match_dup 1) (match_dup 2)))
3886 (compare:CC (match_dup 0)
3890 (define_insn "*rotlsi3_internal4"
3891 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3892 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3893 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3894 (match_operand:SI 3 "mask_operand" "n,n")))]
3897 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
3898 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
3899 [(set_attr "type" "var_shift_rotate,integer")])
3901 (define_insn "*rotlsi3_internal5"
3902 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3904 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3905 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3906 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3908 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3911 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
3912 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3915 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3916 (set_attr "length" "4,4,8,8")])
3919 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3921 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3922 (match_operand:SI 2 "reg_or_cint_operand" ""))
3923 (match_operand:SI 3 "mask_operand" ""))
3925 (clobber (match_scratch:SI 4 ""))]
3928 (and:SI (rotate:SI (match_dup 1)
3932 (compare:CC (match_dup 4)
3936 (define_insn "*rotlsi3_internal6"
3937 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3939 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3940 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3941 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3943 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3944 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3947 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
3948 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3951 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3952 (set_attr "length" "4,4,8,8")])
3955 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3957 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3958 (match_operand:SI 2 "reg_or_cint_operand" ""))
3959 (match_operand:SI 3 "mask_operand" ""))
3961 (set (match_operand:SI 0 "gpc_reg_operand" "")
3962 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3965 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3967 (compare:CC (match_dup 0)
3971 (define_insn "*rotlsi3_internal7"
3972 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3975 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3976 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3978 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3980 (define_insn "*rotlsi3_internal8"
3981 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3982 (compare:CC (zero_extend:SI
3984 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3985 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3987 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3990 {rlnm.|rlwnm.} %3,%1,%2,0xff
3991 {rlinm.|rlwinm.} %3,%1,%h2,0xff
3994 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3995 (set_attr "length" "4,4,8,8")])
3998 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3999 (compare:CC (zero_extend:SI
4001 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4002 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4004 (clobber (match_scratch:SI 3 ""))]
4007 (zero_extend:SI (subreg:QI
4008 (rotate:SI (match_dup 1)
4011 (compare:CC (match_dup 3)
4015 (define_insn "*rotlsi3_internal9"
4016 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4017 (compare:CC (zero_extend:SI
4019 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4020 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4022 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4023 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4026 {rlnm.|rlwnm.} %0,%1,%2,0xff
4027 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4030 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4031 (set_attr "length" "4,4,8,8")])
4034 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4035 (compare:CC (zero_extend:SI
4037 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4038 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4040 (set (match_operand:SI 0 "gpc_reg_operand" "")
4041 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4044 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4046 (compare:CC (match_dup 0)
4050 (define_insn "*rotlsi3_internal10"
4051 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4054 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4055 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4058 {rlnm|rlwnm} %0,%1,%2,0xffff
4059 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4060 [(set_attr "type" "var_shift_rotate,integer")])
4063 (define_insn "*rotlsi3_internal11"
4064 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4065 (compare:CC (zero_extend:SI
4067 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4068 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4070 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4073 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4074 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4077 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4078 (set_attr "length" "4,4,8,8")])
4081 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4082 (compare:CC (zero_extend:SI
4084 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4085 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4087 (clobber (match_scratch:SI 3 ""))]
4090 (zero_extend:SI (subreg:HI
4091 (rotate:SI (match_dup 1)
4094 (compare:CC (match_dup 3)
4098 (define_insn "*rotlsi3_internal12"
4099 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4100 (compare:CC (zero_extend:SI
4102 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4103 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4105 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4106 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4109 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4110 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4113 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4114 (set_attr "length" "4,4,8,8")])
4117 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4118 (compare:CC (zero_extend:SI
4120 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4121 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4123 (set (match_operand:SI 0 "gpc_reg_operand" "")
4124 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4127 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4129 (compare:CC (match_dup 0)
4133 ;; Note that we use "sle." instead of "sl." so that we can set
4134 ;; SHIFT_COUNT_TRUNCATED.
4136 (define_expand "ashlsi3"
4137 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4138 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4139 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4144 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4146 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4150 (define_insn "ashlsi3_power"
4151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4152 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4153 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4154 (clobber (match_scratch:SI 3 "=q,X"))]
4158 {sli|slwi} %0,%1,%h2")
4160 (define_insn "ashlsi3_no_power"
4161 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4162 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4163 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4167 {sli|slwi} %0,%1,%h2"
4168 [(set_attr "type" "var_shift_rotate,shift")])
4171 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4172 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4173 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4175 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4176 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4180 {sli.|slwi.} %3,%1,%h2
4183 [(set_attr "type" "delayed_compare")
4184 (set_attr "length" "4,4,8,8")])
4187 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4188 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4189 (match_operand:SI 2 "reg_or_cint_operand" ""))
4191 (clobber (match_scratch:SI 3 ""))
4192 (clobber (match_scratch:SI 4 ""))]
4193 "TARGET_POWER && reload_completed"
4194 [(parallel [(set (match_dup 3)
4195 (ashift:SI (match_dup 1) (match_dup 2)))
4196 (clobber (match_dup 4))])
4198 (compare:CC (match_dup 3)
4203 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4204 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4205 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4207 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4208 "! TARGET_POWER && TARGET_32BIT"
4211 {sli.|slwi.} %3,%1,%h2
4214 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4215 (set_attr "length" "4,4,8,8")])
4218 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4219 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4220 (match_operand:SI 2 "reg_or_cint_operand" ""))
4222 (clobber (match_scratch:SI 3 ""))]
4223 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4225 (ashift:SI (match_dup 1) (match_dup 2)))
4227 (compare:CC (match_dup 3)
4232 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4233 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4234 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4236 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4237 (ashift:SI (match_dup 1) (match_dup 2)))
4238 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4242 {sli.|slwi.} %0,%1,%h2
4245 [(set_attr "type" "delayed_compare")
4246 (set_attr "length" "4,4,8,8")])
4249 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4250 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4251 (match_operand:SI 2 "reg_or_cint_operand" ""))
4253 (set (match_operand:SI 0 "gpc_reg_operand" "")
4254 (ashift:SI (match_dup 1) (match_dup 2)))
4255 (clobber (match_scratch:SI 4 ""))]
4256 "TARGET_POWER && reload_completed"
4257 [(parallel [(set (match_dup 0)
4258 (ashift:SI (match_dup 1) (match_dup 2)))
4259 (clobber (match_dup 4))])
4261 (compare:CC (match_dup 0)
4266 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4267 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4268 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4270 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4271 (ashift:SI (match_dup 1) (match_dup 2)))]
4272 "! TARGET_POWER && TARGET_32BIT"
4275 {sli.|slwi.} %0,%1,%h2
4278 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4279 (set_attr "length" "4,4,8,8")])
4282 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4283 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4284 (match_operand:SI 2 "reg_or_cint_operand" ""))
4286 (set (match_operand:SI 0 "gpc_reg_operand" "")
4287 (ashift:SI (match_dup 1) (match_dup 2)))]
4288 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4290 (ashift:SI (match_dup 1) (match_dup 2)))
4292 (compare:CC (match_dup 0)
4296 (define_insn "rlwinm"
4297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4298 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4299 (match_operand:SI 2 "const_int_operand" "i"))
4300 (match_operand:SI 3 "mask_operand" "n")))]
4301 "includes_lshift_p (operands[2], operands[3])"
4302 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4305 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4307 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4308 (match_operand:SI 2 "const_int_operand" "i,i"))
4309 (match_operand:SI 3 "mask_operand" "n,n"))
4311 (clobber (match_scratch:SI 4 "=r,r"))]
4312 "includes_lshift_p (operands[2], operands[3])"
4314 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4316 [(set_attr "type" "delayed_compare")
4317 (set_attr "length" "4,8")])
4320 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4322 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4323 (match_operand:SI 2 "const_int_operand" ""))
4324 (match_operand:SI 3 "mask_operand" ""))
4326 (clobber (match_scratch:SI 4 ""))]
4327 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4329 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4332 (compare:CC (match_dup 4)
4337 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4339 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4340 (match_operand:SI 2 "const_int_operand" "i,i"))
4341 (match_operand:SI 3 "mask_operand" "n,n"))
4343 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4344 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4345 "includes_lshift_p (operands[2], operands[3])"
4347 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4349 [(set_attr "type" "delayed_compare")
4350 (set_attr "length" "4,8")])
4353 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4355 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4356 (match_operand:SI 2 "const_int_operand" ""))
4357 (match_operand:SI 3 "mask_operand" ""))
4359 (set (match_operand:SI 0 "gpc_reg_operand" "")
4360 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4361 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4363 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4365 (compare:CC (match_dup 0)
4369 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4371 (define_expand "lshrsi3"
4372 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4373 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4374 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4379 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4381 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4385 (define_insn "lshrsi3_power"
4386 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4387 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4388 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4389 (clobber (match_scratch:SI 3 "=q,X,X"))]
4394 {s%A2i|s%A2wi} %0,%1,%h2")
4396 (define_insn "lshrsi3_no_power"
4397 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4398 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4399 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4404 {sri|srwi} %0,%1,%h2"
4405 [(set_attr "type" "integer,var_shift_rotate,shift")])
4408 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4409 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4410 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4412 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4413 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4418 {s%A2i.|s%A2wi.} %3,%1,%h2
4422 [(set_attr "type" "delayed_compare")
4423 (set_attr "length" "4,4,4,8,8,8")])
4426 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4427 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4428 (match_operand:SI 2 "reg_or_cint_operand" ""))
4430 (clobber (match_scratch:SI 3 ""))
4431 (clobber (match_scratch:SI 4 ""))]
4432 "TARGET_POWER && reload_completed"
4433 [(parallel [(set (match_dup 3)
4434 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4435 (clobber (match_dup 4))])
4437 (compare:CC (match_dup 3)
4442 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4443 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4444 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4446 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4447 "! TARGET_POWER && TARGET_32BIT"
4451 {sri.|srwi.} %3,%1,%h2
4455 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4456 (set_attr "length" "4,4,4,8,8,8")])
4459 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4460 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4461 (match_operand:SI 2 "reg_or_cint_operand" ""))
4463 (clobber (match_scratch:SI 3 ""))]
4464 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4466 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4468 (compare:CC (match_dup 3)
4473 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4474 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4475 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4477 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4478 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4479 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4484 {s%A2i.|s%A2wi.} %0,%1,%h2
4488 [(set_attr "type" "delayed_compare")
4489 (set_attr "length" "4,4,4,8,8,8")])
4492 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4493 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4494 (match_operand:SI 2 "reg_or_cint_operand" ""))
4496 (set (match_operand:SI 0 "gpc_reg_operand" "")
4497 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4498 (clobber (match_scratch:SI 4 ""))]
4499 "TARGET_POWER && reload_completed"
4500 [(parallel [(set (match_dup 0)
4501 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4502 (clobber (match_dup 4))])
4504 (compare:CC (match_dup 0)
4509 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4510 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4511 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4513 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4514 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4515 "! TARGET_POWER && TARGET_32BIT"
4519 {sri.|srwi.} %0,%1,%h2
4523 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4524 (set_attr "length" "4,4,4,8,8,8")])
4527 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4528 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4529 (match_operand:SI 2 "reg_or_cint_operand" ""))
4531 (set (match_operand:SI 0 "gpc_reg_operand" "")
4532 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4533 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4535 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4537 (compare:CC (match_dup 0)
4542 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4543 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4544 (match_operand:SI 2 "const_int_operand" "i"))
4545 (match_operand:SI 3 "mask_operand" "n")))]
4546 "includes_rshift_p (operands[2], operands[3])"
4547 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4550 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4552 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4553 (match_operand:SI 2 "const_int_operand" "i,i"))
4554 (match_operand:SI 3 "mask_operand" "n,n"))
4556 (clobber (match_scratch:SI 4 "=r,r"))]
4557 "includes_rshift_p (operands[2], operands[3])"
4559 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4561 [(set_attr "type" "delayed_compare")
4562 (set_attr "length" "4,8")])
4565 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4567 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4568 (match_operand:SI 2 "const_int_operand" ""))
4569 (match_operand:SI 3 "mask_operand" ""))
4571 (clobber (match_scratch:SI 4 ""))]
4572 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4574 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4577 (compare:CC (match_dup 4)
4582 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4584 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4585 (match_operand:SI 2 "const_int_operand" "i,i"))
4586 (match_operand:SI 3 "mask_operand" "n,n"))
4588 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4589 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4590 "includes_rshift_p (operands[2], operands[3])"
4592 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4594 [(set_attr "type" "delayed_compare")
4595 (set_attr "length" "4,8")])
4598 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4600 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4601 (match_operand:SI 2 "const_int_operand" ""))
4602 (match_operand:SI 3 "mask_operand" ""))
4604 (set (match_operand:SI 0 "gpc_reg_operand" "")
4605 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4606 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4608 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4610 (compare:CC (match_dup 0)
4615 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4618 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4619 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4620 "includes_rshift_p (operands[2], GEN_INT (255))"
4621 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4624 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4628 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4629 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4631 (clobber (match_scratch:SI 3 "=r,r"))]
4632 "includes_rshift_p (operands[2], GEN_INT (255))"
4634 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4636 [(set_attr "type" "delayed_compare")
4637 (set_attr "length" "4,8")])
4640 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4644 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4645 (match_operand:SI 2 "const_int_operand" "")) 0))
4647 (clobber (match_scratch:SI 3 ""))]
4648 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4650 (zero_extend:SI (subreg:QI
4651 (lshiftrt:SI (match_dup 1)
4654 (compare:CC (match_dup 3)
4659 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4663 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4664 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4666 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4667 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4668 "includes_rshift_p (operands[2], GEN_INT (255))"
4670 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4672 [(set_attr "type" "delayed_compare")
4673 (set_attr "length" "4,8")])
4676 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4680 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4681 (match_operand:SI 2 "const_int_operand" "")) 0))
4683 (set (match_operand:SI 0 "gpc_reg_operand" "")
4684 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4685 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4687 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4689 (compare:CC (match_dup 0)
4694 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4697 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4698 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4699 "includes_rshift_p (operands[2], GEN_INT (65535))"
4700 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4703 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4707 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4708 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4710 (clobber (match_scratch:SI 3 "=r,r"))]
4711 "includes_rshift_p (operands[2], GEN_INT (65535))"
4713 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4715 [(set_attr "type" "delayed_compare")
4716 (set_attr "length" "4,8")])
4719 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4723 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4724 (match_operand:SI 2 "const_int_operand" "")) 0))
4726 (clobber (match_scratch:SI 3 ""))]
4727 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4729 (zero_extend:SI (subreg:HI
4730 (lshiftrt:SI (match_dup 1)
4733 (compare:CC (match_dup 3)
4738 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4742 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4743 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4745 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4746 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4747 "includes_rshift_p (operands[2], GEN_INT (65535))"
4749 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4751 [(set_attr "type" "delayed_compare")
4752 (set_attr "length" "4,8")])
4755 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4759 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4760 (match_operand:SI 2 "const_int_operand" "")) 0))
4762 (set (match_operand:SI 0 "gpc_reg_operand" "")
4763 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4764 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4766 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4768 (compare:CC (match_dup 0)
4773 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4775 (match_operand:SI 1 "gpc_reg_operand" "r"))
4776 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4782 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4784 (match_operand:SI 1 "gpc_reg_operand" "r"))
4785 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4791 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4793 (match_operand:SI 1 "gpc_reg_operand" "r"))
4794 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4800 (define_expand "ashrsi3"
4801 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4802 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4803 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4808 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4810 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4814 (define_insn "ashrsi3_power"
4815 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4816 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4817 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4818 (clobber (match_scratch:SI 3 "=q,X"))]
4822 {srai|srawi} %0,%1,%h2"
4823 [(set_attr "type" "shift")])
4825 (define_insn "ashrsi3_no_power"
4826 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4827 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4828 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4832 {srai|srawi} %0,%1,%h2"
4833 [(set_attr "type" "var_shift_rotate,shift")])
4836 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4837 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4838 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4840 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4841 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4845 {srai.|srawi.} %3,%1,%h2
4848 [(set_attr "type" "delayed_compare")
4849 (set_attr "length" "4,4,8,8")])
4852 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4853 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4854 (match_operand:SI 2 "reg_or_cint_operand" ""))
4856 (clobber (match_scratch:SI 3 ""))
4857 (clobber (match_scratch:SI 4 ""))]
4858 "TARGET_POWER && reload_completed"
4859 [(parallel [(set (match_dup 3)
4860 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4861 (clobber (match_dup 4))])
4863 (compare:CC (match_dup 3)
4868 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4869 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4870 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4872 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4875 {sra.|sraw.} %3,%1,%2
4876 {srai.|srawi.} %3,%1,%h2
4879 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4880 (set_attr "length" "4,4,8,8")])
4883 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4884 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4885 (match_operand:SI 2 "reg_or_cint_operand" ""))
4887 (clobber (match_scratch:SI 3 ""))]
4888 "! TARGET_POWER && reload_completed"
4890 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4892 (compare:CC (match_dup 3)
4897 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4898 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4899 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4901 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4902 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4903 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4907 {srai.|srawi.} %0,%1,%h2
4910 [(set_attr "type" "delayed_compare")
4911 (set_attr "length" "4,4,8,8")])
4914 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4915 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4916 (match_operand:SI 2 "reg_or_cint_operand" ""))
4918 (set (match_operand:SI 0 "gpc_reg_operand" "")
4919 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4920 (clobber (match_scratch:SI 4 ""))]
4921 "TARGET_POWER && reload_completed"
4922 [(parallel [(set (match_dup 0)
4923 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4924 (clobber (match_dup 4))])
4926 (compare:CC (match_dup 0)
4931 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4932 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4933 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4935 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4936 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4939 {sra.|sraw.} %0,%1,%2
4940 {srai.|srawi.} %0,%1,%h2
4943 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4944 (set_attr "length" "4,4,8,8")])
4947 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4948 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4949 (match_operand:SI 2 "reg_or_cint_operand" ""))
4951 (set (match_operand:SI 0 "gpc_reg_operand" "")
4952 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4953 "! TARGET_POWER && reload_completed"
4955 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4957 (compare:CC (match_dup 0)
4961 ;; Floating-point insns, excluding normal data motion.
4963 ;; PowerPC has a full set of single-precision floating point instructions.
4965 ;; For the POWER architecture, we pretend that we have both SFmode and
4966 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4967 ;; The only conversions we will do will be when storing to memory. In that
4968 ;; case, we will use the "frsp" instruction before storing.
4970 ;; Note that when we store into a single-precision memory location, we need to
4971 ;; use the frsp insn first. If the register being stored isn't dead, we
4972 ;; need a scratch register for the frsp. But this is difficult when the store
4973 ;; is done by reload. It is not incorrect to do the frsp on the register in
4974 ;; this case, we just lose precision that we would have otherwise gotten but
4975 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4977 (define_expand "extendsfdf2"
4978 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4979 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4980 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4983 (define_insn_and_split "*extendsfdf2_fpr"
4984 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4985 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4986 "TARGET_HARD_FLOAT && TARGET_FPRS"
4991 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4994 emit_note (NOTE_INSN_DELETED);
4997 [(set_attr "type" "fp,fp,fpload")])
4999 (define_expand "truncdfsf2"
5000 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5001 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5002 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5005 (define_insn "*truncdfsf2_fpr"
5006 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5007 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5008 "TARGET_HARD_FLOAT && TARGET_FPRS"
5010 [(set_attr "type" "fp")])
5012 (define_insn "aux_truncdfsf2"
5013 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5014 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5015 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5017 [(set_attr "type" "fp")])
5019 (define_expand "negsf2"
5020 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5021 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5025 (define_insn "*negsf2"
5026 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5027 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5028 "TARGET_HARD_FLOAT && TARGET_FPRS"
5030 [(set_attr "type" "fp")])
5032 (define_expand "abssf2"
5033 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5034 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5038 (define_insn "*abssf2"
5039 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5040 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5041 "TARGET_HARD_FLOAT && TARGET_FPRS"
5043 [(set_attr "type" "fp")])
5046 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5047 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5048 "TARGET_HARD_FLOAT && TARGET_FPRS"
5050 [(set_attr "type" "fp")])
5052 (define_expand "addsf3"
5053 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5054 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5055 (match_operand:SF 2 "gpc_reg_operand" "")))]
5060 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5061 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5062 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5063 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5065 [(set_attr "type" "fp")])
5068 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5069 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5070 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5071 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5072 "{fa|fadd} %0,%1,%2"
5073 [(set_attr "type" "fp")])
5075 (define_expand "subsf3"
5076 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5077 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5078 (match_operand:SF 2 "gpc_reg_operand" "")))]
5083 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5084 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5085 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5086 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5088 [(set_attr "type" "fp")])
5091 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5092 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5093 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5094 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5095 "{fs|fsub} %0,%1,%2"
5096 [(set_attr "type" "fp")])
5098 (define_expand "mulsf3"
5099 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5100 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5101 (match_operand:SF 2 "gpc_reg_operand" "")))]
5106 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5107 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5108 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5109 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5111 [(set_attr "type" "fp")])
5114 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5115 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5116 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5117 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5118 "{fm|fmul} %0,%1,%2"
5119 [(set_attr "type" "dmul")])
5122 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5123 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5124 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5126 [(set_attr "type" "fp")])
5128 (define_expand "divsf3"
5129 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5130 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5131 (match_operand:SF 2 "gpc_reg_operand" "")))]
5134 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
5135 && flag_finite_math_only && !flag_trapping_math)
5137 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5143 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5144 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5145 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5146 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5148 [(set_attr "type" "sdiv")])
5151 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5152 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5153 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5154 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5155 "{fd|fdiv} %0,%1,%2"
5156 [(set_attr "type" "ddiv")])
5159 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5160 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5161 (match_operand:SF 2 "gpc_reg_operand" "f"))
5162 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5163 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5164 "fmadds %0,%1,%2,%3"
5165 [(set_attr "type" "fp")])
5168 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5169 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5170 (match_operand:SF 2 "gpc_reg_operand" "f"))
5171 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5172 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5173 "{fma|fmadd} %0,%1,%2,%3"
5174 [(set_attr "type" "dmul")])
5177 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5178 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5179 (match_operand:SF 2 "gpc_reg_operand" "f"))
5180 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5181 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5182 "fmsubs %0,%1,%2,%3"
5183 [(set_attr "type" "fp")])
5186 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5187 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5188 (match_operand:SF 2 "gpc_reg_operand" "f"))
5189 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5190 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5191 "{fms|fmsub} %0,%1,%2,%3"
5192 [(set_attr "type" "dmul")])
5195 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5196 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5197 (match_operand:SF 2 "gpc_reg_operand" "f"))
5198 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5199 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5200 && HONOR_SIGNED_ZEROS (SFmode)"
5201 "fnmadds %0,%1,%2,%3"
5202 [(set_attr "type" "fp")])
5205 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5206 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5207 (match_operand:SF 2 "gpc_reg_operand" "f"))
5208 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5209 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5210 && ! HONOR_SIGNED_ZEROS (SFmode)"
5211 "fnmadds %0,%1,%2,%3"
5212 [(set_attr "type" "fp")])
5215 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5216 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5217 (match_operand:SF 2 "gpc_reg_operand" "f"))
5218 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5219 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5220 "{fnma|fnmadd} %0,%1,%2,%3"
5221 [(set_attr "type" "dmul")])
5224 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5225 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5226 (match_operand:SF 2 "gpc_reg_operand" "f"))
5227 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5228 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5229 && ! HONOR_SIGNED_ZEROS (SFmode)"
5230 "{fnma|fnmadd} %0,%1,%2,%3"
5231 [(set_attr "type" "dmul")])
5234 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5235 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5236 (match_operand:SF 2 "gpc_reg_operand" "f"))
5237 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5238 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5239 && HONOR_SIGNED_ZEROS (SFmode)"
5240 "fnmsubs %0,%1,%2,%3"
5241 [(set_attr "type" "fp")])
5244 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5245 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5246 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5247 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5248 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5249 && ! HONOR_SIGNED_ZEROS (SFmode)"
5250 "fnmsubs %0,%1,%2,%3"
5251 [(set_attr "type" "fp")])
5254 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5255 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5256 (match_operand:SF 2 "gpc_reg_operand" "f"))
5257 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5258 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5259 "{fnms|fnmsub} %0,%1,%2,%3"
5260 [(set_attr "type" "dmul")])
5263 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5264 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5265 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5266 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5267 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5268 && ! HONOR_SIGNED_ZEROS (SFmode)"
5269 "{fnms|fnmsub} %0,%1,%2,%3"
5270 [(set_attr "type" "dmul")])
5272 (define_expand "sqrtsf2"
5273 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5274 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5275 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5279 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5280 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5281 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5283 [(set_attr "type" "ssqrt")])
5286 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5287 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5288 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5290 [(set_attr "type" "dsqrt")])
5292 (define_expand "copysignsf3"
5294 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5296 (neg:SF (abs:SF (match_dup 1))))
5297 (set (match_operand:SF 0 "gpc_reg_operand" "")
5298 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5302 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5303 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5305 operands[3] = gen_reg_rtx (SFmode);
5306 operands[4] = gen_reg_rtx (SFmode);
5307 operands[5] = CONST0_RTX (SFmode);
5310 (define_expand "copysigndf3"
5312 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5314 (neg:DF (abs:DF (match_dup 1))))
5315 (set (match_operand:DF 0 "gpc_reg_operand" "")
5316 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5320 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5321 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5323 operands[3] = gen_reg_rtx (DFmode);
5324 operands[4] = gen_reg_rtx (DFmode);
5325 operands[5] = CONST0_RTX (DFmode);
5328 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5329 ;; fsel instruction and some auxiliary computations. Then we just have a
5330 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5332 (define_expand "smaxsf3"
5333 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5334 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5335 (match_operand:SF 2 "gpc_reg_operand" ""))
5338 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5339 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5341 (define_expand "sminsf3"
5342 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5343 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5344 (match_operand:SF 2 "gpc_reg_operand" ""))
5347 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5348 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5351 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5352 (match_operator:SF 3 "min_max_operator"
5353 [(match_operand:SF 1 "gpc_reg_operand" "")
5354 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5355 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5358 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5359 operands[1], operands[2]);
5363 (define_expand "movsicc"
5364 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5365 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5366 (match_operand:SI 2 "gpc_reg_operand" "")
5367 (match_operand:SI 3 "gpc_reg_operand" "")))]
5371 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5377 ;; We use the BASE_REGS for the isel input operands because, if rA is
5378 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5379 ;; because we may switch the operands and rB may end up being rA.
5381 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5382 ;; leave out the mode in operand 4 and use one pattern, but reload can
5383 ;; change the mode underneath our feet and then gets confused trying
5384 ;; to reload the value.
5385 (define_insn "isel_signed"
5386 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5388 (match_operator 1 "comparison_operator"
5389 [(match_operand:CC 4 "cc_reg_operand" "y")
5391 (match_operand:SI 2 "gpc_reg_operand" "b")
5392 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5395 { return output_isel (operands); }"
5396 [(set_attr "length" "4")])
5398 (define_insn "isel_unsigned"
5399 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5401 (match_operator 1 "comparison_operator"
5402 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5404 (match_operand:SI 2 "gpc_reg_operand" "b")
5405 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5408 { return output_isel (operands); }"
5409 [(set_attr "length" "4")])
5411 (define_expand "movsfcc"
5412 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5413 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5414 (match_operand:SF 2 "gpc_reg_operand" "")
5415 (match_operand:SF 3 "gpc_reg_operand" "")))]
5416 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5419 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5425 (define_insn "*fselsfsf4"
5426 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5427 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5428 (match_operand:SF 4 "zero_fp_constant" "F"))
5429 (match_operand:SF 2 "gpc_reg_operand" "f")
5430 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5431 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5433 [(set_attr "type" "fp")])
5435 (define_insn "*fseldfsf4"
5436 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5437 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5438 (match_operand:DF 4 "zero_fp_constant" "F"))
5439 (match_operand:SF 2 "gpc_reg_operand" "f")
5440 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5441 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5443 [(set_attr "type" "fp")])
5445 (define_expand "negdf2"
5446 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5447 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5448 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5451 (define_insn "*negdf2_fpr"
5452 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5453 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5454 "TARGET_HARD_FLOAT && TARGET_FPRS"
5456 [(set_attr "type" "fp")])
5458 (define_expand "absdf2"
5459 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5460 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5461 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5464 (define_insn "*absdf2_fpr"
5465 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5466 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5467 "TARGET_HARD_FLOAT && TARGET_FPRS"
5469 [(set_attr "type" "fp")])
5471 (define_insn "*nabsdf2_fpr"
5472 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5473 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5474 "TARGET_HARD_FLOAT && TARGET_FPRS"
5476 [(set_attr "type" "fp")])
5478 (define_expand "adddf3"
5479 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5480 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5481 (match_operand:DF 2 "gpc_reg_operand" "")))]
5482 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5485 (define_insn "*adddf3_fpr"
5486 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5487 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5488 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5489 "TARGET_HARD_FLOAT && TARGET_FPRS"
5490 "{fa|fadd} %0,%1,%2"
5491 [(set_attr "type" "fp")])
5493 (define_expand "subdf3"
5494 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5495 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5496 (match_operand:DF 2 "gpc_reg_operand" "")))]
5497 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5500 (define_insn "*subdf3_fpr"
5501 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5502 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5503 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5504 "TARGET_HARD_FLOAT && TARGET_FPRS"
5505 "{fs|fsub} %0,%1,%2"
5506 [(set_attr "type" "fp")])
5508 (define_expand "muldf3"
5509 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5510 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5511 (match_operand:DF 2 "gpc_reg_operand" "")))]
5512 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5515 (define_insn "*muldf3_fpr"
5516 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5517 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5518 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5519 "TARGET_HARD_FLOAT && TARGET_FPRS"
5520 "{fm|fmul} %0,%1,%2"
5521 [(set_attr "type" "dmul")])
5524 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5525 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5526 "TARGET_POPCNTB && flag_finite_math_only"
5528 [(set_attr "type" "fp")])
5530 (define_expand "divdf3"
5531 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5532 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5533 (match_operand:DF 2 "gpc_reg_operand" "")))]
5534 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5536 if (swdiv && !optimize_size && TARGET_POPCNTB
5537 && flag_finite_math_only && !flag_trapping_math)
5539 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5544 (define_insn "*divdf3_fpr"
5545 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5546 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5547 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5548 "TARGET_HARD_FLOAT && TARGET_FPRS"
5549 "{fd|fdiv} %0,%1,%2"
5550 [(set_attr "type" "ddiv")])
5553 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5554 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5555 (match_operand:DF 2 "gpc_reg_operand" "f"))
5556 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5557 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5558 "{fma|fmadd} %0,%1,%2,%3"
5559 [(set_attr "type" "dmul")])
5562 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5563 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5564 (match_operand:DF 2 "gpc_reg_operand" "f"))
5565 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5566 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5567 "{fms|fmsub} %0,%1,%2,%3"
5568 [(set_attr "type" "dmul")])
5571 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5572 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5573 (match_operand:DF 2 "gpc_reg_operand" "f"))
5574 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5575 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5576 && HONOR_SIGNED_ZEROS (DFmode)"
5577 "{fnma|fnmadd} %0,%1,%2,%3"
5578 [(set_attr "type" "dmul")])
5581 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5582 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5583 (match_operand:DF 2 "gpc_reg_operand" "f"))
5584 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5585 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5586 && ! HONOR_SIGNED_ZEROS (DFmode)"
5587 "{fnma|fnmadd} %0,%1,%2,%3"
5588 [(set_attr "type" "dmul")])
5591 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5592 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5593 (match_operand:DF 2 "gpc_reg_operand" "f"))
5594 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5595 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5596 && HONOR_SIGNED_ZEROS (DFmode)"
5597 "{fnms|fnmsub} %0,%1,%2,%3"
5598 [(set_attr "type" "dmul")])
5601 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5602 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5603 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5604 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5605 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5606 && ! HONOR_SIGNED_ZEROS (DFmode)"
5607 "{fnms|fnmsub} %0,%1,%2,%3"
5608 [(set_attr "type" "dmul")])
5610 (define_insn "sqrtdf2"
5611 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5612 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5613 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5615 [(set_attr "type" "dsqrt")])
5617 ;; The conditional move instructions allow us to perform max and min
5618 ;; operations even when
5620 (define_expand "smaxdf3"
5621 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5622 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5623 (match_operand:DF 2 "gpc_reg_operand" ""))
5626 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5627 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5629 (define_expand "smindf3"
5630 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5631 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5632 (match_operand:DF 2 "gpc_reg_operand" ""))
5635 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5636 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5639 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5640 (match_operator:DF 3 "min_max_operator"
5641 [(match_operand:DF 1 "gpc_reg_operand" "")
5642 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5643 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5646 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5647 operands[1], operands[2]);
5651 (define_expand "movdfcc"
5652 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5653 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5654 (match_operand:DF 2 "gpc_reg_operand" "")
5655 (match_operand:DF 3 "gpc_reg_operand" "")))]
5656 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5659 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5665 (define_insn "*fseldfdf4"
5666 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5667 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5668 (match_operand:DF 4 "zero_fp_constant" "F"))
5669 (match_operand:DF 2 "gpc_reg_operand" "f")
5670 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5671 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5673 [(set_attr "type" "fp")])
5675 (define_insn "*fselsfdf4"
5676 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5677 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5678 (match_operand:SF 4 "zero_fp_constant" "F"))
5679 (match_operand:DF 2 "gpc_reg_operand" "f")
5680 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5683 [(set_attr "type" "fp")])
5685 ;; Conversions to and from floating-point.
5687 (define_expand "fixuns_truncsfsi2"
5688 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5689 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5690 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5693 (define_expand "fix_truncsfsi2"
5694 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5695 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5696 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5699 ; For each of these conversions, there is a define_expand, a define_insn
5700 ; with a '#' template, and a define_split (with C code). The idea is
5701 ; to allow constant folding with the template of the define_insn,
5702 ; then to have the insns split later (between sched1 and final).
5704 (define_expand "floatsidf2"
5705 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5706 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5709 (clobber (match_dup 4))
5710 (clobber (match_dup 5))
5711 (clobber (match_dup 6))])]
5712 "TARGET_HARD_FLOAT && TARGET_FPRS"
5715 if (TARGET_E500_DOUBLE)
5717 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5720 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS)
5722 rtx t1 = gen_reg_rtx (DImode);
5723 emit_insn (gen_floatsidf_ppc64_mfpgpr (operands[0], operands[1], t1));
5726 if (TARGET_POWERPC64)
5728 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5729 rtx t1 = gen_reg_rtx (DImode);
5730 rtx t2 = gen_reg_rtx (DImode);
5731 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5735 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5736 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5737 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5738 operands[5] = gen_reg_rtx (DFmode);
5739 operands[6] = gen_reg_rtx (SImode);
5742 (define_insn_and_split "*floatsidf2_internal"
5743 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5744 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5745 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5746 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5747 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5748 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5749 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5750 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5752 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5756 rtx lowword, highword;
5757 gcc_assert (MEM_P (operands[4]));
5758 highword = adjust_address (operands[4], SImode, 0);
5759 lowword = adjust_address (operands[4], SImode, 4);
5760 if (! WORDS_BIG_ENDIAN)
5763 tmp = highword; highword = lowword; lowword = tmp;
5766 emit_insn (gen_xorsi3 (operands[6], operands[1],
5767 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5768 emit_move_insn (lowword, operands[6]);
5769 emit_move_insn (highword, operands[2]);
5770 emit_move_insn (operands[5], operands[4]);
5771 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5774 [(set_attr "length" "24")])
5776 (define_expand "floatunssisf2"
5777 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5778 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5779 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5782 (define_expand "floatunssidf2"
5783 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5784 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5787 (clobber (match_dup 4))
5788 (clobber (match_dup 5))])]
5789 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5792 if (TARGET_E500_DOUBLE)
5794 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5797 if (TARGET_POWERPC64)
5799 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5800 rtx t1 = gen_reg_rtx (DImode);
5801 rtx t2 = gen_reg_rtx (DImode);
5802 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5807 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5808 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5809 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5810 operands[5] = gen_reg_rtx (DFmode);
5813 (define_insn_and_split "*floatunssidf2_internal"
5814 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5815 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5816 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5817 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5818 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5819 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5820 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5822 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5826 rtx lowword, highword;
5827 gcc_assert (MEM_P (operands[4]));
5828 highword = adjust_address (operands[4], SImode, 0);
5829 lowword = adjust_address (operands[4], SImode, 4);
5830 if (! WORDS_BIG_ENDIAN)
5833 tmp = highword; highword = lowword; lowword = tmp;
5836 emit_move_insn (lowword, operands[1]);
5837 emit_move_insn (highword, operands[2]);
5838 emit_move_insn (operands[5], operands[4]);
5839 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5842 [(set_attr "length" "20")])
5844 (define_expand "fix_truncdfsi2"
5845 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5846 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5847 (clobber (match_dup 2))
5848 (clobber (match_dup 3))])]
5849 "(TARGET_POWER2 || TARGET_POWERPC)
5850 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5853 if (TARGET_E500_DOUBLE)
5855 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5858 operands[2] = gen_reg_rtx (DImode);
5859 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
5860 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
5862 operands[3] = gen_reg_rtx (DImode);
5863 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
5864 operands[2], operands[3]));
5867 if (TARGET_PPC_GFXOPT)
5869 rtx orig_dest = operands[0];
5870 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5871 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5872 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5874 if (operands[0] != orig_dest)
5875 emit_move_insn (orig_dest, operands[0]);
5878 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5881 (define_insn_and_split "*fix_truncdfsi2_internal"
5882 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5883 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5884 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5885 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5886 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5888 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[3]))"
5893 gcc_assert (MEM_P (operands[3]));
5894 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5896 emit_insn (gen_fctiwz (operands[2], operands[1]));
5897 emit_move_insn (operands[3], operands[2]);
5898 emit_move_insn (operands[0], lowword);
5901 [(set_attr "length" "16")])
5903 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5904 [(set (match_operand:SI 0 "memory_operand" "=Z")
5905 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5906 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5907 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5908 && TARGET_PPC_GFXOPT"
5914 emit_insn (gen_fctiwz (operands[2], operands[1]));
5915 emit_insn (gen_stfiwx (operands[0], operands[2]));
5918 [(set_attr "length" "16")])
5920 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
5921 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5922 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5923 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5924 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
5925 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
5928 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
5929 (set (match_dup 3) (match_dup 2))
5930 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
5932 [(set_attr "length" "12")])
5934 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5935 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5936 ; because the first makes it clear that operand 0 is not live
5937 ; before the instruction.
5938 (define_insn "fctiwz"
5939 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5940 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5942 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5943 "{fcirz|fctiwz} %0,%1"
5944 [(set_attr "type" "fp")])
5946 (define_insn "btruncdf2"
5947 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5948 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5949 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5951 [(set_attr "type" "fp")])
5953 (define_insn "btruncsf2"
5954 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5955 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5956 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5958 [(set_attr "type" "fp")])
5960 (define_insn "ceildf2"
5961 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5962 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5963 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5965 [(set_attr "type" "fp")])
5967 (define_insn "ceilsf2"
5968 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5969 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5970 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5972 [(set_attr "type" "fp")])
5974 (define_insn "floordf2"
5975 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5976 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5977 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5979 [(set_attr "type" "fp")])
5981 (define_insn "floorsf2"
5982 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5983 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5984 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5986 [(set_attr "type" "fp")])
5988 (define_insn "rounddf2"
5989 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5990 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
5991 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5993 [(set_attr "type" "fp")])
5995 (define_insn "roundsf2"
5996 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5997 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
5998 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6000 [(set_attr "type" "fp")])
6002 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6003 (define_insn "stfiwx"
6004 [(set (match_operand:SI 0 "memory_operand" "=Z")
6005 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
6009 [(set_attr "type" "fpstore")])
6011 (define_expand "floatsisf2"
6012 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6013 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6014 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6017 (define_insn "floatdidf2"
6018 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6019 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
6020 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6022 [(set_attr "type" "fp")])
6024 (define_insn_and_split "floatsidf_ppc64_mfpgpr"
6025 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6026 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6027 (clobber (match_operand:DI 2 "gpc_reg_operand" "=r"))]
6028 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6031 [(set (match_dup 2) (sign_extend:DI (match_dup 1)))
6032 (set (match_dup 0) (float:DF (match_dup 2)))]
6035 (define_insn_and_split "floatsidf_ppc64"
6036 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6037 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6038 (clobber (match_operand:DI 2 "memory_operand" "=o"))
6039 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6040 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6041 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6044 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
6045 (set (match_dup 2) (match_dup 3))
6046 (set (match_dup 4) (match_dup 2))
6047 (set (match_dup 0) (float:DF (match_dup 4)))]
6050 (define_insn_and_split "floatunssidf_ppc64"
6051 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6052 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6053 (clobber (match_operand:DI 2 "memory_operand" "=o"))
6054 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6055 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6056 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6059 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
6060 (set (match_dup 2) (match_dup 3))
6061 (set (match_dup 4) (match_dup 2))
6062 (set (match_dup 0) (float:DF (match_dup 4)))]
6065 (define_insn "fix_truncdfdi2"
6066 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
6067 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
6068 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6070 [(set_attr "type" "fp")])
6072 (define_expand "floatdisf2"
6073 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6074 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6075 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6078 rtx val = operands[1];
6079 if (!flag_unsafe_math_optimizations)
6081 rtx label = gen_label_rtx ();
6082 val = gen_reg_rtx (DImode);
6083 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6086 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6090 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6091 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6092 ;; from double rounding.
6093 (define_insn_and_split "floatdisf2_internal1"
6094 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6095 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
6096 (clobber (match_scratch:DF 2 "=f"))]
6097 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6099 "&& reload_completed"
6101 (float:DF (match_dup 1)))
6103 (float_truncate:SF (match_dup 2)))]
6106 ;; Twiddles bits to avoid double rounding.
6107 ;; Bits that might be truncated when converting to DFmode are replaced
6108 ;; by a bit that won't be lost at that stage, but is below the SFmode
6109 ;; rounding position.
6110 (define_expand "floatdisf2_internal2"
6111 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6113 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6115 (clobber (scratch:CC))])
6116 (set (match_dup 3) (plus:DI (match_dup 3)
6118 (set (match_dup 0) (plus:DI (match_dup 0)
6120 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6122 (set (match_dup 0) (ior:DI (match_dup 0)
6124 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6126 (clobber (scratch:CC))])
6127 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6128 (label_ref (match_operand:DI 2 "" ""))
6130 (set (match_dup 0) (match_dup 1))]
6131 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6134 operands[3] = gen_reg_rtx (DImode);
6135 operands[4] = gen_reg_rtx (CCUNSmode);
6138 ;; Define the DImode operations that can be done in a small number
6139 ;; of instructions. The & constraints are to prevent the register
6140 ;; allocator from allocating registers that overlap with the inputs
6141 ;; (for example, having an input in 7,8 and an output in 6,7). We
6142 ;; also allow for the output being the same as one of the inputs.
6144 (define_insn "*adddi3_noppc64"
6145 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6146 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6147 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6148 "! TARGET_POWERPC64"
6151 if (WORDS_BIG_ENDIAN)
6152 return (GET_CODE (operands[2])) != CONST_INT
6153 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6154 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6156 return (GET_CODE (operands[2])) != CONST_INT
6157 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6158 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6160 [(set_attr "type" "two")
6161 (set_attr "length" "8")])
6163 (define_insn "*subdi3_noppc64"
6164 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6165 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6166 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6167 "! TARGET_POWERPC64"
6170 if (WORDS_BIG_ENDIAN)
6171 return (GET_CODE (operands[1]) != CONST_INT)
6172 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6173 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6175 return (GET_CODE (operands[1]) != CONST_INT)
6176 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6177 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6179 [(set_attr "type" "two")
6180 (set_attr "length" "8")])
6182 (define_insn "*negdi2_noppc64"
6183 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6184 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6185 "! TARGET_POWERPC64"
6188 return (WORDS_BIG_ENDIAN)
6189 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6190 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6192 [(set_attr "type" "two")
6193 (set_attr "length" "8")])
6195 (define_expand "mulsidi3"
6196 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6197 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6198 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6199 "! TARGET_POWERPC64"
6202 if (! TARGET_POWER && ! TARGET_POWERPC)
6204 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6205 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6206 emit_insn (gen_mull_call ());
6207 if (WORDS_BIG_ENDIAN)
6208 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6211 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6212 gen_rtx_REG (SImode, 3));
6213 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6214 gen_rtx_REG (SImode, 4));
6218 else if (TARGET_POWER)
6220 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6225 (define_insn "mulsidi3_mq"
6226 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6227 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6228 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6229 (clobber (match_scratch:SI 3 "=q"))]
6231 "mul %0,%1,%2\;mfmq %L0"
6232 [(set_attr "type" "imul")
6233 (set_attr "length" "8")])
6235 (define_insn "*mulsidi3_no_mq"
6236 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6237 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6238 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6239 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6242 return (WORDS_BIG_ENDIAN)
6243 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6244 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6246 [(set_attr "type" "imul")
6247 (set_attr "length" "8")])
6250 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6251 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6252 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6253 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6256 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6257 (sign_extend:DI (match_dup 2)))
6260 (mult:SI (match_dup 1)
6264 int endian = (WORDS_BIG_ENDIAN == 0);
6265 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6266 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6269 (define_expand "umulsidi3"
6270 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6271 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6272 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6273 "TARGET_POWERPC && ! TARGET_POWERPC64"
6278 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6283 (define_insn "umulsidi3_mq"
6284 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6285 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6286 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6287 (clobber (match_scratch:SI 3 "=q"))]
6288 "TARGET_POWERPC && TARGET_POWER"
6291 return (WORDS_BIG_ENDIAN)
6292 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6293 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6295 [(set_attr "type" "imul")
6296 (set_attr "length" "8")])
6298 (define_insn "*umulsidi3_no_mq"
6299 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6300 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6301 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6302 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6305 return (WORDS_BIG_ENDIAN)
6306 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6307 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6309 [(set_attr "type" "imul")
6310 (set_attr "length" "8")])
6313 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6314 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6315 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6316 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6319 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6320 (zero_extend:DI (match_dup 2)))
6323 (mult:SI (match_dup 1)
6327 int endian = (WORDS_BIG_ENDIAN == 0);
6328 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6329 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6332 (define_expand "smulsi3_highpart"
6333 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6335 (lshiftrt:DI (mult:DI (sign_extend:DI
6336 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6338 (match_operand:SI 2 "gpc_reg_operand" "r")))
6343 if (! TARGET_POWER && ! TARGET_POWERPC)
6345 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6346 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6347 emit_insn (gen_mulh_call ());
6348 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6351 else if (TARGET_POWER)
6353 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6358 (define_insn "smulsi3_highpart_mq"
6359 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6361 (lshiftrt:DI (mult:DI (sign_extend:DI
6362 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6364 (match_operand:SI 2 "gpc_reg_operand" "r")))
6366 (clobber (match_scratch:SI 3 "=q"))]
6369 [(set_attr "type" "imul")])
6371 (define_insn "*smulsi3_highpart_no_mq"
6372 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6374 (lshiftrt:DI (mult:DI (sign_extend:DI
6375 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6377 (match_operand:SI 2 "gpc_reg_operand" "r")))
6379 "TARGET_POWERPC && ! TARGET_POWER"
6381 [(set_attr "type" "imul")])
6383 (define_expand "umulsi3_highpart"
6384 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6386 (lshiftrt:DI (mult:DI (zero_extend:DI
6387 (match_operand:SI 1 "gpc_reg_operand" ""))
6389 (match_operand:SI 2 "gpc_reg_operand" "")))
6396 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6401 (define_insn "umulsi3_highpart_mq"
6402 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6404 (lshiftrt:DI (mult:DI (zero_extend:DI
6405 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6407 (match_operand:SI 2 "gpc_reg_operand" "r")))
6409 (clobber (match_scratch:SI 3 "=q"))]
6410 "TARGET_POWERPC && TARGET_POWER"
6412 [(set_attr "type" "imul")])
6414 (define_insn "*umulsi3_highpart_no_mq"
6415 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6417 (lshiftrt:DI (mult:DI (zero_extend:DI
6418 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6420 (match_operand:SI 2 "gpc_reg_operand" "r")))
6422 "TARGET_POWERPC && ! TARGET_POWER"
6424 [(set_attr "type" "imul")])
6426 ;; If operands 0 and 2 are in the same register, we have a problem. But
6427 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6428 ;; why we have the strange constraints below.
6429 (define_insn "ashldi3_power"
6430 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6431 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6432 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6433 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6436 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6437 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6438 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6439 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6440 [(set_attr "length" "8")])
6442 (define_insn "lshrdi3_power"
6443 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6444 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6445 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6446 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6449 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6450 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6451 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6452 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6453 [(set_attr "length" "8")])
6455 ;; Shift by a variable amount is too complex to be worth open-coding. We
6456 ;; just handle shifts by constants.
6457 (define_insn "ashrdi3_power"
6458 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6459 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6460 (match_operand:SI 2 "const_int_operand" "M,i")))
6461 (clobber (match_scratch:SI 3 "=X,q"))]
6464 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6465 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6466 [(set_attr "type" "shift")
6467 (set_attr "length" "8")])
6469 (define_insn "ashrdi3_no_power"
6470 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6471 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6472 (match_operand:SI 2 "const_int_operand" "M,i")))]
6473 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6475 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6476 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6477 [(set_attr "type" "two,three")
6478 (set_attr "length" "8,12")])
6480 (define_insn "*ashrdisi3_noppc64"
6481 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6482 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6483 (const_int 32)) 4))]
6484 "TARGET_32BIT && !TARGET_POWERPC64"
6487 if (REGNO (operands[0]) == REGNO (operands[1]))
6490 return \"mr %0,%1\";
6492 [(set_attr "length" "4")])
6495 ;; PowerPC64 DImode operations.
6497 (define_insn_and_split "absdi2"
6498 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6499 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6500 (clobber (match_scratch:DI 2 "=&r,&r"))]
6503 "&& reload_completed"
6504 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6505 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6506 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6509 (define_insn_and_split "*nabsdi2"
6510 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6511 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6512 (clobber (match_scratch:DI 2 "=&r,&r"))]
6515 "&& reload_completed"
6516 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6517 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6518 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6521 (define_insn "muldi3"
6522 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6523 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6524 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6530 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6531 (const_string "imul3")
6532 (match_operand:SI 2 "short_cint_operand" "")
6533 (const_string "imul2")]
6534 (const_string "lmul")))])
6536 (define_insn "*muldi3_internal1"
6537 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6538 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6539 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6541 (clobber (match_scratch:DI 3 "=r,r"))]
6546 [(set_attr "type" "lmul_compare")
6547 (set_attr "length" "4,8")])
6550 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6551 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6552 (match_operand:DI 2 "gpc_reg_operand" ""))
6554 (clobber (match_scratch:DI 3 ""))]
6555 "TARGET_POWERPC64 && reload_completed"
6557 (mult:DI (match_dup 1) (match_dup 2)))
6559 (compare:CC (match_dup 3)
6563 (define_insn "*muldi3_internal2"
6564 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6565 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6566 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6568 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6569 (mult:DI (match_dup 1) (match_dup 2)))]
6574 [(set_attr "type" "lmul_compare")
6575 (set_attr "length" "4,8")])
6578 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6579 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6580 (match_operand:DI 2 "gpc_reg_operand" ""))
6582 (set (match_operand:DI 0 "gpc_reg_operand" "")
6583 (mult:DI (match_dup 1) (match_dup 2)))]
6584 "TARGET_POWERPC64 && reload_completed"
6586 (mult:DI (match_dup 1) (match_dup 2)))
6588 (compare:CC (match_dup 0)
6592 (define_insn "smuldi3_highpart"
6593 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6595 (lshiftrt:TI (mult:TI (sign_extend:TI
6596 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6598 (match_operand:DI 2 "gpc_reg_operand" "r")))
6602 [(set_attr "type" "lmul")])
6604 (define_insn "umuldi3_highpart"
6605 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6607 (lshiftrt:TI (mult:TI (zero_extend:TI
6608 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6610 (match_operand:DI 2 "gpc_reg_operand" "r")))
6614 [(set_attr "type" "lmul")])
6616 (define_insn "rotldi3"
6617 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6618 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6619 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6624 [(set_attr "type" "var_shift_rotate,integer")])
6626 (define_insn "*rotldi3_internal2"
6627 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6628 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6629 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6631 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6638 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6639 (set_attr "length" "4,4,8,8")])
6642 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6643 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6644 (match_operand:DI 2 "reg_or_cint_operand" ""))
6646 (clobber (match_scratch:DI 3 ""))]
6647 "TARGET_POWERPC64 && reload_completed"
6649 (rotate:DI (match_dup 1) (match_dup 2)))
6651 (compare:CC (match_dup 3)
6655 (define_insn "*rotldi3_internal3"
6656 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6657 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6658 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6660 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6661 (rotate:DI (match_dup 1) (match_dup 2)))]
6668 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6669 (set_attr "length" "4,4,8,8")])
6672 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6673 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6674 (match_operand:DI 2 "reg_or_cint_operand" ""))
6676 (set (match_operand:DI 0 "gpc_reg_operand" "")
6677 (rotate:DI (match_dup 1) (match_dup 2)))]
6678 "TARGET_POWERPC64 && reload_completed"
6680 (rotate:DI (match_dup 1) (match_dup 2)))
6682 (compare:CC (match_dup 0)
6686 (define_insn "*rotldi3_internal4"
6687 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6688 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6689 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6690 (match_operand:DI 3 "mask64_operand" "n,n")))]
6693 rldc%B3 %0,%1,%2,%S3
6694 rldic%B3 %0,%1,%H2,%S3"
6695 [(set_attr "type" "var_shift_rotate,integer")])
6697 (define_insn "*rotldi3_internal5"
6698 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6700 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6701 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6702 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6704 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6707 rldc%B3. %4,%1,%2,%S3
6708 rldic%B3. %4,%1,%H2,%S3
6711 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6712 (set_attr "length" "4,4,8,8")])
6715 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6717 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6718 (match_operand:DI 2 "reg_or_cint_operand" ""))
6719 (match_operand:DI 3 "mask64_operand" ""))
6721 (clobber (match_scratch:DI 4 ""))]
6722 "TARGET_POWERPC64 && reload_completed"
6724 (and:DI (rotate:DI (match_dup 1)
6728 (compare:CC (match_dup 4)
6732 (define_insn "*rotldi3_internal6"
6733 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6735 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6736 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6737 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6739 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6740 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6743 rldc%B3. %0,%1,%2,%S3
6744 rldic%B3. %0,%1,%H2,%S3
6747 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6748 (set_attr "length" "4,4,8,8")])
6751 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6753 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6754 (match_operand:DI 2 "reg_or_cint_operand" ""))
6755 (match_operand:DI 3 "mask64_operand" ""))
6757 (set (match_operand:DI 0 "gpc_reg_operand" "")
6758 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6759 "TARGET_POWERPC64 && reload_completed"
6761 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6763 (compare:CC (match_dup 0)
6767 (define_insn "*rotldi3_internal7"
6768 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6771 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6772 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6776 rldicl %0,%1,%H2,56"
6777 [(set_attr "type" "var_shift_rotate,integer")])
6779 (define_insn "*rotldi3_internal8"
6780 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6781 (compare:CC (zero_extend:DI
6783 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6784 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6786 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6790 rldicl. %3,%1,%H2,56
6793 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6794 (set_attr "length" "4,4,8,8")])
6797 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6798 (compare:CC (zero_extend:DI
6800 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6801 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6803 (clobber (match_scratch:DI 3 ""))]
6804 "TARGET_POWERPC64 && reload_completed"
6806 (zero_extend:DI (subreg:QI
6807 (rotate:DI (match_dup 1)
6810 (compare:CC (match_dup 3)
6814 (define_insn "*rotldi3_internal9"
6815 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6816 (compare:CC (zero_extend:DI
6818 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6819 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6821 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6822 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6826 rldicl. %0,%1,%H2,56
6829 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6830 (set_attr "length" "4,4,8,8")])
6833 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6834 (compare:CC (zero_extend:DI
6836 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6837 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6839 (set (match_operand:DI 0 "gpc_reg_operand" "")
6840 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6841 "TARGET_POWERPC64 && reload_completed"
6843 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6845 (compare:CC (match_dup 0)
6849 (define_insn "*rotldi3_internal10"
6850 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6853 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6854 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6858 rldicl %0,%1,%H2,48"
6859 [(set_attr "type" "var_shift_rotate,integer")])
6861 (define_insn "*rotldi3_internal11"
6862 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6863 (compare:CC (zero_extend:DI
6865 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6866 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6868 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6872 rldicl. %3,%1,%H2,48
6875 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6876 (set_attr "length" "4,4,8,8")])
6879 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6880 (compare:CC (zero_extend:DI
6882 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6883 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6885 (clobber (match_scratch:DI 3 ""))]
6886 "TARGET_POWERPC64 && reload_completed"
6888 (zero_extend:DI (subreg:HI
6889 (rotate:DI (match_dup 1)
6892 (compare:CC (match_dup 3)
6896 (define_insn "*rotldi3_internal12"
6897 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6898 (compare:CC (zero_extend:DI
6900 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6901 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6903 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6904 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6908 rldicl. %0,%1,%H2,48
6911 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6912 (set_attr "length" "4,4,8,8")])
6915 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6916 (compare:CC (zero_extend:DI
6918 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6919 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6921 (set (match_operand:DI 0 "gpc_reg_operand" "")
6922 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6923 "TARGET_POWERPC64 && reload_completed"
6925 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6927 (compare:CC (match_dup 0)
6931 (define_insn "*rotldi3_internal13"
6932 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6935 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6936 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6940 rldicl %0,%1,%H2,32"
6941 [(set_attr "type" "var_shift_rotate,integer")])
6943 (define_insn "*rotldi3_internal14"
6944 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6945 (compare:CC (zero_extend:DI
6947 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6948 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6950 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6954 rldicl. %3,%1,%H2,32
6957 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6958 (set_attr "length" "4,4,8,8")])
6961 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6962 (compare:CC (zero_extend:DI
6964 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6965 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6967 (clobber (match_scratch:DI 3 ""))]
6968 "TARGET_POWERPC64 && reload_completed"
6970 (zero_extend:DI (subreg:SI
6971 (rotate:DI (match_dup 1)
6974 (compare:CC (match_dup 3)
6978 (define_insn "*rotldi3_internal15"
6979 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6980 (compare:CC (zero_extend:DI
6982 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6983 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6985 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6986 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6990 rldicl. %0,%1,%H2,32
6993 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6994 (set_attr "length" "4,4,8,8")])
6997 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6998 (compare:CC (zero_extend:DI
7000 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7001 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7003 (set (match_operand:DI 0 "gpc_reg_operand" "")
7004 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7005 "TARGET_POWERPC64 && reload_completed"
7007 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7009 (compare:CC (match_dup 0)
7013 (define_expand "ashldi3"
7014 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7015 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7016 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7017 "TARGET_POWERPC64 || TARGET_POWER"
7020 if (TARGET_POWERPC64)
7022 else if (TARGET_POWER)
7024 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7031 (define_insn "*ashldi3_internal1"
7032 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7033 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7034 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7039 [(set_attr "type" "var_shift_rotate,shift")])
7041 (define_insn "*ashldi3_internal2"
7042 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7043 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7044 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7046 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7053 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7054 (set_attr "length" "4,4,8,8")])
7057 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7058 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7059 (match_operand:SI 2 "reg_or_cint_operand" ""))
7061 (clobber (match_scratch:DI 3 ""))]
7062 "TARGET_POWERPC64 && reload_completed"
7064 (ashift:DI (match_dup 1) (match_dup 2)))
7066 (compare:CC (match_dup 3)
7070 (define_insn "*ashldi3_internal3"
7071 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7072 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7073 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7075 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7076 (ashift:DI (match_dup 1) (match_dup 2)))]
7083 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7084 (set_attr "length" "4,4,8,8")])
7087 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7088 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7089 (match_operand:SI 2 "reg_or_cint_operand" ""))
7091 (set (match_operand:DI 0 "gpc_reg_operand" "")
7092 (ashift:DI (match_dup 1) (match_dup 2)))]
7093 "TARGET_POWERPC64 && reload_completed"
7095 (ashift:DI (match_dup 1) (match_dup 2)))
7097 (compare:CC (match_dup 0)
7101 (define_insn "*ashldi3_internal4"
7102 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7103 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7104 (match_operand:SI 2 "const_int_operand" "i"))
7105 (match_operand:DI 3 "const_int_operand" "n")))]
7106 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7107 "rldic %0,%1,%H2,%W3")
7109 (define_insn "ashldi3_internal5"
7110 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7112 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7113 (match_operand:SI 2 "const_int_operand" "i,i"))
7114 (match_operand:DI 3 "const_int_operand" "n,n"))
7116 (clobber (match_scratch:DI 4 "=r,r"))]
7117 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7119 rldic. %4,%1,%H2,%W3
7121 [(set_attr "type" "compare")
7122 (set_attr "length" "4,8")])
7125 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7127 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7128 (match_operand:SI 2 "const_int_operand" ""))
7129 (match_operand:DI 3 "const_int_operand" ""))
7131 (clobber (match_scratch:DI 4 ""))]
7132 "TARGET_POWERPC64 && reload_completed
7133 && includes_rldic_lshift_p (operands[2], operands[3])"
7135 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7138 (compare:CC (match_dup 4)
7142 (define_insn "*ashldi3_internal6"
7143 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7145 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7146 (match_operand:SI 2 "const_int_operand" "i,i"))
7147 (match_operand:DI 3 "const_int_operand" "n,n"))
7149 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7150 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7151 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7153 rldic. %0,%1,%H2,%W3
7155 [(set_attr "type" "compare")
7156 (set_attr "length" "4,8")])
7159 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7161 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7162 (match_operand:SI 2 "const_int_operand" ""))
7163 (match_operand:DI 3 "const_int_operand" ""))
7165 (set (match_operand:DI 0 "gpc_reg_operand" "")
7166 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7167 "TARGET_POWERPC64 && reload_completed
7168 && includes_rldic_lshift_p (operands[2], operands[3])"
7170 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7173 (compare:CC (match_dup 0)
7177 (define_insn "*ashldi3_internal7"
7178 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7179 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7180 (match_operand:SI 2 "const_int_operand" "i"))
7181 (match_operand:DI 3 "mask64_operand" "n")))]
7182 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7183 "rldicr %0,%1,%H2,%S3")
7185 (define_insn "ashldi3_internal8"
7186 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7188 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7189 (match_operand:SI 2 "const_int_operand" "i,i"))
7190 (match_operand:DI 3 "mask64_operand" "n,n"))
7192 (clobber (match_scratch:DI 4 "=r,r"))]
7193 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7195 rldicr. %4,%1,%H2,%S3
7197 [(set_attr "type" "compare")
7198 (set_attr "length" "4,8")])
7201 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7203 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7204 (match_operand:SI 2 "const_int_operand" ""))
7205 (match_operand:DI 3 "mask64_operand" ""))
7207 (clobber (match_scratch:DI 4 ""))]
7208 "TARGET_POWERPC64 && reload_completed
7209 && includes_rldicr_lshift_p (operands[2], operands[3])"
7211 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7214 (compare:CC (match_dup 4)
7218 (define_insn "*ashldi3_internal9"
7219 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7221 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7222 (match_operand:SI 2 "const_int_operand" "i,i"))
7223 (match_operand:DI 3 "mask64_operand" "n,n"))
7225 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7226 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7227 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7229 rldicr. %0,%1,%H2,%S3
7231 [(set_attr "type" "compare")
7232 (set_attr "length" "4,8")])
7235 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7237 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7238 (match_operand:SI 2 "const_int_operand" ""))
7239 (match_operand:DI 3 "mask64_operand" ""))
7241 (set (match_operand:DI 0 "gpc_reg_operand" "")
7242 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7243 "TARGET_POWERPC64 && reload_completed
7244 && includes_rldicr_lshift_p (operands[2], operands[3])"
7246 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7249 (compare:CC (match_dup 0)
7253 (define_expand "lshrdi3"
7254 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7255 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7256 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7257 "TARGET_POWERPC64 || TARGET_POWER"
7260 if (TARGET_POWERPC64)
7262 else if (TARGET_POWER)
7264 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7271 (define_insn "*lshrdi3_internal1"
7272 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7273 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7274 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7279 [(set_attr "type" "var_shift_rotate,shift")])
7281 (define_insn "*lshrdi3_internal2"
7282 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7283 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7284 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7286 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7293 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7294 (set_attr "length" "4,4,8,8")])
7297 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7298 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7299 (match_operand:SI 2 "reg_or_cint_operand" ""))
7301 (clobber (match_scratch:DI 3 ""))]
7302 "TARGET_POWERPC64 && reload_completed"
7304 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7306 (compare:CC (match_dup 3)
7310 (define_insn "*lshrdi3_internal3"
7311 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7312 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7313 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7315 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7316 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7323 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7324 (set_attr "length" "4,4,8,8")])
7327 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7328 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7329 (match_operand:SI 2 "reg_or_cint_operand" ""))
7331 (set (match_operand:DI 0 "gpc_reg_operand" "")
7332 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7333 "TARGET_POWERPC64 && reload_completed"
7335 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7337 (compare:CC (match_dup 0)
7341 (define_expand "ashrdi3"
7342 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7343 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7344 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7348 if (TARGET_POWERPC64)
7350 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7352 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7355 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7356 && WORDS_BIG_ENDIAN)
7358 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7365 (define_insn "*ashrdi3_internal1"
7366 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7367 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7368 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7373 [(set_attr "type" "var_shift_rotate,shift")])
7375 (define_insn "*ashrdi3_internal2"
7376 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7377 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7378 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7380 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7387 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7388 (set_attr "length" "4,4,8,8")])
7391 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7392 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7393 (match_operand:SI 2 "reg_or_cint_operand" ""))
7395 (clobber (match_scratch:DI 3 ""))]
7396 "TARGET_POWERPC64 && reload_completed"
7398 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7400 (compare:CC (match_dup 3)
7404 (define_insn "*ashrdi3_internal3"
7405 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7406 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7407 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7409 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7410 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7417 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7418 (set_attr "length" "4,4,8,8")])
7421 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7422 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7423 (match_operand:SI 2 "reg_or_cint_operand" ""))
7425 (set (match_operand:DI 0 "gpc_reg_operand" "")
7426 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7427 "TARGET_POWERPC64 && reload_completed"
7429 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7431 (compare:CC (match_dup 0)
7435 (define_insn "anddi3"
7436 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7437 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7438 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7439 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7443 rldic%B2 %0,%1,0,%S2
7444 rlwinm %0,%1,0,%m2,%M2
7448 [(set_attr "type" "*,*,*,compare,compare,*")
7449 (set_attr "length" "4,4,4,4,4,8")])
7452 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7453 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7454 (match_operand:DI 2 "mask64_2_operand" "")))
7455 (clobber (match_scratch:CC 3 ""))]
7457 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7458 && !mask_operand (operands[2], DImode)
7459 && !mask64_operand (operands[2], DImode)"
7461 (and:DI (rotate:DI (match_dup 1)
7465 (and:DI (rotate:DI (match_dup 0)
7469 build_mask64_2_operands (operands[2], &operands[4]);
7472 (define_insn "*anddi3_internal2"
7473 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7474 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7475 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7477 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7478 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7482 rldic%B2. %3,%1,0,%S2
7483 rlwinm. %3,%1,0,%m2,%M2
7493 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7494 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7497 [(set (match_operand:CC 0 "cc_reg_operand" "")
7498 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7499 (match_operand:DI 2 "mask64_2_operand" ""))
7501 (clobber (match_scratch:DI 3 ""))
7502 (clobber (match_scratch:CC 4 ""))]
7503 "TARGET_64BIT && reload_completed
7504 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7505 && !mask_operand (operands[2], DImode)
7506 && !mask64_operand (operands[2], DImode)"
7508 (and:DI (rotate:DI (match_dup 1)
7511 (parallel [(set (match_dup 0)
7512 (compare:CC (and:DI (rotate:DI (match_dup 3)
7516 (clobber (match_dup 3))])]
7519 build_mask64_2_operands (operands[2], &operands[5]);
7522 (define_insn "*anddi3_internal3"
7523 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7524 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7525 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7527 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7528 (and:DI (match_dup 1) (match_dup 2)))
7529 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7533 rldic%B2. %0,%1,0,%S2
7534 rlwinm. %0,%1,0,%m2,%M2
7544 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7545 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7548 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7549 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7550 (match_operand:DI 2 "and64_2_operand" ""))
7552 (set (match_operand:DI 0 "gpc_reg_operand" "")
7553 (and:DI (match_dup 1) (match_dup 2)))
7554 (clobber (match_scratch:CC 4 ""))]
7555 "TARGET_64BIT && reload_completed"
7556 [(parallel [(set (match_dup 0)
7557 (and:DI (match_dup 1) (match_dup 2)))
7558 (clobber (match_dup 4))])
7560 (compare:CC (match_dup 0)
7565 [(set (match_operand:CC 3 "cc_reg_operand" "")
7566 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7567 (match_operand:DI 2 "mask64_2_operand" ""))
7569 (set (match_operand:DI 0 "gpc_reg_operand" "")
7570 (and:DI (match_dup 1) (match_dup 2)))
7571 (clobber (match_scratch:CC 4 ""))]
7572 "TARGET_64BIT && reload_completed
7573 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7574 && !mask_operand (operands[2], DImode)
7575 && !mask64_operand (operands[2], DImode)"
7577 (and:DI (rotate:DI (match_dup 1)
7580 (parallel [(set (match_dup 3)
7581 (compare:CC (and:DI (rotate:DI (match_dup 0)
7586 (and:DI (rotate:DI (match_dup 0)
7591 build_mask64_2_operands (operands[2], &operands[5]);
7594 (define_expand "iordi3"
7595 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7596 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7597 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7601 if (non_logical_cint_operand (operands[2], DImode))
7603 HOST_WIDE_INT value;
7604 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7605 ? operands[0] : gen_reg_rtx (DImode));
7607 if (GET_CODE (operands[2]) == CONST_INT)
7609 value = INTVAL (operands[2]);
7610 emit_insn (gen_iordi3 (tmp, operands[1],
7611 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7615 value = CONST_DOUBLE_LOW (operands[2]);
7616 emit_insn (gen_iordi3 (tmp, operands[1],
7617 immed_double_const (value
7618 & (~ (HOST_WIDE_INT) 0xffff),
7622 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7627 (define_expand "xordi3"
7628 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7629 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7630 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7634 if (non_logical_cint_operand (operands[2], DImode))
7636 HOST_WIDE_INT value;
7637 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7638 ? operands[0] : gen_reg_rtx (DImode));
7640 if (GET_CODE (operands[2]) == CONST_INT)
7642 value = INTVAL (operands[2]);
7643 emit_insn (gen_xordi3 (tmp, operands[1],
7644 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7648 value = CONST_DOUBLE_LOW (operands[2]);
7649 emit_insn (gen_xordi3 (tmp, operands[1],
7650 immed_double_const (value
7651 & (~ (HOST_WIDE_INT) 0xffff),
7655 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7660 (define_insn "*booldi3_internal1"
7661 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7662 (match_operator:DI 3 "boolean_or_operator"
7663 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7664 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7671 (define_insn "*booldi3_internal2"
7672 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7673 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7674 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7675 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7677 (clobber (match_scratch:DI 3 "=r,r"))]
7682 [(set_attr "type" "compare")
7683 (set_attr "length" "4,8")])
7686 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7687 (compare:CC (match_operator:DI 4 "boolean_operator"
7688 [(match_operand:DI 1 "gpc_reg_operand" "")
7689 (match_operand:DI 2 "gpc_reg_operand" "")])
7691 (clobber (match_scratch:DI 3 ""))]
7692 "TARGET_POWERPC64 && reload_completed"
7693 [(set (match_dup 3) (match_dup 4))
7695 (compare:CC (match_dup 3)
7699 (define_insn "*booldi3_internal3"
7700 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7701 (compare:CC (match_operator:DI 4 "boolean_operator"
7702 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7703 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7705 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7711 [(set_attr "type" "compare")
7712 (set_attr "length" "4,8")])
7715 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7716 (compare:CC (match_operator:DI 4 "boolean_operator"
7717 [(match_operand:DI 1 "gpc_reg_operand" "")
7718 (match_operand:DI 2 "gpc_reg_operand" "")])
7720 (set (match_operand:DI 0 "gpc_reg_operand" "")
7722 "TARGET_POWERPC64 && reload_completed"
7723 [(set (match_dup 0) (match_dup 4))
7725 (compare:CC (match_dup 0)
7729 ;; Split a logical operation that we can't do in one insn into two insns,
7730 ;; each of which does one 16-bit part. This is used by combine.
7733 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7734 (match_operator:DI 3 "boolean_or_operator"
7735 [(match_operand:DI 1 "gpc_reg_operand" "")
7736 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7738 [(set (match_dup 0) (match_dup 4))
7739 (set (match_dup 0) (match_dup 5))]
7744 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7746 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7747 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7749 i4 = GEN_INT (value & 0xffff);
7753 i3 = GEN_INT (INTVAL (operands[2])
7754 & (~ (HOST_WIDE_INT) 0xffff));
7755 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7757 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7759 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7763 (define_insn "*boolcdi3_internal1"
7764 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7765 (match_operator:DI 3 "boolean_operator"
7766 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7767 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7771 (define_insn "*boolcdi3_internal2"
7772 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7773 (compare:CC (match_operator:DI 4 "boolean_operator"
7774 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7775 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7777 (clobber (match_scratch:DI 3 "=r,r"))]
7782 [(set_attr "type" "compare")
7783 (set_attr "length" "4,8")])
7786 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7787 (compare:CC (match_operator:DI 4 "boolean_operator"
7788 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7789 (match_operand:DI 2 "gpc_reg_operand" "")])
7791 (clobber (match_scratch:DI 3 ""))]
7792 "TARGET_POWERPC64 && reload_completed"
7793 [(set (match_dup 3) (match_dup 4))
7795 (compare:CC (match_dup 3)
7799 (define_insn "*boolcdi3_internal3"
7800 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7801 (compare:CC (match_operator:DI 4 "boolean_operator"
7802 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7803 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7805 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7811 [(set_attr "type" "compare")
7812 (set_attr "length" "4,8")])
7815 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7816 (compare:CC (match_operator:DI 4 "boolean_operator"
7817 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7818 (match_operand:DI 2 "gpc_reg_operand" "")])
7820 (set (match_operand:DI 0 "gpc_reg_operand" "")
7822 "TARGET_POWERPC64 && reload_completed"
7823 [(set (match_dup 0) (match_dup 4))
7825 (compare:CC (match_dup 0)
7829 (define_insn "*boolccdi3_internal1"
7830 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7831 (match_operator:DI 3 "boolean_operator"
7832 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7833 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7837 (define_insn "*boolccdi3_internal2"
7838 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7839 (compare:CC (match_operator:DI 4 "boolean_operator"
7840 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7841 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7843 (clobber (match_scratch:DI 3 "=r,r"))]
7848 [(set_attr "type" "compare")
7849 (set_attr "length" "4,8")])
7852 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7853 (compare:CC (match_operator:DI 4 "boolean_operator"
7854 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7855 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7857 (clobber (match_scratch:DI 3 ""))]
7858 "TARGET_POWERPC64 && reload_completed"
7859 [(set (match_dup 3) (match_dup 4))
7861 (compare:CC (match_dup 3)
7865 (define_insn "*boolccdi3_internal3"
7866 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7867 (compare:CC (match_operator:DI 4 "boolean_operator"
7868 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7869 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7871 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7877 [(set_attr "type" "compare")
7878 (set_attr "length" "4,8")])
7881 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7882 (compare:CC (match_operator:DI 4 "boolean_operator"
7883 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7884 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7886 (set (match_operand:DI 0 "gpc_reg_operand" "")
7888 "TARGET_POWERPC64 && reload_completed"
7889 [(set (match_dup 0) (match_dup 4))
7891 (compare:CC (match_dup 0)
7895 ;; Now define ways of moving data around.
7897 ;; Set up a register with a value from the GOT table
7899 (define_expand "movsi_got"
7900 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7901 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7902 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7903 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7906 if (GET_CODE (operands[1]) == CONST)
7908 rtx offset = const0_rtx;
7909 HOST_WIDE_INT value;
7911 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7912 value = INTVAL (offset);
7915 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7916 emit_insn (gen_movsi_got (tmp, operands[1]));
7917 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7922 operands[2] = rs6000_got_register (operands[1]);
7925 (define_insn "*movsi_got_internal"
7926 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7927 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7928 (match_operand:SI 2 "gpc_reg_operand" "b")]
7930 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7931 "{l|lwz} %0,%a1@got(%2)"
7932 [(set_attr "type" "load")])
7934 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7935 ;; didn't get allocated to a hard register.
7937 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7938 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7939 (match_operand:SI 2 "memory_operand" "")]
7941 "DEFAULT_ABI == ABI_V4
7943 && (reload_in_progress || reload_completed)"
7944 [(set (match_dup 0) (match_dup 2))
7945 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7949 ;; For SI, we special-case integers that can't be loaded in one insn. We
7950 ;; do the load 16-bits at a time. We could do this by loading from memory,
7951 ;; and this is even supposed to be faster, but it is simpler not to get
7952 ;; integers in the TOC.
7953 (define_insn "movsi_low"
7954 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7955 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7956 (match_operand 2 "" ""))))]
7957 "TARGET_MACHO && ! TARGET_64BIT"
7958 "{l|lwz} %0,lo16(%2)(%1)"
7959 [(set_attr "type" "load")
7960 (set_attr "length" "4")])
7962 (define_insn "*movsi_internal1"
7963 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7964 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7965 "gpc_reg_operand (operands[0], SImode)
7966 || gpc_reg_operand (operands[1], SImode)"
7970 {l%U1%X1|lwz%U1%X1} %0,%1
7971 {st%U0%X0|stw%U0%X0} %1,%0
7981 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7982 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7984 ;; Split a load of a large constant into the appropriate two-insn
7988 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7989 (match_operand:SI 1 "const_int_operand" ""))]
7990 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7991 && (INTVAL (operands[1]) & 0xffff) != 0"
7995 (ior:SI (match_dup 0)
7998 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8000 if (tem == operands[0])
8006 (define_insn "*mov<mode>_internal2"
8007 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8008 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8010 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8013 {cmpi|cmp<wd>i} %2,%0,0
8016 [(set_attr "type" "cmp,compare,cmp")
8017 (set_attr "length" "4,4,8")])
8020 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8021 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8023 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8025 [(set (match_dup 0) (match_dup 1))
8027 (compare:CC (match_dup 0)
8031 (define_insn "*movhi_internal"
8032 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8033 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8034 "gpc_reg_operand (operands[0], HImode)
8035 || gpc_reg_operand (operands[1], HImode)"
8045 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8047 (define_expand "mov<mode>"
8048 [(set (match_operand:INT 0 "general_operand" "")
8049 (match_operand:INT 1 "any_operand" ""))]
8051 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8053 (define_insn "*movqi_internal"
8054 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8055 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8056 "gpc_reg_operand (operands[0], QImode)
8057 || gpc_reg_operand (operands[1], QImode)"
8067 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8069 ;; Here is how to move condition codes around. When we store CC data in
8070 ;; an integer register or memory, we store just the high-order 4 bits.
8071 ;; This lets us not shift in the most common case of CR0.
8072 (define_expand "movcc"
8073 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8074 (match_operand:CC 1 "nonimmediate_operand" ""))]
8078 (define_insn "*movcc_internal1"
8079 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8080 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8081 "register_operand (operands[0], CCmode)
8082 || register_operand (operands[1], CCmode)"
8086 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8089 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8095 {l%U1%X1|lwz%U1%X1} %0,%1
8096 {st%U0%U1|stw%U0%U1} %1,%0"
8098 (cond [(eq_attr "alternative" "0,3")
8099 (const_string "cr_logical")
8100 (eq_attr "alternative" "1,2")
8101 (const_string "mtcr")
8102 (eq_attr "alternative" "6,7,9")
8103 (const_string "integer")
8104 (eq_attr "alternative" "8")
8105 (const_string "mfjmpr")
8106 (eq_attr "alternative" "10")
8107 (const_string "mtjmpr")
8108 (eq_attr "alternative" "11")
8109 (const_string "load")
8110 (eq_attr "alternative" "12")
8111 (const_string "store")
8112 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8113 (const_string "mfcrf")
8115 (const_string "mfcr")))
8116 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8118 ;; For floating-point, we normally deal with the floating-point registers
8119 ;; unless -msoft-float is used. The sole exception is that parameter passing
8120 ;; can produce floating-point values in fixed-point registers. Unless the
8121 ;; value is a simple constant or already in memory, we deal with this by
8122 ;; allocating memory and copying the value explicitly via that memory location.
8123 (define_expand "movsf"
8124 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8125 (match_operand:SF 1 "any_operand" ""))]
8127 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8130 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8131 (match_operand:SF 1 "const_double_operand" ""))]
8133 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8134 || (GET_CODE (operands[0]) == SUBREG
8135 && GET_CODE (SUBREG_REG (operands[0])) == REG
8136 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8137 [(set (match_dup 2) (match_dup 3))]
8143 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8144 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8146 if (! TARGET_POWERPC64)
8147 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8149 operands[2] = gen_lowpart (SImode, operands[0]);
8151 operands[3] = gen_int_mode (l, SImode);
8154 (define_insn "*movsf_hardfloat"
8155 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8156 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8157 "(gpc_reg_operand (operands[0], SFmode)
8158 || gpc_reg_operand (operands[1], SFmode))
8159 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
8162 {l%U1%X1|lwz%U1%X1} %0,%1
8163 {st%U0%X0|stw%U0%X0} %1,%0
8173 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8174 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8176 (define_insn "*movsf_softfloat"
8177 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8178 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8179 "(gpc_reg_operand (operands[0], SFmode)
8180 || gpc_reg_operand (operands[1], SFmode))
8181 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8187 {l%U1%X1|lwz%U1%X1} %0,%1
8188 {st%U0%X0|stw%U0%X0} %1,%0
8195 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8196 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8199 (define_expand "movdf"
8200 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8201 (match_operand:DF 1 "any_operand" ""))]
8203 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8206 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8207 (match_operand:DF 1 "const_int_operand" ""))]
8208 "! TARGET_POWERPC64 && reload_completed
8209 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8210 || (GET_CODE (operands[0]) == SUBREG
8211 && GET_CODE (SUBREG_REG (operands[0])) == REG
8212 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8213 [(set (match_dup 2) (match_dup 4))
8214 (set (match_dup 3) (match_dup 1))]
8217 int endian = (WORDS_BIG_ENDIAN == 0);
8218 HOST_WIDE_INT value = INTVAL (operands[1]);
8220 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8221 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8222 #if HOST_BITS_PER_WIDE_INT == 32
8223 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8225 operands[4] = GEN_INT (value >> 32);
8226 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8231 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8232 (match_operand:DF 1 "const_double_operand" ""))]
8233 "! TARGET_POWERPC64 && reload_completed
8234 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8235 || (GET_CODE (operands[0]) == SUBREG
8236 && GET_CODE (SUBREG_REG (operands[0])) == REG
8237 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8238 [(set (match_dup 2) (match_dup 4))
8239 (set (match_dup 3) (match_dup 5))]
8242 int endian = (WORDS_BIG_ENDIAN == 0);
8246 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8247 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8249 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8250 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8251 operands[4] = gen_int_mode (l[endian], SImode);
8252 operands[5] = gen_int_mode (l[1 - endian], SImode);
8256 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8257 (match_operand:DF 1 "const_double_operand" ""))]
8258 "TARGET_POWERPC64 && reload_completed
8259 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8260 || (GET_CODE (operands[0]) == SUBREG
8261 && GET_CODE (SUBREG_REG (operands[0])) == REG
8262 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8263 [(set (match_dup 2) (match_dup 3))]
8266 int endian = (WORDS_BIG_ENDIAN == 0);
8269 #if HOST_BITS_PER_WIDE_INT >= 64
8273 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8274 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8276 operands[2] = gen_lowpart (DImode, operands[0]);
8277 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8278 #if HOST_BITS_PER_WIDE_INT >= 64
8279 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8280 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8282 operands[3] = gen_int_mode (val, DImode);
8284 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8288 ;; Don't have reload use general registers to load a constant. First,
8289 ;; it might not work if the output operand is the equivalent of
8290 ;; a non-offsettable memref, but also it is less efficient than loading
8291 ;; the constant into an FP register, since it will probably be used there.
8292 ;; The "??" is a kludge until we can figure out a more reasonable way
8293 ;; of handling these non-offsettable values.
8294 (define_insn "*movdf_hardfloat32"
8295 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8296 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8297 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8298 && (gpc_reg_operand (operands[0], DFmode)
8299 || gpc_reg_operand (operands[1], DFmode))"
8302 switch (which_alternative)
8307 /* We normally copy the low-numbered register first. However, if
8308 the first register operand 0 is the same as the second register
8309 of operand 1, we must copy in the opposite order. */
8310 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8311 return \"mr %L0,%L1\;mr %0,%1\";
8313 return \"mr %0,%1\;mr %L0,%L1\";
8315 if (rs6000_offsettable_memref_p (operands[1])
8316 || (GET_CODE (operands[1]) == MEM
8317 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8318 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8319 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8321 /* If the low-address word is used in the address, we must load
8322 it last. Otherwise, load it first. Note that we cannot have
8323 auto-increment in that case since the address register is
8324 known to be dead. */
8325 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8327 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8329 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8335 addreg = find_addr_reg (XEXP (operands[1], 0));
8336 if (refers_to_regno_p (REGNO (operands[0]),
8337 REGNO (operands[0]) + 1,
8340 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8341 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8342 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8343 return \"{lx|lwzx} %0,%1\";
8347 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8348 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8349 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8350 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8355 if (rs6000_offsettable_memref_p (operands[0])
8356 || (GET_CODE (operands[0]) == MEM
8357 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8358 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8359 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8360 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8365 addreg = find_addr_reg (XEXP (operands[0], 0));
8366 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8367 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8368 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8369 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8373 return \"fmr %0,%1\";
8375 return \"lfd%U1%X1 %0,%1\";
8377 return \"stfd%U0%X0 %1,%0\";
8384 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8385 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8387 (define_insn "*movdf_softfloat32"
8388 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8389 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8390 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8391 && (gpc_reg_operand (operands[0], DFmode)
8392 || gpc_reg_operand (operands[1], DFmode))"
8395 switch (which_alternative)
8400 /* We normally copy the low-numbered register first. However, if
8401 the first register operand 0 is the same as the second register of
8402 operand 1, we must copy in the opposite order. */
8403 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8404 return \"mr %L0,%L1\;mr %0,%1\";
8406 return \"mr %0,%1\;mr %L0,%L1\";
8408 /* If the low-address word is used in the address, we must load
8409 it last. Otherwise, load it first. Note that we cannot have
8410 auto-increment in that case since the address register is
8411 known to be dead. */
8412 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8414 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8416 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8418 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8425 [(set_attr "type" "two,load,store,*,*,*")
8426 (set_attr "length" "8,8,8,8,12,16")])
8428 ; ld/std require word-aligned displacements -> 'Y' constraint.
8429 ; List Y->r and r->Y before r->r for reload.
8430 (define_insn "*movdf_hardfloat64_mfpgpr"
8431 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
8432 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
8433 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8434 && (gpc_reg_operand (operands[0], DFmode)
8435 || gpc_reg_operand (operands[1], DFmode))"
8451 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8452 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8454 ; ld/std require word-aligned displacements -> 'Y' constraint.
8455 ; List Y->r and r->Y before r->r for reload.
8456 (define_insn "*movdf_hardfloat64"
8457 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8458 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8459 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8460 && (gpc_reg_operand (operands[0], DFmode)
8461 || gpc_reg_operand (operands[1], DFmode))"
8475 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8476 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8478 (define_insn "*movdf_softfloat64"
8479 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8480 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8481 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8482 && (gpc_reg_operand (operands[0], DFmode)
8483 || gpc_reg_operand (operands[1], DFmode))"
8494 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8495 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8497 (define_expand "movtf"
8498 [(set (match_operand:TF 0 "general_operand" "")
8499 (match_operand:TF 1 "any_operand" ""))]
8501 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8502 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8504 ; It's important to list the o->f and f->o moves before f->f because
8505 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8506 ; which doesn't make progress. Likewise r->Y must be before r->r.
8507 (define_insn_and_split "*movtf_internal"
8508 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8509 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8511 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8512 && (gpc_reg_operand (operands[0], TFmode)
8513 || gpc_reg_operand (operands[1], TFmode))"
8515 "&& reload_completed"
8517 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8518 [(set_attr "length" "8,8,8,20,20,16")])
8520 (define_expand "extenddftf2"
8521 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8522 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8523 (use (match_dup 2))])]
8525 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8527 operands[2] = CONST0_RTX (DFmode);
8528 /* Generate GOT reference early for SVR4 PIC. */
8529 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8530 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8533 (define_insn_and_split "*extenddftf2_internal"
8534 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8535 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8536 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8538 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8540 "&& reload_completed"
8543 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8544 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8545 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8547 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8552 (define_expand "extendsftf2"
8553 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8554 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8556 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8558 rtx tmp = gen_reg_rtx (DFmode);
8559 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8560 emit_insn (gen_extenddftf2 (operands[0], tmp));
8564 (define_expand "trunctfdf2"
8565 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8566 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8568 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8571 (define_insn_and_split "trunctfdf2_internal1"
8572 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8573 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8574 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8575 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8579 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8582 emit_note (NOTE_INSN_DELETED);
8585 [(set_attr "type" "fp")])
8587 (define_insn "trunctfdf2_internal2"
8588 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8589 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8590 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8591 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8593 [(set_attr "type" "fp")])
8595 (define_insn_and_split "trunctfsf2"
8596 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8597 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8598 (clobber (match_scratch:DF 2 "=f"))]
8600 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8602 "&& reload_completed"
8604 (float_truncate:DF (match_dup 1)))
8606 (float_truncate:SF (match_dup 2)))]
8609 (define_expand "floatsitf2"
8610 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8611 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8613 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8615 rtx tmp = gen_reg_rtx (DFmode);
8616 expand_float (tmp, operands[1], false);
8617 emit_insn (gen_extenddftf2 (operands[0], tmp));
8621 ; fadd, but rounding towards zero.
8622 ; This is probably not the optimal code sequence.
8623 (define_insn "fix_trunc_helper"
8624 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8625 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8626 UNSPEC_FIX_TRUNC_TF))
8627 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8628 "TARGET_HARD_FLOAT && TARGET_FPRS"
8629 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8630 [(set_attr "type" "fp")
8631 (set_attr "length" "20")])
8633 (define_expand "fix_trunctfsi2"
8634 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8635 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8636 (clobber (match_dup 2))
8637 (clobber (match_dup 3))
8638 (clobber (match_dup 4))
8639 (clobber (match_dup 5))])]
8641 && (TARGET_POWER2 || TARGET_POWERPC)
8642 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8644 operands[2] = gen_reg_rtx (DFmode);
8645 operands[3] = gen_reg_rtx (DFmode);
8646 operands[4] = gen_reg_rtx (DImode);
8647 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8650 (define_insn_and_split "*fix_trunctfsi2_internal"
8651 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8652 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8653 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8654 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8655 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8656 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8658 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8660 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[5]))"
8664 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8666 gcc_assert (MEM_P (operands[5]));
8667 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8669 emit_insn (gen_fctiwz (operands[4], operands[2]));
8670 emit_move_insn (operands[5], operands[4]);
8671 emit_move_insn (operands[0], lowword);
8675 (define_insn "negtf2"
8676 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8677 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8679 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8682 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8683 return \"fneg %L0,%L1\;fneg %0,%1\";
8685 return \"fneg %0,%1\;fneg %L0,%L1\";
8687 [(set_attr "type" "fp")
8688 (set_attr "length" "8")])
8690 (define_expand "abstf2"
8691 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8692 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8694 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8697 rtx label = gen_label_rtx ();
8698 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8703 (define_expand "abstf2_internal"
8704 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8705 (match_operand:TF 1 "gpc_reg_operand" "f"))
8706 (set (match_dup 3) (match_dup 5))
8707 (set (match_dup 5) (abs:DF (match_dup 5)))
8708 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8709 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8710 (label_ref (match_operand 2 "" ""))
8712 (set (match_dup 6) (neg:DF (match_dup 6)))]
8714 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8717 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8718 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8719 operands[3] = gen_reg_rtx (DFmode);
8720 operands[4] = gen_reg_rtx (CCFPmode);
8721 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8722 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8725 ;; Next come the multi-word integer load and store and the load and store
8728 ; List r->r after r->"o<>", otherwise reload will try to reload a
8729 ; non-offsettable address by using r->r which won't make progress.
8730 (define_insn "*movdi_internal32"
8731 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8732 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8734 && (gpc_reg_operand (operands[0], DImode)
8735 || gpc_reg_operand (operands[1], DImode))"
8744 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8747 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8748 (match_operand:DI 1 "const_int_operand" ""))]
8749 "! TARGET_POWERPC64 && reload_completed"
8750 [(set (match_dup 2) (match_dup 4))
8751 (set (match_dup 3) (match_dup 1))]
8754 HOST_WIDE_INT value = INTVAL (operands[1]);
8755 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8757 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8759 #if HOST_BITS_PER_WIDE_INT == 32
8760 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8762 operands[4] = GEN_INT (value >> 32);
8763 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8768 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8769 (match_operand:DI 1 "input_operand" ""))]
8770 "reload_completed && !TARGET_POWERPC64
8771 && gpr_or_gpr_p (operands[0], operands[1])"
8773 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8775 (define_insn "*movdi_mfpgpr"
8776 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
8777 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
8778 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8779 && (gpc_reg_operand (operands[0], DImode)
8780 || gpc_reg_operand (operands[1], DImode))"
8797 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8798 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
8800 (define_insn "*movdi_internal64"
8801 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8802 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8803 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
8804 && (gpc_reg_operand (operands[0], DImode)
8805 || gpc_reg_operand (operands[1], DImode))"
8820 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8821 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8823 ;; immediate value valid for a single instruction hiding in a const_double
8825 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8826 (match_operand:DI 1 "const_double_operand" "F"))]
8827 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8828 && GET_CODE (operands[1]) == CONST_DOUBLE
8829 && num_insns_constant (operands[1], DImode) == 1"
8832 return ((unsigned HOST_WIDE_INT)
8833 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8834 ? \"li %0,%1\" : \"lis %0,%v1\";
8837 ;; Generate all one-bits and clear left or right.
8838 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8840 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8841 (match_operand:DI 1 "mask64_operand" ""))]
8842 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8843 [(set (match_dup 0) (const_int -1))
8845 (and:DI (rotate:DI (match_dup 0)
8850 ;; Split a load of a large constant into the appropriate five-instruction
8851 ;; sequence. Handle anything in a constant number of insns.
8852 ;; When non-easy constants can go in the TOC, this should use
8853 ;; easy_fp_constant predicate.
8855 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8856 (match_operand:DI 1 "const_int_operand" ""))]
8857 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8858 [(set (match_dup 0) (match_dup 2))
8859 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8861 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8863 if (tem == operands[0])
8870 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8871 (match_operand:DI 1 "const_double_operand" ""))]
8872 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8873 [(set (match_dup 0) (match_dup 2))
8874 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8876 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8878 if (tem == operands[0])
8884 ;; TImode is similar, except that we usually want to compute the address into
8885 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8886 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8888 ;; We say that MQ is clobbered in the last alternative because the first
8889 ;; alternative would never get used otherwise since it would need a reload
8890 ;; while the 2nd alternative would not. We put memory cases first so they
8891 ;; are preferred. Otherwise, we'd try to reload the output instead of
8892 ;; giving the SCRATCH mq.
8894 (define_insn "*movti_power"
8895 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8896 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8897 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8898 "TARGET_POWER && ! TARGET_POWERPC64
8899 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8902 switch (which_alternative)
8909 return \"{stsi|stswi} %1,%P0,16\";
8914 /* If the address is not used in the output, we can use lsi. Otherwise,
8915 fall through to generating four loads. */
8917 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8918 return \"{lsi|lswi} %0,%P1,16\";
8919 /* ... fall through ... */
8925 [(set_attr "type" "store,store,*,load,load,*")])
8927 (define_insn "*movti_string"
8928 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8929 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8930 "! TARGET_POWER && ! TARGET_POWERPC64
8931 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8934 switch (which_alternative)
8940 return \"{stsi|stswi} %1,%P0,16\";
8945 /* If the address is not used in the output, we can use lsi. Otherwise,
8946 fall through to generating four loads. */
8948 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8949 return \"{lsi|lswi} %0,%P1,16\";
8950 /* ... fall through ... */
8956 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
8958 (define_insn "*movti_ppc64"
8959 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8960 (match_operand:TI 1 "input_operand" "r,r,m"))]
8961 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8962 || gpc_reg_operand (operands[1], TImode))"
8964 [(set_attr "type" "*,load,store")])
8967 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8968 (match_operand:TI 1 "const_double_operand" ""))]
8970 [(set (match_dup 2) (match_dup 4))
8971 (set (match_dup 3) (match_dup 5))]
8974 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8976 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8978 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8980 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8981 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8983 else if (GET_CODE (operands[1]) == CONST_INT)
8985 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8986 operands[5] = operands[1];
8993 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8994 (match_operand:TI 1 "input_operand" ""))]
8996 && gpr_or_gpr_p (operands[0], operands[1])"
8998 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9000 (define_expand "load_multiple"
9001 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9002 (match_operand:SI 1 "" ""))
9003 (use (match_operand:SI 2 "" ""))])]
9004 "TARGET_STRING && !TARGET_POWERPC64"
9012 /* Support only loading a constant number of fixed-point registers from
9013 memory and only bother with this if more than two; the machine
9014 doesn't support more than eight. */
9015 if (GET_CODE (operands[2]) != CONST_INT
9016 || INTVAL (operands[2]) <= 2
9017 || INTVAL (operands[2]) > 8
9018 || GET_CODE (operands[1]) != MEM
9019 || GET_CODE (operands[0]) != REG
9020 || REGNO (operands[0]) >= 32)
9023 count = INTVAL (operands[2]);
9024 regno = REGNO (operands[0]);
9026 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9027 op1 = replace_equiv_address (operands[1],
9028 force_reg (SImode, XEXP (operands[1], 0)));
9030 for (i = 0; i < count; i++)
9031 XVECEXP (operands[3], 0, i)
9032 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9033 adjust_address_nv (op1, SImode, i * 4));
9036 (define_insn "*ldmsi8"
9037 [(match_parallel 0 "load_multiple_operation"
9038 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9039 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9040 (set (match_operand:SI 3 "gpc_reg_operand" "")
9041 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9042 (set (match_operand:SI 4 "gpc_reg_operand" "")
9043 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9044 (set (match_operand:SI 5 "gpc_reg_operand" "")
9045 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9046 (set (match_operand:SI 6 "gpc_reg_operand" "")
9047 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9048 (set (match_operand:SI 7 "gpc_reg_operand" "")
9049 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9050 (set (match_operand:SI 8 "gpc_reg_operand" "")
9051 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9052 (set (match_operand:SI 9 "gpc_reg_operand" "")
9053 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9054 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9056 { return rs6000_output_load_multiple (operands); }"
9057 [(set_attr "type" "load_ux")
9058 (set_attr "length" "32")])
9060 (define_insn "*ldmsi7"
9061 [(match_parallel 0 "load_multiple_operation"
9062 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9063 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9064 (set (match_operand:SI 3 "gpc_reg_operand" "")
9065 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9066 (set (match_operand:SI 4 "gpc_reg_operand" "")
9067 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9068 (set (match_operand:SI 5 "gpc_reg_operand" "")
9069 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9070 (set (match_operand:SI 6 "gpc_reg_operand" "")
9071 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9072 (set (match_operand:SI 7 "gpc_reg_operand" "")
9073 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9074 (set (match_operand:SI 8 "gpc_reg_operand" "")
9075 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9076 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9078 { return rs6000_output_load_multiple (operands); }"
9079 [(set_attr "type" "load_ux")
9080 (set_attr "length" "32")])
9082 (define_insn "*ldmsi6"
9083 [(match_parallel 0 "load_multiple_operation"
9084 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9085 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9086 (set (match_operand:SI 3 "gpc_reg_operand" "")
9087 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9088 (set (match_operand:SI 4 "gpc_reg_operand" "")
9089 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9090 (set (match_operand:SI 5 "gpc_reg_operand" "")
9091 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9092 (set (match_operand:SI 6 "gpc_reg_operand" "")
9093 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9094 (set (match_operand:SI 7 "gpc_reg_operand" "")
9095 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9096 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9098 { return rs6000_output_load_multiple (operands); }"
9099 [(set_attr "type" "load_ux")
9100 (set_attr "length" "32")])
9102 (define_insn "*ldmsi5"
9103 [(match_parallel 0 "load_multiple_operation"
9104 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9105 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9106 (set (match_operand:SI 3 "gpc_reg_operand" "")
9107 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9108 (set (match_operand:SI 4 "gpc_reg_operand" "")
9109 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9110 (set (match_operand:SI 5 "gpc_reg_operand" "")
9111 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9112 (set (match_operand:SI 6 "gpc_reg_operand" "")
9113 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9114 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9116 { return rs6000_output_load_multiple (operands); }"
9117 [(set_attr "type" "load_ux")
9118 (set_attr "length" "32")])
9120 (define_insn "*ldmsi4"
9121 [(match_parallel 0 "load_multiple_operation"
9122 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9123 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9124 (set (match_operand:SI 3 "gpc_reg_operand" "")
9125 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9126 (set (match_operand:SI 4 "gpc_reg_operand" "")
9127 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9128 (set (match_operand:SI 5 "gpc_reg_operand" "")
9129 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9130 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9132 { return rs6000_output_load_multiple (operands); }"
9133 [(set_attr "type" "load_ux")
9134 (set_attr "length" "32")])
9136 (define_insn "*ldmsi3"
9137 [(match_parallel 0 "load_multiple_operation"
9138 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9139 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9140 (set (match_operand:SI 3 "gpc_reg_operand" "")
9141 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9142 (set (match_operand:SI 4 "gpc_reg_operand" "")
9143 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9144 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9146 { return rs6000_output_load_multiple (operands); }"
9147 [(set_attr "type" "load_ux")
9148 (set_attr "length" "32")])
9150 (define_expand "store_multiple"
9151 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9152 (match_operand:SI 1 "" ""))
9153 (clobber (scratch:SI))
9154 (use (match_operand:SI 2 "" ""))])]
9155 "TARGET_STRING && !TARGET_POWERPC64"
9164 /* Support only storing a constant number of fixed-point registers to
9165 memory and only bother with this if more than two; the machine
9166 doesn't support more than eight. */
9167 if (GET_CODE (operands[2]) != CONST_INT
9168 || INTVAL (operands[2]) <= 2
9169 || INTVAL (operands[2]) > 8
9170 || GET_CODE (operands[0]) != MEM
9171 || GET_CODE (operands[1]) != REG
9172 || REGNO (operands[1]) >= 32)
9175 count = INTVAL (operands[2]);
9176 regno = REGNO (operands[1]);
9178 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9179 to = force_reg (SImode, XEXP (operands[0], 0));
9180 op0 = replace_equiv_address (operands[0], to);
9182 XVECEXP (operands[3], 0, 0)
9183 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9184 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9185 gen_rtx_SCRATCH (SImode));
9187 for (i = 1; i < count; i++)
9188 XVECEXP (operands[3], 0, i + 1)
9189 = gen_rtx_SET (VOIDmode,
9190 adjust_address_nv (op0, SImode, i * 4),
9191 gen_rtx_REG (SImode, regno + i));
9194 (define_insn "*stmsi8"
9195 [(match_parallel 0 "store_multiple_operation"
9196 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9197 (match_operand:SI 2 "gpc_reg_operand" "r"))
9198 (clobber (match_scratch:SI 3 "=X"))
9199 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9200 (match_operand:SI 4 "gpc_reg_operand" "r"))
9201 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9202 (match_operand:SI 5 "gpc_reg_operand" "r"))
9203 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9204 (match_operand:SI 6 "gpc_reg_operand" "r"))
9205 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9206 (match_operand:SI 7 "gpc_reg_operand" "r"))
9207 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9208 (match_operand:SI 8 "gpc_reg_operand" "r"))
9209 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9210 (match_operand:SI 9 "gpc_reg_operand" "r"))
9211 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9212 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9213 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9214 "{stsi|stswi} %2,%1,%O0"
9215 [(set_attr "type" "store_ux")])
9217 (define_insn "*stmsi7"
9218 [(match_parallel 0 "store_multiple_operation"
9219 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9220 (match_operand:SI 2 "gpc_reg_operand" "r"))
9221 (clobber (match_scratch:SI 3 "=X"))
9222 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9223 (match_operand:SI 4 "gpc_reg_operand" "r"))
9224 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9225 (match_operand:SI 5 "gpc_reg_operand" "r"))
9226 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9227 (match_operand:SI 6 "gpc_reg_operand" "r"))
9228 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9229 (match_operand:SI 7 "gpc_reg_operand" "r"))
9230 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9231 (match_operand:SI 8 "gpc_reg_operand" "r"))
9232 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9233 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9234 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9235 "{stsi|stswi} %2,%1,%O0"
9236 [(set_attr "type" "store_ux")])
9238 (define_insn "*stmsi6"
9239 [(match_parallel 0 "store_multiple_operation"
9240 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9241 (match_operand:SI 2 "gpc_reg_operand" "r"))
9242 (clobber (match_scratch:SI 3 "=X"))
9243 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9244 (match_operand:SI 4 "gpc_reg_operand" "r"))
9245 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9246 (match_operand:SI 5 "gpc_reg_operand" "r"))
9247 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9248 (match_operand:SI 6 "gpc_reg_operand" "r"))
9249 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9250 (match_operand:SI 7 "gpc_reg_operand" "r"))
9251 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9252 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9253 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9254 "{stsi|stswi} %2,%1,%O0"
9255 [(set_attr "type" "store_ux")])
9257 (define_insn "*stmsi5"
9258 [(match_parallel 0 "store_multiple_operation"
9259 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9260 (match_operand:SI 2 "gpc_reg_operand" "r"))
9261 (clobber (match_scratch:SI 3 "=X"))
9262 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9263 (match_operand:SI 4 "gpc_reg_operand" "r"))
9264 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9265 (match_operand:SI 5 "gpc_reg_operand" "r"))
9266 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9267 (match_operand:SI 6 "gpc_reg_operand" "r"))
9268 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9269 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9270 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9271 "{stsi|stswi} %2,%1,%O0"
9272 [(set_attr "type" "store_ux")])
9274 (define_insn "*stmsi4"
9275 [(match_parallel 0 "store_multiple_operation"
9276 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9277 (match_operand:SI 2 "gpc_reg_operand" "r"))
9278 (clobber (match_scratch:SI 3 "=X"))
9279 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9280 (match_operand:SI 4 "gpc_reg_operand" "r"))
9281 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9282 (match_operand:SI 5 "gpc_reg_operand" "r"))
9283 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9284 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9285 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9286 "{stsi|stswi} %2,%1,%O0"
9287 [(set_attr "type" "store_ux")])
9289 (define_insn "*stmsi3"
9290 [(match_parallel 0 "store_multiple_operation"
9291 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9292 (match_operand:SI 2 "gpc_reg_operand" "r"))
9293 (clobber (match_scratch:SI 3 "=X"))
9294 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9295 (match_operand:SI 4 "gpc_reg_operand" "r"))
9296 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9297 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9298 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9299 "{stsi|stswi} %2,%1,%O0"
9300 [(set_attr "type" "store_ux")])
9302 (define_insn "*stmsi8_power"
9303 [(match_parallel 0 "store_multiple_operation"
9304 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9305 (match_operand:SI 2 "gpc_reg_operand" "r"))
9306 (clobber (match_scratch:SI 3 "=q"))
9307 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9308 (match_operand:SI 4 "gpc_reg_operand" "r"))
9309 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9310 (match_operand:SI 5 "gpc_reg_operand" "r"))
9311 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9312 (match_operand:SI 6 "gpc_reg_operand" "r"))
9313 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9314 (match_operand:SI 7 "gpc_reg_operand" "r"))
9315 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9316 (match_operand:SI 8 "gpc_reg_operand" "r"))
9317 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9318 (match_operand:SI 9 "gpc_reg_operand" "r"))
9319 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9320 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9321 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9322 "{stsi|stswi} %2,%1,%O0"
9323 [(set_attr "type" "store_ux")])
9325 (define_insn "*stmsi7_power"
9326 [(match_parallel 0 "store_multiple_operation"
9327 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9328 (match_operand:SI 2 "gpc_reg_operand" "r"))
9329 (clobber (match_scratch:SI 3 "=q"))
9330 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9331 (match_operand:SI 4 "gpc_reg_operand" "r"))
9332 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9333 (match_operand:SI 5 "gpc_reg_operand" "r"))
9334 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9335 (match_operand:SI 6 "gpc_reg_operand" "r"))
9336 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9337 (match_operand:SI 7 "gpc_reg_operand" "r"))
9338 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9339 (match_operand:SI 8 "gpc_reg_operand" "r"))
9340 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9341 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9342 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9343 "{stsi|stswi} %2,%1,%O0"
9344 [(set_attr "type" "store_ux")])
9346 (define_insn "*stmsi6_power"
9347 [(match_parallel 0 "store_multiple_operation"
9348 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9349 (match_operand:SI 2 "gpc_reg_operand" "r"))
9350 (clobber (match_scratch:SI 3 "=q"))
9351 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9352 (match_operand:SI 4 "gpc_reg_operand" "r"))
9353 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9354 (match_operand:SI 5 "gpc_reg_operand" "r"))
9355 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9356 (match_operand:SI 6 "gpc_reg_operand" "r"))
9357 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9358 (match_operand:SI 7 "gpc_reg_operand" "r"))
9359 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9360 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9361 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9362 "{stsi|stswi} %2,%1,%O0"
9363 [(set_attr "type" "store_ux")])
9365 (define_insn "*stmsi5_power"
9366 [(match_parallel 0 "store_multiple_operation"
9367 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9368 (match_operand:SI 2 "gpc_reg_operand" "r"))
9369 (clobber (match_scratch:SI 3 "=q"))
9370 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9371 (match_operand:SI 4 "gpc_reg_operand" "r"))
9372 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9373 (match_operand:SI 5 "gpc_reg_operand" "r"))
9374 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9375 (match_operand:SI 6 "gpc_reg_operand" "r"))
9376 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9377 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9378 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9379 "{stsi|stswi} %2,%1,%O0"
9380 [(set_attr "type" "store_ux")])
9382 (define_insn "*stmsi4_power"
9383 [(match_parallel 0 "store_multiple_operation"
9384 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9385 (match_operand:SI 2 "gpc_reg_operand" "r"))
9386 (clobber (match_scratch:SI 3 "=q"))
9387 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9388 (match_operand:SI 4 "gpc_reg_operand" "r"))
9389 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9390 (match_operand:SI 5 "gpc_reg_operand" "r"))
9391 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9392 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9393 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9394 "{stsi|stswi} %2,%1,%O0"
9395 [(set_attr "type" "store_ux")])
9397 (define_insn "*stmsi3_power"
9398 [(match_parallel 0 "store_multiple_operation"
9399 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9400 (match_operand:SI 2 "gpc_reg_operand" "r"))
9401 (clobber (match_scratch:SI 3 "=q"))
9402 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9403 (match_operand:SI 4 "gpc_reg_operand" "r"))
9404 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9405 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9406 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9407 "{stsi|stswi} %2,%1,%O0"
9408 [(set_attr "type" "store_ux")])
9410 (define_expand "setmemsi"
9411 [(parallel [(set (match_operand:BLK 0 "" "")
9412 (match_operand 2 "const_int_operand" ""))
9413 (use (match_operand:SI 1 "" ""))
9414 (use (match_operand:SI 3 "" ""))])]
9418 /* If value to set is not zero, use the library routine. */
9419 if (operands[2] != const0_rtx)
9422 if (expand_block_clear (operands))
9428 ;; String/block move insn.
9429 ;; Argument 0 is the destination
9430 ;; Argument 1 is the source
9431 ;; Argument 2 is the length
9432 ;; Argument 3 is the alignment
9434 (define_expand "movmemsi"
9435 [(parallel [(set (match_operand:BLK 0 "" "")
9436 (match_operand:BLK 1 "" ""))
9437 (use (match_operand:SI 2 "" ""))
9438 (use (match_operand:SI 3 "" ""))])]
9442 if (expand_block_move (operands))
9448 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9449 ;; register allocator doesn't have a clue about allocating 8 word registers.
9450 ;; rD/rS = r5 is preferred, efficient form.
9451 (define_expand "movmemsi_8reg"
9452 [(parallel [(set (match_operand 0 "" "")
9453 (match_operand 1 "" ""))
9454 (use (match_operand 2 "" ""))
9455 (use (match_operand 3 "" ""))
9456 (clobber (reg:SI 5))
9457 (clobber (reg:SI 6))
9458 (clobber (reg:SI 7))
9459 (clobber (reg:SI 8))
9460 (clobber (reg:SI 9))
9461 (clobber (reg:SI 10))
9462 (clobber (reg:SI 11))
9463 (clobber (reg:SI 12))
9464 (clobber (match_scratch:SI 4 ""))])]
9469 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9470 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9471 (use (match_operand:SI 2 "immediate_operand" "i"))
9472 (use (match_operand:SI 3 "immediate_operand" "i"))
9473 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9474 (clobber (reg:SI 6))
9475 (clobber (reg:SI 7))
9476 (clobber (reg:SI 8))
9477 (clobber (reg:SI 9))
9478 (clobber (reg:SI 10))
9479 (clobber (reg:SI 11))
9480 (clobber (reg:SI 12))
9481 (clobber (match_scratch:SI 5 "=q"))]
9482 "TARGET_STRING && TARGET_POWER
9483 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9484 || INTVAL (operands[2]) == 0)
9485 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9486 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9487 && REGNO (operands[4]) == 5"
9488 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9489 [(set_attr "type" "store_ux")
9490 (set_attr "length" "8")])
9493 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9494 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9495 (use (match_operand:SI 2 "immediate_operand" "i"))
9496 (use (match_operand:SI 3 "immediate_operand" "i"))
9497 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9498 (clobber (reg:SI 6))
9499 (clobber (reg:SI 7))
9500 (clobber (reg:SI 8))
9501 (clobber (reg:SI 9))
9502 (clobber (reg:SI 10))
9503 (clobber (reg:SI 11))
9504 (clobber (reg:SI 12))
9505 (clobber (match_scratch:SI 5 "=X"))]
9506 "TARGET_STRING && ! TARGET_POWER
9507 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9508 || INTVAL (operands[2]) == 0)
9509 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9510 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9511 && REGNO (operands[4]) == 5"
9512 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9513 [(set_attr "type" "store_ux")
9514 (set_attr "length" "8")])
9516 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9517 ;; register allocator doesn't have a clue about allocating 6 word registers.
9518 ;; rD/rS = r5 is preferred, efficient form.
9519 (define_expand "movmemsi_6reg"
9520 [(parallel [(set (match_operand 0 "" "")
9521 (match_operand 1 "" ""))
9522 (use (match_operand 2 "" ""))
9523 (use (match_operand 3 "" ""))
9524 (clobber (reg:SI 5))
9525 (clobber (reg:SI 6))
9526 (clobber (reg:SI 7))
9527 (clobber (reg:SI 8))
9528 (clobber (reg:SI 9))
9529 (clobber (reg:SI 10))
9530 (clobber (match_scratch:SI 4 ""))])]
9535 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9536 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9537 (use (match_operand:SI 2 "immediate_operand" "i"))
9538 (use (match_operand:SI 3 "immediate_operand" "i"))
9539 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9540 (clobber (reg:SI 6))
9541 (clobber (reg:SI 7))
9542 (clobber (reg:SI 8))
9543 (clobber (reg:SI 9))
9544 (clobber (reg:SI 10))
9545 (clobber (match_scratch:SI 5 "=q"))]
9546 "TARGET_STRING && TARGET_POWER
9547 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9548 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9549 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9550 && REGNO (operands[4]) == 5"
9551 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9552 [(set_attr "type" "store_ux")
9553 (set_attr "length" "8")])
9556 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9557 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9558 (use (match_operand:SI 2 "immediate_operand" "i"))
9559 (use (match_operand:SI 3 "immediate_operand" "i"))
9560 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9561 (clobber (reg:SI 6))
9562 (clobber (reg:SI 7))
9563 (clobber (reg:SI 8))
9564 (clobber (reg:SI 9))
9565 (clobber (reg:SI 10))
9566 (clobber (match_scratch:SI 5 "=X"))]
9567 "TARGET_STRING && ! TARGET_POWER
9568 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9569 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9570 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9571 && REGNO (operands[4]) == 5"
9572 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9573 [(set_attr "type" "store_ux")
9574 (set_attr "length" "8")])
9576 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9577 ;; problems with TImode.
9578 ;; rD/rS = r5 is preferred, efficient form.
9579 (define_expand "movmemsi_4reg"
9580 [(parallel [(set (match_operand 0 "" "")
9581 (match_operand 1 "" ""))
9582 (use (match_operand 2 "" ""))
9583 (use (match_operand 3 "" ""))
9584 (clobber (reg:SI 5))
9585 (clobber (reg:SI 6))
9586 (clobber (reg:SI 7))
9587 (clobber (reg:SI 8))
9588 (clobber (match_scratch:SI 4 ""))])]
9593 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9594 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9595 (use (match_operand:SI 2 "immediate_operand" "i"))
9596 (use (match_operand:SI 3 "immediate_operand" "i"))
9597 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9598 (clobber (reg:SI 6))
9599 (clobber (reg:SI 7))
9600 (clobber (reg:SI 8))
9601 (clobber (match_scratch:SI 5 "=q"))]
9602 "TARGET_STRING && TARGET_POWER
9603 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9604 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9605 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9606 && REGNO (operands[4]) == 5"
9607 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9608 [(set_attr "type" "store_ux")
9609 (set_attr "length" "8")])
9612 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9613 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9614 (use (match_operand:SI 2 "immediate_operand" "i"))
9615 (use (match_operand:SI 3 "immediate_operand" "i"))
9616 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9617 (clobber (reg:SI 6))
9618 (clobber (reg:SI 7))
9619 (clobber (reg:SI 8))
9620 (clobber (match_scratch:SI 5 "=X"))]
9621 "TARGET_STRING && ! TARGET_POWER
9622 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9623 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9624 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9625 && REGNO (operands[4]) == 5"
9626 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9627 [(set_attr "type" "store_ux")
9628 (set_attr "length" "8")])
9630 ;; Move up to 8 bytes at a time.
9631 (define_expand "movmemsi_2reg"
9632 [(parallel [(set (match_operand 0 "" "")
9633 (match_operand 1 "" ""))
9634 (use (match_operand 2 "" ""))
9635 (use (match_operand 3 "" ""))
9636 (clobber (match_scratch:DI 4 ""))
9637 (clobber (match_scratch:SI 5 ""))])]
9638 "TARGET_STRING && ! TARGET_POWERPC64"
9642 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9643 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9644 (use (match_operand:SI 2 "immediate_operand" "i"))
9645 (use (match_operand:SI 3 "immediate_operand" "i"))
9646 (clobber (match_scratch:DI 4 "=&r"))
9647 (clobber (match_scratch:SI 5 "=q"))]
9648 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9649 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9650 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9651 [(set_attr "type" "store_ux")
9652 (set_attr "length" "8")])
9655 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9656 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9657 (use (match_operand:SI 2 "immediate_operand" "i"))
9658 (use (match_operand:SI 3 "immediate_operand" "i"))
9659 (clobber (match_scratch:DI 4 "=&r"))
9660 (clobber (match_scratch:SI 5 "=X"))]
9661 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9662 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9663 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9664 [(set_attr "type" "store_ux")
9665 (set_attr "length" "8")])
9667 ;; Move up to 4 bytes at a time.
9668 (define_expand "movmemsi_1reg"
9669 [(parallel [(set (match_operand 0 "" "")
9670 (match_operand 1 "" ""))
9671 (use (match_operand 2 "" ""))
9672 (use (match_operand 3 "" ""))
9673 (clobber (match_scratch:SI 4 ""))
9674 (clobber (match_scratch:SI 5 ""))])]
9679 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9680 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9681 (use (match_operand:SI 2 "immediate_operand" "i"))
9682 (use (match_operand:SI 3 "immediate_operand" "i"))
9683 (clobber (match_scratch:SI 4 "=&r"))
9684 (clobber (match_scratch:SI 5 "=q"))]
9685 "TARGET_STRING && TARGET_POWER
9686 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9687 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9688 [(set_attr "type" "store_ux")
9689 (set_attr "length" "8")])
9692 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9693 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9694 (use (match_operand:SI 2 "immediate_operand" "i"))
9695 (use (match_operand:SI 3 "immediate_operand" "i"))
9696 (clobber (match_scratch:SI 4 "=&r"))
9697 (clobber (match_scratch:SI 5 "=X"))]
9698 "TARGET_STRING && ! TARGET_POWER
9699 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9700 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9701 [(set_attr "type" "store_ux")
9702 (set_attr "length" "8")])
9704 ;; Define insns that do load or store with update. Some of these we can
9705 ;; get by using pre-decrement or pre-increment, but the hardware can also
9706 ;; do cases where the increment is not the size of the object.
9708 ;; In all these cases, we use operands 0 and 1 for the register being
9709 ;; incremented because those are the operands that local-alloc will
9710 ;; tie and these are the pair most likely to be tieable (and the ones
9711 ;; that will benefit the most).
9713 (define_insn "*movdi_update1"
9714 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9715 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9716 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9717 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9718 (plus:DI (match_dup 1) (match_dup 2)))]
9719 "TARGET_POWERPC64 && TARGET_UPDATE"
9723 [(set_attr "type" "load_ux,load_u")])
9725 (define_insn "movdi_<mode>_update"
9726 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9727 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9728 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9729 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9730 (plus:P (match_dup 1) (match_dup 2)))]
9731 "TARGET_POWERPC64 && TARGET_UPDATE"
9735 [(set_attr "type" "store_ux,store_u")])
9737 (define_insn "*movsi_update1"
9738 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9739 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9740 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9741 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9742 (plus:SI (match_dup 1) (match_dup 2)))]
9745 {lux|lwzux} %3,%0,%2
9746 {lu|lwzu} %3,%2(%0)"
9747 [(set_attr "type" "load_ux,load_u")])
9749 (define_insn "*movsi_update2"
9750 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9752 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9753 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9754 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9755 (plus:DI (match_dup 1) (match_dup 2)))]
9758 [(set_attr "type" "load_ext_ux")])
9760 (define_insn "movsi_update"
9761 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9762 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9763 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9764 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9765 (plus:SI (match_dup 1) (match_dup 2)))]
9768 {stux|stwux} %3,%0,%2
9769 {stu|stwu} %3,%2(%0)"
9770 [(set_attr "type" "store_ux,store_u")])
9772 (define_insn "*movhi_update1"
9773 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9774 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9775 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9776 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9777 (plus:SI (match_dup 1) (match_dup 2)))]
9782 [(set_attr "type" "load_ux,load_u")])
9784 (define_insn "*movhi_update2"
9785 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9787 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9788 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9789 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9790 (plus:SI (match_dup 1) (match_dup 2)))]
9795 [(set_attr "type" "load_ux,load_u")])
9797 (define_insn "*movhi_update3"
9798 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9800 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9801 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9802 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9803 (plus:SI (match_dup 1) (match_dup 2)))]
9808 [(set_attr "type" "load_ext_ux,load_ext_u")])
9810 (define_insn "*movhi_update4"
9811 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9812 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9813 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9814 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9815 (plus:SI (match_dup 1) (match_dup 2)))]
9820 [(set_attr "type" "store_ux,store_u")])
9822 (define_insn "*movqi_update1"
9823 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9824 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9825 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9826 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9827 (plus:SI (match_dup 1) (match_dup 2)))]
9832 [(set_attr "type" "load_ux,load_u")])
9834 (define_insn "*movqi_update2"
9835 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9837 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9838 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9839 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9840 (plus:SI (match_dup 1) (match_dup 2)))]
9845 [(set_attr "type" "load_ux,load_u")])
9847 (define_insn "*movqi_update3"
9848 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9849 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9850 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9851 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9852 (plus:SI (match_dup 1) (match_dup 2)))]
9857 [(set_attr "type" "store_ux,store_u")])
9859 (define_insn "*movsf_update1"
9860 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9861 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9862 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9863 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9864 (plus:SI (match_dup 1) (match_dup 2)))]
9865 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9869 [(set_attr "type" "fpload_ux,fpload_u")])
9871 (define_insn "*movsf_update2"
9872 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9873 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9874 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9875 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9876 (plus:SI (match_dup 1) (match_dup 2)))]
9877 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9881 [(set_attr "type" "fpstore_ux,fpstore_u")])
9883 (define_insn "*movsf_update3"
9884 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9885 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9886 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9887 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9888 (plus:SI (match_dup 1) (match_dup 2)))]
9889 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9891 {lux|lwzux} %3,%0,%2
9892 {lu|lwzu} %3,%2(%0)"
9893 [(set_attr "type" "load_ux,load_u")])
9895 (define_insn "*movsf_update4"
9896 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9897 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9898 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9899 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9900 (plus:SI (match_dup 1) (match_dup 2)))]
9901 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9903 {stux|stwux} %3,%0,%2
9904 {stu|stwu} %3,%2(%0)"
9905 [(set_attr "type" "store_ux,store_u")])
9907 (define_insn "*movdf_update1"
9908 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9909 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9910 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9911 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9912 (plus:SI (match_dup 1) (match_dup 2)))]
9913 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9917 [(set_attr "type" "fpload_ux,fpload_u")])
9919 (define_insn "*movdf_update2"
9920 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9921 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9922 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9923 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9924 (plus:SI (match_dup 1) (match_dup 2)))]
9925 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9929 [(set_attr "type" "fpstore_ux,fpstore_u")])
9931 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9933 (define_insn "*lfq_power2"
9934 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
9935 (match_operand:V2DF 1 "memory_operand" ""))]
9937 && TARGET_HARD_FLOAT && TARGET_FPRS"
9941 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9942 (match_operand:DF 1 "memory_operand" ""))
9943 (set (match_operand:DF 2 "gpc_reg_operand" "")
9944 (match_operand:DF 3 "memory_operand" ""))]
9946 && TARGET_HARD_FLOAT && TARGET_FPRS
9947 && registers_ok_for_quad_peep (operands[0], operands[2])
9948 && mems_ok_for_quad_peep (operands[1], operands[3])"
9951 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
9952 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
9954 (define_insn "*stfq_power2"
9955 [(set (match_operand:V2DF 0 "memory_operand" "")
9956 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
9958 && TARGET_HARD_FLOAT && TARGET_FPRS"
9963 [(set (match_operand:DF 0 "memory_operand" "")
9964 (match_operand:DF 1 "gpc_reg_operand" ""))
9965 (set (match_operand:DF 2 "memory_operand" "")
9966 (match_operand:DF 3 "gpc_reg_operand" ""))]
9968 && TARGET_HARD_FLOAT && TARGET_FPRS
9969 && registers_ok_for_quad_peep (operands[1], operands[3])
9970 && mems_ok_for_quad_peep (operands[0], operands[2])"
9973 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
9974 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
9976 ;; After inserting conditional returns we can sometimes have
9977 ;; unnecessary register moves. Unfortunately we cannot have a
9978 ;; modeless peephole here, because some single SImode sets have early
9979 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9980 ;; sequences, using get_attr_length here will smash the operands
9981 ;; array. Neither is there an early_cobbler_p predicate.
9982 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
9984 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9985 (match_operand:DF 1 "any_operand" ""))
9986 (set (match_operand:DF 2 "gpc_reg_operand" "")
9988 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
9989 && peep2_reg_dead_p (2, operands[0])"
9990 [(set (match_dup 2) (match_dup 1))])
9993 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9994 (match_operand:SF 1 "any_operand" ""))
9995 (set (match_operand:SF 2 "gpc_reg_operand" "")
9997 "peep2_reg_dead_p (2, operands[0])"
9998 [(set (match_dup 2) (match_dup 1))])
10003 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
10004 (define_insn "tls_gd_32"
10005 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10006 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10007 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10009 "HAVE_AS_TLS && !TARGET_64BIT"
10010 "addi %0,%1,%2@got@tlsgd")
10012 (define_insn "tls_gd_64"
10013 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10014 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10015 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10017 "HAVE_AS_TLS && TARGET_64BIT"
10018 "addi %0,%1,%2@got@tlsgd")
10020 (define_insn "tls_ld_32"
10021 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10022 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
10024 "HAVE_AS_TLS && !TARGET_64BIT"
10025 "addi %0,%1,%&@got@tlsld")
10027 (define_insn "tls_ld_64"
10028 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10029 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
10031 "HAVE_AS_TLS && TARGET_64BIT"
10032 "addi %0,%1,%&@got@tlsld")
10034 (define_insn "tls_dtprel_32"
10035 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10036 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10037 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10038 UNSPEC_TLSDTPREL))]
10039 "HAVE_AS_TLS && !TARGET_64BIT"
10040 "addi %0,%1,%2@dtprel")
10042 (define_insn "tls_dtprel_64"
10043 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10044 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10045 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10046 UNSPEC_TLSDTPREL))]
10047 "HAVE_AS_TLS && TARGET_64BIT"
10048 "addi %0,%1,%2@dtprel")
10050 (define_insn "tls_dtprel_ha_32"
10051 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10052 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10053 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10054 UNSPEC_TLSDTPRELHA))]
10055 "HAVE_AS_TLS && !TARGET_64BIT"
10056 "addis %0,%1,%2@dtprel@ha")
10058 (define_insn "tls_dtprel_ha_64"
10059 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10060 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10061 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10062 UNSPEC_TLSDTPRELHA))]
10063 "HAVE_AS_TLS && TARGET_64BIT"
10064 "addis %0,%1,%2@dtprel@ha")
10066 (define_insn "tls_dtprel_lo_32"
10067 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10068 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10069 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10070 UNSPEC_TLSDTPRELLO))]
10071 "HAVE_AS_TLS && !TARGET_64BIT"
10072 "addi %0,%1,%2@dtprel@l")
10074 (define_insn "tls_dtprel_lo_64"
10075 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10076 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10077 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10078 UNSPEC_TLSDTPRELLO))]
10079 "HAVE_AS_TLS && TARGET_64BIT"
10080 "addi %0,%1,%2@dtprel@l")
10082 (define_insn "tls_got_dtprel_32"
10083 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10084 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10085 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10086 UNSPEC_TLSGOTDTPREL))]
10087 "HAVE_AS_TLS && !TARGET_64BIT"
10088 "lwz %0,%2@got@dtprel(%1)")
10090 (define_insn "tls_got_dtprel_64"
10091 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10092 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10093 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10094 UNSPEC_TLSGOTDTPREL))]
10095 "HAVE_AS_TLS && TARGET_64BIT"
10096 "ld %0,%2@got@dtprel(%1)")
10098 (define_insn "tls_tprel_32"
10099 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10100 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10101 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10103 "HAVE_AS_TLS && !TARGET_64BIT"
10104 "addi %0,%1,%2@tprel")
10106 (define_insn "tls_tprel_64"
10107 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10108 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10109 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10111 "HAVE_AS_TLS && TARGET_64BIT"
10112 "addi %0,%1,%2@tprel")
10114 (define_insn "tls_tprel_ha_32"
10115 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10116 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10117 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10118 UNSPEC_TLSTPRELHA))]
10119 "HAVE_AS_TLS && !TARGET_64BIT"
10120 "addis %0,%1,%2@tprel@ha")
10122 (define_insn "tls_tprel_ha_64"
10123 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10124 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10125 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10126 UNSPEC_TLSTPRELHA))]
10127 "HAVE_AS_TLS && TARGET_64BIT"
10128 "addis %0,%1,%2@tprel@ha")
10130 (define_insn "tls_tprel_lo_32"
10131 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10132 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10133 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10134 UNSPEC_TLSTPRELLO))]
10135 "HAVE_AS_TLS && !TARGET_64BIT"
10136 "addi %0,%1,%2@tprel@l")
10138 (define_insn "tls_tprel_lo_64"
10139 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10140 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10141 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10142 UNSPEC_TLSTPRELLO))]
10143 "HAVE_AS_TLS && TARGET_64BIT"
10144 "addi %0,%1,%2@tprel@l")
10146 ;; "b" output constraint here and on tls_tls input to support linker tls
10147 ;; optimization. The linker may edit the instructions emitted by a
10148 ;; tls_got_tprel/tls_tls pair to addis,addi.
10149 (define_insn "tls_got_tprel_32"
10150 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10151 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10152 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10153 UNSPEC_TLSGOTTPREL))]
10154 "HAVE_AS_TLS && !TARGET_64BIT"
10155 "lwz %0,%2@got@tprel(%1)")
10157 (define_insn "tls_got_tprel_64"
10158 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10159 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10160 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10161 UNSPEC_TLSGOTTPREL))]
10162 "HAVE_AS_TLS && TARGET_64BIT"
10163 "ld %0,%2@got@tprel(%1)")
10165 (define_insn "tls_tls_32"
10166 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10167 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10168 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10170 "HAVE_AS_TLS && !TARGET_64BIT"
10171 "add %0,%1,%2@tls")
10173 (define_insn "tls_tls_64"
10174 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10175 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10176 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10178 "HAVE_AS_TLS && TARGET_64BIT"
10179 "add %0,%1,%2@tls")
10181 ;; Next come insns related to the calling sequence.
10183 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10184 ;; We move the back-chain and decrement the stack pointer.
10186 (define_expand "allocate_stack"
10187 [(set (match_operand 0 "gpc_reg_operand" "=r")
10188 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10190 (minus (reg 1) (match_dup 1)))]
10193 { rtx chain = gen_reg_rtx (Pmode);
10194 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10197 emit_move_insn (chain, stack_bot);
10199 /* Check stack bounds if necessary. */
10200 if (current_function_limit_stack)
10203 available = expand_binop (Pmode, sub_optab,
10204 stack_pointer_rtx, stack_limit_rtx,
10205 NULL_RTX, 1, OPTAB_WIDEN);
10206 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10209 if (GET_CODE (operands[1]) != CONST_INT
10210 || INTVAL (operands[1]) < -32767
10211 || INTVAL (operands[1]) > 32768)
10213 neg_op0 = gen_reg_rtx (Pmode);
10215 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10217 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10220 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10223 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
10224 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10228 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10229 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10230 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10233 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10237 ;; These patterns say how to save and restore the stack pointer. We need not
10238 ;; save the stack pointer at function level since we are careful to
10239 ;; preserve the backchain. At block level, we have to restore the backchain
10240 ;; when we restore the stack pointer.
10242 ;; For nonlocal gotos, we must save both the stack pointer and its
10243 ;; backchain and restore both. Note that in the nonlocal case, the
10244 ;; save area is a memory location.
10246 (define_expand "save_stack_function"
10247 [(match_operand 0 "any_operand" "")
10248 (match_operand 1 "any_operand" "")]
10252 (define_expand "restore_stack_function"
10253 [(match_operand 0 "any_operand" "")
10254 (match_operand 1 "any_operand" "")]
10258 ;; Adjust stack pointer (op0) to a new value (op1).
10259 ;; First copy old stack backchain to new location, and ensure that the
10260 ;; scheduler won't reorder the sp assignment before the backchain write.
10261 (define_expand "restore_stack_block"
10262 [(set (match_dup 2) (match_dup 3))
10263 (set (match_dup 4) (match_dup 2))
10264 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10265 (set (match_operand 0 "register_operand" "")
10266 (match_operand 1 "register_operand" ""))]
10270 operands[2] = gen_reg_rtx (Pmode);
10271 operands[3] = gen_frame_mem (Pmode, operands[0]);
10272 operands[4] = gen_frame_mem (Pmode, operands[1]);
10273 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10276 (define_expand "save_stack_nonlocal"
10277 [(set (match_dup 3) (match_dup 4))
10278 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10279 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10283 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10285 /* Copy the backchain to the first word, sp to the second. */
10286 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10287 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10288 operands[3] = gen_reg_rtx (Pmode);
10289 operands[4] = gen_frame_mem (Pmode, operands[1]);
10292 (define_expand "restore_stack_nonlocal"
10293 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10294 (set (match_dup 3) (match_dup 4))
10295 (set (match_dup 5) (match_dup 2))
10296 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10297 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10301 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10303 /* Restore the backchain from the first word, sp from the second. */
10304 operands[2] = gen_reg_rtx (Pmode);
10305 operands[3] = gen_reg_rtx (Pmode);
10306 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10307 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10308 operands[5] = gen_frame_mem (Pmode, operands[3]);
10309 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10312 ;; TOC register handling.
10314 ;; Code to initialize the TOC register...
10316 (define_insn "load_toc_aix_si"
10317 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10318 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10319 (use (reg:SI 2))])]
10320 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10324 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10325 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10326 operands[2] = gen_rtx_REG (Pmode, 2);
10327 return \"{l|lwz} %0,%1(%2)\";
10329 [(set_attr "type" "load")])
10331 (define_insn "load_toc_aix_di"
10332 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10333 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10334 (use (reg:DI 2))])]
10335 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10339 #ifdef TARGET_RELOCATABLE
10340 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10341 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10343 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10346 strcat (buf, \"@toc\");
10347 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10348 operands[2] = gen_rtx_REG (Pmode, 2);
10349 return \"ld %0,%1(%2)\";
10351 [(set_attr "type" "load")])
10353 (define_insn "load_toc_v4_pic_si"
10354 [(set (match_operand:SI 0 "register_operand" "=l")
10355 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10356 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10357 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10358 [(set_attr "type" "branch")
10359 (set_attr "length" "4")])
10361 (define_insn "load_toc_v4_PIC_1"
10362 [(set (match_operand:SI 0 "register_operand" "=l")
10363 (match_operand:SI 1 "immediate_operand" "s"))
10364 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
10365 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10366 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10367 "bcl 20,31,%1\\n%1:"
10368 [(set_attr "type" "branch")
10369 (set_attr "length" "4")])
10371 (define_insn "load_toc_v4_PIC_1b"
10372 [(set (match_operand:SI 0 "register_operand" "=l")
10373 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
10375 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10376 "bcl 20,31,$+8\\n\\t.long %1-$"
10377 [(set_attr "type" "branch")
10378 (set_attr "length" "8")])
10380 (define_insn "load_toc_v4_PIC_2"
10381 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10382 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10383 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10384 (match_operand:SI 3 "immediate_operand" "s")))))]
10385 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10386 "{l|lwz} %0,%2-%3(%1)"
10387 [(set_attr "type" "load")])
10389 (define_insn "load_toc_v4_PIC_3b"
10390 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10391 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10393 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10394 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10395 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10396 "{cau|addis} %0,%1,%2-%3@ha")
10398 (define_insn "load_toc_v4_PIC_3c"
10399 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10400 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10401 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10402 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10403 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10404 "{cal|addi} %0,%1,%2-%3@l")
10406 ;; If the TOC is shared over a translation unit, as happens with all
10407 ;; the kinds of PIC that we support, we need to restore the TOC
10408 ;; pointer only when jumping over units of translation.
10409 ;; On Darwin, we need to reload the picbase.
10411 (define_expand "builtin_setjmp_receiver"
10412 [(use (label_ref (match_operand 0 "" "")))]
10413 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10414 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10415 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10419 if (DEFAULT_ABI == ABI_DARWIN)
10421 const char *picbase = machopic_function_base_name ();
10422 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10423 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10427 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10428 CODE_LABEL_NUMBER (operands[0]));
10429 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10431 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10432 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10436 rs6000_emit_load_toc_table (FALSE);
10440 ;; Elf specific ways of loading addresses for non-PIC code.
10441 ;; The output of this could be r0, but we make a very strong
10442 ;; preference for a base register because it will usually
10443 ;; be needed there.
10444 (define_insn "elf_high"
10445 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10446 (high:SI (match_operand 1 "" "")))]
10447 "TARGET_ELF && ! TARGET_64BIT"
10448 "{liu|lis} %0,%1@ha")
10450 (define_insn "elf_low"
10451 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10452 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10453 (match_operand 2 "" "")))]
10454 "TARGET_ELF && ! TARGET_64BIT"
10456 {cal|la} %0,%2@l(%1)
10457 {ai|addic} %0,%1,%K2")
10459 ;; A function pointer under AIX is a pointer to a data area whose first word
10460 ;; contains the actual address of the function, whose second word contains a
10461 ;; pointer to its TOC, and whose third word contains a value to place in the
10462 ;; static chain register (r11). Note that if we load the static chain, our
10463 ;; "trampoline" need not have any executable code.
10465 (define_expand "call_indirect_aix32"
10466 [(set (match_dup 2)
10467 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10468 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10471 (mem:SI (plus:SI (match_dup 0)
10474 (mem:SI (plus:SI (match_dup 0)
10476 (parallel [(call (mem:SI (match_dup 2))
10477 (match_operand 1 "" ""))
10481 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10482 (clobber (scratch:SI))])]
10485 { operands[2] = gen_reg_rtx (SImode); }")
10487 (define_expand "call_indirect_aix64"
10488 [(set (match_dup 2)
10489 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10490 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10493 (mem:DI (plus:DI (match_dup 0)
10496 (mem:DI (plus:DI (match_dup 0)
10498 (parallel [(call (mem:SI (match_dup 2))
10499 (match_operand 1 "" ""))
10503 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10504 (clobber (scratch:SI))])]
10507 { operands[2] = gen_reg_rtx (DImode); }")
10509 (define_expand "call_value_indirect_aix32"
10510 [(set (match_dup 3)
10511 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10512 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10515 (mem:SI (plus:SI (match_dup 1)
10518 (mem:SI (plus:SI (match_dup 1)
10520 (parallel [(set (match_operand 0 "" "")
10521 (call (mem:SI (match_dup 3))
10522 (match_operand 2 "" "")))
10526 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10527 (clobber (scratch:SI))])]
10530 { operands[3] = gen_reg_rtx (SImode); }")
10532 (define_expand "call_value_indirect_aix64"
10533 [(set (match_dup 3)
10534 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10535 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10538 (mem:DI (plus:DI (match_dup 1)
10541 (mem:DI (plus:DI (match_dup 1)
10543 (parallel [(set (match_operand 0 "" "")
10544 (call (mem:SI (match_dup 3))
10545 (match_operand 2 "" "")))
10549 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10550 (clobber (scratch:SI))])]
10553 { operands[3] = gen_reg_rtx (DImode); }")
10555 ;; Now the definitions for the call and call_value insns
10556 (define_expand "call"
10557 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10558 (match_operand 1 "" ""))
10559 (use (match_operand 2 "" ""))
10560 (clobber (scratch:SI))])]
10565 if (MACHOPIC_INDIRECT)
10566 operands[0] = machopic_indirect_call_target (operands[0]);
10569 gcc_assert (GET_CODE (operands[0]) == MEM);
10570 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10572 operands[0] = XEXP (operands[0], 0);
10574 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10576 && GET_CODE (operands[0]) == SYMBOL_REF
10577 && !SYMBOL_REF_LOCAL_P (operands[0]))
10582 tmp = gen_rtvec (3,
10583 gen_rtx_CALL (VOIDmode,
10584 gen_rtx_MEM (SImode, operands[0]),
10586 gen_rtx_USE (VOIDmode, operands[2]),
10587 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10588 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10589 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10593 if (GET_CODE (operands[0]) != SYMBOL_REF
10594 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10595 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10597 if (INTVAL (operands[2]) & CALL_LONG)
10598 operands[0] = rs6000_longcall_ref (operands[0]);
10600 switch (DEFAULT_ABI)
10604 operands[0] = force_reg (Pmode, operands[0]);
10608 /* AIX function pointers are really pointers to a three word
10610 emit_call_insn (TARGET_32BIT
10611 ? gen_call_indirect_aix32 (force_reg (SImode,
10614 : gen_call_indirect_aix64 (force_reg (DImode,
10620 gcc_unreachable ();
10625 (define_expand "call_value"
10626 [(parallel [(set (match_operand 0 "" "")
10627 (call (mem:SI (match_operand 1 "address_operand" ""))
10628 (match_operand 2 "" "")))
10629 (use (match_operand 3 "" ""))
10630 (clobber (scratch:SI))])]
10635 if (MACHOPIC_INDIRECT)
10636 operands[1] = machopic_indirect_call_target (operands[1]);
10639 gcc_assert (GET_CODE (operands[1]) == MEM);
10640 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10642 operands[1] = XEXP (operands[1], 0);
10644 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10646 && GET_CODE (operands[1]) == SYMBOL_REF
10647 && !SYMBOL_REF_LOCAL_P (operands[1]))
10652 tmp = gen_rtvec (3,
10653 gen_rtx_SET (VOIDmode,
10655 gen_rtx_CALL (VOIDmode,
10656 gen_rtx_MEM (SImode,
10659 gen_rtx_USE (VOIDmode, operands[3]),
10660 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10661 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10662 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10666 if (GET_CODE (operands[1]) != SYMBOL_REF
10667 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10668 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10670 if (INTVAL (operands[3]) & CALL_LONG)
10671 operands[1] = rs6000_longcall_ref (operands[1]);
10673 switch (DEFAULT_ABI)
10677 operands[1] = force_reg (Pmode, operands[1]);
10681 /* AIX function pointers are really pointers to a three word
10683 emit_call_insn (TARGET_32BIT
10684 ? gen_call_value_indirect_aix32 (operands[0],
10688 : gen_call_value_indirect_aix64 (operands[0],
10695 gcc_unreachable ();
10700 ;; Call to function in current module. No TOC pointer reload needed.
10701 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10702 ;; either the function was not prototyped, or it was prototyped as a
10703 ;; variable argument function. It is > 0 if FP registers were passed
10704 ;; and < 0 if they were not.
10706 (define_insn "*call_local32"
10707 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10708 (match_operand 1 "" "g,g"))
10709 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10710 (clobber (match_scratch:SI 3 "=l,l"))]
10711 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10714 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10715 output_asm_insn (\"crxor 6,6,6\", operands);
10717 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10718 output_asm_insn (\"creqv 6,6,6\", operands);
10720 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10722 [(set_attr "type" "branch")
10723 (set_attr "length" "4,8")])
10725 (define_insn "*call_local64"
10726 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10727 (match_operand 1 "" "g,g"))
10728 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10729 (clobber (match_scratch:SI 3 "=l,l"))]
10730 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10733 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10734 output_asm_insn (\"crxor 6,6,6\", operands);
10736 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10737 output_asm_insn (\"creqv 6,6,6\", operands);
10739 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10741 [(set_attr "type" "branch")
10742 (set_attr "length" "4,8")])
10744 (define_insn "*call_value_local32"
10745 [(set (match_operand 0 "" "")
10746 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10747 (match_operand 2 "" "g,g")))
10748 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10749 (clobber (match_scratch:SI 4 "=l,l"))]
10750 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10753 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10754 output_asm_insn (\"crxor 6,6,6\", operands);
10756 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10757 output_asm_insn (\"creqv 6,6,6\", operands);
10759 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10761 [(set_attr "type" "branch")
10762 (set_attr "length" "4,8")])
10765 (define_insn "*call_value_local64"
10766 [(set (match_operand 0 "" "")
10767 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10768 (match_operand 2 "" "g,g")))
10769 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10770 (clobber (match_scratch:SI 4 "=l,l"))]
10771 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10774 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10775 output_asm_insn (\"crxor 6,6,6\", operands);
10777 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10778 output_asm_insn (\"creqv 6,6,6\", operands);
10780 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10782 [(set_attr "type" "branch")
10783 (set_attr "length" "4,8")])
10785 ;; Call to function which may be in another module. Restore the TOC
10786 ;; pointer (r2) after the call unless this is System V.
10787 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10788 ;; either the function was not prototyped, or it was prototyped as a
10789 ;; variable argument function. It is > 0 if FP registers were passed
10790 ;; and < 0 if they were not.
10792 (define_insn "*call_indirect_nonlocal_aix32"
10793 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10794 (match_operand 1 "" "g,g"))
10798 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10799 (clobber (match_scratch:SI 2 "=l,l"))]
10800 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10801 "b%T0l\;{l|lwz} 2,20(1)"
10802 [(set_attr "type" "jmpreg")
10803 (set_attr "length" "8")])
10805 (define_insn "*call_nonlocal_aix32"
10806 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10807 (match_operand 1 "" "g"))
10808 (use (match_operand:SI 2 "immediate_operand" "O"))
10809 (clobber (match_scratch:SI 3 "=l"))]
10811 && DEFAULT_ABI == ABI_AIX
10812 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10814 [(set_attr "type" "branch")
10815 (set_attr "length" "8")])
10817 (define_insn "*call_indirect_nonlocal_aix64"
10818 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10819 (match_operand 1 "" "g,g"))
10823 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10824 (clobber (match_scratch:SI 2 "=l,l"))]
10825 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10826 "b%T0l\;ld 2,40(1)"
10827 [(set_attr "type" "jmpreg")
10828 (set_attr "length" "8")])
10830 (define_insn "*call_nonlocal_aix64"
10831 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10832 (match_operand 1 "" "g"))
10833 (use (match_operand:SI 2 "immediate_operand" "O"))
10834 (clobber (match_scratch:SI 3 "=l"))]
10836 && DEFAULT_ABI == ABI_AIX
10837 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10839 [(set_attr "type" "branch")
10840 (set_attr "length" "8")])
10842 (define_insn "*call_value_indirect_nonlocal_aix32"
10843 [(set (match_operand 0 "" "")
10844 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10845 (match_operand 2 "" "g,g")))
10849 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10850 (clobber (match_scratch:SI 3 "=l,l"))]
10851 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10852 "b%T1l\;{l|lwz} 2,20(1)"
10853 [(set_attr "type" "jmpreg")
10854 (set_attr "length" "8")])
10856 (define_insn "*call_value_nonlocal_aix32"
10857 [(set (match_operand 0 "" "")
10858 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10859 (match_operand 2 "" "g")))
10860 (use (match_operand:SI 3 "immediate_operand" "O"))
10861 (clobber (match_scratch:SI 4 "=l"))]
10863 && DEFAULT_ABI == ABI_AIX
10864 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10866 [(set_attr "type" "branch")
10867 (set_attr "length" "8")])
10869 (define_insn "*call_value_indirect_nonlocal_aix64"
10870 [(set (match_operand 0 "" "")
10871 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10872 (match_operand 2 "" "g,g")))
10876 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10877 (clobber (match_scratch:SI 3 "=l,l"))]
10878 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10879 "b%T1l\;ld 2,40(1)"
10880 [(set_attr "type" "jmpreg")
10881 (set_attr "length" "8")])
10883 (define_insn "*call_value_nonlocal_aix64"
10884 [(set (match_operand 0 "" "")
10885 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10886 (match_operand 2 "" "g")))
10887 (use (match_operand:SI 3 "immediate_operand" "O"))
10888 (clobber (match_scratch:SI 4 "=l"))]
10890 && DEFAULT_ABI == ABI_AIX
10891 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10893 [(set_attr "type" "branch")
10894 (set_attr "length" "8")])
10896 ;; A function pointer under System V is just a normal pointer
10897 ;; operands[0] is the function pointer
10898 ;; operands[1] is the stack size to clean up
10899 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10900 ;; which indicates how to set cr1
10902 (define_insn "*call_indirect_nonlocal_sysv<mode>"
10903 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
10904 (match_operand 1 "" "g,g,g,g"))
10905 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10906 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10907 "DEFAULT_ABI == ABI_V4
10908 || DEFAULT_ABI == ABI_DARWIN"
10910 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10911 output_asm_insn ("crxor 6,6,6", operands);
10913 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10914 output_asm_insn ("creqv 6,6,6", operands);
10918 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10919 (set_attr "length" "4,4,8,8")])
10921 (define_insn "*call_nonlocal_sysv<mode>"
10922 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
10923 (match_operand 1 "" "g,g"))
10924 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10925 (clobber (match_scratch:SI 3 "=l,l"))]
10926 "(DEFAULT_ABI == ABI_DARWIN
10927 || (DEFAULT_ABI == ABI_V4
10928 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10930 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10931 output_asm_insn ("crxor 6,6,6", operands);
10933 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10934 output_asm_insn ("creqv 6,6,6", operands);
10937 return output_call(insn, operands, 0, 2);
10939 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10941 if (TARGET_SECURE_PLT && flag_pic == 2)
10942 /* The magic 32768 offset here and in the other sysv call insns
10943 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10944 See sysv4.h:toc_section. */
10945 return "bl %z0+32768@plt";
10947 return "bl %z0@plt";
10953 [(set_attr "type" "branch,branch")
10954 (set_attr "length" "4,8")])
10956 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
10957 [(set (match_operand 0 "" "")
10958 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
10959 (match_operand 2 "" "g,g,g,g")))
10960 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10961 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10962 "DEFAULT_ABI == ABI_V4
10963 || DEFAULT_ABI == ABI_DARWIN"
10965 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10966 output_asm_insn ("crxor 6,6,6", operands);
10968 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10969 output_asm_insn ("creqv 6,6,6", operands);
10973 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10974 (set_attr "length" "4,4,8,8")])
10976 (define_insn "*call_value_nonlocal_sysv<mode>"
10977 [(set (match_operand 0 "" "")
10978 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
10979 (match_operand 2 "" "g,g")))
10980 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10981 (clobber (match_scratch:SI 4 "=l,l"))]
10982 "(DEFAULT_ABI == ABI_DARWIN
10983 || (DEFAULT_ABI == ABI_V4
10984 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10986 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10987 output_asm_insn ("crxor 6,6,6", operands);
10989 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10990 output_asm_insn ("creqv 6,6,6", operands);
10993 return output_call(insn, operands, 1, 3);
10995 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10997 if (TARGET_SECURE_PLT && flag_pic == 2)
10998 return "bl %z1+32768@plt";
11000 return "bl %z1@plt";
11006 [(set_attr "type" "branch,branch")
11007 (set_attr "length" "4,8")])
11009 ;; Call subroutine returning any type.
11010 (define_expand "untyped_call"
11011 [(parallel [(call (match_operand 0 "" "")
11013 (match_operand 1 "" "")
11014 (match_operand 2 "" "")])]
11020 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11022 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11024 rtx set = XVECEXP (operands[2], 0, i);
11025 emit_move_insn (SET_DEST (set), SET_SRC (set));
11028 /* The optimizer does not know that the call sets the function value
11029 registers we stored in the result block. We avoid problems by
11030 claiming that all hard registers are used and clobbered at this
11032 emit_insn (gen_blockage ());
11037 ;; sibling call patterns
11038 (define_expand "sibcall"
11039 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11040 (match_operand 1 "" ""))
11041 (use (match_operand 2 "" ""))
11042 (use (match_operand 3 "" ""))
11048 if (MACHOPIC_INDIRECT)
11049 operands[0] = machopic_indirect_call_target (operands[0]);
11052 gcc_assert (GET_CODE (operands[0]) == MEM);
11053 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11055 operands[0] = XEXP (operands[0], 0);
11056 operands[3] = gen_reg_rtx (SImode);
11060 ;; this and similar patterns must be marked as using LR, otherwise
11061 ;; dataflow will try to delete the store into it. This is true
11062 ;; even when the actual reg to jump to is in CTR, when LR was
11063 ;; saved and restored around the PIC-setting BCL.
11064 (define_insn "*sibcall_local32"
11065 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11066 (match_operand 1 "" "g,g"))
11067 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11068 (use (match_operand:SI 3 "register_operand" "l,l"))
11070 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11073 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11074 output_asm_insn (\"crxor 6,6,6\", operands);
11076 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11077 output_asm_insn (\"creqv 6,6,6\", operands);
11079 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11081 [(set_attr "type" "branch")
11082 (set_attr "length" "4,8")])
11084 (define_insn "*sibcall_local64"
11085 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11086 (match_operand 1 "" "g,g"))
11087 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11088 (use (match_operand:SI 3 "register_operand" "l,l"))
11090 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11093 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11094 output_asm_insn (\"crxor 6,6,6\", operands);
11096 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11097 output_asm_insn (\"creqv 6,6,6\", operands);
11099 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11101 [(set_attr "type" "branch")
11102 (set_attr "length" "4,8")])
11104 (define_insn "*sibcall_value_local32"
11105 [(set (match_operand 0 "" "")
11106 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11107 (match_operand 2 "" "g,g")))
11108 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11109 (use (match_operand:SI 4 "register_operand" "l,l"))
11111 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11114 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11115 output_asm_insn (\"crxor 6,6,6\", operands);
11117 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11118 output_asm_insn (\"creqv 6,6,6\", operands);
11120 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11122 [(set_attr "type" "branch")
11123 (set_attr "length" "4,8")])
11126 (define_insn "*sibcall_value_local64"
11127 [(set (match_operand 0 "" "")
11128 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11129 (match_operand 2 "" "g,g")))
11130 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11131 (use (match_operand:SI 4 "register_operand" "l,l"))
11133 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11136 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11137 output_asm_insn (\"crxor 6,6,6\", operands);
11139 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11140 output_asm_insn (\"creqv 6,6,6\", operands);
11142 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11144 [(set_attr "type" "branch")
11145 (set_attr "length" "4,8")])
11147 (define_insn "*sibcall_nonlocal_aix32"
11148 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11149 (match_operand 1 "" "g"))
11150 (use (match_operand:SI 2 "immediate_operand" "O"))
11151 (use (match_operand:SI 3 "register_operand" "l"))
11154 && DEFAULT_ABI == ABI_AIX
11155 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11157 [(set_attr "type" "branch")
11158 (set_attr "length" "4")])
11160 (define_insn "*sibcall_nonlocal_aix64"
11161 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11162 (match_operand 1 "" "g"))
11163 (use (match_operand:SI 2 "immediate_operand" "O"))
11164 (use (match_operand:SI 3 "register_operand" "l"))
11167 && DEFAULT_ABI == ABI_AIX
11168 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11170 [(set_attr "type" "branch")
11171 (set_attr "length" "4")])
11173 (define_insn "*sibcall_value_nonlocal_aix32"
11174 [(set (match_operand 0 "" "")
11175 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11176 (match_operand 2 "" "g")))
11177 (use (match_operand:SI 3 "immediate_operand" "O"))
11178 (use (match_operand:SI 4 "register_operand" "l"))
11181 && DEFAULT_ABI == ABI_AIX
11182 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11184 [(set_attr "type" "branch")
11185 (set_attr "length" "4")])
11187 (define_insn "*sibcall_value_nonlocal_aix64"
11188 [(set (match_operand 0 "" "")
11189 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11190 (match_operand 2 "" "g")))
11191 (use (match_operand:SI 3 "immediate_operand" "O"))
11192 (use (match_operand:SI 4 "register_operand" "l"))
11195 && DEFAULT_ABI == ABI_AIX
11196 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11198 [(set_attr "type" "branch")
11199 (set_attr "length" "4")])
11201 (define_insn "*sibcall_nonlocal_sysv<mode>"
11202 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11203 (match_operand 1 "" ""))
11204 (use (match_operand 2 "immediate_operand" "O,n"))
11205 (use (match_operand:SI 3 "register_operand" "l,l"))
11207 "(DEFAULT_ABI == ABI_DARWIN
11208 || DEFAULT_ABI == ABI_V4)
11209 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11212 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11213 output_asm_insn (\"crxor 6,6,6\", operands);
11215 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11216 output_asm_insn (\"creqv 6,6,6\", operands);
11218 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11220 if (TARGET_SECURE_PLT && flag_pic == 2)
11221 return \"b %z0+32768@plt\";
11223 return \"b %z0@plt\";
11228 [(set_attr "type" "branch,branch")
11229 (set_attr "length" "4,8")])
11231 (define_expand "sibcall_value"
11232 [(parallel [(set (match_operand 0 "register_operand" "")
11233 (call (mem:SI (match_operand 1 "address_operand" ""))
11234 (match_operand 2 "" "")))
11235 (use (match_operand 3 "" ""))
11236 (use (match_operand 4 "" ""))
11242 if (MACHOPIC_INDIRECT)
11243 operands[1] = machopic_indirect_call_target (operands[1]);
11246 gcc_assert (GET_CODE (operands[1]) == MEM);
11247 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11249 operands[1] = XEXP (operands[1], 0);
11250 operands[4] = gen_reg_rtx (SImode);
11254 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11255 [(set (match_operand 0 "" "")
11256 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11257 (match_operand 2 "" "")))
11258 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11259 (use (match_operand:SI 4 "register_operand" "l,l"))
11261 "(DEFAULT_ABI == ABI_DARWIN
11262 || DEFAULT_ABI == ABI_V4)
11263 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11266 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11267 output_asm_insn (\"crxor 6,6,6\", operands);
11269 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11270 output_asm_insn (\"creqv 6,6,6\", operands);
11272 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11274 if (TARGET_SECURE_PLT && flag_pic == 2)
11275 return \"b %z1+32768@plt\";
11277 return \"b %z1@plt\";
11282 [(set_attr "type" "branch,branch")
11283 (set_attr "length" "4,8")])
11285 (define_expand "sibcall_epilogue"
11286 [(use (const_int 0))]
11287 "TARGET_SCHED_PROLOG"
11290 rs6000_emit_epilogue (TRUE);
11294 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11295 ;; all of memory. This blocks insns from being moved across this point.
11297 (define_insn "blockage"
11298 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11302 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11303 ;; signed & unsigned, and one type of branch.
11305 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11306 ;; insns, and branches. We store the operands of compares until we see
11308 (define_expand "cmp<mode>"
11310 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11311 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11315 /* Take care of the possibility that operands[1] might be negative but
11316 this might be a logical operation. That insn doesn't exist. */
11317 if (GET_CODE (operands[1]) == CONST_INT
11318 && INTVAL (operands[1]) < 0)
11319 operands[1] = force_reg (<MODE>mode, operands[1]);
11321 rs6000_compare_op0 = operands[0];
11322 rs6000_compare_op1 = operands[1];
11323 rs6000_compare_fp_p = 0;
11327 (define_expand "cmp<mode>"
11328 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11329 (match_operand:FP 1 "gpc_reg_operand" "")))]
11333 rs6000_compare_op0 = operands[0];
11334 rs6000_compare_op1 = operands[1];
11335 rs6000_compare_fp_p = 1;
11339 (define_expand "beq"
11340 [(use (match_operand 0 "" ""))]
11342 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11344 (define_expand "bne"
11345 [(use (match_operand 0 "" ""))]
11347 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11349 (define_expand "bge"
11350 [(use (match_operand 0 "" ""))]
11352 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11354 (define_expand "bgt"
11355 [(use (match_operand 0 "" ""))]
11357 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11359 (define_expand "ble"
11360 [(use (match_operand 0 "" ""))]
11362 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11364 (define_expand "blt"
11365 [(use (match_operand 0 "" ""))]
11367 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11369 (define_expand "bgeu"
11370 [(use (match_operand 0 "" ""))]
11372 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11374 (define_expand "bgtu"
11375 [(use (match_operand 0 "" ""))]
11377 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11379 (define_expand "bleu"
11380 [(use (match_operand 0 "" ""))]
11382 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11384 (define_expand "bltu"
11385 [(use (match_operand 0 "" ""))]
11387 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11389 (define_expand "bunordered"
11390 [(use (match_operand 0 "" ""))]
11391 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11392 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11394 (define_expand "bordered"
11395 [(use (match_operand 0 "" ""))]
11396 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11397 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11399 (define_expand "buneq"
11400 [(use (match_operand 0 "" ""))]
11402 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11404 (define_expand "bunge"
11405 [(use (match_operand 0 "" ""))]
11407 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11409 (define_expand "bungt"
11410 [(use (match_operand 0 "" ""))]
11412 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11414 (define_expand "bunle"
11415 [(use (match_operand 0 "" ""))]
11417 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11419 (define_expand "bunlt"
11420 [(use (match_operand 0 "" ""))]
11422 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11424 (define_expand "bltgt"
11425 [(use (match_operand 0 "" ""))]
11427 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11429 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11430 ;; For SEQ, likewise, except that comparisons with zero should be done
11431 ;; with an scc insns. However, due to the order that combine see the
11432 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11433 ;; the cases we don't want to handle.
11434 (define_expand "seq"
11435 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11437 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11439 (define_expand "sne"
11440 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11444 if (! rs6000_compare_fp_p)
11447 rs6000_emit_sCOND (NE, operands[0]);
11451 ;; A >= 0 is best done the portable way for A an integer.
11452 (define_expand "sge"
11453 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11457 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11460 rs6000_emit_sCOND (GE, operands[0]);
11464 ;; A > 0 is best done using the portable sequence, so fail in that case.
11465 (define_expand "sgt"
11466 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11470 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11473 rs6000_emit_sCOND (GT, operands[0]);
11477 ;; A <= 0 is best done the portable way for A an integer.
11478 (define_expand "sle"
11479 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11483 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11486 rs6000_emit_sCOND (LE, operands[0]);
11490 ;; A < 0 is best done in the portable way for A an integer.
11491 (define_expand "slt"
11492 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11496 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11499 rs6000_emit_sCOND (LT, operands[0]);
11503 (define_expand "sgeu"
11504 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11506 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11508 (define_expand "sgtu"
11509 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11511 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11513 (define_expand "sleu"
11514 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11516 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11518 (define_expand "sltu"
11519 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11521 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11523 (define_expand "sunordered"
11524 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11525 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11526 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11528 (define_expand "sordered"
11529 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11530 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11531 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11533 (define_expand "suneq"
11534 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11536 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11538 (define_expand "sunge"
11539 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11541 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11543 (define_expand "sungt"
11544 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11546 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11548 (define_expand "sunle"
11549 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11551 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11553 (define_expand "sunlt"
11554 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11556 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11558 (define_expand "sltgt"
11559 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11561 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11563 (define_expand "stack_protect_set"
11564 [(match_operand 0 "memory_operand" "")
11565 (match_operand 1 "memory_operand" "")]
11568 #ifdef TARGET_THREAD_SSP_OFFSET
11569 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11570 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11571 operands[1] = gen_rtx_MEM (Pmode, addr);
11574 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11576 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11580 (define_insn "stack_protect_setsi"
11581 [(set (match_operand:SI 0 "memory_operand" "=m")
11582 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11583 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11585 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11586 [(set_attr "type" "three")
11587 (set_attr "length" "12")])
11589 (define_insn "stack_protect_setdi"
11590 [(set (match_operand:DI 0 "memory_operand" "=m")
11591 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11592 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11594 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11595 [(set_attr "type" "three")
11596 (set_attr "length" "12")])
11598 (define_expand "stack_protect_test"
11599 [(match_operand 0 "memory_operand" "")
11600 (match_operand 1 "memory_operand" "")
11601 (match_operand 2 "" "")]
11604 #ifdef TARGET_THREAD_SSP_OFFSET
11605 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11606 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11607 operands[1] = gen_rtx_MEM (Pmode, addr);
11609 rs6000_compare_op0 = operands[0];
11610 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11612 rs6000_compare_fp_p = 0;
11613 emit_jump_insn (gen_beq (operands[2]));
11617 (define_insn "stack_protect_testsi"
11618 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11619 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11620 (match_operand:SI 2 "memory_operand" "m,m")]
11622 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11623 (clobber (match_scratch:SI 3 "=&r,&r"))]
11626 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11627 {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"
11628 [(set_attr "length" "16,20")])
11630 (define_insn "stack_protect_testdi"
11631 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11632 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11633 (match_operand:DI 2 "memory_operand" "m,m")]
11635 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11636 (clobber (match_scratch:DI 3 "=&r,&r"))]
11639 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11640 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11641 [(set_attr "length" "16,20")])
11644 ;; Here are the actual compare insns.
11645 (define_insn "*cmp<mode>_internal1"
11646 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11647 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11648 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11650 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11651 [(set_attr "type" "cmp")])
11653 ;; If we are comparing a register for equality with a large constant,
11654 ;; we can do this with an XOR followed by a compare. But this is profitable
11655 ;; only if the large constant is only used for the comparison (and in this
11656 ;; case we already have a register to reuse as scratch).
11658 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11659 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11662 [(set (match_operand:SI 0 "register_operand")
11663 (match_operand:SI 1 "logical_const_operand" ""))
11664 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11666 (match_operand:SI 2 "logical_const_operand" "")]))
11667 (set (match_operand:CC 4 "cc_reg_operand" "")
11668 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11671 (if_then_else (match_operator 6 "equality_operator"
11672 [(match_dup 4) (const_int 0)])
11673 (match_operand 7 "" "")
11674 (match_operand 8 "" "")))]
11675 "peep2_reg_dead_p (3, operands[0])
11676 && peep2_reg_dead_p (4, operands[4])"
11677 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11678 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11679 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11682 /* Get the constant we are comparing against, and see what it looks like
11683 when sign-extended from 16 to 32 bits. Then see what constant we could
11684 XOR with SEXTC to get the sign-extended value. */
11685 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11687 operands[1], operands[2]);
11688 HOST_WIDE_INT c = INTVAL (cnst);
11689 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11690 HOST_WIDE_INT xorv = c ^ sextc;
11692 operands[9] = GEN_INT (xorv);
11693 operands[10] = GEN_INT (sextc);
11696 (define_insn "*cmpsi_internal2"
11697 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11698 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11699 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11701 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11702 [(set_attr "type" "cmp")])
11704 (define_insn "*cmpdi_internal2"
11705 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11706 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11707 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11709 "cmpld%I2 %0,%1,%b2"
11710 [(set_attr "type" "cmp")])
11712 ;; The following two insns don't exist as single insns, but if we provide
11713 ;; them, we can swap an add and compare, which will enable us to overlap more
11714 ;; of the required delay between a compare and branch. We generate code for
11715 ;; them by splitting.
11718 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11719 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11720 (match_operand:SI 2 "short_cint_operand" "i")))
11721 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11722 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11725 [(set_attr "length" "8")])
11728 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11729 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11730 (match_operand:SI 2 "u_short_cint_operand" "i")))
11731 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11732 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11735 [(set_attr "length" "8")])
11738 [(set (match_operand:CC 3 "cc_reg_operand" "")
11739 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11740 (match_operand:SI 2 "short_cint_operand" "")))
11741 (set (match_operand:SI 0 "gpc_reg_operand" "")
11742 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11744 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11745 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11748 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11749 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11750 (match_operand:SI 2 "u_short_cint_operand" "")))
11751 (set (match_operand:SI 0 "gpc_reg_operand" "")
11752 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11754 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11755 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11757 (define_insn "*cmpsf_internal1"
11758 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11759 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11760 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11761 "TARGET_HARD_FLOAT && TARGET_FPRS"
11763 [(set_attr "type" "fpcompare")])
11765 (define_insn "*cmpdf_internal1"
11766 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11767 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11768 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11769 "TARGET_HARD_FLOAT && TARGET_FPRS"
11771 [(set_attr "type" "fpcompare")])
11773 ;; Only need to compare second words if first words equal
11774 (define_insn "*cmptf_internal1"
11775 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11776 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11777 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11778 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11779 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11780 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11781 [(set_attr "type" "fpcompare")
11782 (set_attr "length" "12")])
11784 (define_insn_and_split "*cmptf_internal2"
11785 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11786 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11787 (match_operand:TF 2 "gpc_reg_operand" "f")))
11788 (clobber (match_scratch:DF 3 "=f"))
11789 (clobber (match_scratch:DF 4 "=f"))
11790 (clobber (match_scratch:DF 5 "=f"))
11791 (clobber (match_scratch:DF 6 "=f"))
11792 (clobber (match_scratch:DF 7 "=f"))
11793 (clobber (match_scratch:DF 8 "=f"))
11794 (clobber (match_scratch:DF 9 "=f"))
11795 (clobber (match_scratch:DF 10 "=f"))]
11796 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11797 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11799 "&& reload_completed"
11800 [(set (match_dup 3) (match_dup 13))
11801 (set (match_dup 4) (match_dup 14))
11802 (set (match_dup 9) (abs:DF (match_dup 5)))
11803 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11804 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11805 (label_ref (match_dup 11))
11807 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11808 (set (pc) (label_ref (match_dup 12)))
11810 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11811 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11812 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11813 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11816 REAL_VALUE_TYPE rv;
11817 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11818 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11820 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11821 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11822 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11823 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11824 operands[11] = gen_label_rtx ();
11825 operands[12] = gen_label_rtx ();
11827 operands[13] = force_const_mem (DFmode,
11828 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11829 operands[14] = force_const_mem (DFmode,
11830 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11834 operands[13] = gen_const_mem (DFmode,
11835 create_TOC_reference (XEXP (operands[13], 0)));
11836 operands[14] = gen_const_mem (DFmode,
11837 create_TOC_reference (XEXP (operands[14], 0)));
11838 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11839 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11843 ;; Now we have the scc insns. We can do some combinations because of the
11844 ;; way the machine works.
11846 ;; Note that this is probably faster if we can put an insn between the
11847 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11848 ;; cases the insns below which don't use an intermediate CR field will
11849 ;; be used instead.
11851 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11852 (match_operator:SI 1 "scc_comparison_operator"
11853 [(match_operand 2 "cc_reg_operand" "y")
11856 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11857 [(set (attr "type")
11858 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11859 (const_string "mfcrf")
11861 (const_string "mfcr")))
11862 (set_attr "length" "8")])
11864 ;; Same as above, but get the GT bit.
11865 (define_insn "move_from_CR_gt_bit"
11866 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11867 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11869 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11870 [(set_attr "type" "mfcr")
11871 (set_attr "length" "8")])
11873 ;; Same as above, but get the OV/ORDERED bit.
11874 (define_insn "move_from_CR_ov_bit"
11875 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11876 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11878 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11879 [(set_attr "type" "mfcr")
11880 (set_attr "length" "8")])
11883 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11884 (match_operator:DI 1 "scc_comparison_operator"
11885 [(match_operand 2 "cc_reg_operand" "y")
11888 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11889 [(set (attr "type")
11890 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11891 (const_string "mfcrf")
11893 (const_string "mfcr")))
11894 (set_attr "length" "8")])
11897 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11898 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11899 [(match_operand 2 "cc_reg_operand" "y,y")
11902 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11903 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11906 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11908 [(set_attr "type" "delayed_compare")
11909 (set_attr "length" "8,16")])
11912 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11913 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11914 [(match_operand 2 "cc_reg_operand" "")
11917 (set (match_operand:SI 3 "gpc_reg_operand" "")
11918 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11919 "TARGET_32BIT && reload_completed"
11920 [(set (match_dup 3)
11921 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11923 (compare:CC (match_dup 3)
11928 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11929 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11930 [(match_operand 2 "cc_reg_operand" "y")
11932 (match_operand:SI 3 "const_int_operand" "n")))]
11936 int is_bit = ccr_bit (operands[1], 1);
11937 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11940 if (is_bit >= put_bit)
11941 count = is_bit - put_bit;
11943 count = 32 - (put_bit - is_bit);
11945 operands[4] = GEN_INT (count);
11946 operands[5] = GEN_INT (put_bit);
11948 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11950 [(set (attr "type")
11951 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11952 (const_string "mfcrf")
11954 (const_string "mfcr")))
11955 (set_attr "length" "8")])
11958 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11960 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11961 [(match_operand 2 "cc_reg_operand" "y,y")
11963 (match_operand:SI 3 "const_int_operand" "n,n"))
11965 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11966 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11971 int is_bit = ccr_bit (operands[1], 1);
11972 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11975 /* Force split for non-cc0 compare. */
11976 if (which_alternative == 1)
11979 if (is_bit >= put_bit)
11980 count = is_bit - put_bit;
11982 count = 32 - (put_bit - is_bit);
11984 operands[5] = GEN_INT (count);
11985 operands[6] = GEN_INT (put_bit);
11987 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11989 [(set_attr "type" "delayed_compare")
11990 (set_attr "length" "8,16")])
11993 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11995 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11996 [(match_operand 2 "cc_reg_operand" "")
11998 (match_operand:SI 3 "const_int_operand" ""))
12000 (set (match_operand:SI 4 "gpc_reg_operand" "")
12001 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12004 [(set (match_dup 4)
12005 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12008 (compare:CC (match_dup 4)
12012 ;; There is a 3 cycle delay between consecutive mfcr instructions
12013 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12017 (match_operator:SI 1 "scc_comparison_operator"
12018 [(match_operand 2 "cc_reg_operand" "y")
12020 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12021 (match_operator:SI 4 "scc_comparison_operator"
12022 [(match_operand 5 "cc_reg_operand" "y")
12024 "REGNO (operands[2]) != REGNO (operands[5])"
12025 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12026 [(set_attr "type" "mfcr")
12027 (set_attr "length" "12")])
12030 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12031 (match_operator:DI 1 "scc_comparison_operator"
12032 [(match_operand 2 "cc_reg_operand" "y")
12034 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12035 (match_operator:DI 4 "scc_comparison_operator"
12036 [(match_operand 5 "cc_reg_operand" "y")
12038 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12039 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12040 [(set_attr "type" "mfcr")
12041 (set_attr "length" "12")])
12043 ;; There are some scc insns that can be done directly, without a compare.
12044 ;; These are faster because they don't involve the communications between
12045 ;; the FXU and branch units. In fact, we will be replacing all of the
12046 ;; integer scc insns here or in the portable methods in emit_store_flag.
12048 ;; Also support (neg (scc ..)) since that construct is used to replace
12049 ;; branches, (plus (scc ..) ..) since that construct is common and
12050 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12051 ;; cases where it is no more expensive than (neg (scc ..)).
12053 ;; Have reload force a constant into a register for the simple insns that
12054 ;; otherwise won't accept constants. We do this because it is faster than
12055 ;; the cmp/mfcr sequence we would otherwise generate.
12057 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12060 (define_insn_and_split "*eq<mode>"
12061 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12062 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12063 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12067 [(set (match_dup 0)
12068 (clz:GPR (match_dup 3)))
12070 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12072 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12074 /* Use output operand as intermediate. */
12075 operands[3] = operands[0];
12077 if (logical_operand (operands[2], <MODE>mode))
12078 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12079 gen_rtx_XOR (<MODE>mode,
12080 operands[1], operands[2])));
12082 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12083 gen_rtx_PLUS (<MODE>mode, operands[1],
12084 negate_rtx (<MODE>mode,
12088 operands[3] = operands[1];
12090 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12093 (define_insn_and_split "*eq<mode>_compare"
12094 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12096 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12097 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12099 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12100 (eq:P (match_dup 1) (match_dup 2)))]
12101 "!TARGET_POWER && optimize_size"
12103 "!TARGET_POWER && optimize_size"
12104 [(set (match_dup 0)
12105 (clz:P (match_dup 4)))
12106 (parallel [(set (match_dup 3)
12107 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12110 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12112 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12114 /* Use output operand as intermediate. */
12115 operands[4] = operands[0];
12117 if (logical_operand (operands[2], <MODE>mode))
12118 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12119 gen_rtx_XOR (<MODE>mode,
12120 operands[1], operands[2])));
12122 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12123 gen_rtx_PLUS (<MODE>mode, operands[1],
12124 negate_rtx (<MODE>mode,
12128 operands[4] = operands[1];
12130 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12133 (define_insn "*eqsi_power"
12134 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12135 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12136 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
12137 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
12140 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12141 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
12142 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12143 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12144 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
12145 [(set_attr "type" "three,two,three,three,three")
12146 (set_attr "length" "12,8,12,12,12")])
12148 ;; We have insns of the form shown by the first define_insn below. If
12149 ;; there is something inside the comparison operation, we must split it.
12151 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12152 (plus:SI (match_operator 1 "comparison_operator"
12153 [(match_operand:SI 2 "" "")
12154 (match_operand:SI 3
12155 "reg_or_cint_operand" "")])
12156 (match_operand:SI 4 "gpc_reg_operand" "")))
12157 (clobber (match_operand:SI 5 "register_operand" ""))]
12158 "! gpc_reg_operand (operands[2], SImode)"
12159 [(set (match_dup 5) (match_dup 2))
12160 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
12163 (define_insn "*plus_eqsi"
12164 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12165 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12166 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12167 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12170 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12171 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
12172 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12173 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12174 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12175 [(set_attr "type" "three,two,three,three,three")
12176 (set_attr "length" "12,8,12,12,12")])
12178 (define_insn "*compare_plus_eqsi"
12179 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12182 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12183 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12184 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12186 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12187 "TARGET_32BIT && optimize_size"
12189 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12190 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12191 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12192 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12193 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12199 [(set_attr "type" "compare")
12200 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12203 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12206 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12207 (match_operand:SI 2 "scc_eq_operand" ""))
12208 (match_operand:SI 3 "gpc_reg_operand" ""))
12210 (clobber (match_scratch:SI 4 ""))]
12211 "TARGET_32BIT && optimize_size && reload_completed"
12212 [(set (match_dup 4)
12213 (plus:SI (eq:SI (match_dup 1)
12217 (compare:CC (match_dup 4)
12221 (define_insn "*plus_eqsi_compare"
12222 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12225 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12226 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12227 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12229 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12230 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12231 "TARGET_32BIT && optimize_size"
12233 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12234 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12235 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12236 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12237 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12243 [(set_attr "type" "compare")
12244 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12247 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12250 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12251 (match_operand:SI 2 "scc_eq_operand" ""))
12252 (match_operand:SI 3 "gpc_reg_operand" ""))
12254 (set (match_operand:SI 0 "gpc_reg_operand" "")
12255 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12256 "TARGET_32BIT && optimize_size && reload_completed"
12257 [(set (match_dup 0)
12258 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12260 (compare:CC (match_dup 0)
12264 (define_insn "*neg_eq0<mode>"
12265 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12266 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12269 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12270 [(set_attr "type" "two")
12271 (set_attr "length" "8")])
12273 (define_insn_and_split "*neg_eq<mode>"
12274 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12275 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12276 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12280 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12282 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12284 /* Use output operand as intermediate. */
12285 operands[3] = operands[0];
12287 if (logical_operand (operands[2], <MODE>mode))
12288 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12289 gen_rtx_XOR (<MODE>mode,
12290 operands[1], operands[2])));
12292 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12293 gen_rtx_PLUS (<MODE>mode, operands[1],
12294 negate_rtx (<MODE>mode,
12298 operands[3] = operands[1];
12301 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12302 ;; since it nabs/sr is just as fast.
12303 (define_insn "*ne0si"
12304 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12305 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12307 (clobber (match_scratch:SI 2 "=&r"))]
12308 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12309 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12310 [(set_attr "type" "two")
12311 (set_attr "length" "8")])
12313 (define_insn "*ne0di"
12314 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12315 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12317 (clobber (match_scratch:DI 2 "=&r"))]
12319 "addic %2,%1,-1\;subfe %0,%2,%1"
12320 [(set_attr "type" "two")
12321 (set_attr "length" "8")])
12323 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12324 (define_insn "*plus_ne0si"
12325 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12326 (plus:SI (lshiftrt:SI
12327 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12329 (match_operand:SI 2 "gpc_reg_operand" "r")))
12330 (clobber (match_scratch:SI 3 "=&r"))]
12332 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12333 [(set_attr "type" "two")
12334 (set_attr "length" "8")])
12336 (define_insn "*plus_ne0di"
12337 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12338 (plus:DI (lshiftrt:DI
12339 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12341 (match_operand:DI 2 "gpc_reg_operand" "r")))
12342 (clobber (match_scratch:DI 3 "=&r"))]
12344 "addic %3,%1,-1\;addze %0,%2"
12345 [(set_attr "type" "two")
12346 (set_attr "length" "8")])
12348 (define_insn "*compare_plus_ne0si"
12349 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12351 (plus:SI (lshiftrt:SI
12352 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12354 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12356 (clobber (match_scratch:SI 3 "=&r,&r"))
12357 (clobber (match_scratch:SI 4 "=X,&r"))]
12360 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12362 [(set_attr "type" "compare")
12363 (set_attr "length" "8,12")])
12366 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12368 (plus:SI (lshiftrt:SI
12369 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12371 (match_operand:SI 2 "gpc_reg_operand" ""))
12373 (clobber (match_scratch:SI 3 ""))
12374 (clobber (match_scratch:SI 4 ""))]
12375 "TARGET_32BIT && reload_completed"
12376 [(parallel [(set (match_dup 3)
12377 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12380 (clobber (match_dup 4))])
12382 (compare:CC (match_dup 3)
12386 (define_insn "*compare_plus_ne0di"
12387 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12389 (plus:DI (lshiftrt:DI
12390 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12392 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12394 (clobber (match_scratch:DI 3 "=&r,&r"))]
12397 addic %3,%1,-1\;addze. %3,%2
12399 [(set_attr "type" "compare")
12400 (set_attr "length" "8,12")])
12403 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12405 (plus:DI (lshiftrt:DI
12406 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12408 (match_operand:DI 2 "gpc_reg_operand" ""))
12410 (clobber (match_scratch:DI 3 ""))]
12411 "TARGET_64BIT && reload_completed"
12412 [(set (match_dup 3)
12413 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12417 (compare:CC (match_dup 3)
12421 (define_insn "*plus_ne0si_compare"
12422 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12424 (plus:SI (lshiftrt:SI
12425 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12427 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12429 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12430 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12432 (clobber (match_scratch:SI 3 "=&r,&r"))]
12435 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12437 [(set_attr "type" "compare")
12438 (set_attr "length" "8,12")])
12441 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12443 (plus:SI (lshiftrt:SI
12444 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12446 (match_operand:SI 2 "gpc_reg_operand" ""))
12448 (set (match_operand:SI 0 "gpc_reg_operand" "")
12449 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12451 (clobber (match_scratch:SI 3 ""))]
12452 "TARGET_32BIT && reload_completed"
12453 [(parallel [(set (match_dup 0)
12454 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12456 (clobber (match_dup 3))])
12458 (compare:CC (match_dup 0)
12462 (define_insn "*plus_ne0di_compare"
12463 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12465 (plus:DI (lshiftrt:DI
12466 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12468 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12470 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12471 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12473 (clobber (match_scratch:DI 3 "=&r,&r"))]
12476 addic %3,%1,-1\;addze. %0,%2
12478 [(set_attr "type" "compare")
12479 (set_attr "length" "8,12")])
12482 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12484 (plus:DI (lshiftrt:DI
12485 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12487 (match_operand:DI 2 "gpc_reg_operand" ""))
12489 (set (match_operand:DI 0 "gpc_reg_operand" "")
12490 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12492 (clobber (match_scratch:DI 3 ""))]
12493 "TARGET_64BIT && reload_completed"
12494 [(parallel [(set (match_dup 0)
12495 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12497 (clobber (match_dup 3))])
12499 (compare:CC (match_dup 0)
12504 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12505 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12506 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12507 (clobber (match_scratch:SI 3 "=r,X"))]
12510 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12511 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12512 [(set_attr "length" "12")])
12515 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12517 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12518 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12520 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12521 (le:SI (match_dup 1) (match_dup 2)))
12522 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12525 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12526 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12529 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12530 (set_attr "length" "12,12,16,16")])
12533 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12535 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12536 (match_operand:SI 2 "reg_or_short_operand" ""))
12538 (set (match_operand:SI 0 "gpc_reg_operand" "")
12539 (le:SI (match_dup 1) (match_dup 2)))
12540 (clobber (match_scratch:SI 3 ""))]
12541 "TARGET_POWER && reload_completed"
12542 [(parallel [(set (match_dup 0)
12543 (le:SI (match_dup 1) (match_dup 2)))
12544 (clobber (match_dup 3))])
12546 (compare:CC (match_dup 0)
12551 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12552 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12553 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12554 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12557 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12558 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12559 [(set_attr "length" "12")])
12562 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12564 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12565 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12566 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12568 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12571 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12572 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12575 [(set_attr "type" "compare")
12576 (set_attr "length" "12,12,16,16")])
12579 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12581 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12582 (match_operand:SI 2 "reg_or_short_operand" ""))
12583 (match_operand:SI 3 "gpc_reg_operand" ""))
12585 (clobber (match_scratch:SI 4 ""))]
12586 "TARGET_POWER && reload_completed"
12587 [(set (match_dup 4)
12588 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12591 (compare:CC (match_dup 4)
12596 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12598 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12599 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12600 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12602 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12603 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12606 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12607 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12610 [(set_attr "type" "compare")
12611 (set_attr "length" "12,12,16,16")])
12614 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12616 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12617 (match_operand:SI 2 "reg_or_short_operand" ""))
12618 (match_operand:SI 3 "gpc_reg_operand" ""))
12620 (set (match_operand:SI 0 "gpc_reg_operand" "")
12621 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12622 "TARGET_POWER && reload_completed"
12623 [(set (match_dup 0)
12624 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12626 (compare:CC (match_dup 0)
12631 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12632 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12633 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12636 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12637 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12638 [(set_attr "length" "12")])
12640 (define_insn "*leu<mode>"
12641 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12642 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12643 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12645 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12646 [(set_attr "type" "three")
12647 (set_attr "length" "12")])
12649 (define_insn "*leu<mode>_compare"
12650 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12652 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12653 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12655 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12656 (leu:P (match_dup 1) (match_dup 2)))]
12659 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12661 [(set_attr "type" "compare")
12662 (set_attr "length" "12,16")])
12665 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12667 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12668 (match_operand:P 2 "reg_or_short_operand" ""))
12670 (set (match_operand:P 0 "gpc_reg_operand" "")
12671 (leu:P (match_dup 1) (match_dup 2)))]
12673 [(set (match_dup 0)
12674 (leu:P (match_dup 1) (match_dup 2)))
12676 (compare:CC (match_dup 0)
12680 (define_insn "*plus_leu<mode>"
12681 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12682 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12683 (match_operand:P 2 "reg_or_short_operand" "rI"))
12684 (match_operand:P 3 "gpc_reg_operand" "r")))]
12686 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12687 [(set_attr "type" "two")
12688 (set_attr "length" "8")])
12691 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12693 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12694 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12695 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12697 (clobber (match_scratch:SI 4 "=&r,&r"))]
12700 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12702 [(set_attr "type" "compare")
12703 (set_attr "length" "8,12")])
12706 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12708 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12709 (match_operand:SI 2 "reg_or_short_operand" ""))
12710 (match_operand:SI 3 "gpc_reg_operand" ""))
12712 (clobber (match_scratch:SI 4 ""))]
12713 "TARGET_32BIT && reload_completed"
12714 [(set (match_dup 4)
12715 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12718 (compare:CC (match_dup 4)
12723 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12725 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12726 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12727 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12729 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12730 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12733 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12735 [(set_attr "type" "compare")
12736 (set_attr "length" "8,12")])
12739 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12741 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12742 (match_operand:SI 2 "reg_or_short_operand" ""))
12743 (match_operand:SI 3 "gpc_reg_operand" ""))
12745 (set (match_operand:SI 0 "gpc_reg_operand" "")
12746 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12747 "TARGET_32BIT && reload_completed"
12748 [(set (match_dup 0)
12749 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12751 (compare:CC (match_dup 0)
12755 (define_insn "*neg_leu<mode>"
12756 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12757 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12758 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12760 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12761 [(set_attr "type" "three")
12762 (set_attr "length" "12")])
12764 (define_insn "*and_neg_leu<mode>"
12765 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12767 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12768 (match_operand:P 2 "reg_or_short_operand" "rI")))
12769 (match_operand:P 3 "gpc_reg_operand" "r")))]
12771 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12772 [(set_attr "type" "three")
12773 (set_attr "length" "12")])
12776 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12779 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12780 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12781 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12783 (clobber (match_scratch:SI 4 "=&r,&r"))]
12786 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12788 [(set_attr "type" "compare")
12789 (set_attr "length" "12,16")])
12792 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12795 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12796 (match_operand:SI 2 "reg_or_short_operand" "")))
12797 (match_operand:SI 3 "gpc_reg_operand" ""))
12799 (clobber (match_scratch:SI 4 ""))]
12800 "TARGET_32BIT && reload_completed"
12801 [(set (match_dup 4)
12802 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12805 (compare:CC (match_dup 4)
12810 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12813 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12814 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12815 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12817 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12818 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12821 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12823 [(set_attr "type" "compare")
12824 (set_attr "length" "12,16")])
12827 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12830 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12831 (match_operand:SI 2 "reg_or_short_operand" "")))
12832 (match_operand:SI 3 "gpc_reg_operand" ""))
12834 (set (match_operand:SI 0 "gpc_reg_operand" "")
12835 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12836 "TARGET_32BIT && reload_completed"
12837 [(set (match_dup 0)
12838 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12841 (compare:CC (match_dup 0)
12846 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12847 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12848 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12850 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12851 [(set_attr "length" "12")])
12854 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12856 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12857 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12859 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12860 (lt:SI (match_dup 1) (match_dup 2)))]
12863 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12865 [(set_attr "type" "delayed_compare")
12866 (set_attr "length" "12,16")])
12869 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12871 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12872 (match_operand:SI 2 "reg_or_short_operand" ""))
12874 (set (match_operand:SI 0 "gpc_reg_operand" "")
12875 (lt:SI (match_dup 1) (match_dup 2)))]
12876 "TARGET_POWER && reload_completed"
12877 [(set (match_dup 0)
12878 (lt:SI (match_dup 1) (match_dup 2)))
12880 (compare:CC (match_dup 0)
12885 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12886 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12887 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12888 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12890 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12891 [(set_attr "length" "12")])
12894 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12896 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12897 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12898 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12900 (clobber (match_scratch:SI 4 "=&r,&r"))]
12903 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12905 [(set_attr "type" "compare")
12906 (set_attr "length" "12,16")])
12909 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12911 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12912 (match_operand:SI 2 "reg_or_short_operand" ""))
12913 (match_operand:SI 3 "gpc_reg_operand" ""))
12915 (clobber (match_scratch:SI 4 ""))]
12916 "TARGET_POWER && reload_completed"
12917 [(set (match_dup 4)
12918 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12921 (compare:CC (match_dup 4)
12926 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12928 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12929 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12930 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12932 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12933 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12936 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12938 [(set_attr "type" "compare")
12939 (set_attr "length" "12,16")])
12942 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12944 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12945 (match_operand:SI 2 "reg_or_short_operand" ""))
12946 (match_operand:SI 3 "gpc_reg_operand" ""))
12948 (set (match_operand:SI 0 "gpc_reg_operand" "")
12949 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12950 "TARGET_POWER && reload_completed"
12951 [(set (match_dup 0)
12952 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12954 (compare:CC (match_dup 0)
12959 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12960 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12961 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12963 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12964 [(set_attr "length" "12")])
12966 (define_insn_and_split "*ltu<mode>"
12967 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12968 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12969 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12973 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12974 (set (match_dup 0) (neg:P (match_dup 0)))]
12977 (define_insn_and_split "*ltu<mode>_compare"
12978 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12980 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12981 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12983 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12984 (ltu:P (match_dup 1) (match_dup 2)))]
12988 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12989 (parallel [(set (match_dup 3)
12990 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12991 (set (match_dup 0) (neg:P (match_dup 0)))])]
12994 (define_insn_and_split "*plus_ltu<mode>"
12995 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
12996 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12997 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12998 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13001 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13002 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13003 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13006 (define_insn_and_split "*plus_ltu<mode>_compare"
13007 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13009 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13010 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13011 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13013 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13014 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13017 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13018 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13019 (parallel [(set (match_dup 4)
13020 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13022 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13025 (define_insn "*neg_ltu<mode>"
13026 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13027 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13028 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13031 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
13032 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
13033 [(set_attr "type" "two")
13034 (set_attr "length" "8")])
13037 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13038 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13039 (match_operand:SI 2 "reg_or_short_operand" "rI")))
13040 (clobber (match_scratch:SI 3 "=r"))]
13042 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
13043 [(set_attr "length" "12")])
13046 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13048 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13049 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13051 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13052 (ge:SI (match_dup 1) (match_dup 2)))
13053 (clobber (match_scratch:SI 3 "=r,r"))]
13056 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13058 [(set_attr "type" "compare")
13059 (set_attr "length" "12,16")])
13062 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13064 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13065 (match_operand:SI 2 "reg_or_short_operand" ""))
13067 (set (match_operand:SI 0 "gpc_reg_operand" "")
13068 (ge:SI (match_dup 1) (match_dup 2)))
13069 (clobber (match_scratch:SI 3 ""))]
13070 "TARGET_POWER && reload_completed"
13071 [(parallel [(set (match_dup 0)
13072 (ge:SI (match_dup 1) (match_dup 2)))
13073 (clobber (match_dup 3))])
13075 (compare:CC (match_dup 0)
13080 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13081 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13082 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13083 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13085 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13086 [(set_attr "length" "12")])
13089 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13091 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13092 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13093 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13095 (clobber (match_scratch:SI 4 "=&r,&r"))]
13098 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13100 [(set_attr "type" "compare")
13101 (set_attr "length" "12,16")])
13104 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13106 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13107 (match_operand:SI 2 "reg_or_short_operand" ""))
13108 (match_operand:SI 3 "gpc_reg_operand" ""))
13110 (clobber (match_scratch:SI 4 ""))]
13111 "TARGET_POWER && reload_completed"
13112 [(set (match_dup 4)
13113 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13116 (compare:CC (match_dup 4)
13121 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13123 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13124 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13125 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13127 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13128 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13131 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13133 [(set_attr "type" "compare")
13134 (set_attr "length" "12,16")])
13137 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13139 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13140 (match_operand:SI 2 "reg_or_short_operand" ""))
13141 (match_operand:SI 3 "gpc_reg_operand" ""))
13143 (set (match_operand:SI 0 "gpc_reg_operand" "")
13144 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13145 "TARGET_POWER && reload_completed"
13146 [(set (match_dup 0)
13147 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13149 (compare:CC (match_dup 0)
13154 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13155 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13156 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13158 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13159 [(set_attr "length" "12")])
13161 (define_insn "*geu<mode>"
13162 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13163 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13164 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13167 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13168 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13169 [(set_attr "type" "three")
13170 (set_attr "length" "12")])
13172 (define_insn "*geu<mode>_compare"
13173 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13175 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13176 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13178 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13179 (geu:P (match_dup 1) (match_dup 2)))]
13182 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13183 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13186 [(set_attr "type" "compare")
13187 (set_attr "length" "12,12,16,16")])
13190 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13192 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13193 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13195 (set (match_operand:P 0 "gpc_reg_operand" "")
13196 (geu:P (match_dup 1) (match_dup 2)))]
13198 [(set (match_dup 0)
13199 (geu:P (match_dup 1) (match_dup 2)))
13201 (compare:CC (match_dup 0)
13205 (define_insn "*plus_geu<mode>"
13206 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13207 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13208 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13209 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13212 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13213 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13214 [(set_attr "type" "two")
13215 (set_attr "length" "8")])
13218 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13220 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13221 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13222 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13224 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13227 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13228 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13231 [(set_attr "type" "compare")
13232 (set_attr "length" "8,8,12,12")])
13235 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13237 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13238 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13239 (match_operand:SI 3 "gpc_reg_operand" ""))
13241 (clobber (match_scratch:SI 4 ""))]
13242 "TARGET_32BIT && reload_completed"
13243 [(set (match_dup 4)
13244 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13247 (compare:CC (match_dup 4)
13252 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13254 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13255 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13256 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13258 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13259 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13262 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13263 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13266 [(set_attr "type" "compare")
13267 (set_attr "length" "8,8,12,12")])
13270 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13272 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13273 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13274 (match_operand:SI 3 "gpc_reg_operand" ""))
13276 (set (match_operand:SI 0 "gpc_reg_operand" "")
13277 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13278 "TARGET_32BIT && reload_completed"
13279 [(set (match_dup 0)
13280 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13282 (compare:CC (match_dup 0)
13286 (define_insn "*neg_geu<mode>"
13287 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13288 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13289 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13292 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13293 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13294 [(set_attr "type" "three")
13295 (set_attr "length" "12")])
13297 (define_insn "*and_neg_geu<mode>"
13298 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13300 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13301 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13302 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13305 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13306 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13307 [(set_attr "type" "three")
13308 (set_attr "length" "12")])
13311 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13314 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13315 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13316 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13318 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13321 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13322 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13325 [(set_attr "type" "compare")
13326 (set_attr "length" "12,12,16,16")])
13329 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13332 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13333 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13334 (match_operand:SI 3 "gpc_reg_operand" ""))
13336 (clobber (match_scratch:SI 4 ""))]
13337 "TARGET_32BIT && reload_completed"
13338 [(set (match_dup 4)
13339 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13342 (compare:CC (match_dup 4)
13347 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13350 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13351 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13352 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13354 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13355 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13358 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13359 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13362 [(set_attr "type" "compare")
13363 (set_attr "length" "12,12,16,16")])
13366 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13369 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13370 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13371 (match_operand:SI 3 "gpc_reg_operand" ""))
13373 (set (match_operand:SI 0 "gpc_reg_operand" "")
13374 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13375 "TARGET_32BIT && reload_completed"
13376 [(set (match_dup 0)
13377 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13379 (compare:CC (match_dup 0)
13384 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13385 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13386 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13388 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13389 [(set_attr "length" "12")])
13392 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13394 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13395 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13397 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13398 (gt:SI (match_dup 1) (match_dup 2)))]
13401 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13403 [(set_attr "type" "delayed_compare")
13404 (set_attr "length" "12,16")])
13407 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13409 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13410 (match_operand:SI 2 "reg_or_short_operand" ""))
13412 (set (match_operand:SI 0 "gpc_reg_operand" "")
13413 (gt:SI (match_dup 1) (match_dup 2)))]
13414 "TARGET_POWER && reload_completed"
13415 [(set (match_dup 0)
13416 (gt:SI (match_dup 1) (match_dup 2)))
13418 (compare:CC (match_dup 0)
13422 (define_insn "*plus_gt0<mode>"
13423 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13424 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13426 (match_operand:P 2 "gpc_reg_operand" "r")))]
13428 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13429 [(set_attr "type" "three")
13430 (set_attr "length" "12")])
13433 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13435 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13437 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13439 (clobber (match_scratch:SI 3 "=&r,&r"))]
13442 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13444 [(set_attr "type" "compare")
13445 (set_attr "length" "12,16")])
13448 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13450 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13452 (match_operand:SI 2 "gpc_reg_operand" ""))
13454 (clobber (match_scratch:SI 3 ""))]
13455 "TARGET_32BIT && reload_completed"
13456 [(set (match_dup 3)
13457 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13460 (compare:CC (match_dup 3)
13465 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13467 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13469 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13471 (clobber (match_scratch:DI 3 "=&r,&r"))]
13474 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13476 [(set_attr "type" "compare")
13477 (set_attr "length" "12,16")])
13480 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13482 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13484 (match_operand:DI 2 "gpc_reg_operand" ""))
13486 (clobber (match_scratch:DI 3 ""))]
13487 "TARGET_64BIT && reload_completed"
13488 [(set (match_dup 3)
13489 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13492 (compare:CC (match_dup 3)
13497 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13499 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13501 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13503 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13504 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13507 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13509 [(set_attr "type" "compare")
13510 (set_attr "length" "12,16")])
13513 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13515 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13517 (match_operand:SI 2 "gpc_reg_operand" ""))
13519 (set (match_operand:SI 0 "gpc_reg_operand" "")
13520 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13521 "TARGET_32BIT && reload_completed"
13522 [(set (match_dup 0)
13523 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13525 (compare:CC (match_dup 0)
13530 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13532 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13534 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13536 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13537 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13540 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13542 [(set_attr "type" "compare")
13543 (set_attr "length" "12,16")])
13546 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13548 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13550 (match_operand:DI 2 "gpc_reg_operand" ""))
13552 (set (match_operand:DI 0 "gpc_reg_operand" "")
13553 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13554 "TARGET_64BIT && reload_completed"
13555 [(set (match_dup 0)
13556 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13558 (compare:CC (match_dup 0)
13563 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13564 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13565 (match_operand:SI 2 "reg_or_short_operand" "r"))
13566 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13568 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13569 [(set_attr "length" "12")])
13572 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13574 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13575 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13576 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13578 (clobber (match_scratch:SI 4 "=&r,&r"))]
13581 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13583 [(set_attr "type" "compare")
13584 (set_attr "length" "12,16")])
13587 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13589 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13590 (match_operand:SI 2 "reg_or_short_operand" ""))
13591 (match_operand:SI 3 "gpc_reg_operand" ""))
13593 (clobber (match_scratch:SI 4 ""))]
13594 "TARGET_POWER && reload_completed"
13595 [(set (match_dup 4)
13596 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13598 (compare:CC (match_dup 4)
13603 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13605 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13606 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13607 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13609 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13610 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13613 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13615 [(set_attr "type" "compare")
13616 (set_attr "length" "12,16")])
13619 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13621 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13622 (match_operand:SI 2 "reg_or_short_operand" ""))
13623 (match_operand:SI 3 "gpc_reg_operand" ""))
13625 (set (match_operand:SI 0 "gpc_reg_operand" "")
13626 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13627 "TARGET_POWER && reload_completed"
13628 [(set (match_dup 0)
13629 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13631 (compare:CC (match_dup 0)
13636 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13637 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13638 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13640 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13641 [(set_attr "length" "12")])
13643 (define_insn_and_split "*gtu<mode>"
13644 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13645 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13646 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13650 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13651 (set (match_dup 0) (neg:P (match_dup 0)))]
13654 (define_insn_and_split "*gtu<mode>_compare"
13655 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13657 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13658 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13660 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13661 (gtu:P (match_dup 1) (match_dup 2)))]
13665 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13666 (parallel [(set (match_dup 3)
13667 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13668 (set (match_dup 0) (neg:P (match_dup 0)))])]
13671 (define_insn_and_split "*plus_gtu<mode>"
13672 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13673 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13674 (match_operand:P 2 "reg_or_short_operand" "rI"))
13675 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13678 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13679 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13680 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13683 (define_insn_and_split "*plus_gtu<mode>_compare"
13684 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13686 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13687 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13688 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13690 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13691 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13694 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13695 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13696 (parallel [(set (match_dup 4)
13697 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13699 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13702 (define_insn "*neg_gtu<mode>"
13703 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13704 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13705 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13707 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13708 [(set_attr "type" "two")
13709 (set_attr "length" "8")])
13712 ;; Define both directions of branch and return. If we need a reload
13713 ;; register, we'd rather use CR0 since it is much easier to copy a
13714 ;; register CC value to there.
13718 (if_then_else (match_operator 1 "branch_comparison_operator"
13720 "cc_reg_operand" "y")
13722 (label_ref (match_operand 0 "" ""))
13727 return output_cbranch (operands[1], \"%l0\", 0, insn);
13729 [(set_attr "type" "branch")])
13733 (if_then_else (match_operator 0 "branch_comparison_operator"
13735 "cc_reg_operand" "y")
13742 return output_cbranch (operands[0], NULL, 0, insn);
13744 [(set_attr "type" "jmpreg")
13745 (set_attr "length" "4")])
13749 (if_then_else (match_operator 1 "branch_comparison_operator"
13751 "cc_reg_operand" "y")
13754 (label_ref (match_operand 0 "" ""))))]
13758 return output_cbranch (operands[1], \"%l0\", 1, insn);
13760 [(set_attr "type" "branch")])
13764 (if_then_else (match_operator 0 "branch_comparison_operator"
13766 "cc_reg_operand" "y")
13773 return output_cbranch (operands[0], NULL, 1, insn);
13775 [(set_attr "type" "jmpreg")
13776 (set_attr "length" "4")])
13778 ;; Logic on condition register values.
13780 ; This pattern matches things like
13781 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13782 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13784 ; which are generated by the branch logic.
13785 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13787 (define_insn "*cceq_ior_compare"
13788 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13789 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13790 [(match_operator:SI 2
13791 "branch_positive_comparison_operator"
13793 "cc_reg_operand" "y,y")
13795 (match_operator:SI 4
13796 "branch_positive_comparison_operator"
13798 "cc_reg_operand" "0,y")
13802 "cr%q1 %E0,%j2,%j4"
13803 [(set_attr "type" "cr_logical,delayed_cr")])
13805 ; Why is the constant -1 here, but 1 in the previous pattern?
13806 ; Because ~1 has all but the low bit set.
13808 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13809 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13810 [(not:SI (match_operator:SI 2
13811 "branch_positive_comparison_operator"
13813 "cc_reg_operand" "y,y")
13815 (match_operator:SI 4
13816 "branch_positive_comparison_operator"
13818 "cc_reg_operand" "0,y")
13822 "cr%q1 %E0,%j2,%j4"
13823 [(set_attr "type" "cr_logical,delayed_cr")])
13825 (define_insn "*cceq_rev_compare"
13826 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13827 (compare:CCEQ (match_operator:SI 1
13828 "branch_positive_comparison_operator"
13830 "cc_reg_operand" "0,y")
13834 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13835 [(set_attr "type" "cr_logical,delayed_cr")])
13837 ;; If we are comparing the result of two comparisons, this can be done
13838 ;; using creqv or crxor.
13840 (define_insn_and_split ""
13841 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13842 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13843 [(match_operand 2 "cc_reg_operand" "y")
13845 (match_operator 3 "branch_comparison_operator"
13846 [(match_operand 4 "cc_reg_operand" "y")
13851 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13855 int positive_1, positive_2;
13857 positive_1 = branch_positive_comparison_operator (operands[1],
13858 GET_MODE (operands[1]));
13859 positive_2 = branch_positive_comparison_operator (operands[3],
13860 GET_MODE (operands[3]));
13863 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13864 GET_CODE (operands[1])),
13866 operands[2], const0_rtx);
13867 else if (GET_MODE (operands[1]) != SImode)
13868 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13869 operands[2], const0_rtx);
13872 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13873 GET_CODE (operands[3])),
13875 operands[4], const0_rtx);
13876 else if (GET_MODE (operands[3]) != SImode)
13877 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13878 operands[4], const0_rtx);
13880 if (positive_1 == positive_2)
13882 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13883 operands[5] = constm1_rtx;
13887 operands[5] = const1_rtx;
13891 ;; Unconditional branch and return.
13893 (define_insn "jump"
13895 (label_ref (match_operand 0 "" "")))]
13898 [(set_attr "type" "branch")])
13900 (define_insn "return"
13904 [(set_attr "type" "jmpreg")])
13906 (define_expand "indirect_jump"
13907 [(set (pc) (match_operand 0 "register_operand" ""))])
13909 (define_insn "*indirect_jump<mode>"
13910 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13915 [(set_attr "type" "jmpreg")])
13917 ;; Table jump for switch statements:
13918 (define_expand "tablejump"
13919 [(use (match_operand 0 "" ""))
13920 (use (label_ref (match_operand 1 "" "")))]
13925 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13927 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13931 (define_expand "tablejumpsi"
13932 [(set (match_dup 3)
13933 (plus:SI (match_operand:SI 0 "" "")
13935 (parallel [(set (pc) (match_dup 3))
13936 (use (label_ref (match_operand 1 "" "")))])]
13939 { operands[0] = force_reg (SImode, operands[0]);
13940 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13941 operands[3] = gen_reg_rtx (SImode);
13944 (define_expand "tablejumpdi"
13945 [(set (match_dup 4)
13946 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13948 (plus:DI (match_dup 4)
13950 (parallel [(set (pc) (match_dup 3))
13951 (use (label_ref (match_operand 1 "" "")))])]
13954 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13955 operands[3] = gen_reg_rtx (DImode);
13956 operands[4] = gen_reg_rtx (DImode);
13959 (define_insn "*tablejump<mode>_internal1"
13961 (match_operand:P 0 "register_operand" "c,*l"))
13962 (use (label_ref (match_operand 1 "" "")))]
13967 [(set_attr "type" "jmpreg")])
13972 "{cror 0,0,0|nop}")
13974 ;; Define the subtract-one-and-jump insns, starting with the template
13975 ;; so loop.c knows what to generate.
13977 (define_expand "doloop_end"
13978 [(use (match_operand 0 "" "")) ; loop pseudo
13979 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13980 (use (match_operand 2 "" "")) ; max iterations
13981 (use (match_operand 3 "" "")) ; loop level
13982 (use (match_operand 4 "" ""))] ; label
13986 /* Only use this on innermost loops. */
13987 if (INTVAL (operands[3]) > 1)
13991 if (GET_MODE (operands[0]) != DImode)
13993 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13997 if (GET_MODE (operands[0]) != SImode)
13999 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14004 (define_expand "ctr<mode>"
14005 [(parallel [(set (pc)
14006 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14008 (label_ref (match_operand 1 "" ""))
14011 (plus:P (match_dup 0)
14013 (clobber (match_scratch:CC 2 ""))
14014 (clobber (match_scratch:P 3 ""))])]
14018 ;; We need to be able to do this for any operand, including MEM, or we
14019 ;; will cause reload to blow up since we don't allow output reloads on
14021 ;; For the length attribute to be calculated correctly, the
14022 ;; label MUST be operand 0.
14024 (define_insn "*ctr<mode>_internal1"
14026 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14028 (label_ref (match_operand 0 "" ""))
14030 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14031 (plus:P (match_dup 1)
14033 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14034 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14038 if (which_alternative != 0)
14040 else if (get_attr_length (insn) == 4)
14041 return \"{bdn|bdnz} %l0\";
14043 return \"bdz $+8\;b %l0\";
14045 [(set_attr "type" "branch")
14046 (set_attr "length" "*,12,16,16")])
14048 (define_insn "*ctr<mode>_internal2"
14050 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14053 (label_ref (match_operand 0 "" ""))))
14054 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14055 (plus:P (match_dup 1)
14057 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14058 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14062 if (which_alternative != 0)
14064 else if (get_attr_length (insn) == 4)
14065 return \"bdz %l0\";
14067 return \"{bdn|bdnz} $+8\;b %l0\";
14069 [(set_attr "type" "branch")
14070 (set_attr "length" "*,12,16,16")])
14072 ;; Similar but use EQ
14074 (define_insn "*ctr<mode>_internal5"
14076 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14078 (label_ref (match_operand 0 "" ""))
14080 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14081 (plus:P (match_dup 1)
14083 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14084 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14088 if (which_alternative != 0)
14090 else if (get_attr_length (insn) == 4)
14091 return \"bdz %l0\";
14093 return \"{bdn|bdnz} $+8\;b %l0\";
14095 [(set_attr "type" "branch")
14096 (set_attr "length" "*,12,16,16")])
14098 (define_insn "*ctr<mode>_internal6"
14100 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14103 (label_ref (match_operand 0 "" ""))))
14104 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14105 (plus:P (match_dup 1)
14107 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14108 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14112 if (which_alternative != 0)
14114 else if (get_attr_length (insn) == 4)
14115 return \"{bdn|bdnz} %l0\";
14117 return \"bdz $+8\;b %l0\";
14119 [(set_attr "type" "branch")
14120 (set_attr "length" "*,12,16,16")])
14122 ;; Now the splitters if we could not allocate the CTR register
14126 (if_then_else (match_operator 2 "comparison_operator"
14127 [(match_operand:P 1 "gpc_reg_operand" "")
14129 (match_operand 5 "" "")
14130 (match_operand 6 "" "")))
14131 (set (match_operand:P 0 "gpc_reg_operand" "")
14132 (plus:P (match_dup 1) (const_int -1)))
14133 (clobber (match_scratch:CC 3 ""))
14134 (clobber (match_scratch:P 4 ""))]
14136 [(parallel [(set (match_dup 3)
14137 (compare:CC (plus:P (match_dup 1)
14141 (plus:P (match_dup 1)
14143 (set (pc) (if_then_else (match_dup 7)
14147 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14148 operands[3], const0_rtx); }")
14152 (if_then_else (match_operator 2 "comparison_operator"
14153 [(match_operand:P 1 "gpc_reg_operand" "")
14155 (match_operand 5 "" "")
14156 (match_operand 6 "" "")))
14157 (set (match_operand:P 0 "nonimmediate_operand" "")
14158 (plus:P (match_dup 1) (const_int -1)))
14159 (clobber (match_scratch:CC 3 ""))
14160 (clobber (match_scratch:P 4 ""))]
14161 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14162 [(parallel [(set (match_dup 3)
14163 (compare:CC (plus:P (match_dup 1)
14167 (plus:P (match_dup 1)
14171 (set (pc) (if_then_else (match_dup 7)
14175 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14176 operands[3], const0_rtx); }")
14178 (define_insn "trap"
14179 [(trap_if (const_int 1) (const_int 0))]
14182 [(set_attr "type" "trap")])
14184 (define_expand "conditional_trap"
14185 [(trap_if (match_operator 0 "trap_comparison_operator"
14186 [(match_dup 2) (match_dup 3)])
14187 (match_operand 1 "const_int_operand" ""))]
14189 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14190 operands[2] = rs6000_compare_op0;
14191 operands[3] = rs6000_compare_op1;")
14194 [(trap_if (match_operator 0 "trap_comparison_operator"
14195 [(match_operand:GPR 1 "register_operand" "r")
14196 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14199 "{t|t<wd>}%V0%I2 %1,%2"
14200 [(set_attr "type" "trap")])
14202 ;; Insns related to generating the function prologue and epilogue.
14204 (define_expand "prologue"
14205 [(use (const_int 0))]
14206 "TARGET_SCHED_PROLOG"
14209 rs6000_emit_prologue ();
14213 (define_insn "*movesi_from_cr_one"
14214 [(match_parallel 0 "mfcr_operation"
14215 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14216 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14217 (match_operand 3 "immediate_operand" "n")]
14218 UNSPEC_MOVESI_FROM_CR))])]
14224 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14226 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14227 operands[4] = GEN_INT (mask);
14228 output_asm_insn (\"mfcr %1,%4\", operands);
14232 [(set_attr "type" "mfcrf")])
14234 (define_insn "movesi_from_cr"
14235 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14236 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14237 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14238 UNSPEC_MOVESI_FROM_CR))]
14241 [(set_attr "type" "mfcr")])
14243 (define_insn "*stmw"
14244 [(match_parallel 0 "stmw_operation"
14245 [(set (match_operand:SI 1 "memory_operand" "=m")
14246 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14249 [(set_attr "type" "store_ux")])
14251 (define_insn "*save_fpregs_<mode>"
14252 [(match_parallel 0 "any_parallel_operand"
14253 [(clobber (match_operand:P 1 "register_operand" "=l"))
14254 (use (match_operand:P 2 "call_operand" "s"))
14255 (set (match_operand:DF 3 "memory_operand" "=m")
14256 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14259 [(set_attr "type" "branch")
14260 (set_attr "length" "4")])
14262 ; These are to explain that changes to the stack pointer should
14263 ; not be moved over stores to stack memory.
14264 (define_insn "stack_tie"
14265 [(set (match_operand:BLK 0 "memory_operand" "+m")
14266 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14269 [(set_attr "length" "0")])
14272 (define_expand "epilogue"
14273 [(use (const_int 0))]
14274 "TARGET_SCHED_PROLOG"
14277 rs6000_emit_epilogue (FALSE);
14281 ; On some processors, doing the mtcrf one CC register at a time is
14282 ; faster (like on the 604e). On others, doing them all at once is
14283 ; faster; for instance, on the 601 and 750.
14285 (define_expand "movsi_to_cr_one"
14286 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14287 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14288 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14290 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14292 (define_insn "*movsi_to_cr"
14293 [(match_parallel 0 "mtcrf_operation"
14294 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14295 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14296 (match_operand 3 "immediate_operand" "n")]
14297 UNSPEC_MOVESI_TO_CR))])]
14303 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14304 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14305 operands[4] = GEN_INT (mask);
14306 return \"mtcrf %4,%2\";
14308 [(set_attr "type" "mtcr")])
14310 (define_insn "*mtcrfsi"
14311 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14312 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14313 (match_operand 2 "immediate_operand" "n")]
14314 UNSPEC_MOVESI_TO_CR))]
14315 "GET_CODE (operands[0]) == REG
14316 && CR_REGNO_P (REGNO (operands[0]))
14317 && GET_CODE (operands[2]) == CONST_INT
14318 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14320 [(set_attr "type" "mtcr")])
14322 ; The load-multiple instructions have similar properties.
14323 ; Note that "load_multiple" is a name known to the machine-independent
14324 ; code that actually corresponds to the PowerPC load-string.
14326 (define_insn "*lmw"
14327 [(match_parallel 0 "lmw_operation"
14328 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14329 (match_operand:SI 2 "memory_operand" "m"))])]
14332 [(set_attr "type" "load_ux")])
14334 (define_insn "*return_internal_<mode>"
14336 (use (match_operand:P 0 "register_operand" "lc"))]
14339 [(set_attr "type" "jmpreg")])
14341 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14342 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14344 (define_insn "*return_and_restore_fpregs_<mode>"
14345 [(match_parallel 0 "any_parallel_operand"
14347 (use (match_operand:P 1 "register_operand" "l"))
14348 (use (match_operand:P 2 "call_operand" "s"))
14349 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14350 (match_operand:DF 4 "memory_operand" "m"))])]
14354 ; This is used in compiling the unwind routines.
14355 (define_expand "eh_return"
14356 [(use (match_operand 0 "general_operand" ""))]
14361 emit_insn (gen_eh_set_lr_si (operands[0]));
14363 emit_insn (gen_eh_set_lr_di (operands[0]));
14367 ; We can't expand this before we know where the link register is stored.
14368 (define_insn "eh_set_lr_<mode>"
14369 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14371 (clobber (match_scratch:P 1 "=&b"))]
14376 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14377 (clobber (match_scratch 1 ""))]
14382 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14386 (define_insn "prefetch"
14387 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14388 (match_operand:SI 1 "const_int_operand" "n")
14389 (match_operand:SI 2 "const_int_operand" "n"))]
14393 if (GET_CODE (operands[0]) == REG)
14394 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14395 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14397 [(set_attr "type" "load")])
14400 (include "sync.md")
14401 (include "altivec.md")