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 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 2, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 ;; MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 [(UNSPEC_FRSP 0) ; frsp for POWER machines
31 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
32 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
33 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
35 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
37 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
38 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
41 (UNSPEC_MOVESI_FROM_CR 19)
42 (UNSPEC_MOVESI_TO_CR 20)
44 (UNSPEC_TLSDTPRELHA 22)
45 (UNSPEC_TLSDTPRELLO 23)
46 (UNSPEC_TLSGOTDTPREL 24)
48 (UNSPEC_TLSTPRELHA 26)
49 (UNSPEC_TLSTPRELLO 27)
50 (UNSPEC_TLSGOTTPREL 28)
52 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
56 ;; UNSPEC_VOLATILE usage
61 (UNSPECV_EH_RR 9) ; eh_reg_restore
64 ;; Define an insn type attribute. This is used in function unit delay
66 (define_attr "type" "integer,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,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"
67 (const_string "integer"))
70 ; '(pc)' in the following doesn't include the instruction itself; it is
71 ; calculated as if the instruction had zero size.
72 (define_attr "length" ""
73 (if_then_else (eq_attr "type" "branch")
74 (if_then_else (and (ge (minus (match_dup 0) (pc))
76 (lt (minus (match_dup 0) (pc))
82 ;; Processor type -- this attribute must exactly match the processor_type
83 ;; enumeration in rs6000.h.
85 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
86 (const (symbol_ref "rs6000_cpu_attr")))
88 (automata_option "ndfa")
101 (include "power4.md")
102 (include "power5.md")
105 ;; Start with fixed-point load and store insns. Here we put only the more
106 ;; complex forms. Basic data transfer is done later.
108 (define_expand "zero_extendqidi2"
109 [(set (match_operand:DI 0 "gpc_reg_operand" "")
110 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
115 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
116 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
121 [(set_attr "type" "load,*")])
124 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
125 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
127 (clobber (match_scratch:DI 2 "=r,r"))]
132 [(set_attr "type" "compare")
133 (set_attr "length" "4,8")])
136 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
137 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
139 (clobber (match_scratch:DI 2 ""))]
140 "TARGET_POWERPC64 && reload_completed"
142 (zero_extend:DI (match_dup 1)))
144 (compare:CC (match_dup 2)
149 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
150 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
152 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
153 (zero_extend:DI (match_dup 1)))]
158 [(set_attr "type" "compare")
159 (set_attr "length" "4,8")])
162 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
163 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
165 (set (match_operand:DI 0 "gpc_reg_operand" "")
166 (zero_extend:DI (match_dup 1)))]
167 "TARGET_POWERPC64 && reload_completed"
169 (zero_extend:DI (match_dup 1)))
171 (compare:CC (match_dup 0)
175 (define_insn "extendqidi2"
176 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
177 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
182 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
183 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
185 (clobber (match_scratch:DI 2 "=r,r"))]
190 [(set_attr "type" "compare")
191 (set_attr "length" "4,8")])
194 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
195 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
197 (clobber (match_scratch:DI 2 ""))]
198 "TARGET_POWERPC64 && reload_completed"
200 (sign_extend:DI (match_dup 1)))
202 (compare:CC (match_dup 2)
207 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
208 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
210 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
211 (sign_extend:DI (match_dup 1)))]
216 [(set_attr "type" "compare")
217 (set_attr "length" "4,8")])
220 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
221 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
223 (set (match_operand:DI 0 "gpc_reg_operand" "")
224 (sign_extend:DI (match_dup 1)))]
225 "TARGET_POWERPC64 && reload_completed"
227 (sign_extend:DI (match_dup 1)))
229 (compare:CC (match_dup 0)
233 (define_expand "zero_extendhidi2"
234 [(set (match_operand:DI 0 "gpc_reg_operand" "")
235 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
240 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
241 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
246 [(set_attr "type" "load,*")])
249 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
250 (compare:CC (zero_extend:DI (match_operand:HI 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 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
264 (clobber (match_scratch:DI 2 ""))]
265 "TARGET_POWERPC64 && reload_completed"
267 (zero_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 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
277 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
278 (zero_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 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
290 (set (match_operand:DI 0 "gpc_reg_operand" "")
291 (zero_extend:DI (match_dup 1)))]
292 "TARGET_POWERPC64 && reload_completed"
294 (zero_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,*")])
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 "zero_extendsidi2"
368 [(set (match_operand:DI 0 "gpc_reg_operand" "")
369 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
374 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
375 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
380 [(set_attr "type" "load,*")])
383 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
384 (compare:CC (zero_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 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
398 (clobber (match_scratch:DI 2 ""))]
399 "TARGET_POWERPC64 && reload_completed"
401 (zero_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 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
411 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
412 (zero_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 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
424 (set (match_operand:DI 0 "gpc_reg_operand" "")
425 (zero_extend:DI (match_dup 1)))]
426 "TARGET_POWERPC64 && reload_completed"
428 (zero_extend:DI (match_dup 1)))
430 (compare:CC (match_dup 0)
434 (define_expand "extendsidi2"
435 [(set (match_operand:DI 0 "gpc_reg_operand" "")
436 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
441 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
442 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
447 [(set_attr "type" "load_ext,*")])
450 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
451 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
453 (clobber (match_scratch:DI 2 "=r,r"))]
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 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
465 (clobber (match_scratch:DI 2 ""))]
466 "TARGET_POWERPC64 && reload_completed"
468 (sign_extend:DI (match_dup 1)))
470 (compare:CC (match_dup 2)
475 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
476 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
478 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
479 (sign_extend:DI (match_dup 1)))]
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 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
491 (set (match_operand:DI 0 "gpc_reg_operand" "")
492 (sign_extend:DI (match_dup 1)))]
493 "TARGET_POWERPC64 && reload_completed"
495 (sign_extend:DI (match_dup 1)))
497 (compare:CC (match_dup 0)
501 (define_expand "zero_extendqisi2"
502 [(set (match_operand:SI 0 "gpc_reg_operand" "")
503 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
508 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
509 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
513 {rlinm|rlwinm} %0,%1,0,0xff"
514 [(set_attr "type" "load,*")])
517 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
518 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
520 (clobber (match_scratch:SI 2 "=r,r"))]
523 {andil.|andi.} %2,%1,0xff
525 [(set_attr "type" "compare")
526 (set_attr "length" "4,8")])
529 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
530 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
532 (clobber (match_scratch:SI 2 ""))]
535 (zero_extend:SI (match_dup 1)))
537 (compare:CC (match_dup 2)
542 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
543 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
545 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
546 (zero_extend:SI (match_dup 1)))]
549 {andil.|andi.} %0,%1,0xff
551 [(set_attr "type" "compare")
552 (set_attr "length" "4,8")])
555 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
556 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
558 (set (match_operand:SI 0 "gpc_reg_operand" "")
559 (zero_extend:SI (match_dup 1)))]
562 (zero_extend:SI (match_dup 1)))
564 (compare:CC (match_dup 0)
568 (define_expand "extendqisi2"
569 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
570 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
575 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
576 else if (TARGET_POWER)
577 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
579 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
583 (define_insn "extendqisi2_ppc"
584 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
585 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
590 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
591 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
593 (clobber (match_scratch:SI 2 "=r,r"))]
598 [(set_attr "type" "compare")
599 (set_attr "length" "4,8")])
602 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
603 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
605 (clobber (match_scratch:SI 2 ""))]
606 "TARGET_POWERPC && reload_completed"
608 (sign_extend:SI (match_dup 1)))
610 (compare:CC (match_dup 2)
615 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
616 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
618 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
619 (sign_extend:SI (match_dup 1)))]
624 [(set_attr "type" "compare")
625 (set_attr "length" "4,8")])
628 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
629 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
631 (set (match_operand:SI 0 "gpc_reg_operand" "")
632 (sign_extend:SI (match_dup 1)))]
633 "TARGET_POWERPC && reload_completed"
635 (sign_extend:SI (match_dup 1)))
637 (compare:CC (match_dup 0)
641 (define_expand "extendqisi2_power"
642 [(parallel [(set (match_dup 2)
643 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
645 (clobber (scratch:SI))])
646 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
647 (ashiftrt:SI (match_dup 2)
649 (clobber (scratch:SI))])]
652 { operands[1] = gen_lowpart (SImode, operands[1]);
653 operands[2] = gen_reg_rtx (SImode); }")
655 (define_expand "extendqisi2_no_power"
657 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
659 (set (match_operand:SI 0 "gpc_reg_operand" "")
660 (ashiftrt:SI (match_dup 2)
662 "! TARGET_POWER && ! TARGET_POWERPC"
664 { operands[1] = gen_lowpart (SImode, operands[1]);
665 operands[2] = gen_reg_rtx (SImode); }")
667 (define_expand "zero_extendqihi2"
668 [(set (match_operand:HI 0 "gpc_reg_operand" "")
669 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
674 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
675 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
679 {rlinm|rlwinm} %0,%1,0,0xff"
680 [(set_attr "type" "load,*")])
683 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
684 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
686 (clobber (match_scratch:HI 2 "=r,r"))]
689 {andil.|andi.} %2,%1,0xff
691 [(set_attr "type" "compare")
692 (set_attr "length" "4,8")])
695 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
696 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
698 (clobber (match_scratch:HI 2 ""))]
701 (zero_extend:HI (match_dup 1)))
703 (compare:CC (match_dup 2)
708 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
709 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
711 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
712 (zero_extend:HI (match_dup 1)))]
715 {andil.|andi.} %0,%1,0xff
717 [(set_attr "type" "compare")
718 (set_attr "length" "4,8")])
721 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
722 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
724 (set (match_operand:HI 0 "gpc_reg_operand" "")
725 (zero_extend:HI (match_dup 1)))]
728 (zero_extend:HI (match_dup 1)))
730 (compare:CC (match_dup 0)
734 (define_expand "extendqihi2"
735 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
736 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
741 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
742 else if (TARGET_POWER)
743 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
745 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
749 (define_insn "extendqihi2_ppc"
750 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
751 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
756 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
757 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
759 (clobber (match_scratch:HI 2 "=r,r"))]
764 [(set_attr "type" "compare")
765 (set_attr "length" "4,8")])
768 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
769 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
771 (clobber (match_scratch:HI 2 ""))]
772 "TARGET_POWERPC && reload_completed"
774 (sign_extend:HI (match_dup 1)))
776 (compare:CC (match_dup 2)
781 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
782 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
784 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
785 (sign_extend:HI (match_dup 1)))]
790 [(set_attr "type" "compare")
791 (set_attr "length" "4,8")])
794 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
795 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
797 (set (match_operand:HI 0 "gpc_reg_operand" "")
798 (sign_extend:HI (match_dup 1)))]
799 "TARGET_POWERPC && reload_completed"
801 (sign_extend:HI (match_dup 1)))
803 (compare:CC (match_dup 0)
807 (define_expand "extendqihi2_power"
808 [(parallel [(set (match_dup 2)
809 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
811 (clobber (scratch:SI))])
812 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
813 (ashiftrt:SI (match_dup 2)
815 (clobber (scratch:SI))])]
818 { operands[0] = gen_lowpart (SImode, operands[0]);
819 operands[1] = gen_lowpart (SImode, operands[1]);
820 operands[2] = gen_reg_rtx (SImode); }")
822 (define_expand "extendqihi2_no_power"
824 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
826 (set (match_operand:HI 0 "gpc_reg_operand" "")
827 (ashiftrt:SI (match_dup 2)
829 "! TARGET_POWER && ! TARGET_POWERPC"
831 { operands[0] = gen_lowpart (SImode, operands[0]);
832 operands[1] = gen_lowpart (SImode, operands[1]);
833 operands[2] = gen_reg_rtx (SImode); }")
835 (define_expand "zero_extendhisi2"
836 [(set (match_operand:SI 0 "gpc_reg_operand" "")
837 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
842 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
843 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
847 {rlinm|rlwinm} %0,%1,0,0xffff"
848 [(set_attr "type" "load,*")])
851 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
852 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
854 (clobber (match_scratch:SI 2 "=r,r"))]
857 {andil.|andi.} %2,%1,0xffff
859 [(set_attr "type" "compare")
860 (set_attr "length" "4,8")])
863 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
864 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
866 (clobber (match_scratch:SI 2 ""))]
869 (zero_extend:SI (match_dup 1)))
871 (compare:CC (match_dup 2)
876 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
877 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
879 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
880 (zero_extend:SI (match_dup 1)))]
883 {andil.|andi.} %0,%1,0xffff
885 [(set_attr "type" "compare")
886 (set_attr "length" "4,8")])
889 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
890 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
892 (set (match_operand:SI 0 "gpc_reg_operand" "")
893 (zero_extend:SI (match_dup 1)))]
896 (zero_extend:SI (match_dup 1)))
898 (compare:CC (match_dup 0)
902 (define_expand "extendhisi2"
903 [(set (match_operand:SI 0 "gpc_reg_operand" "")
904 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
909 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
910 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
915 [(set_attr "type" "load_ext,*")])
918 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
919 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
921 (clobber (match_scratch:SI 2 "=r,r"))]
926 [(set_attr "type" "compare")
927 (set_attr "length" "4,8")])
930 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
931 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
933 (clobber (match_scratch:SI 2 ""))]
936 (sign_extend:SI (match_dup 1)))
938 (compare:CC (match_dup 2)
943 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
944 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
946 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
947 (sign_extend:SI (match_dup 1)))]
952 [(set_attr "type" "compare")
953 (set_attr "length" "4,8")])
956 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
957 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
959 (set (match_operand:SI 0 "gpc_reg_operand" "")
960 (sign_extend:SI (match_dup 1)))]
963 (sign_extend:SI (match_dup 1)))
965 (compare:CC (match_dup 0)
969 ;; Fixed-point arithmetic insns.
971 ;; Discourage ai/addic because of carry but provide it in an alternative
972 ;; allowing register zero as source.
973 (define_expand "addsi3"
974 [(set (match_operand:SI 0 "gpc_reg_operand" "")
975 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
976 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
980 if (GET_CODE (operands[2]) == CONST_INT
981 && ! add_operand (operands[2], SImode))
983 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
984 ? operands[0] : gen_reg_rtx (SImode));
986 HOST_WIDE_INT val = INTVAL (operands[2]);
987 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
988 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
990 /* The ordering here is important for the prolog expander.
991 When space is allocated from the stack, adding 'low' first may
992 produce a temporary deallocation (which would be bad). */
993 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
994 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
999 (define_insn "*addsi3_internal1"
1000 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1001 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1002 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1006 {cal %0,%2(%1)|addi %0,%1,%2}
1008 {cau|addis} %0,%1,%v2"
1009 [(set_attr "length" "4,4,4,4")])
1011 (define_insn "addsi3_high"
1012 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1013 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1014 (high:SI (match_operand 2 "" ""))))]
1015 "TARGET_MACHO && !TARGET_64BIT"
1016 "{cau|addis} %0,%1,ha16(%2)"
1017 [(set_attr "length" "4")])
1019 (define_insn "*addsi3_internal2"
1020 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1021 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1022 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1024 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1027 {cax.|add.} %3,%1,%2
1028 {ai.|addic.} %3,%1,%2
1031 [(set_attr "type" "fast_compare,compare,compare,compare")
1032 (set_attr "length" "4,4,8,8")])
1035 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1036 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1037 (match_operand:SI 2 "reg_or_short_operand" ""))
1039 (clobber (match_scratch:SI 3 ""))]
1040 "TARGET_32BIT && reload_completed"
1042 (plus:SI (match_dup 1)
1045 (compare:CC (match_dup 3)
1049 (define_insn "*addsi3_internal3"
1050 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1051 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1052 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1054 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1055 (plus:SI (match_dup 1)
1059 {cax.|add.} %0,%1,%2
1060 {ai.|addic.} %0,%1,%2
1063 [(set_attr "type" "fast_compare,compare,compare,compare")
1064 (set_attr "length" "4,4,8,8")])
1067 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1068 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1069 (match_operand:SI 2 "reg_or_short_operand" ""))
1071 (set (match_operand:SI 0 "gpc_reg_operand" "")
1072 (plus:SI (match_dup 1) (match_dup 2)))]
1073 "TARGET_32BIT && reload_completed"
1075 (plus:SI (match_dup 1)
1078 (compare:CC (match_dup 0)
1082 ;; Split an add that we can't do in one insn into two insns, each of which
1083 ;; does one 16-bit part. This is used by combine. Note that the low-order
1084 ;; add should be last in case the result gets used in an address.
1087 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1088 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1089 (match_operand:SI 2 "non_add_cint_operand" "")))]
1091 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1092 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1095 HOST_WIDE_INT val = INTVAL (operands[2]);
1096 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1097 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1099 operands[3] = GEN_INT (rest);
1100 operands[4] = GEN_INT (low);
1103 (define_insn "one_cmplsi2"
1104 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1105 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1110 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1111 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1113 (clobber (match_scratch:SI 2 "=r,r"))]
1118 [(set_attr "type" "compare")
1119 (set_attr "length" "4,8")])
1122 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1123 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1125 (clobber (match_scratch:SI 2 ""))]
1126 "TARGET_32BIT && reload_completed"
1128 (not:SI (match_dup 1)))
1130 (compare:CC (match_dup 2)
1135 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1136 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1138 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1139 (not:SI (match_dup 1)))]
1144 [(set_attr "type" "compare")
1145 (set_attr "length" "4,8")])
1148 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1149 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1151 (set (match_operand:SI 0 "gpc_reg_operand" "")
1152 (not:SI (match_dup 1)))]
1153 "TARGET_32BIT && reload_completed"
1155 (not:SI (match_dup 1)))
1157 (compare:CC (match_dup 0)
1162 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1163 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1164 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1166 "{sf%I1|subf%I1c} %0,%2,%1")
1169 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1170 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1171 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1178 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1179 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1180 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1182 (clobber (match_scratch:SI 3 "=r,r"))]
1185 {sf.|subfc.} %3,%2,%1
1187 [(set_attr "type" "compare")
1188 (set_attr "length" "4,8")])
1191 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1192 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1193 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1195 (clobber (match_scratch:SI 3 "=r,r"))]
1196 "TARGET_POWERPC && TARGET_32BIT"
1200 [(set_attr "type" "fast_compare")
1201 (set_attr "length" "4,8")])
1204 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1205 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1206 (match_operand:SI 2 "gpc_reg_operand" ""))
1208 (clobber (match_scratch:SI 3 ""))]
1209 "TARGET_32BIT && reload_completed"
1211 (minus:SI (match_dup 1)
1214 (compare:CC (match_dup 3)
1219 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1220 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1221 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1223 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1224 (minus:SI (match_dup 1) (match_dup 2)))]
1227 {sf.|subfc.} %0,%2,%1
1229 [(set_attr "type" "compare")
1230 (set_attr "length" "4,8")])
1233 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1234 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1235 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1237 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1238 (minus:SI (match_dup 1)
1240 "TARGET_POWERPC && TARGET_32BIT"
1244 [(set_attr "type" "fast_compare")
1245 (set_attr "length" "4,8")])
1248 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1249 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1250 (match_operand:SI 2 "gpc_reg_operand" ""))
1252 (set (match_operand:SI 0 "gpc_reg_operand" "")
1253 (minus:SI (match_dup 1)
1255 "TARGET_32BIT && reload_completed"
1257 (minus:SI (match_dup 1)
1260 (compare:CC (match_dup 0)
1264 (define_expand "subsi3"
1265 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1266 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1267 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1271 if (GET_CODE (operands[2]) == CONST_INT)
1273 emit_insn (gen_addsi3 (operands[0], operands[1],
1274 negate_rtx (SImode, operands[2])));
1279 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1280 ;; instruction and some auxiliary computations. Then we just have a single
1281 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1284 (define_expand "sminsi3"
1286 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1287 (match_operand:SI 2 "reg_or_short_operand" ""))
1289 (minus:SI (match_dup 2) (match_dup 1))))
1290 (set (match_operand:SI 0 "gpc_reg_operand" "")
1291 (minus:SI (match_dup 2) (match_dup 3)))]
1292 "TARGET_POWER || TARGET_ISEL"
1297 operands[2] = force_reg (SImode, operands[2]);
1298 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1302 operands[3] = gen_reg_rtx (SImode);
1306 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1307 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1308 (match_operand:SI 2 "reg_or_short_operand" "")))
1309 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1312 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1314 (minus:SI (match_dup 2) (match_dup 1))))
1315 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1318 (define_expand "smaxsi3"
1320 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1321 (match_operand:SI 2 "reg_or_short_operand" ""))
1323 (minus:SI (match_dup 2) (match_dup 1))))
1324 (set (match_operand:SI 0 "gpc_reg_operand" "")
1325 (plus:SI (match_dup 3) (match_dup 1)))]
1326 "TARGET_POWER || TARGET_ISEL"
1331 operands[2] = force_reg (SImode, operands[2]);
1332 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1335 operands[3] = gen_reg_rtx (SImode);
1339 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1340 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1341 (match_operand:SI 2 "reg_or_short_operand" "")))
1342 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1345 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1347 (minus:SI (match_dup 2) (match_dup 1))))
1348 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1351 (define_expand "uminsi3"
1352 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1354 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1356 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1358 (minus:SI (match_dup 4) (match_dup 3))))
1359 (set (match_operand:SI 0 "gpc_reg_operand" "")
1360 (minus:SI (match_dup 2) (match_dup 3)))]
1361 "TARGET_POWER || TARGET_ISEL"
1366 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1369 operands[3] = gen_reg_rtx (SImode);
1370 operands[4] = gen_reg_rtx (SImode);
1371 operands[5] = GEN_INT (-2147483647 - 1);
1374 (define_expand "umaxsi3"
1375 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1377 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1379 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1381 (minus:SI (match_dup 4) (match_dup 3))))
1382 (set (match_operand:SI 0 "gpc_reg_operand" "")
1383 (plus:SI (match_dup 3) (match_dup 1)))]
1384 "TARGET_POWER || TARGET_ISEL"
1389 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1392 operands[3] = gen_reg_rtx (SImode);
1393 operands[4] = gen_reg_rtx (SImode);
1394 operands[5] = GEN_INT (-2147483647 - 1);
1398 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1399 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1400 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1402 (minus:SI (match_dup 2) (match_dup 1))))]
1407 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1409 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1410 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1412 (minus:SI (match_dup 2) (match_dup 1)))
1414 (clobber (match_scratch:SI 3 "=r,r"))]
1419 [(set_attr "type" "delayed_compare")
1420 (set_attr "length" "4,8")])
1423 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1425 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1426 (match_operand:SI 2 "reg_or_short_operand" ""))
1428 (minus:SI (match_dup 2) (match_dup 1)))
1430 (clobber (match_scratch:SI 3 ""))]
1431 "TARGET_POWER && reload_completed"
1433 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1435 (minus:SI (match_dup 2) (match_dup 1))))
1437 (compare:CC (match_dup 3)
1442 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1444 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1445 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1447 (minus:SI (match_dup 2) (match_dup 1)))
1449 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1450 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1452 (minus:SI (match_dup 2) (match_dup 1))))]
1457 [(set_attr "type" "delayed_compare")
1458 (set_attr "length" "4,8")])
1461 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1463 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1464 (match_operand:SI 2 "reg_or_short_operand" ""))
1466 (minus:SI (match_dup 2) (match_dup 1)))
1468 (set (match_operand:SI 0 "gpc_reg_operand" "")
1469 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1471 (minus:SI (match_dup 2) (match_dup 1))))]
1472 "TARGET_POWER && reload_completed"
1474 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1476 (minus:SI (match_dup 2) (match_dup 1))))
1478 (compare:CC (match_dup 0)
1482 ;; We don't need abs with condition code because such comparisons should
1484 (define_expand "abssi2"
1485 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1486 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1492 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1495 else if (! TARGET_POWER)
1497 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1502 (define_insn "*abssi2_power"
1503 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1504 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1508 (define_insn_and_split "abssi2_isel"
1509 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1510 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1511 (clobber (match_scratch:SI 2 "=&b"))
1512 (clobber (match_scratch:CC 3 "=y"))]
1515 "&& reload_completed"
1516 [(set (match_dup 2) (neg:SI (match_dup 1)))
1518 (compare:CC (match_dup 1)
1521 (if_then_else:SI (ge (match_dup 3)
1527 (define_insn_and_split "abssi2_nopower"
1528 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1529 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1530 (clobber (match_scratch:SI 2 "=&r,&r"))]
1531 "! TARGET_POWER && ! TARGET_ISEL"
1533 "&& reload_completed"
1534 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1535 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1536 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1539 (define_insn "*nabs_power"
1540 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1541 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1545 (define_insn_and_split "*nabs_nopower"
1546 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1547 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1548 (clobber (match_scratch:SI 2 "=&r,&r"))]
1551 "&& reload_completed"
1552 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1553 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1554 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1557 (define_insn "negsi2"
1558 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1559 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1564 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1565 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1567 (clobber (match_scratch:SI 2 "=r,r"))]
1572 [(set_attr "type" "fast_compare")
1573 (set_attr "length" "4,8")])
1576 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1577 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1579 (clobber (match_scratch:SI 2 ""))]
1580 "TARGET_32BIT && reload_completed"
1582 (neg:SI (match_dup 1)))
1584 (compare:CC (match_dup 2)
1589 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1590 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1592 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1593 (neg:SI (match_dup 1)))]
1598 [(set_attr "type" "fast_compare")
1599 (set_attr "length" "4,8")])
1602 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1603 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1605 (set (match_operand:SI 0 "gpc_reg_operand" "")
1606 (neg:SI (match_dup 1)))]
1607 "TARGET_32BIT && reload_completed"
1609 (neg:SI (match_dup 1)))
1611 (compare:CC (match_dup 0)
1615 (define_insn "clzsi2"
1616 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1617 (clz:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1619 "{cntlz|cntlzw} %0,%1")
1621 (define_expand "ctzsi2"
1623 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1624 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1626 (clobber (scratch:CC))])
1627 (set (match_dup 4) (clz:SI (match_dup 3)))
1628 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1629 (minus:SI (const_int 31) (match_dup 4)))]
1632 operands[2] = gen_reg_rtx (SImode);
1633 operands[3] = gen_reg_rtx (SImode);
1634 operands[4] = gen_reg_rtx (SImode);
1637 (define_expand "ffssi2"
1639 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1640 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1642 (clobber (scratch:CC))])
1643 (set (match_dup 4) (clz:SI (match_dup 3)))
1644 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1645 (minus:SI (const_int 32) (match_dup 4)))]
1648 operands[2] = gen_reg_rtx (SImode);
1649 operands[3] = gen_reg_rtx (SImode);
1650 operands[4] = gen_reg_rtx (SImode);
1653 (define_expand "mulsi3"
1654 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1655 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1656 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1661 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1663 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1667 (define_insn "mulsi3_mq"
1668 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1669 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1670 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1671 (clobber (match_scratch:SI 3 "=q,q"))]
1674 {muls|mullw} %0,%1,%2
1675 {muli|mulli} %0,%1,%2"
1677 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1678 (const_string "imul3")
1679 (match_operand:SI 2 "short_cint_operand" "")
1680 (const_string "imul2")]
1681 (const_string "imul")))])
1683 (define_insn "mulsi3_no_mq"
1684 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1685 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1686 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1689 {muls|mullw} %0,%1,%2
1690 {muli|mulli} %0,%1,%2"
1692 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1693 (const_string "imul3")
1694 (match_operand:SI 2 "short_cint_operand" "")
1695 (const_string "imul2")]
1696 (const_string "imul")))])
1698 (define_insn "*mulsi3_mq_internal1"
1699 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1700 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1701 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1703 (clobber (match_scratch:SI 3 "=r,r"))
1704 (clobber (match_scratch:SI 4 "=q,q"))]
1707 {muls.|mullw.} %3,%1,%2
1709 [(set_attr "type" "imul_compare")
1710 (set_attr "length" "4,8")])
1713 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1714 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1715 (match_operand:SI 2 "gpc_reg_operand" ""))
1717 (clobber (match_scratch:SI 3 ""))
1718 (clobber (match_scratch:SI 4 ""))]
1719 "TARGET_POWER && reload_completed"
1720 [(parallel [(set (match_dup 3)
1721 (mult:SI (match_dup 1) (match_dup 2)))
1722 (clobber (match_dup 4))])
1724 (compare:CC (match_dup 3)
1728 (define_insn "*mulsi3_no_mq_internal1"
1729 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1730 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1731 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1733 (clobber (match_scratch:SI 3 "=r,r"))]
1736 {muls.|mullw.} %3,%1,%2
1738 [(set_attr "type" "imul_compare")
1739 (set_attr "length" "4,8")])
1742 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1743 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1744 (match_operand:SI 2 "gpc_reg_operand" ""))
1746 (clobber (match_scratch:SI 3 ""))]
1747 "! TARGET_POWER && reload_completed"
1749 (mult:SI (match_dup 1) (match_dup 2)))
1751 (compare:CC (match_dup 3)
1755 (define_insn "*mulsi3_mq_internal2"
1756 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1757 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1758 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1760 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1761 (mult:SI (match_dup 1) (match_dup 2)))
1762 (clobber (match_scratch:SI 4 "=q,q"))]
1765 {muls.|mullw.} %0,%1,%2
1767 [(set_attr "type" "imul_compare")
1768 (set_attr "length" "4,8")])
1771 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1772 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1773 (match_operand:SI 2 "gpc_reg_operand" ""))
1775 (set (match_operand:SI 0 "gpc_reg_operand" "")
1776 (mult:SI (match_dup 1) (match_dup 2)))
1777 (clobber (match_scratch:SI 4 ""))]
1778 "TARGET_POWER && reload_completed"
1779 [(parallel [(set (match_dup 0)
1780 (mult:SI (match_dup 1) (match_dup 2)))
1781 (clobber (match_dup 4))])
1783 (compare:CC (match_dup 0)
1787 (define_insn "*mulsi3_no_mq_internal2"
1788 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1789 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1790 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1792 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1793 (mult:SI (match_dup 1) (match_dup 2)))]
1796 {muls.|mullw.} %0,%1,%2
1798 [(set_attr "type" "imul_compare")
1799 (set_attr "length" "4,8")])
1802 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1803 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1804 (match_operand:SI 2 "gpc_reg_operand" ""))
1806 (set (match_operand:SI 0 "gpc_reg_operand" "")
1807 (mult:SI (match_dup 1) (match_dup 2)))]
1808 "! TARGET_POWER && reload_completed"
1810 (mult:SI (match_dup 1) (match_dup 2)))
1812 (compare:CC (match_dup 0)
1816 ;; Operand 1 is divided by operand 2; quotient goes to operand
1817 ;; 0 and remainder to operand 3.
1818 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1820 (define_expand "divmodsi4"
1821 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1822 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1823 (match_operand:SI 2 "gpc_reg_operand" "")))
1824 (set (match_operand:SI 3 "register_operand" "")
1825 (mod:SI (match_dup 1) (match_dup 2)))])]
1826 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1829 if (! TARGET_POWER && ! TARGET_POWERPC)
1831 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1832 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1833 emit_insn (gen_divss_call ());
1834 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1835 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1840 (define_insn "*divmodsi4_internal"
1841 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1842 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1843 (match_operand:SI 2 "gpc_reg_operand" "r")))
1844 (set (match_operand:SI 3 "register_operand" "=q")
1845 (mod:SI (match_dup 1) (match_dup 2)))]
1848 [(set_attr "type" "idiv")])
1850 (define_expand "udivsi3"
1851 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1852 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1853 (match_operand:SI 2 "gpc_reg_operand" "")))]
1854 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1857 if (! TARGET_POWER && ! TARGET_POWERPC)
1859 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1860 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1861 emit_insn (gen_quous_call ());
1862 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1865 else if (TARGET_POWER)
1867 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1872 (define_insn "udivsi3_mq"
1873 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1874 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1875 (match_operand:SI 2 "gpc_reg_operand" "r")))
1876 (clobber (match_scratch:SI 3 "=q"))]
1877 "TARGET_POWERPC && TARGET_POWER"
1879 [(set_attr "type" "idiv")])
1881 (define_insn "*udivsi3_no_mq"
1882 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1883 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1884 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1885 "TARGET_POWERPC && ! TARGET_POWER"
1887 [(set_attr "type" "idiv")])
1889 ;; For powers of two we can do srai/aze for divide and then adjust for
1890 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1891 ;; used; for PowerPC, force operands into register and do a normal divide;
1892 ;; for AIX common-mode, use quoss call on register operands.
1893 (define_expand "divsi3"
1894 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1895 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1896 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1900 if (GET_CODE (operands[2]) == CONST_INT
1901 && INTVAL (operands[2]) > 0
1902 && exact_log2 (INTVAL (operands[2])) >= 0)
1904 else if (TARGET_POWERPC)
1906 operands[2] = force_reg (SImode, operands[2]);
1909 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1913 else if (TARGET_POWER)
1917 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1918 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1919 emit_insn (gen_quoss_call ());
1920 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1925 (define_insn "divsi3_mq"
1926 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1927 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1928 (match_operand:SI 2 "gpc_reg_operand" "r")))
1929 (clobber (match_scratch:SI 3 "=q"))]
1930 "TARGET_POWERPC && TARGET_POWER"
1932 [(set_attr "type" "idiv")])
1934 (define_insn "*divsi3_no_mq"
1935 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1936 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1937 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1938 "TARGET_POWERPC && ! TARGET_POWER"
1940 [(set_attr "type" "idiv")])
1942 (define_expand "modsi3"
1943 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1944 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1945 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1953 if (GET_CODE (operands[2]) != CONST_INT
1954 || INTVAL (operands[2]) <= 0
1955 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
1958 temp1 = gen_reg_rtx (SImode);
1959 temp2 = gen_reg_rtx (SImode);
1961 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1962 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1963 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1969 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1970 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
1972 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1973 [(set_attr "length" "8")])
1976 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1977 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1978 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1980 (clobber (match_scratch:SI 3 "=r,r"))]
1983 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
1985 [(set_attr "type" "compare")
1986 (set_attr "length" "8,12")])
1989 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1990 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1991 (match_operand:SI 2 "exact_log2_cint_operand" ""))
1993 (clobber (match_scratch:SI 3 ""))]
1996 (div:SI (match_dup 1) (match_dup 2)))
1998 (compare:CC (match_dup 3)
2003 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2004 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2005 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2007 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2008 (div:SI (match_dup 1) (match_dup 2)))]
2011 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2013 [(set_attr "type" "compare")
2014 (set_attr "length" "8,12")])
2017 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2018 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2019 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2021 (set (match_operand:SI 0 "gpc_reg_operand" "")
2022 (div:SI (match_dup 1) (match_dup 2)))]
2025 (div:SI (match_dup 1) (match_dup 2)))
2027 (compare:CC (match_dup 0)
2032 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2035 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2037 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2038 (match_operand:SI 3 "gpc_reg_operand" "r")))
2039 (set (match_operand:SI 2 "register_operand" "=*q")
2042 (zero_extend:DI (match_dup 1)) (const_int 32))
2043 (zero_extend:DI (match_dup 4)))
2047 [(set_attr "type" "idiv")])
2049 ;; To do unsigned divide we handle the cases of the divisor looking like a
2050 ;; negative number. If it is a constant that is less than 2**31, we don't
2051 ;; have to worry about the branches. So make a few subroutines here.
2053 ;; First comes the normal case.
2054 (define_expand "udivmodsi4_normal"
2055 [(set (match_dup 4) (const_int 0))
2056 (parallel [(set (match_operand:SI 0 "" "")
2057 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2059 (zero_extend:DI (match_operand:SI 1 "" "")))
2060 (match_operand:SI 2 "" "")))
2061 (set (match_operand:SI 3 "" "")
2062 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2064 (zero_extend:DI (match_dup 1)))
2068 { operands[4] = gen_reg_rtx (SImode); }")
2070 ;; This handles the branches.
2071 (define_expand "udivmodsi4_tests"
2072 [(set (match_operand:SI 0 "" "") (const_int 0))
2073 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2074 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2075 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2076 (label_ref (match_operand:SI 4 "" "")) (pc)))
2077 (set (match_dup 0) (const_int 1))
2078 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2079 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2080 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2081 (label_ref (match_dup 4)) (pc)))]
2084 { operands[5] = gen_reg_rtx (CCUNSmode);
2085 operands[6] = gen_reg_rtx (CCmode);
2088 (define_expand "udivmodsi4"
2089 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2090 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2091 (match_operand:SI 2 "reg_or_cint_operand" "")))
2092 (set (match_operand:SI 3 "gpc_reg_operand" "")
2093 (umod:SI (match_dup 1) (match_dup 2)))])]
2101 if (! TARGET_POWERPC)
2103 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2104 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2105 emit_insn (gen_divus_call ());
2106 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2107 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2114 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2116 operands[2] = force_reg (SImode, operands[2]);
2117 label = gen_label_rtx ();
2118 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2119 operands[3], label));
2122 operands[2] = force_reg (SImode, operands[2]);
2124 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2132 ;; AIX architecture-independent common-mode multiply (DImode),
2133 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2134 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2135 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2136 ;; assumed unused if generating common-mode, so ignore.
2137 (define_insn "mulh_call"
2140 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2141 (sign_extend:DI (reg:SI 4)))
2143 (clobber (match_scratch:SI 0 "=l"))]
2144 "! TARGET_POWER && ! TARGET_POWERPC"
2146 [(set_attr "type" "imul")])
2148 (define_insn "mull_call"
2150 (mult:DI (sign_extend:DI (reg:SI 3))
2151 (sign_extend:DI (reg:SI 4))))
2152 (clobber (match_scratch:SI 0 "=l"))
2153 (clobber (reg:SI 0))]
2154 "! TARGET_POWER && ! TARGET_POWERPC"
2156 [(set_attr "type" "imul")])
2158 (define_insn "divss_call"
2160 (div:SI (reg:SI 3) (reg:SI 4)))
2162 (mod:SI (reg:SI 3) (reg:SI 4)))
2163 (clobber (match_scratch:SI 0 "=l"))
2164 (clobber (reg:SI 0))]
2165 "! TARGET_POWER && ! TARGET_POWERPC"
2167 [(set_attr "type" "idiv")])
2169 (define_insn "divus_call"
2171 (udiv:SI (reg:SI 3) (reg:SI 4)))
2173 (umod:SI (reg:SI 3) (reg:SI 4)))
2174 (clobber (match_scratch:SI 0 "=l"))
2175 (clobber (reg:SI 0))
2176 (clobber (match_scratch:CC 1 "=x"))
2177 (clobber (reg:CC 69))]
2178 "! TARGET_POWER && ! TARGET_POWERPC"
2180 [(set_attr "type" "idiv")])
2182 (define_insn "quoss_call"
2184 (div:SI (reg:SI 3) (reg:SI 4)))
2185 (clobber (match_scratch:SI 0 "=l"))]
2186 "! TARGET_POWER && ! TARGET_POWERPC"
2188 [(set_attr "type" "idiv")])
2190 (define_insn "quous_call"
2192 (udiv:SI (reg:SI 3) (reg:SI 4)))
2193 (clobber (match_scratch:SI 0 "=l"))
2194 (clobber (reg:SI 0))
2195 (clobber (match_scratch:CC 1 "=x"))
2196 (clobber (reg:CC 69))]
2197 "! TARGET_POWER && ! TARGET_POWERPC"
2199 [(set_attr "type" "idiv")])
2201 ;; Logical instructions
2202 ;; The logical instructions are mostly combined by using match_operator,
2203 ;; but the plain AND insns are somewhat different because there is no
2204 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2205 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2207 (define_insn "andsi3"
2208 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2209 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2210 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2211 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2215 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2216 {andil.|andi.} %0,%1,%b2
2217 {andiu.|andis.} %0,%1,%u2")
2219 ;; Note to set cr's other than cr0 we do the and immediate and then
2220 ;; the test again -- this avoids a mfcr which on the higher end
2221 ;; machines causes an execution serialization
2223 (define_insn "*andsi3_internal2"
2224 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2225 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2226 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2228 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2229 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2233 {andil.|andi.} %3,%1,%b2
2234 {andiu.|andis.} %3,%1,%u2
2235 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2240 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2241 (set_attr "length" "4,4,4,4,8,8,8,8")])
2243 (define_insn "*andsi3_internal3"
2244 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2245 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2246 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2248 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2249 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2253 {andil.|andi.} %3,%1,%b2
2254 {andiu.|andis.} %3,%1,%u2
2255 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2260 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2261 (set_attr "length" "8,4,4,4,8,8,8,8")])
2264 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2265 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2266 (match_operand:SI 2 "and_operand" ""))
2268 (clobber (match_scratch:SI 3 ""))
2269 (clobber (match_scratch:CC 4 ""))]
2271 [(parallel [(set (match_dup 3)
2272 (and:SI (match_dup 1)
2274 (clobber (match_dup 4))])
2276 (compare:CC (match_dup 3)
2280 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2281 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2284 [(set (match_operand:CC 0 "cc_reg_operand" "")
2285 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2286 (match_operand:SI 2 "gpc_reg_operand" ""))
2288 (clobber (match_scratch:SI 3 ""))
2289 (clobber (match_scratch:CC 4 ""))]
2290 "TARGET_POWERPC64 && reload_completed"
2291 [(parallel [(set (match_dup 3)
2292 (and:SI (match_dup 1)
2294 (clobber (match_dup 4))])
2296 (compare:CC (match_dup 3)
2300 (define_insn "*andsi3_internal4"
2301 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2302 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2303 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2305 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2306 (and:SI (match_dup 1)
2308 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2312 {andil.|andi.} %0,%1,%b2
2313 {andiu.|andis.} %0,%1,%u2
2314 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2319 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2320 (set_attr "length" "4,4,4,4,8,8,8,8")])
2322 (define_insn "*andsi3_internal5"
2323 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2324 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2325 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2327 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2328 (and:SI (match_dup 1)
2330 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2334 {andil.|andi.} %0,%1,%b2
2335 {andiu.|andis.} %0,%1,%u2
2336 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2341 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2342 (set_attr "length" "8,4,4,4,8,8,8,8")])
2345 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2346 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2347 (match_operand:SI 2 "and_operand" ""))
2349 (set (match_operand:SI 0 "gpc_reg_operand" "")
2350 (and:SI (match_dup 1)
2352 (clobber (match_scratch:CC 4 ""))]
2354 [(parallel [(set (match_dup 0)
2355 (and:SI (match_dup 1)
2357 (clobber (match_dup 4))])
2359 (compare:CC (match_dup 0)
2364 [(set (match_operand:CC 3 "cc_reg_operand" "")
2365 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2366 (match_operand:SI 2 "gpc_reg_operand" ""))
2368 (set (match_operand:SI 0 "gpc_reg_operand" "")
2369 (and:SI (match_dup 1)
2371 (clobber (match_scratch:CC 4 ""))]
2372 "TARGET_POWERPC64 && reload_completed"
2373 [(parallel [(set (match_dup 0)
2374 (and:SI (match_dup 1)
2376 (clobber (match_dup 4))])
2378 (compare:CC (match_dup 0)
2382 ;; Handle the PowerPC64 rlwinm corner case
2384 (define_insn_and_split "*andsi3_internal6"
2385 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2386 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2387 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2392 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2395 (rotate:SI (match_dup 0) (match_dup 5)))]
2398 int mb = extract_MB (operands[2]);
2399 int me = extract_ME (operands[2]);
2400 operands[3] = GEN_INT (me + 1);
2401 operands[5] = GEN_INT (32 - (me + 1));
2402 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2404 [(set_attr "length" "8")])
2406 (define_insn_and_split "*andsi3_internal7"
2407 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2408 (compare:CC (and:SI (match_operand:SI 0 "gpc_reg_operand" "r,r")
2409 (match_operand:SI 1 "mask_operand_wrap" "i,i"))
2411 (clobber (match_scratch:SI 3 "=r,r"))]
2415 [(parallel [(set (match_dup 2)
2416 (compare:CC (and:SI (rotate:SI (match_dup 0) (match_dup 4))
2419 (clobber (match_dup 3))])]
2422 int mb = extract_MB (operands[1]);
2423 int me = extract_ME (operands[1]);
2424 operands[4] = GEN_INT (me + 1);
2425 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2427 [(set_attr "type" "delayed_compare,compare")
2428 (set_attr "length" "4,8")])
2430 (define_insn_and_split "*andsi3_internal8"
2431 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2432 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2433 (match_operand:SI 2 "mask_operand_wrap" "i,i"))
2435 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2436 (and:SI (match_dup 1)
2441 [(parallel [(set (match_dup 3)
2442 (compare:CC (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2446 (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2449 (rotate:SI (match_dup 0) (match_dup 6)))]
2452 int mb = extract_MB (operands[2]);
2453 int me = extract_ME (operands[2]);
2454 operands[4] = GEN_INT (me + 1);
2455 operands[6] = GEN_INT (32 - (me + 1));
2456 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2458 [(set_attr "type" "delayed_compare,compare")
2459 (set_attr "length" "8,12")])
2461 (define_expand "iorsi3"
2462 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2463 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2464 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2468 if (GET_CODE (operands[2]) == CONST_INT
2469 && ! logical_operand (operands[2], SImode))
2471 HOST_WIDE_INT value = INTVAL (operands[2]);
2472 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2473 ? operands[0] : gen_reg_rtx (SImode));
2475 emit_insn (gen_iorsi3 (tmp, operands[1],
2476 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2477 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2482 (define_expand "xorsi3"
2483 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2484 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2485 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2489 if (GET_CODE (operands[2]) == CONST_INT
2490 && ! logical_operand (operands[2], SImode))
2492 HOST_WIDE_INT value = INTVAL (operands[2]);
2493 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2494 ? operands[0] : gen_reg_rtx (SImode));
2496 emit_insn (gen_xorsi3 (tmp, operands[1],
2497 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2498 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2503 (define_insn "*boolsi3_internal1"
2504 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2505 (match_operator:SI 3 "boolean_or_operator"
2506 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2507 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2511 {%q3il|%q3i} %0,%1,%b2
2512 {%q3iu|%q3is} %0,%1,%u2")
2514 (define_insn "*boolsi3_internal2"
2515 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2516 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2517 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2518 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2520 (clobber (match_scratch:SI 3 "=r,r"))]
2525 [(set_attr "type" "compare")
2526 (set_attr "length" "4,8")])
2529 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2530 (compare:CC (match_operator:SI 4 "boolean_operator"
2531 [(match_operand:SI 1 "gpc_reg_operand" "")
2532 (match_operand:SI 2 "gpc_reg_operand" "")])
2534 (clobber (match_scratch:SI 3 ""))]
2535 "TARGET_32BIT && reload_completed"
2536 [(set (match_dup 3) (match_dup 4))
2538 (compare:CC (match_dup 3)
2542 (define_insn "*boolsi3_internal3"
2543 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2544 (compare:CC (match_operator:SI 4 "boolean_operator"
2545 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2546 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2548 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2554 [(set_attr "type" "compare")
2555 (set_attr "length" "4,8")])
2558 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2559 (compare:CC (match_operator:SI 4 "boolean_operator"
2560 [(match_operand:SI 1 "gpc_reg_operand" "")
2561 (match_operand:SI 2 "gpc_reg_operand" "")])
2563 (set (match_operand:SI 0 "gpc_reg_operand" "")
2565 "TARGET_32BIT && reload_completed"
2566 [(set (match_dup 0) (match_dup 4))
2568 (compare:CC (match_dup 0)
2572 ;; Split a logical operation that we can't do in one insn into two insns,
2573 ;; each of which does one 16-bit part. This is used by combine.
2576 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2577 (match_operator:SI 3 "boolean_or_operator"
2578 [(match_operand:SI 1 "gpc_reg_operand" "")
2579 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2581 [(set (match_dup 0) (match_dup 4))
2582 (set (match_dup 0) (match_dup 5))]
2586 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2587 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2589 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2590 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2594 (define_insn "*boolcsi3_internal1"
2595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2596 (match_operator:SI 3 "boolean_operator"
2597 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2598 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2602 (define_insn "*boolcsi3_internal2"
2603 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2604 (compare:CC (match_operator:SI 4 "boolean_operator"
2605 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2606 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2608 (clobber (match_scratch:SI 3 "=r,r"))]
2613 [(set_attr "type" "compare")
2614 (set_attr "length" "4,8")])
2617 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2618 (compare:CC (match_operator:SI 4 "boolean_operator"
2619 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2620 (match_operand:SI 2 "gpc_reg_operand" "")])
2622 (clobber (match_scratch:SI 3 ""))]
2623 "TARGET_32BIT && reload_completed"
2624 [(set (match_dup 3) (match_dup 4))
2626 (compare:CC (match_dup 3)
2630 (define_insn "*boolcsi3_internal3"
2631 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2632 (compare:CC (match_operator:SI 4 "boolean_operator"
2633 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2634 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2636 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2642 [(set_attr "type" "compare")
2643 (set_attr "length" "4,8")])
2646 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2647 (compare:CC (match_operator:SI 4 "boolean_operator"
2648 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2649 (match_operand:SI 2 "gpc_reg_operand" "")])
2651 (set (match_operand:SI 0 "gpc_reg_operand" "")
2653 "TARGET_32BIT && reload_completed"
2654 [(set (match_dup 0) (match_dup 4))
2656 (compare:CC (match_dup 0)
2660 (define_insn "*boolccsi3_internal1"
2661 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2662 (match_operator:SI 3 "boolean_operator"
2663 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2664 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2668 (define_insn "*boolccsi3_internal2"
2669 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2670 (compare:CC (match_operator:SI 4 "boolean_operator"
2671 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2672 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2674 (clobber (match_scratch:SI 3 "=r,r"))]
2679 [(set_attr "type" "compare")
2680 (set_attr "length" "4,8")])
2683 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2684 (compare:CC (match_operator:SI 4 "boolean_operator"
2685 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2686 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2688 (clobber (match_scratch:SI 3 ""))]
2689 "TARGET_32BIT && reload_completed"
2690 [(set (match_dup 3) (match_dup 4))
2692 (compare:CC (match_dup 3)
2696 (define_insn "*boolccsi3_internal3"
2697 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2698 (compare:CC (match_operator:SI 4 "boolean_operator"
2699 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2700 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2702 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2708 [(set_attr "type" "compare")
2709 (set_attr "length" "4,8")])
2712 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2713 (compare:CC (match_operator:SI 4 "boolean_operator"
2714 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2715 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2717 (set (match_operand:SI 0 "gpc_reg_operand" "")
2719 "TARGET_32BIT && reload_completed"
2720 [(set (match_dup 0) (match_dup 4))
2722 (compare:CC (match_dup 0)
2726 ;; maskir insn. We need four forms because things might be in arbitrary
2727 ;; orders. Don't define forms that only set CR fields because these
2728 ;; would modify an input register.
2730 (define_insn "*maskir_internal1"
2731 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2732 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2733 (match_operand:SI 1 "gpc_reg_operand" "0"))
2734 (and:SI (match_dup 2)
2735 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2739 (define_insn "*maskir_internal2"
2740 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2741 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2742 (match_operand:SI 1 "gpc_reg_operand" "0"))
2743 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2748 (define_insn "*maskir_internal3"
2749 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2750 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2751 (match_operand:SI 3 "gpc_reg_operand" "r"))
2752 (and:SI (not:SI (match_dup 2))
2753 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2757 (define_insn "*maskir_internal4"
2758 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2759 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2760 (match_operand:SI 2 "gpc_reg_operand" "r"))
2761 (and:SI (not:SI (match_dup 2))
2762 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2766 (define_insn "*maskir_internal5"
2767 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2769 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2770 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2771 (and:SI (match_dup 2)
2772 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2774 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2775 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2776 (and:SI (match_dup 2) (match_dup 3))))]
2781 [(set_attr "type" "compare")
2782 (set_attr "length" "4,8")])
2785 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2787 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2788 (match_operand:SI 1 "gpc_reg_operand" ""))
2789 (and:SI (match_dup 2)
2790 (match_operand:SI 3 "gpc_reg_operand" "")))
2792 (set (match_operand:SI 0 "gpc_reg_operand" "")
2793 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2794 (and:SI (match_dup 2) (match_dup 3))))]
2795 "TARGET_POWER && reload_completed"
2797 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2798 (and:SI (match_dup 2) (match_dup 3))))
2800 (compare:CC (match_dup 0)
2804 (define_insn "*maskir_internal6"
2805 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2807 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2808 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2809 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2812 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2813 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2814 (and:SI (match_dup 3) (match_dup 2))))]
2819 [(set_attr "type" "compare")
2820 (set_attr "length" "4,8")])
2823 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2825 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2826 (match_operand:SI 1 "gpc_reg_operand" ""))
2827 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2830 (set (match_operand:SI 0 "gpc_reg_operand" "")
2831 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2832 (and:SI (match_dup 3) (match_dup 2))))]
2833 "TARGET_POWER && reload_completed"
2835 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2836 (and:SI (match_dup 3) (match_dup 2))))
2838 (compare:CC (match_dup 0)
2842 (define_insn "*maskir_internal7"
2843 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2845 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2846 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2847 (and:SI (not:SI (match_dup 2))
2848 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2850 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2851 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2852 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2857 [(set_attr "type" "compare")
2858 (set_attr "length" "4,8")])
2861 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2863 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2864 (match_operand:SI 3 "gpc_reg_operand" ""))
2865 (and:SI (not:SI (match_dup 2))
2866 (match_operand:SI 1 "gpc_reg_operand" "")))
2868 (set (match_operand:SI 0 "gpc_reg_operand" "")
2869 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2870 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2871 "TARGET_POWER && reload_completed"
2873 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2874 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2876 (compare:CC (match_dup 0)
2880 (define_insn "*maskir_internal8"
2881 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2883 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2884 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2885 (and:SI (not:SI (match_dup 2))
2886 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2888 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2889 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2890 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2895 [(set_attr "type" "compare")
2896 (set_attr "length" "4,8")])
2899 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2901 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2902 (match_operand:SI 2 "gpc_reg_operand" ""))
2903 (and:SI (not:SI (match_dup 2))
2904 (match_operand:SI 1 "gpc_reg_operand" "")))
2906 (set (match_operand:SI 0 "gpc_reg_operand" "")
2907 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2908 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2909 "TARGET_POWER && reload_completed"
2911 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2912 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2914 (compare:CC (match_dup 0)
2918 ;; Rotate and shift insns, in all their variants. These support shifts,
2919 ;; field inserts and extracts, and various combinations thereof.
2920 (define_expand "insv"
2921 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2922 (match_operand:SI 1 "const_int_operand" "")
2923 (match_operand:SI 2 "const_int_operand" ""))
2924 (match_operand 3 "gpc_reg_operand" ""))]
2928 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2929 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2930 compiler if the address of the structure is taken later. */
2931 if (GET_CODE (operands[0]) == SUBREG
2932 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2935 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2936 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2938 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2942 (define_insn "insvsi"
2943 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2944 (match_operand:SI 1 "const_int_operand" "i")
2945 (match_operand:SI 2 "const_int_operand" "i"))
2946 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2950 int start = INTVAL (operands[2]) & 31;
2951 int size = INTVAL (operands[1]) & 31;
2953 operands[4] = GEN_INT (32 - start - size);
2954 operands[1] = GEN_INT (start + size - 1);
2955 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2957 [(set_attr "type" "insert_word")])
2959 (define_insn "*insvsi_internal1"
2960 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2961 (match_operand:SI 1 "const_int_operand" "i")
2962 (match_operand:SI 2 "const_int_operand" "i"))
2963 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2964 (match_operand:SI 4 "const_int_operand" "i")))]
2965 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2968 int shift = INTVAL (operands[4]) & 31;
2969 int start = INTVAL (operands[2]) & 31;
2970 int size = INTVAL (operands[1]) & 31;
2972 operands[4] = GEN_INT (shift - start - size);
2973 operands[1] = GEN_INT (start + size - 1);
2974 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2976 [(set_attr "type" "insert_word")])
2978 (define_insn "*insvsi_internal2"
2979 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2980 (match_operand:SI 1 "const_int_operand" "i")
2981 (match_operand:SI 2 "const_int_operand" "i"))
2982 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2983 (match_operand:SI 4 "const_int_operand" "i")))]
2984 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2987 int shift = INTVAL (operands[4]) & 31;
2988 int start = INTVAL (operands[2]) & 31;
2989 int size = INTVAL (operands[1]) & 31;
2991 operands[4] = GEN_INT (32 - shift - start - size);
2992 operands[1] = GEN_INT (start + size - 1);
2993 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2995 [(set_attr "type" "insert_word")])
2997 (define_insn "*insvsi_internal3"
2998 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2999 (match_operand:SI 1 "const_int_operand" "i")
3000 (match_operand:SI 2 "const_int_operand" "i"))
3001 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3002 (match_operand:SI 4 "const_int_operand" "i")))]
3003 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3006 int shift = INTVAL (operands[4]) & 31;
3007 int start = INTVAL (operands[2]) & 31;
3008 int size = INTVAL (operands[1]) & 31;
3010 operands[4] = GEN_INT (32 - shift - start - size);
3011 operands[1] = GEN_INT (start + size - 1);
3012 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3014 [(set_attr "type" "insert_word")])
3016 (define_insn "*insvsi_internal4"
3017 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3018 (match_operand:SI 1 "const_int_operand" "i")
3019 (match_operand:SI 2 "const_int_operand" "i"))
3020 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3021 (match_operand:SI 4 "const_int_operand" "i")
3022 (match_operand:SI 5 "const_int_operand" "i")))]
3023 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3026 int extract_start = INTVAL (operands[5]) & 31;
3027 int extract_size = INTVAL (operands[4]) & 31;
3028 int insert_start = INTVAL (operands[2]) & 31;
3029 int insert_size = INTVAL (operands[1]) & 31;
3031 /* Align extract field with insert field */
3032 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3033 operands[1] = GEN_INT (insert_start + insert_size - 1);
3034 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3036 [(set_attr "type" "insert_word")])
3038 (define_insn "insvdi"
3039 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3040 (match_operand:SI 1 "const_int_operand" "i")
3041 (match_operand:SI 2 "const_int_operand" "i"))
3042 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3046 int start = INTVAL (operands[2]) & 63;
3047 int size = INTVAL (operands[1]) & 63;
3049 operands[1] = GEN_INT (64 - start - size);
3050 return \"rldimi %0,%3,%H1,%H2\";
3053 (define_expand "extzv"
3054 [(set (match_operand 0 "gpc_reg_operand" "")
3055 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3056 (match_operand:SI 2 "const_int_operand" "")
3057 (match_operand:SI 3 "const_int_operand" "")))]
3061 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3062 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3063 compiler if the address of the structure is taken later. */
3064 if (GET_CODE (operands[0]) == SUBREG
3065 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3068 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3069 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3071 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3075 (define_insn "extzvsi"
3076 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3077 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3078 (match_operand:SI 2 "const_int_operand" "i")
3079 (match_operand:SI 3 "const_int_operand" "i")))]
3083 int start = INTVAL (operands[3]) & 31;
3084 int size = INTVAL (operands[2]) & 31;
3086 if (start + size >= 32)
3087 operands[3] = const0_rtx;
3089 operands[3] = GEN_INT (start + size);
3090 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3093 (define_insn "*extzvsi_internal1"
3094 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3095 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3096 (match_operand:SI 2 "const_int_operand" "i,i")
3097 (match_operand:SI 3 "const_int_operand" "i,i"))
3099 (clobber (match_scratch:SI 4 "=r,r"))]
3103 int start = INTVAL (operands[3]) & 31;
3104 int size = INTVAL (operands[2]) & 31;
3106 /* Force split for non-cc0 compare. */
3107 if (which_alternative == 1)
3110 /* If the bit-field being tested fits in the upper or lower half of a
3111 word, it is possible to use andiu. or andil. to test it. This is
3112 useful because the condition register set-use delay is smaller for
3113 andi[ul]. than for rlinm. This doesn't work when the starting bit
3114 position is 0 because the LT and GT bits may be set wrong. */
3116 if ((start > 0 && start + size <= 16) || start >= 16)
3118 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3119 - (1 << (16 - (start & 15) - size))));
3121 return \"{andiu.|andis.} %4,%1,%3\";
3123 return \"{andil.|andi.} %4,%1,%3\";
3126 if (start + size >= 32)
3127 operands[3] = const0_rtx;
3129 operands[3] = GEN_INT (start + size);
3130 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3132 [(set_attr "type" "compare")
3133 (set_attr "length" "4,8")])
3136 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3137 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3138 (match_operand:SI 2 "const_int_operand" "")
3139 (match_operand:SI 3 "const_int_operand" ""))
3141 (clobber (match_scratch:SI 4 ""))]
3144 (zero_extract:SI (match_dup 1) (match_dup 2)
3147 (compare:CC (match_dup 4)
3151 (define_insn "*extzvsi_internal2"
3152 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3153 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3154 (match_operand:SI 2 "const_int_operand" "i,i")
3155 (match_operand:SI 3 "const_int_operand" "i,i"))
3157 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3158 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3162 int start = INTVAL (operands[3]) & 31;
3163 int size = INTVAL (operands[2]) & 31;
3165 /* Force split for non-cc0 compare. */
3166 if (which_alternative == 1)
3169 /* Since we are using the output value, we can't ignore any need for
3170 a shift. The bit-field must end at the LSB. */
3171 if (start >= 16 && start + size == 32)
3173 operands[3] = GEN_INT ((1 << size) - 1);
3174 return \"{andil.|andi.} %0,%1,%3\";
3177 if (start + size >= 32)
3178 operands[3] = const0_rtx;
3180 operands[3] = GEN_INT (start + size);
3181 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3183 [(set_attr "type" "compare")
3184 (set_attr "length" "4,8")])
3187 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3188 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3189 (match_operand:SI 2 "const_int_operand" "")
3190 (match_operand:SI 3 "const_int_operand" ""))
3192 (set (match_operand:SI 0 "gpc_reg_operand" "")
3193 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3196 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3198 (compare:CC (match_dup 0)
3202 (define_insn "extzvdi"
3203 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3204 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3205 (match_operand:SI 2 "const_int_operand" "i")
3206 (match_operand:SI 3 "const_int_operand" "i")))]
3210 int start = INTVAL (operands[3]) & 63;
3211 int size = INTVAL (operands[2]) & 63;
3213 if (start + size >= 64)
3214 operands[3] = const0_rtx;
3216 operands[3] = GEN_INT (start + size);
3217 operands[2] = GEN_INT (64 - size);
3218 return \"rldicl %0,%1,%3,%2\";
3221 (define_insn "*extzvdi_internal1"
3222 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3223 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3224 (match_operand:SI 2 "const_int_operand" "i")
3225 (match_operand:SI 3 "const_int_operand" "i"))
3227 (clobber (match_scratch:DI 4 "=r"))]
3231 int start = INTVAL (operands[3]) & 63;
3232 int size = INTVAL (operands[2]) & 63;
3234 if (start + size >= 64)
3235 operands[3] = const0_rtx;
3237 operands[3] = GEN_INT (start + size);
3238 operands[2] = GEN_INT (64 - size);
3239 return \"rldicl. %4,%1,%3,%2\";
3242 (define_insn "*extzvdi_internal2"
3243 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3244 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3245 (match_operand:SI 2 "const_int_operand" "i")
3246 (match_operand:SI 3 "const_int_operand" "i"))
3248 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3249 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3253 int start = INTVAL (operands[3]) & 63;
3254 int size = INTVAL (operands[2]) & 63;
3256 if (start + size >= 64)
3257 operands[3] = const0_rtx;
3259 operands[3] = GEN_INT (start + size);
3260 operands[2] = GEN_INT (64 - size);
3261 return \"rldicl. %0,%1,%3,%2\";
3264 (define_insn "rotlsi3"
3265 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3266 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3267 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3269 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3271 (define_insn "*rotlsi3_internal2"
3272 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3273 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3274 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3276 (clobber (match_scratch:SI 3 "=r,r"))]
3279 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3281 [(set_attr "type" "delayed_compare")
3282 (set_attr "length" "4,8")])
3285 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3286 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3287 (match_operand:SI 2 "reg_or_cint_operand" ""))
3289 (clobber (match_scratch:SI 3 ""))]
3292 (rotate:SI (match_dup 1) (match_dup 2)))
3294 (compare:CC (match_dup 3)
3298 (define_insn "*rotlsi3_internal3"
3299 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3300 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3301 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3303 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3304 (rotate:SI (match_dup 1) (match_dup 2)))]
3307 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3309 [(set_attr "type" "delayed_compare")
3310 (set_attr "length" "4,8")])
3313 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3314 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3315 (match_operand:SI 2 "reg_or_cint_operand" ""))
3317 (set (match_operand:SI 0 "gpc_reg_operand" "")
3318 (rotate:SI (match_dup 1) (match_dup 2)))]
3321 (rotate:SI (match_dup 1) (match_dup 2)))
3323 (compare:CC (match_dup 0)
3327 (define_insn "*rotlsi3_internal4"
3328 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3329 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3330 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3331 (match_operand:SI 3 "mask_operand" "n")))]
3333 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3335 (define_insn "*rotlsi3_internal5"
3336 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3338 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3339 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3340 (match_operand:SI 3 "mask_operand" "n,n"))
3342 (clobber (match_scratch:SI 4 "=r,r"))]
3345 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3347 [(set_attr "type" "delayed_compare")
3348 (set_attr "length" "4,8")])
3351 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3353 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3354 (match_operand:SI 2 "reg_or_cint_operand" ""))
3355 (match_operand:SI 3 "mask_operand" ""))
3357 (clobber (match_scratch:SI 4 ""))]
3360 (and:SI (rotate:SI (match_dup 1)
3364 (compare:CC (match_dup 4)
3368 (define_insn "*rotlsi3_internal6"
3369 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3371 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3372 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3373 (match_operand:SI 3 "mask_operand" "n,n"))
3375 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3376 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3379 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3381 [(set_attr "type" "delayed_compare")
3382 (set_attr "length" "4,8")])
3385 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3387 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3388 (match_operand:SI 2 "reg_or_cint_operand" ""))
3389 (match_operand:SI 3 "mask_operand" ""))
3391 (set (match_operand:SI 0 "gpc_reg_operand" "")
3392 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3395 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3397 (compare:CC (match_dup 0)
3401 (define_insn "*rotlsi3_internal7"
3402 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3405 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3406 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3408 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3410 (define_insn "*rotlsi3_internal8"
3411 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3412 (compare:CC (zero_extend:SI
3414 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3415 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3417 (clobber (match_scratch:SI 3 "=r,r"))]
3420 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3422 [(set_attr "type" "delayed_compare")
3423 (set_attr "length" "4,8")])
3426 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3427 (compare:CC (zero_extend:SI
3429 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3430 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3432 (clobber (match_scratch:SI 3 ""))]
3435 (zero_extend:SI (subreg:QI
3436 (rotate:SI (match_dup 1)
3439 (compare:CC (match_dup 3)
3443 (define_insn "*rotlsi3_internal9"
3444 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3445 (compare:CC (zero_extend:SI
3447 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3448 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3450 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3451 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3454 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3456 [(set_attr "type" "delayed_compare")
3457 (set_attr "length" "4,8")])
3460 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3461 (compare:CC (zero_extend:SI
3463 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3464 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3466 (set (match_operand:SI 0 "gpc_reg_operand" "")
3467 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3470 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3472 (compare:CC (match_dup 0)
3476 (define_insn "*rotlsi3_internal10"
3477 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3480 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3481 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3483 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3485 (define_insn "*rotlsi3_internal11"
3486 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3487 (compare:CC (zero_extend:SI
3489 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3490 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3492 (clobber (match_scratch:SI 3 "=r,r"))]
3495 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3497 [(set_attr "type" "delayed_compare")
3498 (set_attr "length" "4,8")])
3501 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3502 (compare:CC (zero_extend:SI
3504 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3505 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3507 (clobber (match_scratch:SI 3 ""))]
3510 (zero_extend:SI (subreg:HI
3511 (rotate:SI (match_dup 1)
3514 (compare:CC (match_dup 3)
3518 (define_insn "*rotlsi3_internal12"
3519 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3520 (compare:CC (zero_extend:SI
3522 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3523 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3525 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3526 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3529 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3531 [(set_attr "type" "delayed_compare")
3532 (set_attr "length" "4,8")])
3535 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3536 (compare:CC (zero_extend:SI
3538 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3539 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3541 (set (match_operand:SI 0 "gpc_reg_operand" "")
3542 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3545 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3547 (compare:CC (match_dup 0)
3551 ;; Note that we use "sle." instead of "sl." so that we can set
3552 ;; SHIFT_COUNT_TRUNCATED.
3554 (define_expand "ashlsi3"
3555 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3556 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3557 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3562 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3564 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3568 (define_insn "ashlsi3_power"
3569 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3570 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3571 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3572 (clobber (match_scratch:SI 3 "=q,X"))]
3576 {sli|slwi} %0,%1,%h2")
3578 (define_insn "ashlsi3_no_power"
3579 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3580 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3581 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3583 "{sl|slw}%I2 %0,%1,%h2")
3586 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3587 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3588 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3590 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3591 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3595 {sli.|slwi.} %3,%1,%h2
3598 [(set_attr "type" "delayed_compare")
3599 (set_attr "length" "4,4,8,8")])
3602 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3603 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3604 (match_operand:SI 2 "reg_or_cint_operand" ""))
3606 (clobber (match_scratch:SI 3 ""))
3607 (clobber (match_scratch:SI 4 ""))]
3608 "TARGET_POWER && reload_completed"
3609 [(parallel [(set (match_dup 3)
3610 (ashift:SI (match_dup 1) (match_dup 2)))
3611 (clobber (match_dup 4))])
3613 (compare:CC (match_dup 3)
3618 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3619 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3620 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3622 (clobber (match_scratch:SI 3 "=r,r"))]
3623 "! TARGET_POWER && TARGET_32BIT"
3625 {sl|slw}%I2. %3,%1,%h2
3627 [(set_attr "type" "delayed_compare")
3628 (set_attr "length" "4,8")])
3631 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3632 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3633 (match_operand:SI 2 "reg_or_cint_operand" ""))
3635 (clobber (match_scratch:SI 3 ""))]
3636 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3638 (ashift:SI (match_dup 1) (match_dup 2)))
3640 (compare:CC (match_dup 3)
3645 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3646 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3647 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3649 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3650 (ashift:SI (match_dup 1) (match_dup 2)))
3651 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3655 {sli.|slwi.} %0,%1,%h2
3658 [(set_attr "type" "delayed_compare")
3659 (set_attr "length" "4,4,8,8")])
3662 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3663 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3664 (match_operand:SI 2 "reg_or_cint_operand" ""))
3666 (set (match_operand:SI 0 "gpc_reg_operand" "")
3667 (ashift:SI (match_dup 1) (match_dup 2)))
3668 (clobber (match_scratch:SI 4 ""))]
3669 "TARGET_POWER && reload_completed"
3670 [(parallel [(set (match_dup 0)
3671 (ashift:SI (match_dup 1) (match_dup 2)))
3672 (clobber (match_dup 4))])
3674 (compare:CC (match_dup 0)
3679 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3680 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3681 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3683 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3684 (ashift:SI (match_dup 1) (match_dup 2)))]
3685 "! TARGET_POWER && TARGET_32BIT"
3687 {sl|slw}%I2. %0,%1,%h2
3689 [(set_attr "type" "delayed_compare")
3690 (set_attr "length" "4,8")])
3693 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3694 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3695 (match_operand:SI 2 "reg_or_cint_operand" ""))
3697 (set (match_operand:SI 0 "gpc_reg_operand" "")
3698 (ashift:SI (match_dup 1) (match_dup 2)))]
3699 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3701 (ashift:SI (match_dup 1) (match_dup 2)))
3703 (compare:CC (match_dup 0)
3708 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3709 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3710 (match_operand:SI 2 "const_int_operand" "i"))
3711 (match_operand:SI 3 "mask_operand" "n")))]
3712 "includes_lshift_p (operands[2], operands[3])"
3713 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3716 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3718 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3719 (match_operand:SI 2 "const_int_operand" "i,i"))
3720 (match_operand:SI 3 "mask_operand" "n,n"))
3722 (clobber (match_scratch:SI 4 "=r,r"))]
3723 "includes_lshift_p (operands[2], operands[3])"
3725 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3727 [(set_attr "type" "delayed_compare")
3728 (set_attr "length" "4,8")])
3731 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3733 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3734 (match_operand:SI 2 "const_int_operand" ""))
3735 (match_operand:SI 3 "mask_operand" ""))
3737 (clobber (match_scratch:SI 4 ""))]
3738 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3740 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3743 (compare:CC (match_dup 4)
3748 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3750 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3751 (match_operand:SI 2 "const_int_operand" "i,i"))
3752 (match_operand:SI 3 "mask_operand" "n,n"))
3754 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3755 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3756 "includes_lshift_p (operands[2], operands[3])"
3758 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3760 [(set_attr "type" "delayed_compare")
3761 (set_attr "length" "4,8")])
3764 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3766 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3767 (match_operand:SI 2 "const_int_operand" ""))
3768 (match_operand:SI 3 "mask_operand" ""))
3770 (set (match_operand:SI 0 "gpc_reg_operand" "")
3771 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3772 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3774 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3776 (compare:CC (match_dup 0)
3780 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3782 (define_expand "lshrsi3"
3783 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3784 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3785 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3790 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3792 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3796 (define_insn "lshrsi3_power"
3797 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3798 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3799 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3800 (clobber (match_scratch:SI 3 "=q,X,X"))]
3805 {s%A2i|s%A2wi} %0,%1,%h2")
3807 (define_insn "lshrsi3_no_power"
3808 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3809 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3810 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3814 {sr|srw}%I2 %0,%1,%h2")
3817 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3818 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3819 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3821 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3822 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3827 {s%A2i.|s%A2wi.} %3,%1,%h2
3831 [(set_attr "type" "delayed_compare")
3832 (set_attr "length" "4,4,4,8,8,8")])
3835 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3836 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3837 (match_operand:SI 2 "reg_or_cint_operand" ""))
3839 (clobber (match_scratch:SI 3 ""))
3840 (clobber (match_scratch:SI 4 ""))]
3841 "TARGET_POWER && reload_completed"
3842 [(parallel [(set (match_dup 3)
3843 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3844 (clobber (match_dup 4))])
3846 (compare:CC (match_dup 3)
3851 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3852 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3853 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3855 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3856 "! TARGET_POWER && TARGET_32BIT"
3859 {sr|srw}%I2. %3,%1,%h2
3862 [(set_attr "type" "delayed_compare")
3863 (set_attr "length" "4,4,8,8")])
3866 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3867 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3868 (match_operand:SI 2 "reg_or_cint_operand" ""))
3870 (clobber (match_scratch:SI 3 ""))]
3871 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3873 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3875 (compare:CC (match_dup 3)
3880 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3881 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3882 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3884 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3885 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3886 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3891 {s%A2i.|s%A2wi.} %0,%1,%h2
3895 [(set_attr "type" "delayed_compare")
3896 (set_attr "length" "4,4,4,8,8,8")])
3899 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3900 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3901 (match_operand:SI 2 "reg_or_cint_operand" ""))
3903 (set (match_operand:SI 0 "gpc_reg_operand" "")
3904 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3905 (clobber (match_scratch:SI 4 ""))]
3906 "TARGET_POWER && reload_completed"
3907 [(parallel [(set (match_dup 0)
3908 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3909 (clobber (match_dup 4))])
3911 (compare:CC (match_dup 0)
3916 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3917 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3918 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3920 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3921 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3922 "! TARGET_POWER && TARGET_32BIT"
3925 {sr|srw}%I2. %0,%1,%h2
3928 [(set_attr "type" "delayed_compare")
3929 (set_attr "length" "4,4,8,8")])
3932 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3933 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3934 (match_operand:SI 2 "reg_or_cint_operand" ""))
3936 (set (match_operand:SI 0 "gpc_reg_operand" "")
3937 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3938 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3940 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3942 (compare:CC (match_dup 0)
3947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3948 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3949 (match_operand:SI 2 "const_int_operand" "i"))
3950 (match_operand:SI 3 "mask_operand" "n")))]
3951 "includes_rshift_p (operands[2], operands[3])"
3952 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3955 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3957 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3958 (match_operand:SI 2 "const_int_operand" "i,i"))
3959 (match_operand:SI 3 "mask_operand" "n,n"))
3961 (clobber (match_scratch:SI 4 "=r,r"))]
3962 "includes_rshift_p (operands[2], operands[3])"
3964 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
3966 [(set_attr "type" "delayed_compare")
3967 (set_attr "length" "4,8")])
3970 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3972 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3973 (match_operand:SI 2 "const_int_operand" ""))
3974 (match_operand:SI 3 "mask_operand" ""))
3976 (clobber (match_scratch:SI 4 ""))]
3977 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
3979 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
3982 (compare:CC (match_dup 4)
3987 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3989 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3990 (match_operand:SI 2 "const_int_operand" "i,i"))
3991 (match_operand:SI 3 "mask_operand" "n,n"))
3993 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3994 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3995 "includes_rshift_p (operands[2], operands[3])"
3997 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
3999 [(set_attr "type" "delayed_compare")
4000 (set_attr "length" "4,8")])
4003 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4005 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4006 (match_operand:SI 2 "const_int_operand" ""))
4007 (match_operand:SI 3 "mask_operand" ""))
4009 (set (match_operand:SI 0 "gpc_reg_operand" "")
4010 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4011 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4013 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4015 (compare:CC (match_dup 0)
4020 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4023 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4024 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4025 "includes_rshift_p (operands[2], GEN_INT (255))"
4026 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4029 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4033 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4034 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4036 (clobber (match_scratch:SI 3 "=r,r"))]
4037 "includes_rshift_p (operands[2], GEN_INT (255))"
4039 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4041 [(set_attr "type" "delayed_compare")
4042 (set_attr "length" "4,8")])
4045 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4049 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4050 (match_operand:SI 2 "const_int_operand" "")) 0))
4052 (clobber (match_scratch:SI 3 ""))]
4053 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4055 (zero_extend:SI (subreg:QI
4056 (lshiftrt:SI (match_dup 1)
4059 (compare:CC (match_dup 3)
4064 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4068 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4069 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4071 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4072 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4073 "includes_rshift_p (operands[2], GEN_INT (255))"
4075 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4077 [(set_attr "type" "delayed_compare")
4078 (set_attr "length" "4,8")])
4081 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4085 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4086 (match_operand:SI 2 "const_int_operand" "")) 0))
4088 (set (match_operand:SI 0 "gpc_reg_operand" "")
4089 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4090 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4092 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4094 (compare:CC (match_dup 0)
4099 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4102 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4103 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4104 "includes_rshift_p (operands[2], GEN_INT (65535))"
4105 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4108 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4112 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4113 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4115 (clobber (match_scratch:SI 3 "=r,r"))]
4116 "includes_rshift_p (operands[2], GEN_INT (65535))"
4118 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4120 [(set_attr "type" "delayed_compare")
4121 (set_attr "length" "4,8")])
4124 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4128 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4129 (match_operand:SI 2 "const_int_operand" "")) 0))
4131 (clobber (match_scratch:SI 3 ""))]
4132 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4134 (zero_extend:SI (subreg:HI
4135 (lshiftrt:SI (match_dup 1)
4138 (compare:CC (match_dup 3)
4143 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4147 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4148 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4150 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4151 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4152 "includes_rshift_p (operands[2], GEN_INT (65535))"
4154 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4156 [(set_attr "type" "delayed_compare")
4157 (set_attr "length" "4,8")])
4160 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4164 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4165 (match_operand:SI 2 "const_int_operand" "")) 0))
4167 (set (match_operand:SI 0 "gpc_reg_operand" "")
4168 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4169 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4171 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4173 (compare:CC (match_dup 0)
4178 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4180 (match_operand:SI 1 "gpc_reg_operand" "r"))
4181 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4187 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4189 (match_operand:SI 1 "gpc_reg_operand" "r"))
4190 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4196 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4198 (match_operand:SI 1 "gpc_reg_operand" "r"))
4199 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4205 (define_expand "ashrsi3"
4206 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4207 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4208 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4213 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4215 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4219 (define_insn "ashrsi3_power"
4220 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4221 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4222 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4223 (clobber (match_scratch:SI 3 "=q,X"))]
4227 {srai|srawi} %0,%1,%h2")
4229 (define_insn "ashrsi3_no_power"
4230 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4231 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4232 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4234 "{sra|sraw}%I2 %0,%1,%h2")
4237 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4238 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4239 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4241 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4242 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4246 {srai.|srawi.} %3,%1,%h2
4249 [(set_attr "type" "delayed_compare")
4250 (set_attr "length" "4,4,8,8")])
4253 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4254 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4255 (match_operand:SI 2 "reg_or_cint_operand" ""))
4257 (clobber (match_scratch:SI 3 ""))
4258 (clobber (match_scratch:SI 4 ""))]
4259 "TARGET_POWER && reload_completed"
4260 [(parallel [(set (match_dup 3)
4261 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4262 (clobber (match_dup 4))])
4264 (compare:CC (match_dup 3)
4269 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4270 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4271 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4273 (clobber (match_scratch:SI 3 "=r,r"))]
4276 {sra|sraw}%I2. %3,%1,%h2
4278 [(set_attr "type" "delayed_compare")
4279 (set_attr "length" "4,8")])
4282 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4283 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4284 (match_operand:SI 2 "reg_or_cint_operand" ""))
4286 (clobber (match_scratch:SI 3 ""))]
4287 "! TARGET_POWER && reload_completed"
4289 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4291 (compare:CC (match_dup 3)
4296 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4297 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4298 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4300 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4301 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4302 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4306 {srai.|srawi.} %0,%1,%h2
4309 [(set_attr "type" "delayed_compare")
4310 (set_attr "length" "4,4,8,8")])
4313 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4314 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4315 (match_operand:SI 2 "reg_or_cint_operand" ""))
4317 (set (match_operand:SI 0 "gpc_reg_operand" "")
4318 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4319 (clobber (match_scratch:SI 4 ""))]
4320 "TARGET_POWER && reload_completed"
4321 [(parallel [(set (match_dup 0)
4322 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4323 (clobber (match_dup 4))])
4325 (compare:CC (match_dup 0)
4330 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4331 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4332 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4334 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4335 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4338 {sra|sraw}%I2. %0,%1,%h2
4340 [(set_attr "type" "delayed_compare")
4341 (set_attr "length" "4,8")])
4344 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4345 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4346 (match_operand:SI 2 "reg_or_cint_operand" ""))
4348 (set (match_operand:SI 0 "gpc_reg_operand" "")
4349 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4350 "! TARGET_POWER && reload_completed"
4352 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4354 (compare:CC (match_dup 0)
4358 ;; Floating-point insns, excluding normal data motion.
4360 ;; PowerPC has a full set of single-precision floating point instructions.
4362 ;; For the POWER architecture, we pretend that we have both SFmode and
4363 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4364 ;; The only conversions we will do will be when storing to memory. In that
4365 ;; case, we will use the "frsp" instruction before storing.
4367 ;; Note that when we store into a single-precision memory location, we need to
4368 ;; use the frsp insn first. If the register being stored isn't dead, we
4369 ;; need a scratch register for the frsp. But this is difficult when the store
4370 ;; is done by reload. It is not incorrect to do the frsp on the register in
4371 ;; this case, we just lose precision that we would have otherwise gotten but
4372 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4374 (define_insn "extendsfdf2"
4375 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4376 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4377 "TARGET_HARD_FLOAT && TARGET_FPRS"
4380 if (REGNO (operands[0]) == REGNO (operands[1]))
4383 return \"fmr %0,%1\";
4385 [(set_attr "type" "fp")])
4387 (define_insn "truncdfsf2"
4388 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4389 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4390 "TARGET_HARD_FLOAT && TARGET_FPRS"
4392 [(set_attr "type" "fp")])
4394 (define_insn "aux_truncdfsf2"
4395 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4396 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4397 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4399 [(set_attr "type" "fp")])
4401 (define_expand "negsf2"
4402 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4403 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4407 (define_insn "*negsf2"
4408 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4409 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4410 "TARGET_HARD_FLOAT && TARGET_FPRS"
4412 [(set_attr "type" "fp")])
4414 (define_expand "abssf2"
4415 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4416 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4420 (define_insn "*abssf2"
4421 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4422 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4423 "TARGET_HARD_FLOAT && TARGET_FPRS"
4425 [(set_attr "type" "fp")])
4428 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4429 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4430 "TARGET_HARD_FLOAT && TARGET_FPRS"
4432 [(set_attr "type" "fp")])
4434 (define_expand "addsf3"
4435 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4436 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4437 (match_operand:SF 2 "gpc_reg_operand" "")))]
4442 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4443 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4444 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4445 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4447 [(set_attr "type" "fp")])
4450 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4451 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4452 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4453 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4454 "{fa|fadd} %0,%1,%2"
4455 [(set_attr "type" "fp")])
4457 (define_expand "subsf3"
4458 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4459 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4460 (match_operand:SF 2 "gpc_reg_operand" "")))]
4465 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4466 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4467 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4468 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4470 [(set_attr "type" "fp")])
4473 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4474 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4475 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4476 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4477 "{fs|fsub} %0,%1,%2"
4478 [(set_attr "type" "fp")])
4480 (define_expand "mulsf3"
4481 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4482 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4483 (match_operand:SF 2 "gpc_reg_operand" "")))]
4488 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4489 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4490 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4491 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4493 [(set_attr "type" "fp")])
4496 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4497 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4498 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4499 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4500 "{fm|fmul} %0,%1,%2"
4501 [(set_attr "type" "dmul")])
4503 (define_expand "divsf3"
4504 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4505 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4506 (match_operand:SF 2 "gpc_reg_operand" "")))]
4511 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4512 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4513 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4514 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4516 [(set_attr "type" "sdiv")])
4519 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4520 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4521 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4522 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4523 "{fd|fdiv} %0,%1,%2"
4524 [(set_attr "type" "ddiv")])
4527 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4528 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4529 (match_operand:SF 2 "gpc_reg_operand" "f"))
4530 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4531 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4532 "fmadds %0,%1,%2,%3"
4533 [(set_attr "type" "fp")])
4536 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4537 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4538 (match_operand:SF 2 "gpc_reg_operand" "f"))
4539 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4540 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4541 "{fma|fmadd} %0,%1,%2,%3"
4542 [(set_attr "type" "dmul")])
4545 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4546 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4547 (match_operand:SF 2 "gpc_reg_operand" "f"))
4548 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4549 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4550 "fmsubs %0,%1,%2,%3"
4551 [(set_attr "type" "fp")])
4554 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4555 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4556 (match_operand:SF 2 "gpc_reg_operand" "f"))
4557 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4558 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4559 "{fms|fmsub} %0,%1,%2,%3"
4560 [(set_attr "type" "dmul")])
4563 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4564 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4565 (match_operand:SF 2 "gpc_reg_operand" "f"))
4566 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4567 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4568 && HONOR_SIGNED_ZEROS (SFmode)"
4569 "fnmadds %0,%1,%2,%3"
4570 [(set_attr "type" "fp")])
4573 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4574 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4575 (match_operand:SF 2 "gpc_reg_operand" "f"))
4576 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4577 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4578 && ! HONOR_SIGNED_ZEROS (SFmode)"
4579 "fnmadds %0,%1,%2,%3"
4580 [(set_attr "type" "fp")])
4583 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4584 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4585 (match_operand:SF 2 "gpc_reg_operand" "f"))
4586 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4587 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4588 "{fnma|fnmadd} %0,%1,%2,%3"
4589 [(set_attr "type" "dmul")])
4592 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4593 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4594 (match_operand:SF 2 "gpc_reg_operand" "f"))
4595 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4596 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4597 && ! HONOR_SIGNED_ZEROS (SFmode)"
4598 "{fnma|fnmadd} %0,%1,%2,%3"
4599 [(set_attr "type" "dmul")])
4602 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4603 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4604 (match_operand:SF 2 "gpc_reg_operand" "f"))
4605 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4606 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4607 && HONOR_SIGNED_ZEROS (SFmode)"
4608 "fnmsubs %0,%1,%2,%3"
4609 [(set_attr "type" "fp")])
4612 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4613 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4614 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4615 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4616 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4617 && ! HONOR_SIGNED_ZEROS (SFmode)"
4618 "fnmsubs %0,%1,%2,%3"
4619 [(set_attr "type" "fp")])
4622 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4623 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4624 (match_operand:SF 2 "gpc_reg_operand" "f"))
4625 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4626 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4627 "{fnms|fnmsub} %0,%1,%2,%3"
4628 [(set_attr "type" "dmul")])
4631 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4632 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4633 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4634 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4635 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4636 && ! HONOR_SIGNED_ZEROS (SFmode)"
4637 "{fnms|fnmsub} %0,%1,%2,%3"
4638 [(set_attr "type" "fp")])
4640 (define_expand "sqrtsf2"
4641 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4642 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4643 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4647 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4648 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4649 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4651 [(set_attr "type" "ssqrt")])
4654 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4655 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4656 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4658 [(set_attr "type" "dsqrt")])
4660 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4661 ;; fsel instruction and some auxiliary computations. Then we just have a
4662 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4664 (define_expand "maxsf3"
4665 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4666 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4667 (match_operand:SF 2 "gpc_reg_operand" ""))
4670 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4671 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4673 (define_expand "minsf3"
4674 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4675 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4676 (match_operand:SF 2 "gpc_reg_operand" ""))
4679 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4680 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4683 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4684 (match_operator:SF 3 "min_max_operator"
4685 [(match_operand:SF 1 "gpc_reg_operand" "")
4686 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4687 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4690 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4691 operands[1], operands[2]);
4695 (define_expand "movsicc"
4696 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4697 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4698 (match_operand:SI 2 "gpc_reg_operand" "")
4699 (match_operand:SI 3 "gpc_reg_operand" "")))]
4703 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4709 ;; We use the BASE_REGS for the isel input operands because, if rA is
4710 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4711 ;; because we may switch the operands and rB may end up being rA.
4713 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4714 ;; leave out the mode in operand 4 and use one pattern, but reload can
4715 ;; change the mode underneath our feet and then gets confused trying
4716 ;; to reload the value.
4717 (define_insn "isel_signed"
4718 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4720 (match_operator 1 "comparison_operator"
4721 [(match_operand:CC 4 "cc_reg_operand" "y")
4723 (match_operand:SI 2 "gpc_reg_operand" "b")
4724 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4727 { return output_isel (operands); }"
4728 [(set_attr "length" "4")])
4730 (define_insn "isel_unsigned"
4731 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4733 (match_operator 1 "comparison_operator"
4734 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4736 (match_operand:SI 2 "gpc_reg_operand" "b")
4737 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4740 { return output_isel (operands); }"
4741 [(set_attr "length" "4")])
4743 (define_expand "movsfcc"
4744 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4745 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4746 (match_operand:SF 2 "gpc_reg_operand" "")
4747 (match_operand:SF 3 "gpc_reg_operand" "")))]
4748 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4751 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4757 (define_insn "*fselsfsf4"
4758 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4759 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4760 (match_operand:SF 4 "zero_fp_constant" "F"))
4761 (match_operand:SF 2 "gpc_reg_operand" "f")
4762 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4763 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4765 [(set_attr "type" "fp")])
4767 (define_insn "*fseldfsf4"
4768 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4769 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4770 (match_operand:DF 4 "zero_fp_constant" "F"))
4771 (match_operand:SF 2 "gpc_reg_operand" "f")
4772 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4773 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4775 [(set_attr "type" "fp")])
4777 (define_insn "negdf2"
4778 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4779 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4780 "TARGET_HARD_FLOAT && TARGET_FPRS"
4782 [(set_attr "type" "fp")])
4784 (define_insn "absdf2"
4785 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4786 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4787 "TARGET_HARD_FLOAT && TARGET_FPRS"
4789 [(set_attr "type" "fp")])
4792 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4793 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4794 "TARGET_HARD_FLOAT && TARGET_FPRS"
4796 [(set_attr "type" "fp")])
4798 (define_insn "adddf3"
4799 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4800 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4801 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4802 "TARGET_HARD_FLOAT && TARGET_FPRS"
4803 "{fa|fadd} %0,%1,%2"
4804 [(set_attr "type" "fp")])
4806 (define_insn "subdf3"
4807 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4808 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4809 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4810 "TARGET_HARD_FLOAT && TARGET_FPRS"
4811 "{fs|fsub} %0,%1,%2"
4812 [(set_attr "type" "fp")])
4814 (define_insn "muldf3"
4815 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4816 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4817 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4818 "TARGET_HARD_FLOAT && TARGET_FPRS"
4819 "{fm|fmul} %0,%1,%2"
4820 [(set_attr "type" "dmul")])
4822 (define_insn "divdf3"
4823 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4824 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4825 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4826 "TARGET_HARD_FLOAT && TARGET_FPRS"
4827 "{fd|fdiv} %0,%1,%2"
4828 [(set_attr "type" "ddiv")])
4831 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4832 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4833 (match_operand:DF 2 "gpc_reg_operand" "f"))
4834 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4835 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4836 "{fma|fmadd} %0,%1,%2,%3"
4837 [(set_attr "type" "dmul")])
4840 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4841 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4842 (match_operand:DF 2 "gpc_reg_operand" "f"))
4843 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4844 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4845 "{fms|fmsub} %0,%1,%2,%3"
4846 [(set_attr "type" "dmul")])
4849 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4850 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4851 (match_operand:DF 2 "gpc_reg_operand" "f"))
4852 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4853 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4854 && HONOR_SIGNED_ZEROS (DFmode)"
4855 "{fnma|fnmadd} %0,%1,%2,%3"
4856 [(set_attr "type" "dmul")])
4859 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4860 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
4861 (match_operand:DF 2 "gpc_reg_operand" "f"))
4862 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4863 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4864 && ! HONOR_SIGNED_ZEROS (DFmode)"
4865 "{fnma|fnmadd} %0,%1,%2,%3"
4866 [(set_attr "type" "dmul")])
4869 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4870 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4871 (match_operand:DF 2 "gpc_reg_operand" "f"))
4872 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4873 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4874 && HONOR_SIGNED_ZEROS (DFmode)"
4875 "{fnms|fnmsub} %0,%1,%2,%3"
4876 [(set_attr "type" "dmul")])
4879 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4880 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
4881 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4882 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
4883 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4884 && ! HONOR_SIGNED_ZEROS (DFmode)"
4885 "{fnms|fnmsub} %0,%1,%2,%3"
4886 [(set_attr "type" "dmul")])
4888 (define_insn "sqrtdf2"
4889 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4890 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4891 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4893 [(set_attr "type" "dsqrt")])
4895 ;; The conditional move instructions allow us to perform max and min
4896 ;; operations even when
4898 (define_expand "maxdf3"
4899 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4900 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4901 (match_operand:DF 2 "gpc_reg_operand" ""))
4904 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4905 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4907 (define_expand "mindf3"
4908 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4909 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4910 (match_operand:DF 2 "gpc_reg_operand" ""))
4913 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4914 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4917 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4918 (match_operator:DF 3 "min_max_operator"
4919 [(match_operand:DF 1 "gpc_reg_operand" "")
4920 (match_operand:DF 2 "gpc_reg_operand" "")]))]
4921 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4924 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4925 operands[1], operands[2]);
4929 (define_expand "movdfcc"
4930 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4931 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4932 (match_operand:DF 2 "gpc_reg_operand" "")
4933 (match_operand:DF 3 "gpc_reg_operand" "")))]
4934 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4937 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4943 (define_insn "*fseldfdf4"
4944 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4945 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4946 (match_operand:DF 4 "zero_fp_constant" "F"))
4947 (match_operand:DF 2 "gpc_reg_operand" "f")
4948 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4949 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4951 [(set_attr "type" "fp")])
4953 (define_insn "*fselsfdf4"
4954 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4955 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4956 (match_operand:SF 4 "zero_fp_constant" "F"))
4957 (match_operand:DF 2 "gpc_reg_operand" "f")
4958 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4961 [(set_attr "type" "fp")])
4963 ;; Conversions to and from floating-point.
4965 (define_expand "fixuns_truncsfsi2"
4966 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4967 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
4968 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4971 (define_expand "fix_truncsfsi2"
4972 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4973 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
4974 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4977 ; For each of these conversions, there is a define_expand, a define_insn
4978 ; with a '#' template, and a define_split (with C code). The idea is
4979 ; to allow constant folding with the template of the define_insn,
4980 ; then to have the insns split later (between sched1 and final).
4982 (define_expand "floatsidf2"
4983 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
4984 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4987 (clobber (match_dup 4))
4988 (clobber (match_dup 5))
4989 (clobber (match_dup 6))])]
4990 "TARGET_HARD_FLOAT && TARGET_FPRS"
4993 if (TARGET_POWERPC64)
4995 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
4996 rtx t1 = gen_reg_rtx (DImode);
4997 rtx t2 = gen_reg_rtx (DImode);
4998 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5002 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5003 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5004 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5005 operands[5] = gen_reg_rtx (DFmode);
5006 operands[6] = gen_reg_rtx (SImode);
5009 (define_insn "*floatsidf2_internal"
5010 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5011 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5012 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5013 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5014 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5015 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5016 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5017 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5019 [(set_attr "length" "24")])
5022 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5023 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5024 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5025 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5026 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5027 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5028 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5029 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5030 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5031 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5032 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5033 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5034 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5035 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5036 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5039 rtx lowword, highword;
5040 if (GET_CODE (operands[4]) != MEM)
5042 highword = XEXP (operands[4], 0);
5043 lowword = plus_constant (highword, 4);
5044 if (! WORDS_BIG_ENDIAN)
5047 tmp = highword; highword = lowword; lowword = tmp;
5050 emit_insn (gen_xorsi3 (operands[6], operands[1],
5051 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5052 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5053 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5054 emit_move_insn (operands[5], operands[4]);
5055 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5059 (define_expand "floatunssisf2"
5060 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5061 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5062 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5065 (define_expand "floatunssidf2"
5066 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5067 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5070 (clobber (match_dup 4))
5071 (clobber (match_dup 5))])]
5072 "TARGET_HARD_FLOAT && TARGET_FPRS"
5075 if (TARGET_POWERPC64)
5077 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5078 rtx t1 = gen_reg_rtx (DImode);
5079 rtx t2 = gen_reg_rtx (DImode);
5080 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5085 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5086 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5087 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5088 operands[5] = gen_reg_rtx (DFmode);
5091 (define_insn "*floatunssidf2_internal"
5092 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5093 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5094 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5095 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5096 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5097 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5098 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5100 [(set_attr "length" "20")])
5103 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5104 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5105 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5106 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5107 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5108 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5109 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5110 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5111 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5112 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5113 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5114 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5115 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5118 rtx lowword, highword;
5119 if (GET_CODE (operands[4]) != MEM)
5121 highword = XEXP (operands[4], 0);
5122 lowword = plus_constant (highword, 4);
5123 if (! WORDS_BIG_ENDIAN)
5126 tmp = highword; highword = lowword; lowword = tmp;
5129 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5130 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5131 emit_move_insn (operands[5], operands[4]);
5132 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5136 (define_expand "fix_truncdfsi2"
5137 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5138 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5139 (clobber (match_dup 2))
5140 (clobber (match_dup 3))])]
5141 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5144 operands[2] = gen_reg_rtx (DImode);
5145 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5148 (define_insn "*fix_truncdfsi2_internal"
5149 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5150 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5151 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5152 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5153 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5155 [(set_attr "length" "16")])
5158 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5159 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5160 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5161 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5162 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5163 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5164 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5165 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5166 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5170 if (GET_CODE (operands[3]) != MEM)
5172 lowword = XEXP (operands[3], 0);
5173 if (WORDS_BIG_ENDIAN)
5174 lowword = plus_constant (lowword, 4);
5176 emit_insn (gen_fctiwz (operands[2], operands[1]));
5177 emit_move_insn (operands[3], operands[2]);
5178 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5182 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5183 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5184 ; because the first makes it clear that operand 0 is not live
5185 ; before the instruction.
5186 (define_insn "fctiwz"
5187 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5188 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5190 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5191 "{fcirz|fctiwz} %0,%1"
5192 [(set_attr "type" "fp")])
5194 (define_expand "floatsisf2"
5195 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5196 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5197 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5200 (define_insn "floatdidf2"
5201 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5202 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5203 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5205 [(set_attr "type" "fp")])
5207 (define_insn_and_split "floatsidf_ppc64"
5208 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5209 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5210 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5211 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5212 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5213 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5216 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5217 (set (match_dup 2) (match_dup 3))
5218 (set (match_dup 4) (match_dup 2))
5219 (set (match_dup 0) (float:DF (match_dup 4)))]
5222 (define_insn_and_split "floatunssidf_ppc64"
5223 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5224 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5225 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5226 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5227 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5228 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5231 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5232 (set (match_dup 2) (match_dup 3))
5233 (set (match_dup 4) (match_dup 2))
5234 (set (match_dup 0) (float:DF (match_dup 4)))]
5237 (define_insn "fix_truncdfdi2"
5238 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5239 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5240 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5242 [(set_attr "type" "fp")])
5244 (define_expand "floatdisf2"
5245 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5246 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5247 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_FPRS"
5250 if (!flag_unsafe_math_optimizations)
5252 rtx label = gen_label_rtx ();
5253 emit_insn (gen_floatdisf2_internal2 (operands[1], label));
5256 emit_insn (gen_floatdisf2_internal1 (operands[0], operands[1]));
5260 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5261 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5262 ;; from double rounding.
5263 (define_insn_and_split "floatdisf2_internal1"
5264 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5265 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5266 (clobber (match_scratch:DF 2 "=f"))]
5267 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5269 "&& reload_completed"
5271 (float:DF (match_dup 1)))
5273 (float_truncate:SF (match_dup 2)))]
5276 ;; Twiddles bits to avoid double rounding.
5277 ;; Bits that might be truncated when converting to DFmode are replaced
5278 ;; by a bit that won't be lost at that stage, but is below the SFmode
5279 ;; rounding position.
5280 (define_expand "floatdisf2_internal2"
5281 [(parallel [(set (match_dup 4)
5282 (compare:CC (and:DI (match_operand:DI 0 "" "")
5285 (set (match_dup 2) (and:DI (match_dup 0) (const_int 2047)))
5286 (clobber (match_scratch:CC 7 ""))])
5287 (set (match_dup 3) (ashiftrt:DI (match_dup 0) (const_int 53)))
5288 (set (match_dup 3) (plus:DI (match_dup 3) (const_int 1)))
5289 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
5290 (label_ref (match_operand:DI 1 "" ""))
5292 (set (match_dup 5) (compare:CCUNS (match_dup 3) (const_int 2)))
5293 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
5294 (label_ref (match_dup 1))
5296 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 2)))
5297 (set (match_dup 0) (ior:DI (match_dup 0) (const_int 2048)))]
5298 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_FPRS"
5301 operands[2] = gen_reg_rtx (DImode);
5302 operands[3] = gen_reg_rtx (DImode);
5303 operands[4] = gen_reg_rtx (CCmode);
5304 operands[5] = gen_reg_rtx (CCUNSmode);
5307 ;; Define the DImode operations that can be done in a small number
5308 ;; of instructions. The & constraints are to prevent the register
5309 ;; allocator from allocating registers that overlap with the inputs
5310 ;; (for example, having an input in 7,8 and an output in 6,7). We
5311 ;; also allow for the output being the same as one of the inputs.
5313 (define_insn "*adddi3_noppc64"
5314 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5315 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5316 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5317 "! TARGET_POWERPC64"
5320 if (WORDS_BIG_ENDIAN)
5321 return (GET_CODE (operands[2])) != CONST_INT
5322 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5323 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5325 return (GET_CODE (operands[2])) != CONST_INT
5326 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5327 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5329 [(set_attr "length" "8")])
5331 (define_insn "*subdi3_noppc64"
5332 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5333 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5334 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5335 "! TARGET_POWERPC64"
5338 if (WORDS_BIG_ENDIAN)
5339 return (GET_CODE (operands[1]) != CONST_INT)
5340 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5341 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5343 return (GET_CODE (operands[1]) != CONST_INT)
5344 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5345 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5347 [(set_attr "length" "8")])
5349 (define_insn "*negdi2_noppc64"
5350 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5351 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5352 "! TARGET_POWERPC64"
5355 return (WORDS_BIG_ENDIAN)
5356 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5357 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5359 [(set_attr "length" "8")])
5361 (define_expand "mulsidi3"
5362 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5363 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5364 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5365 "! TARGET_POWERPC64"
5368 if (! TARGET_POWER && ! TARGET_POWERPC)
5370 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5371 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5372 emit_insn (gen_mull_call ());
5373 if (WORDS_BIG_ENDIAN)
5374 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5377 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5378 gen_rtx_REG (SImode, 3));
5379 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5380 gen_rtx_REG (SImode, 4));
5384 else if (TARGET_POWER)
5386 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5391 (define_insn "mulsidi3_mq"
5392 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5393 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5394 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5395 (clobber (match_scratch:SI 3 "=q"))]
5397 "mul %0,%1,%2\;mfmq %L0"
5398 [(set_attr "type" "imul")
5399 (set_attr "length" "8")])
5401 (define_insn "*mulsidi3_no_mq"
5402 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5403 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5404 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5405 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5408 return (WORDS_BIG_ENDIAN)
5409 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5410 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5412 [(set_attr "type" "imul")
5413 (set_attr "length" "8")])
5416 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5417 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5418 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5419 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5422 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5423 (sign_extend:DI (match_dup 2)))
5426 (mult:SI (match_dup 1)
5430 int endian = (WORDS_BIG_ENDIAN == 0);
5431 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5432 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5435 (define_expand "umulsidi3"
5436 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5437 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5438 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5439 "TARGET_POWERPC && ! TARGET_POWERPC64"
5444 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5449 (define_insn "umulsidi3_mq"
5450 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5451 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5452 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5453 (clobber (match_scratch:SI 3 "=q"))]
5454 "TARGET_POWERPC && TARGET_POWER"
5457 return (WORDS_BIG_ENDIAN)
5458 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5459 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5461 [(set_attr "type" "imul")
5462 (set_attr "length" "8")])
5464 (define_insn "*umulsidi3_no_mq"
5465 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5466 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5467 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5468 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5471 return (WORDS_BIG_ENDIAN)
5472 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5473 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5475 [(set_attr "type" "imul")
5476 (set_attr "length" "8")])
5479 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5480 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5481 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5482 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5485 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5486 (zero_extend:DI (match_dup 2)))
5489 (mult:SI (match_dup 1)
5493 int endian = (WORDS_BIG_ENDIAN == 0);
5494 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5495 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5498 (define_expand "smulsi3_highpart"
5499 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5501 (lshiftrt:DI (mult:DI (sign_extend:DI
5502 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5504 (match_operand:SI 2 "gpc_reg_operand" "r")))
5509 if (! TARGET_POWER && ! TARGET_POWERPC)
5511 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5512 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5513 emit_insn (gen_mulh_call ());
5514 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5517 else if (TARGET_POWER)
5519 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5524 (define_insn "smulsi3_highpart_mq"
5525 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5527 (lshiftrt:DI (mult:DI (sign_extend:DI
5528 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5530 (match_operand:SI 2 "gpc_reg_operand" "r")))
5532 (clobber (match_scratch:SI 3 "=q"))]
5535 [(set_attr "type" "imul")])
5537 (define_insn "*smulsi3_highpart_no_mq"
5538 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5540 (lshiftrt:DI (mult:DI (sign_extend:DI
5541 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5543 (match_operand:SI 2 "gpc_reg_operand" "r")))
5545 "TARGET_POWERPC && ! TARGET_POWER"
5547 [(set_attr "type" "imul")])
5549 (define_expand "umulsi3_highpart"
5550 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5552 (lshiftrt:DI (mult:DI (zero_extend:DI
5553 (match_operand:SI 1 "gpc_reg_operand" ""))
5555 (match_operand:SI 2 "gpc_reg_operand" "")))
5562 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5567 (define_insn "umulsi3_highpart_mq"
5568 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5570 (lshiftrt:DI (mult:DI (zero_extend:DI
5571 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5573 (match_operand:SI 2 "gpc_reg_operand" "r")))
5575 (clobber (match_scratch:SI 3 "=q"))]
5576 "TARGET_POWERPC && TARGET_POWER"
5578 [(set_attr "type" "imul")])
5580 (define_insn "*umulsi3_highpart_no_mq"
5581 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5583 (lshiftrt:DI (mult:DI (zero_extend:DI
5584 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5586 (match_operand:SI 2 "gpc_reg_operand" "r")))
5588 "TARGET_POWERPC && ! TARGET_POWER"
5590 [(set_attr "type" "imul")])
5592 ;; If operands 0 and 2 are in the same register, we have a problem. But
5593 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5594 ;; why we have the strange constraints below.
5595 (define_insn "ashldi3_power"
5596 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5597 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5598 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5599 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5602 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5603 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5604 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5605 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5606 [(set_attr "length" "8")])
5608 (define_insn "lshrdi3_power"
5609 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5610 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5611 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5612 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5615 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5616 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5617 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5618 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5619 [(set_attr "length" "8")])
5621 ;; Shift by a variable amount is too complex to be worth open-coding. We
5622 ;; just handle shifts by constants.
5623 (define_insn "ashrdi3_power"
5624 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5625 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5626 (match_operand:SI 2 "const_int_operand" "M,i")))
5627 (clobber (match_scratch:SI 3 "=X,q"))]
5630 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5631 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5632 [(set_attr "length" "8")])
5634 (define_insn "ashrdi3_no_power"
5635 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5636 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5637 (match_operand:SI 2 "const_int_operand" "M,i")))]
5638 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5640 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5641 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5642 [(set_attr "length" "8,12")])
5644 (define_insn "*ashrdisi3_noppc64"
5645 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5646 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5647 (const_int 32)) 4))]
5648 "TARGET_32BIT && !TARGET_POWERPC64"
5651 if (REGNO (operands[0]) == REGNO (operands[1]))
5654 return \"mr %0,%1\";
5656 [(set_attr "length" "4")])
5659 ;; PowerPC64 DImode operations.
5661 (define_expand "adddi3"
5662 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5663 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5664 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5668 if (! TARGET_POWERPC64)
5670 if (non_short_cint_operand (operands[2], DImode))
5674 if (GET_CODE (operands[2]) == CONST_INT
5675 && ! add_operand (operands[2], DImode))
5677 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5678 ? operands[0] : gen_reg_rtx (DImode));
5680 HOST_WIDE_INT val = INTVAL (operands[2]);
5681 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5682 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5684 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5687 /* The ordering here is important for the prolog expander.
5688 When space is allocated from the stack, adding 'low' first may
5689 produce a temporary deallocation (which would be bad). */
5690 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5691 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5696 ;; Discourage ai/addic because of carry but provide it in an alternative
5697 ;; allowing register zero as source.
5699 (define_insn "*adddi3_internal1"
5700 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5701 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5702 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5710 (define_insn "*adddi3_internal2"
5711 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5712 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5713 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5715 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5722 [(set_attr "type" "fast_compare,compare,compare,compare")
5723 (set_attr "length" "4,4,8,8")])
5726 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5727 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5728 (match_operand:DI 2 "reg_or_short_operand" ""))
5730 (clobber (match_scratch:DI 3 ""))]
5731 "TARGET_POWERPC64 && reload_completed"
5733 (plus:DI (match_dup 1) (match_dup 2)))
5735 (compare:CC (match_dup 3)
5739 (define_insn "*adddi3_internal3"
5740 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5741 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5742 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5744 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5745 (plus:DI (match_dup 1) (match_dup 2)))]
5752 [(set_attr "type" "fast_compare,compare,compare,compare")
5753 (set_attr "length" "4,4,8,8")])
5756 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5757 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5758 (match_operand:DI 2 "reg_or_short_operand" ""))
5760 (set (match_operand:DI 0 "gpc_reg_operand" "")
5761 (plus:DI (match_dup 1) (match_dup 2)))]
5762 "TARGET_POWERPC64 && reload_completed"
5764 (plus:DI (match_dup 1) (match_dup 2)))
5766 (compare:CC (match_dup 0)
5770 ;; Split an add that we can't do in one insn into two insns, each of which
5771 ;; does one 16-bit part. This is used by combine. Note that the low-order
5772 ;; add should be last in case the result gets used in an address.
5775 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5776 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5777 (match_operand:DI 2 "non_add_cint_operand" "")))]
5779 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5780 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5783 HOST_WIDE_INT val = INTVAL (operands[2]);
5784 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5785 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5787 operands[4] = GEN_INT (low);
5788 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5789 operands[3] = GEN_INT (rest);
5790 else if (! no_new_pseudos)
5792 operands[3] = gen_reg_rtx (DImode);
5793 emit_move_insn (operands[3], operands[2]);
5794 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5801 (define_insn "one_cmpldi2"
5802 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5803 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5808 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5809 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5811 (clobber (match_scratch:DI 2 "=r,r"))]
5816 [(set_attr "type" "compare")
5817 (set_attr "length" "4,8")])
5820 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5821 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5823 (clobber (match_scratch:DI 2 ""))]
5824 "TARGET_POWERPC64 && reload_completed"
5826 (not:DI (match_dup 1)))
5828 (compare:CC (match_dup 2)
5833 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5834 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5836 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5837 (not:DI (match_dup 1)))]
5842 [(set_attr "type" "compare")
5843 (set_attr "length" "4,8")])
5846 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5847 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5849 (set (match_operand:DI 0 "gpc_reg_operand" "")
5850 (not:DI (match_dup 1)))]
5851 "TARGET_POWERPC64 && reload_completed"
5853 (not:DI (match_dup 1)))
5855 (compare:CC (match_dup 0)
5860 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5861 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
5862 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
5869 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5870 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5871 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5873 (clobber (match_scratch:DI 3 "=r,r"))]
5878 [(set_attr "type" "fast_compare")
5879 (set_attr "length" "4,8")])
5882 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5883 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5884 (match_operand:DI 2 "gpc_reg_operand" ""))
5886 (clobber (match_scratch:DI 3 ""))]
5887 "TARGET_POWERPC64 && reload_completed"
5889 (minus:DI (match_dup 1) (match_dup 2)))
5891 (compare:CC (match_dup 3)
5896 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5897 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5898 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5900 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5901 (minus:DI (match_dup 1) (match_dup 2)))]
5906 [(set_attr "type" "fast_compare")
5907 (set_attr "length" "4,8")])
5910 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5911 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5912 (match_operand:DI 2 "gpc_reg_operand" ""))
5914 (set (match_operand:DI 0 "gpc_reg_operand" "")
5915 (minus:DI (match_dup 1) (match_dup 2)))]
5916 "TARGET_POWERPC64 && reload_completed"
5918 (minus:DI (match_dup 1) (match_dup 2)))
5920 (compare:CC (match_dup 0)
5924 (define_expand "subdi3"
5925 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5926 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
5927 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
5931 if (GET_CODE (operands[2]) == CONST_INT)
5933 emit_insn (gen_adddi3 (operands[0], operands[1],
5934 negate_rtx (DImode, operands[2])));
5939 (define_insn_and_split "absdi2"
5940 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5941 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5942 (clobber (match_scratch:DI 2 "=&r,&r"))]
5945 "&& reload_completed"
5946 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5947 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5948 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5951 (define_insn_and_split "*nabsdi2"
5952 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5953 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5954 (clobber (match_scratch:DI 2 "=&r,&r"))]
5957 "&& reload_completed"
5958 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5959 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5960 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
5963 (define_expand "negdi2"
5964 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5965 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
5970 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5971 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5976 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5977 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5979 (clobber (match_scratch:DI 2 "=r,r"))]
5984 [(set_attr "type" "fast_compare")
5985 (set_attr "length" "4,8")])
5988 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5989 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5991 (clobber (match_scratch:DI 2 ""))]
5992 "TARGET_POWERPC64 && reload_completed"
5994 (neg:DI (match_dup 1)))
5996 (compare:CC (match_dup 2)
6001 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6002 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6004 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6005 (neg:DI (match_dup 1)))]
6010 [(set_attr "type" "fast_compare")
6011 (set_attr "length" "4,8")])
6014 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6015 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6017 (set (match_operand:DI 0 "gpc_reg_operand" "")
6018 (neg:DI (match_dup 1)))]
6019 "TARGET_POWERPC64 && reload_completed"
6021 (neg:DI (match_dup 1)))
6023 (compare:CC (match_dup 0)
6027 (define_insn "clzdi2"
6028 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6029 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6033 (define_expand "ctzdi2"
6035 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6036 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6038 (clobber (scratch:CC))])
6039 (set (match_dup 4) (clz:DI (match_dup 3)))
6040 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6041 (minus:DI (const_int 63) (match_dup 4)))]
6044 operands[2] = gen_reg_rtx (DImode);
6045 operands[3] = gen_reg_rtx (DImode);
6046 operands[4] = gen_reg_rtx (DImode);
6049 (define_expand "ffsdi2"
6051 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6052 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6054 (clobber (scratch:CC))])
6055 (set (match_dup 4) (clz:DI (match_dup 3)))
6056 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6057 (minus:DI (const_int 64) (match_dup 4)))]
6060 operands[2] = gen_reg_rtx (DImode);
6061 operands[3] = gen_reg_rtx (DImode);
6062 operands[4] = gen_reg_rtx (DImode);
6065 (define_insn "muldi3"
6066 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6067 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6068 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6071 [(set_attr "type" "lmul")])
6073 (define_insn "*muldi3_internal1"
6074 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6075 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6076 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6078 (clobber (match_scratch:DI 3 "=r,r"))]
6083 [(set_attr "type" "lmul_compare")
6084 (set_attr "length" "4,8")])
6087 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6088 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6089 (match_operand:DI 2 "gpc_reg_operand" ""))
6091 (clobber (match_scratch:DI 3 ""))]
6092 "TARGET_POWERPC64 && reload_completed"
6094 (mult:DI (match_dup 1) (match_dup 2)))
6096 (compare:CC (match_dup 3)
6100 (define_insn "*muldi3_internal2"
6101 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6102 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6103 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6105 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6106 (mult:DI (match_dup 1) (match_dup 2)))]
6111 [(set_attr "type" "lmul_compare")
6112 (set_attr "length" "4,8")])
6115 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6116 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6117 (match_operand:DI 2 "gpc_reg_operand" ""))
6119 (set (match_operand:DI 0 "gpc_reg_operand" "")
6120 (mult:DI (match_dup 1) (match_dup 2)))]
6121 "TARGET_POWERPC64 && reload_completed"
6123 (mult:DI (match_dup 1) (match_dup 2)))
6125 (compare:CC (match_dup 0)
6129 (define_insn "smuldi3_highpart"
6130 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6132 (lshiftrt:TI (mult:TI (sign_extend:TI
6133 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6135 (match_operand:DI 2 "gpc_reg_operand" "r")))
6139 [(set_attr "type" "lmul")])
6141 (define_insn "umuldi3_highpart"
6142 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6144 (lshiftrt:TI (mult:TI (zero_extend:TI
6145 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6147 (match_operand:DI 2 "gpc_reg_operand" "r")))
6151 [(set_attr "type" "lmul")])
6153 (define_expand "divdi3"
6154 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6155 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6156 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6160 if (GET_CODE (operands[2]) == CONST_INT
6161 && INTVAL (operands[2]) > 0
6162 && exact_log2 (INTVAL (operands[2])) >= 0)
6165 operands[2] = force_reg (DImode, operands[2]);
6168 (define_expand "moddi3"
6169 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6170 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6171 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6179 if (GET_CODE (operands[2]) != CONST_INT
6180 || INTVAL (operands[2]) <= 0
6181 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6184 temp1 = gen_reg_rtx (DImode);
6185 temp2 = gen_reg_rtx (DImode);
6187 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6188 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6189 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6194 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6195 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6196 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6198 "sradi %0,%1,%p2\;addze %0,%0"
6199 [(set_attr "length" "8")])
6202 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6203 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6204 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6206 (clobber (match_scratch:DI 3 "=r,r"))]
6209 sradi %3,%1,%p2\;addze. %3,%3
6211 [(set_attr "type" "compare")
6212 (set_attr "length" "8,12")])
6215 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6216 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6217 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6219 (clobber (match_scratch:DI 3 ""))]
6220 "TARGET_POWERPC64 && reload_completed"
6222 (div:DI (match_dup 1) (match_dup 2)))
6224 (compare:CC (match_dup 3)
6229 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6230 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6231 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6233 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6234 (div:DI (match_dup 1) (match_dup 2)))]
6237 sradi %0,%1,%p2\;addze. %0,%0
6239 [(set_attr "type" "compare")
6240 (set_attr "length" "8,12")])
6243 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6244 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6245 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6247 (set (match_operand:DI 0 "gpc_reg_operand" "")
6248 (div:DI (match_dup 1) (match_dup 2)))]
6249 "TARGET_POWERPC64 && reload_completed"
6251 (div:DI (match_dup 1) (match_dup 2)))
6253 (compare:CC (match_dup 0)
6258 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6259 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6260 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6263 [(set_attr "type" "ldiv")])
6265 (define_insn "udivdi3"
6266 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6267 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6268 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6271 [(set_attr "type" "ldiv")])
6273 (define_insn "rotldi3"
6274 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6275 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6276 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6278 "rld%I2cl %0,%1,%H2,0")
6280 (define_insn "*rotldi3_internal2"
6281 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6282 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6283 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6285 (clobber (match_scratch:DI 3 "=r,r"))]
6288 rld%I2cl. %3,%1,%H2,0
6290 [(set_attr "type" "delayed_compare")
6291 (set_attr "length" "4,8")])
6294 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6295 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6296 (match_operand:DI 2 "reg_or_cint_operand" ""))
6298 (clobber (match_scratch:DI 3 ""))]
6299 "TARGET_POWERPC64 && reload_completed"
6301 (rotate:DI (match_dup 1) (match_dup 2)))
6303 (compare:CC (match_dup 3)
6307 (define_insn "*rotldi3_internal3"
6308 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6309 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6310 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6312 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6313 (rotate:DI (match_dup 1) (match_dup 2)))]
6316 rld%I2cl. %0,%1,%H2,0
6318 [(set_attr "type" "delayed_compare")
6319 (set_attr "length" "4,8")])
6322 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6323 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6324 (match_operand:DI 2 "reg_or_cint_operand" ""))
6326 (set (match_operand:DI 0 "gpc_reg_operand" "")
6327 (rotate:DI (match_dup 1) (match_dup 2)))]
6328 "TARGET_POWERPC64 && reload_completed"
6330 (rotate:DI (match_dup 1) (match_dup 2)))
6332 (compare:CC (match_dup 0)
6336 (define_insn "*rotldi3_internal4"
6337 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6338 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6339 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6340 (match_operand:DI 3 "mask64_operand" "n")))]
6342 "rld%I2c%B3 %0,%1,%H2,%S3")
6344 (define_insn "*rotldi3_internal5"
6345 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6347 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6348 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6349 (match_operand:DI 3 "mask64_operand" "n,n"))
6351 (clobber (match_scratch:DI 4 "=r,r"))]
6354 rld%I2c%B3. %4,%1,%H2,%S3
6356 [(set_attr "type" "delayed_compare")
6357 (set_attr "length" "4,8")])
6360 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6362 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6363 (match_operand:DI 2 "reg_or_cint_operand" ""))
6364 (match_operand:DI 3 "mask64_operand" ""))
6366 (clobber (match_scratch:DI 4 ""))]
6367 "TARGET_POWERPC64 && reload_completed"
6369 (and:DI (rotate:DI (match_dup 1)
6373 (compare:CC (match_dup 4)
6377 (define_insn "*rotldi3_internal6"
6378 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6380 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6381 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6382 (match_operand:DI 3 "mask64_operand" "n,n"))
6384 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6385 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6388 rld%I2c%B3. %0,%1,%H2,%S3
6390 [(set_attr "type" "delayed_compare")
6391 (set_attr "length" "4,8")])
6394 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6396 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6397 (match_operand:DI 2 "reg_or_cint_operand" ""))
6398 (match_operand:DI 3 "mask64_operand" ""))
6400 (set (match_operand:DI 0 "gpc_reg_operand" "")
6401 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6402 "TARGET_POWERPC64 && reload_completed"
6404 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6406 (compare:CC (match_dup 0)
6410 (define_insn "*rotldi3_internal7"
6411 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6414 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6415 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6417 "rld%I2cl %0,%1,%H2,56")
6419 (define_insn "*rotldi3_internal8"
6420 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6421 (compare:CC (zero_extend:DI
6423 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6424 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6426 (clobber (match_scratch:DI 3 "=r,r"))]
6429 rld%I2cl. %3,%1,%H2,56
6431 [(set_attr "type" "delayed_compare")
6432 (set_attr "length" "4,8")])
6435 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6436 (compare:CC (zero_extend:DI
6438 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6439 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6441 (clobber (match_scratch:DI 3 ""))]
6442 "TARGET_POWERPC64 && reload_completed"
6444 (zero_extend:DI (subreg:QI
6445 (rotate:DI (match_dup 1)
6448 (compare:CC (match_dup 3)
6452 (define_insn "*rotldi3_internal9"
6453 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6454 (compare:CC (zero_extend:DI
6456 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6457 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6459 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6460 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6463 rld%I2cl. %0,%1,%H2,56
6465 [(set_attr "type" "delayed_compare")
6466 (set_attr "length" "4,8")])
6469 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6470 (compare:CC (zero_extend:DI
6472 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6473 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6475 (set (match_operand:DI 0 "gpc_reg_operand" "")
6476 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6477 "TARGET_POWERPC64 && reload_completed"
6479 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6481 (compare:CC (match_dup 0)
6485 (define_insn "*rotldi3_internal10"
6486 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6489 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6490 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6492 "rld%I2cl %0,%1,%H2,48")
6494 (define_insn "*rotldi3_internal11"
6495 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6496 (compare:CC (zero_extend:DI
6498 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6499 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6501 (clobber (match_scratch:DI 3 "=r,r"))]
6504 rld%I2cl. %3,%1,%H2,48
6506 [(set_attr "type" "delayed_compare")
6507 (set_attr "length" "4,8")])
6510 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6511 (compare:CC (zero_extend:DI
6513 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6514 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6516 (clobber (match_scratch:DI 3 ""))]
6517 "TARGET_POWERPC64 && reload_completed"
6519 (zero_extend:DI (subreg:HI
6520 (rotate:DI (match_dup 1)
6523 (compare:CC (match_dup 3)
6527 (define_insn "*rotldi3_internal12"
6528 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6529 (compare:CC (zero_extend:DI
6531 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6532 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6534 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6535 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6538 rld%I2cl. %0,%1,%H2,48
6540 [(set_attr "type" "delayed_compare")
6541 (set_attr "length" "4,8")])
6544 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6545 (compare:CC (zero_extend:DI
6547 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6548 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6550 (set (match_operand:DI 0 "gpc_reg_operand" "")
6551 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6552 "TARGET_POWERPC64 && reload_completed"
6554 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6556 (compare:CC (match_dup 0)
6560 (define_insn "*rotldi3_internal13"
6561 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6564 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6565 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6567 "rld%I2cl %0,%1,%H2,32")
6569 (define_insn "*rotldi3_internal14"
6570 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6571 (compare:CC (zero_extend:DI
6573 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6574 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6576 (clobber (match_scratch:DI 3 "=r,r"))]
6579 rld%I2cl. %3,%1,%H2,32
6581 [(set_attr "type" "delayed_compare")
6582 (set_attr "length" "4,8")])
6585 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6586 (compare:CC (zero_extend:DI
6588 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6589 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6591 (clobber (match_scratch:DI 3 ""))]
6592 "TARGET_POWERPC64 && reload_completed"
6594 (zero_extend:DI (subreg:SI
6595 (rotate:DI (match_dup 1)
6598 (compare:CC (match_dup 3)
6602 (define_insn "*rotldi3_internal15"
6603 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6604 (compare:CC (zero_extend:DI
6606 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6607 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6609 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6610 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6613 rld%I2cl. %0,%1,%H2,32
6615 [(set_attr "type" "delayed_compare")
6616 (set_attr "length" "4,8")])
6619 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6620 (compare:CC (zero_extend:DI
6622 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6623 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6625 (set (match_operand:DI 0 "gpc_reg_operand" "")
6626 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6627 "TARGET_POWERPC64 && reload_completed"
6629 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6631 (compare:CC (match_dup 0)
6635 (define_expand "ashldi3"
6636 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6637 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6638 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6639 "TARGET_POWERPC64 || TARGET_POWER"
6642 if (TARGET_POWERPC64)
6644 else if (TARGET_POWER)
6646 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6653 (define_insn "*ashldi3_internal1"
6654 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6655 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6656 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6659 [(set_attr "length" "8")])
6661 (define_insn "*ashldi3_internal2"
6662 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6663 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6664 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6666 (clobber (match_scratch:DI 3 "=r,r"))]
6671 [(set_attr "type" "delayed_compare")
6672 (set_attr "length" "4,8")])
6675 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6676 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6677 (match_operand:SI 2 "reg_or_cint_operand" ""))
6679 (clobber (match_scratch:DI 3 ""))]
6680 "TARGET_POWERPC64 && reload_completed"
6682 (ashift:DI (match_dup 1) (match_dup 2)))
6684 (compare:CC (match_dup 3)
6688 (define_insn "*ashldi3_internal3"
6689 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6690 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6691 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6693 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6694 (ashift:DI (match_dup 1) (match_dup 2)))]
6699 [(set_attr "type" "delayed_compare")
6700 (set_attr "length" "4,8")])
6703 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6704 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6705 (match_operand:SI 2 "reg_or_cint_operand" ""))
6707 (set (match_operand:DI 0 "gpc_reg_operand" "")
6708 (ashift:DI (match_dup 1) (match_dup 2)))]
6709 "TARGET_POWERPC64 && reload_completed"
6711 (ashift:DI (match_dup 1) (match_dup 2)))
6713 (compare:CC (match_dup 0)
6717 (define_insn "*ashldi3_internal4"
6718 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6719 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6720 (match_operand:SI 2 "const_int_operand" "i"))
6721 (match_operand:DI 3 "const_int_operand" "n")))]
6722 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6723 "rldic %0,%1,%H2,%W3")
6725 (define_insn "ashldi3_internal5"
6726 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6728 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6729 (match_operand:SI 2 "const_int_operand" "i,i"))
6730 (match_operand:DI 3 "const_int_operand" "n,n"))
6732 (clobber (match_scratch:DI 4 "=r,r"))]
6733 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6735 rldic. %4,%1,%H2,%W3
6737 [(set_attr "type" "delayed_compare")
6738 (set_attr "length" "4,8")])
6741 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6743 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6744 (match_operand:SI 2 "const_int_operand" ""))
6745 (match_operand:DI 3 "const_int_operand" ""))
6747 (clobber (match_scratch:DI 4 ""))]
6748 "TARGET_POWERPC64 && reload_completed
6749 && includes_rldic_lshift_p (operands[2], operands[3])"
6751 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6754 (compare:CC (match_dup 4)
6758 (define_insn "*ashldi3_internal6"
6759 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6761 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6762 (match_operand:SI 2 "const_int_operand" "i,i"))
6763 (match_operand:DI 3 "const_int_operand" "n,n"))
6765 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6766 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6767 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6769 rldic. %0,%1,%H2,%W3
6771 [(set_attr "type" "delayed_compare")
6772 (set_attr "length" "4,8")])
6775 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6777 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6778 (match_operand:SI 2 "const_int_operand" ""))
6779 (match_operand:DI 3 "const_int_operand" ""))
6781 (set (match_operand:DI 0 "gpc_reg_operand" "")
6782 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6783 "TARGET_POWERPC64 && reload_completed
6784 && includes_rldic_lshift_p (operands[2], operands[3])"
6786 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6789 (compare:CC (match_dup 0)
6793 (define_insn "*ashldi3_internal7"
6794 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6795 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6796 (match_operand:SI 2 "const_int_operand" "i"))
6797 (match_operand:DI 3 "mask64_operand" "n")))]
6798 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6799 "rldicr %0,%1,%H2,%S3")
6801 (define_insn "ashldi3_internal8"
6802 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6804 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6805 (match_operand:SI 2 "const_int_operand" "i,i"))
6806 (match_operand:DI 3 "mask64_operand" "n,n"))
6808 (clobber (match_scratch:DI 4 "=r,r"))]
6809 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6811 rldicr. %4,%1,%H2,%S3
6813 [(set_attr "type" "delayed_compare")
6814 (set_attr "length" "4,8")])
6817 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6819 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6820 (match_operand:SI 2 "const_int_operand" ""))
6821 (match_operand:DI 3 "mask64_operand" ""))
6823 (clobber (match_scratch:DI 4 ""))]
6824 "TARGET_POWERPC64 && reload_completed
6825 && includes_rldicr_lshift_p (operands[2], operands[3])"
6827 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6830 (compare:CC (match_dup 4)
6834 (define_insn "*ashldi3_internal9"
6835 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6837 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6838 (match_operand:SI 2 "const_int_operand" "i,i"))
6839 (match_operand:DI 3 "mask64_operand" "n,n"))
6841 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6842 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6843 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6845 rldicr. %0,%1,%H2,%S3
6847 [(set_attr "type" "delayed_compare")
6848 (set_attr "length" "4,8")])
6851 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6853 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6854 (match_operand:SI 2 "const_int_operand" ""))
6855 (match_operand:DI 3 "mask64_operand" ""))
6857 (set (match_operand:DI 0 "gpc_reg_operand" "")
6858 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6859 "TARGET_POWERPC64 && reload_completed
6860 && includes_rldicr_lshift_p (operands[2], operands[3])"
6862 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6865 (compare:CC (match_dup 0)
6869 (define_expand "lshrdi3"
6870 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6871 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6872 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6873 "TARGET_POWERPC64 || TARGET_POWER"
6876 if (TARGET_POWERPC64)
6878 else if (TARGET_POWER)
6880 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6887 (define_insn "*lshrdi3_internal1"
6888 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6889 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6890 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6894 (define_insn "*lshrdi3_internal2"
6895 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6896 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6897 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6899 (clobber (match_scratch:DI 3 "=r,r"))]
6904 [(set_attr "type" "delayed_compare")
6905 (set_attr "length" "4,8")])
6908 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6909 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6910 (match_operand:SI 2 "reg_or_cint_operand" ""))
6912 (clobber (match_scratch:DI 3 ""))]
6913 "TARGET_POWERPC64 && reload_completed"
6915 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6917 (compare:CC (match_dup 3)
6921 (define_insn "*lshrdi3_internal3"
6922 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6923 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6924 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6926 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6927 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6932 [(set_attr "type" "delayed_compare")
6933 (set_attr "length" "4,8")])
6936 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6937 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6938 (match_operand:SI 2 "reg_or_cint_operand" ""))
6940 (set (match_operand:DI 0 "gpc_reg_operand" "")
6941 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6942 "TARGET_POWERPC64 && reload_completed"
6944 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6946 (compare:CC (match_dup 0)
6950 (define_expand "ashrdi3"
6951 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6952 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6953 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6957 if (TARGET_POWERPC64)
6959 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6961 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
6964 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
6965 && WORDS_BIG_ENDIAN)
6967 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
6974 (define_insn "*ashrdi3_internal1"
6975 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6976 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6977 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6979 "srad%I2 %0,%1,%H2")
6981 (define_insn "*ashrdi3_internal2"
6982 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6983 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6984 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6986 (clobber (match_scratch:DI 3 "=r,r"))]
6991 [(set_attr "type" "delayed_compare")
6992 (set_attr "length" "4,8")])
6995 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6996 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6997 (match_operand:SI 2 "reg_or_cint_operand" ""))
6999 (clobber (match_scratch:DI 3 ""))]
7000 "TARGET_POWERPC64 && reload_completed"
7002 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7004 (compare:CC (match_dup 3)
7008 (define_insn "*ashrdi3_internal3"
7009 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7010 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7011 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7013 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7014 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7019 [(set_attr "type" "delayed_compare")
7020 (set_attr "length" "4,8")])
7023 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7024 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7025 (match_operand:SI 2 "reg_or_cint_operand" ""))
7027 (set (match_operand:DI 0 "gpc_reg_operand" "")
7028 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7029 "TARGET_POWERPC64 && reload_completed"
7031 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7033 (compare:CC (match_dup 0)
7037 (define_insn "anddi3"
7038 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
7039 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
7040 (match_operand:DI 2 "and64_2_operand" "?r,S,K,J,t")))
7041 (clobber (match_scratch:CC 3 "=X,X,x,x,X"))]
7045 rldic%B2 %0,%1,0,%S2
7049 [(set_attr "length" "4,4,4,4,8")])
7052 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7053 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7054 (match_operand:DI 2 "mask64_2_operand" "")))
7055 (clobber (match_scratch:CC 3 ""))]
7057 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7058 && !mask64_operand (operands[2], DImode)"
7060 (and:DI (rotate:DI (match_dup 1)
7064 (and:DI (rotate:DI (match_dup 0)
7069 build_mask64_2_operands (operands[2], &operands[4]);
7072 (define_insn "*anddi3_internal2"
7073 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7074 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7075 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7077 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7078 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7082 rldic%B2. %3,%1,0,%S2
7091 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7092 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7095 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7096 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7097 (match_operand:DI 2 "and64_operand" ""))
7099 (clobber (match_scratch:DI 3 ""))
7100 (clobber (match_scratch:CC 4 ""))]
7101 "TARGET_POWERPC64 && reload_completed"
7102 [(parallel [(set (match_dup 3)
7103 (and:DI (match_dup 1)
7105 (clobber (match_dup 4))])
7107 (compare:CC (match_dup 3)
7112 [(set (match_operand:CC 0 "cc_reg_operand" "")
7113 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7114 (match_operand:DI 2 "mask64_2_operand" ""))
7116 (clobber (match_scratch:DI 3 ""))
7117 (clobber (match_scratch:CC 4 ""))]
7118 "TARGET_POWERPC64 && reload_completed
7119 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7120 && !mask64_operand (operands[2], DImode)"
7122 (and:DI (rotate:DI (match_dup 1)
7125 (parallel [(set (match_dup 0)
7126 (compare:CC (and:DI (rotate:DI (match_dup 3)
7130 (clobber (match_dup 3))])]
7133 build_mask64_2_operands (operands[2], &operands[5]);
7136 (define_insn "*anddi3_internal3"
7137 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7138 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7139 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7141 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7142 (and:DI (match_dup 1) (match_dup 2)))
7143 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7147 rldic%B2. %0,%1,0,%S2
7156 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7157 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7160 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7161 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7162 (match_operand:DI 2 "and64_operand" ""))
7164 (set (match_operand:DI 0 "gpc_reg_operand" "")
7165 (and:DI (match_dup 1) (match_dup 2)))
7166 (clobber (match_scratch:CC 4 ""))]
7167 "TARGET_POWERPC64 && reload_completed"
7168 [(parallel [(set (match_dup 0)
7169 (and:DI (match_dup 1) (match_dup 2)))
7170 (clobber (match_dup 4))])
7172 (compare:CC (match_dup 0)
7177 [(set (match_operand:CC 3 "cc_reg_operand" "")
7178 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7179 (match_operand:DI 2 "mask64_2_operand" ""))
7181 (set (match_operand:DI 0 "gpc_reg_operand" "")
7182 (and:DI (match_dup 1) (match_dup 2)))
7183 (clobber (match_scratch:CC 4 ""))]
7184 "TARGET_POWERPC64 && reload_completed
7185 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7186 && !mask64_operand (operands[2], DImode)"
7188 (and:DI (rotate:DI (match_dup 1)
7191 (parallel [(set (match_dup 3)
7192 (compare:CC (and:DI (rotate:DI (match_dup 0)
7197 (and:DI (rotate:DI (match_dup 0)
7202 build_mask64_2_operands (operands[2], &operands[5]);
7205 (define_expand "iordi3"
7206 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7207 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7208 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7212 if (non_logical_cint_operand (operands[2], DImode))
7214 HOST_WIDE_INT value;
7215 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7216 ? operands[0] : gen_reg_rtx (DImode));
7218 if (GET_CODE (operands[2]) == CONST_INT)
7220 value = INTVAL (operands[2]);
7221 emit_insn (gen_iordi3 (tmp, operands[1],
7222 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7226 value = CONST_DOUBLE_LOW (operands[2]);
7227 emit_insn (gen_iordi3 (tmp, operands[1],
7228 immed_double_const (value
7229 & (~ (HOST_WIDE_INT) 0xffff),
7233 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7238 (define_expand "xordi3"
7239 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7240 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7241 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7245 if (non_logical_cint_operand (operands[2], DImode))
7247 HOST_WIDE_INT value;
7248 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7249 ? operands[0] : gen_reg_rtx (DImode));
7251 if (GET_CODE (operands[2]) == CONST_INT)
7253 value = INTVAL (operands[2]);
7254 emit_insn (gen_xordi3 (tmp, operands[1],
7255 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7259 value = CONST_DOUBLE_LOW (operands[2]);
7260 emit_insn (gen_xordi3 (tmp, operands[1],
7261 immed_double_const (value
7262 & (~ (HOST_WIDE_INT) 0xffff),
7266 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7271 (define_insn "*booldi3_internal1"
7272 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7273 (match_operator:DI 3 "boolean_or_operator"
7274 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7275 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7282 (define_insn "*booldi3_internal2"
7283 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7284 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7285 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7286 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7288 (clobber (match_scratch:DI 3 "=r,r"))]
7293 [(set_attr "type" "compare")
7294 (set_attr "length" "4,8")])
7297 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7298 (compare:CC (match_operator:DI 4 "boolean_operator"
7299 [(match_operand:DI 1 "gpc_reg_operand" "")
7300 (match_operand:DI 2 "gpc_reg_operand" "")])
7302 (clobber (match_scratch:DI 3 ""))]
7303 "TARGET_POWERPC64 && reload_completed"
7304 [(set (match_dup 3) (match_dup 4))
7306 (compare:CC (match_dup 3)
7310 (define_insn "*booldi3_internal3"
7311 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7312 (compare:CC (match_operator:DI 4 "boolean_operator"
7313 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7314 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7316 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7322 [(set_attr "type" "compare")
7323 (set_attr "length" "4,8")])
7326 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7327 (compare:CC (match_operator:DI 4 "boolean_operator"
7328 [(match_operand:DI 1 "gpc_reg_operand" "")
7329 (match_operand:DI 2 "gpc_reg_operand" "")])
7331 (set (match_operand:DI 0 "gpc_reg_operand" "")
7333 "TARGET_POWERPC64 && reload_completed"
7334 [(set (match_dup 0) (match_dup 4))
7336 (compare:CC (match_dup 0)
7340 ;; Split a logical operation that we can't do in one insn into two insns,
7341 ;; each of which does one 16-bit part. This is used by combine.
7344 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7345 (match_operator:DI 3 "boolean_or_operator"
7346 [(match_operand:DI 1 "gpc_reg_operand" "")
7347 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7349 [(set (match_dup 0) (match_dup 4))
7350 (set (match_dup 0) (match_dup 5))]
7355 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7357 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7358 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7360 i4 = GEN_INT (value & 0xffff);
7364 i3 = GEN_INT (INTVAL (operands[2])
7365 & (~ (HOST_WIDE_INT) 0xffff));
7366 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7368 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7370 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7374 (define_insn "*boolcdi3_internal1"
7375 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7376 (match_operator:DI 3 "boolean_operator"
7377 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7378 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7382 (define_insn "*boolcdi3_internal2"
7383 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7384 (compare:CC (match_operator:DI 4 "boolean_operator"
7385 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7386 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7388 (clobber (match_scratch:DI 3 "=r,r"))]
7393 [(set_attr "type" "compare")
7394 (set_attr "length" "4,8")])
7397 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7398 (compare:CC (match_operator:DI 4 "boolean_operator"
7399 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7400 (match_operand:DI 2 "gpc_reg_operand" "")])
7402 (clobber (match_scratch:DI 3 ""))]
7403 "TARGET_POWERPC64 && reload_completed"
7404 [(set (match_dup 3) (match_dup 4))
7406 (compare:CC (match_dup 3)
7410 (define_insn "*boolcdi3_internal3"
7411 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7412 (compare:CC (match_operator:DI 4 "boolean_operator"
7413 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7414 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7416 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7422 [(set_attr "type" "compare")
7423 (set_attr "length" "4,8")])
7426 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7427 (compare:CC (match_operator:DI 4 "boolean_operator"
7428 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7429 (match_operand:DI 2 "gpc_reg_operand" "")])
7431 (set (match_operand:DI 0 "gpc_reg_operand" "")
7433 "TARGET_POWERPC64 && reload_completed"
7434 [(set (match_dup 0) (match_dup 4))
7436 (compare:CC (match_dup 0)
7440 (define_insn "*boolccdi3_internal1"
7441 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7442 (match_operator:DI 3 "boolean_operator"
7443 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7444 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7448 (define_insn "*boolccdi3_internal2"
7449 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7450 (compare:CC (match_operator:DI 4 "boolean_operator"
7451 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7452 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7454 (clobber (match_scratch:DI 3 "=r,r"))]
7459 [(set_attr "type" "compare")
7460 (set_attr "length" "4,8")])
7463 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7464 (compare:CC (match_operator:DI 4 "boolean_operator"
7465 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7466 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7468 (clobber (match_scratch:DI 3 ""))]
7469 "TARGET_POWERPC64 && reload_completed"
7470 [(set (match_dup 3) (match_dup 4))
7472 (compare:CC (match_dup 3)
7476 (define_insn "*boolccdi3_internal3"
7477 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7478 (compare:CC (match_operator:DI 4 "boolean_operator"
7479 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7480 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7482 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7488 [(set_attr "type" "compare")
7489 (set_attr "length" "4,8")])
7492 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7493 (compare:CC (match_operator:DI 4 "boolean_operator"
7494 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7495 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7497 (set (match_operand:DI 0 "gpc_reg_operand" "")
7499 "TARGET_POWERPC64 && reload_completed"
7500 [(set (match_dup 0) (match_dup 4))
7502 (compare:CC (match_dup 0)
7506 ;; Now define ways of moving data around.
7508 ;; Elf specific ways of loading addresses for non-PIC code.
7509 ;; The output of this could be r0, but we make a very strong
7510 ;; preference for a base register because it will usually
7512 (define_insn "elf_high"
7513 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7514 (high:SI (match_operand 1 "" "")))]
7515 "TARGET_ELF && ! TARGET_64BIT"
7516 "{liu|lis} %0,%1@ha")
7518 (define_insn "elf_low"
7519 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7520 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7521 (match_operand 2 "" "")))]
7522 "TARGET_ELF && ! TARGET_64BIT"
7524 {cal|la} %0,%2@l(%1)
7525 {ai|addic} %0,%1,%K2")
7527 ;; Mach-O PIC trickery.
7528 (define_insn "macho_high"
7529 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7530 (high:SI (match_operand 1 "" "")))]
7531 "TARGET_MACHO && ! TARGET_64BIT"
7532 "{liu|lis} %0,ha16(%1)")
7534 (define_insn "macho_low"
7535 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7536 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7537 (match_operand 2 "" "")))]
7538 "TARGET_MACHO && ! TARGET_64BIT"
7540 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
7541 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
7543 ;; Set up a register with a value from the GOT table
7545 (define_expand "movsi_got"
7546 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7547 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7548 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7549 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7552 if (GET_CODE (operands[1]) == CONST)
7554 rtx offset = const0_rtx;
7555 HOST_WIDE_INT value;
7557 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7558 value = INTVAL (offset);
7561 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7562 emit_insn (gen_movsi_got (tmp, operands[1]));
7563 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7568 operands[2] = rs6000_got_register (operands[1]);
7571 (define_insn "*movsi_got_internal"
7572 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7573 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7574 (match_operand:SI 2 "gpc_reg_operand" "b")]
7576 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7577 "{l|lwz} %0,%a1@got(%2)"
7578 [(set_attr "type" "load")])
7580 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7581 ;; didn't get allocated to a hard register.
7583 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7584 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7585 (match_operand:SI 2 "memory_operand" "")]
7587 "DEFAULT_ABI == ABI_V4
7589 && (reload_in_progress || reload_completed)"
7590 [(set (match_dup 0) (match_dup 2))
7591 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7595 ;; For SI, we special-case integers that can't be loaded in one insn. We
7596 ;; do the load 16-bits at a time. We could do this by loading from memory,
7597 ;; and this is even supposed to be faster, but it is simpler not to get
7598 ;; integers in the TOC.
7599 (define_expand "movsi"
7600 [(set (match_operand:SI 0 "general_operand" "")
7601 (match_operand:SI 1 "any_operand" ""))]
7603 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7605 (define_insn "movsi_low"
7606 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7607 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7608 (match_operand 2 "" ""))))]
7609 "TARGET_MACHO && ! TARGET_64BIT"
7610 "{l|lwz} %0,lo16(%2)(%1)"
7611 [(set_attr "type" "load")
7612 (set_attr "length" "4")])
7614 (define_insn "movsi_low_st"
7615 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7616 (match_operand 2 "" "")))
7617 (match_operand:SI 0 "gpc_reg_operand" "r"))]
7618 "TARGET_MACHO && ! TARGET_64BIT"
7619 "{st|stw} %0,lo16(%2)(%1)"
7620 [(set_attr "type" "store")
7621 (set_attr "length" "4")])
7623 (define_insn "movdf_low"
7624 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
7625 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7626 (match_operand 2 "" ""))))]
7627 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7630 switch (which_alternative)
7633 return \"lfd %0,lo16(%2)(%1)\";
7637 operands2[0] = operands[0];
7638 operands2[1] = operands[1];
7639 operands2[2] = operands[2];
7640 if (TARGET_POWERPC64 && TARGET_32BIT)
7641 /* Note, old assemblers didn't support relocation here. */
7642 return \"ld %0,lo16(%2)(%1)\";
7645 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
7646 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
7648 if (MACHO_DYNAMIC_NO_PIC_P)
7649 output_asm_insn (\"{liu|lis} %L0,ha16(%2+4)\", operands);
7651 /* We cannot rely on ha16(low half)==ha16(high half), alas,
7652 although in practice it almost always is. */
7653 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
7655 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
7662 [(set_attr "type" "load")
7663 (set_attr "length" "4,12")])
7665 (define_insn "movdf_low_st"
7666 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7667 (match_operand 2 "" "")))
7668 (match_operand:DF 0 "gpc_reg_operand" "f"))]
7669 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7670 "stfd %0,lo16(%2)(%1)"
7671 [(set_attr "type" "store")
7672 (set_attr "length" "4")])
7674 (define_insn "movsf_low"
7675 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
7676 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7677 (match_operand 2 "" ""))))]
7678 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7681 {l|lwz} %0,lo16(%2)(%1)"
7682 [(set_attr "type" "load")
7683 (set_attr "length" "4")])
7685 (define_insn "movsf_low_st"
7686 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7687 (match_operand 2 "" "")))
7688 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
7689 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7691 stfs %0,lo16(%2)(%1)
7692 {st|stw} %0,lo16(%2)(%1)"
7693 [(set_attr "type" "store")
7694 (set_attr "length" "4")])
7696 (define_insn "*movsi_internal1"
7697 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7698 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7699 "gpc_reg_operand (operands[0], SImode)
7700 || gpc_reg_operand (operands[1], SImode)"
7704 {l%U1%X1|lwz%U1%X1} %0,%1
7705 {st%U0%X0|stw%U0%X0} %1,%0
7715 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7716 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7718 ;; Split a load of a large constant into the appropriate two-insn
7722 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7723 (match_operand:SI 1 "const_int_operand" ""))]
7724 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7725 && (INTVAL (operands[1]) & 0xffff) != 0"
7729 (ior:SI (match_dup 0)
7732 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7734 if (tem == operands[0])
7740 (define_insn "*movsi_internal2"
7741 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7742 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "0,r,r")
7744 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7747 {cmpi|cmpwi} %2,%0,0
7750 [(set_attr "type" "cmp,compare,cmp")
7751 (set_attr "length" "4,4,8")])
7754 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7755 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7757 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7758 "TARGET_32BIT && reload_completed"
7759 [(set (match_dup 0) (match_dup 1))
7761 (compare:CC (match_dup 0)
7765 (define_expand "movhi"
7766 [(set (match_operand:HI 0 "general_operand" "")
7767 (match_operand:HI 1 "any_operand" ""))]
7769 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7771 (define_insn "*movhi_internal"
7772 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7773 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7774 "gpc_reg_operand (operands[0], HImode)
7775 || gpc_reg_operand (operands[1], HImode)"
7785 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7787 (define_expand "movqi"
7788 [(set (match_operand:QI 0 "general_operand" "")
7789 (match_operand:QI 1 "any_operand" ""))]
7791 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7793 (define_insn "*movqi_internal"
7794 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7795 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7796 "gpc_reg_operand (operands[0], QImode)
7797 || gpc_reg_operand (operands[1], QImode)"
7807 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7809 ;; Here is how to move condition codes around. When we store CC data in
7810 ;; an integer register or memory, we store just the high-order 4 bits.
7811 ;; This lets us not shift in the most common case of CR0.
7812 (define_expand "movcc"
7813 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7814 (match_operand:CC 1 "nonimmediate_operand" ""))]
7818 (define_insn "*movcc_internal1"
7819 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7820 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7821 "register_operand (operands[0], CCmode)
7822 || register_operand (operands[1], CCmode)"
7826 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7828 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7833 {l%U1%X1|lwz%U1%X1} %0,%1
7834 {st%U0%U1|stw%U0%U1} %1,%0"
7836 (cond [(eq_attr "alternative" "0")
7837 (const_string "cr_logical")
7838 (eq_attr "alternative" "1,2")
7839 (const_string "mtcr")
7840 (eq_attr "alternative" "5,7")
7841 (const_string "integer")
7842 (eq_attr "alternative" "6")
7843 (const_string "mfjmpr")
7844 (eq_attr "alternative" "8")
7845 (const_string "mtjmpr")
7846 (eq_attr "alternative" "9")
7847 (const_string "load")
7848 (eq_attr "alternative" "10")
7849 (const_string "store")
7850 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7851 (const_string "mfcrf")
7853 (const_string "mfcr")))
7854 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7856 ;; For floating-point, we normally deal with the floating-point registers
7857 ;; unless -msoft-float is used. The sole exception is that parameter passing
7858 ;; can produce floating-point values in fixed-point registers. Unless the
7859 ;; value is a simple constant or already in memory, we deal with this by
7860 ;; allocating memory and copying the value explicitly via that memory location.
7861 (define_expand "movsf"
7862 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7863 (match_operand:SF 1 "any_operand" ""))]
7865 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7868 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7869 (match_operand:SF 1 "const_double_operand" ""))]
7871 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7872 || (GET_CODE (operands[0]) == SUBREG
7873 && GET_CODE (SUBREG_REG (operands[0])) == REG
7874 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7875 [(set (match_dup 2) (match_dup 3))]
7881 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7882 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7884 if (! TARGET_POWERPC64)
7885 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7887 operands[2] = gen_lowpart (SImode, operands[0]);
7889 operands[3] = gen_int_mode (l, SImode);
7892 (define_insn "*movsf_hardfloat"
7893 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7894 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7895 "(gpc_reg_operand (operands[0], SFmode)
7896 || gpc_reg_operand (operands[1], SFmode))
7897 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7900 {l%U1%X1|lwz%U1%X1} %0,%1
7901 {st%U0%X0|stw%U0%X0} %1,%0
7911 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7912 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7914 (define_insn "*movsf_softfloat"
7915 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7916 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7917 "(gpc_reg_operand (operands[0], SFmode)
7918 || gpc_reg_operand (operands[1], SFmode))
7919 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7925 {l%U1%X1|lwz%U1%X1} %0,%1
7926 {st%U0%X0|stw%U0%X0} %1,%0
7933 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
7934 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7937 (define_expand "movdf"
7938 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7939 (match_operand:DF 1 "any_operand" ""))]
7941 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7944 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7945 (match_operand:DF 1 "const_int_operand" ""))]
7946 "! TARGET_POWERPC64 && reload_completed
7947 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7948 || (GET_CODE (operands[0]) == SUBREG
7949 && GET_CODE (SUBREG_REG (operands[0])) == REG
7950 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7951 [(set (match_dup 2) (match_dup 4))
7952 (set (match_dup 3) (match_dup 1))]
7955 int endian = (WORDS_BIG_ENDIAN == 0);
7956 HOST_WIDE_INT value = INTVAL (operands[1]);
7958 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7959 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7960 #if HOST_BITS_PER_WIDE_INT == 32
7961 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7963 operands[4] = GEN_INT (value >> 32);
7964 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7969 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7970 (match_operand:DF 1 "const_double_operand" ""))]
7971 "! TARGET_POWERPC64 && reload_completed
7972 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7973 || (GET_CODE (operands[0]) == SUBREG
7974 && GET_CODE (SUBREG_REG (operands[0])) == REG
7975 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7976 [(set (match_dup 2) (match_dup 4))
7977 (set (match_dup 3) (match_dup 5))]
7980 int endian = (WORDS_BIG_ENDIAN == 0);
7984 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7985 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7987 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7988 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7989 operands[4] = gen_int_mode (l[endian], SImode);
7990 operands[5] = gen_int_mode (l[1 - endian], SImode);
7994 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7995 (match_operand:DF 1 "easy_fp_constant" ""))]
7996 "TARGET_POWERPC64 && reload_completed
7997 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7998 || (GET_CODE (operands[0]) == SUBREG
7999 && GET_CODE (SUBREG_REG (operands[0])) == REG
8000 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8001 [(set (match_dup 2) (match_dup 3))]
8004 int endian = (WORDS_BIG_ENDIAN == 0);
8007 #if HOST_BITS_PER_WIDE_INT >= 64
8011 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8012 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8014 operands[2] = gen_lowpart (DImode, operands[0]);
8015 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8016 #if HOST_BITS_PER_WIDE_INT >= 64
8017 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8018 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8020 operands[3] = gen_int_mode (val, DImode);
8022 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8026 ;; Don't have reload use general registers to load a constant. First,
8027 ;; it might not work if the output operand is the equivalent of
8028 ;; a non-offsettable memref, but also it is less efficient than loading
8029 ;; the constant into an FP register, since it will probably be used there.
8030 ;; The "??" is a kludge until we can figure out a more reasonable way
8031 ;; of handling these non-offsettable values.
8032 (define_insn "*movdf_hardfloat32"
8033 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8034 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8035 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8036 && (gpc_reg_operand (operands[0], DFmode)
8037 || gpc_reg_operand (operands[1], DFmode))"
8040 switch (which_alternative)
8045 /* We normally copy the low-numbered register first. However, if
8046 the first register operand 0 is the same as the second register
8047 of operand 1, we must copy in the opposite order. */
8048 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8049 return \"mr %L0,%L1\;mr %0,%1\";
8051 return \"mr %0,%1\;mr %L0,%L1\";
8053 if (offsettable_memref_p (operands[1])
8054 || (GET_CODE (operands[1]) == MEM
8055 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8056 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8057 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8059 /* If the low-address word is used in the address, we must load
8060 it last. Otherwise, load it first. Note that we cannot have
8061 auto-increment in that case since the address register is
8062 known to be dead. */
8063 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8065 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8067 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8073 addreg = find_addr_reg (XEXP (operands[1], 0));
8074 if (refers_to_regno_p (REGNO (operands[0]),
8075 REGNO (operands[0]) + 1,
8078 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8079 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8080 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8081 return \"{lx|lwzx} %0,%1\";
8085 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8086 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8087 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8088 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8093 if (offsettable_memref_p (operands[0])
8094 || (GET_CODE (operands[0]) == MEM
8095 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8096 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8097 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8098 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8103 addreg = find_addr_reg (XEXP (operands[0], 0));
8104 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8105 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8106 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8107 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8111 return \"fmr %0,%1\";
8113 return \"lfd%U1%X1 %0,%1\";
8115 return \"stfd%U0%X0 %1,%0\";
8122 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*")
8123 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8125 (define_insn "*movdf_softfloat32"
8126 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8127 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8128 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8129 && (gpc_reg_operand (operands[0], DFmode)
8130 || gpc_reg_operand (operands[1], DFmode))"
8133 switch (which_alternative)
8138 /* We normally copy the low-numbered register first. However, if
8139 the first register operand 0 is the same as the second register of
8140 operand 1, we must copy in the opposite order. */
8141 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8142 return \"mr %L0,%L1\;mr %0,%1\";
8144 return \"mr %0,%1\;mr %L0,%L1\";
8146 /* If the low-address word is used in the address, we must load
8147 it last. Otherwise, load it first. Note that we cannot have
8148 auto-increment in that case since the address register is
8149 known to be dead. */
8150 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8152 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8154 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8156 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8163 [(set_attr "type" "*,load,store,*,*,*")
8164 (set_attr "length" "8,8,8,8,12,16")])
8166 ; ld/std require word-aligned displacements -> 'Y' constraint.
8167 ; List Y->r and r->Y before r->r for reload.
8168 (define_insn "*movdf_hardfloat64"
8169 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
8170 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8171 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8172 && (gpc_reg_operand (operands[0], DFmode)
8173 || gpc_reg_operand (operands[1], DFmode))"
8187 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
8188 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8190 (define_insn "*movdf_softfloat64"
8191 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8192 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8193 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8194 && (gpc_reg_operand (operands[0], DFmode)
8195 || gpc_reg_operand (operands[1], DFmode))"
8206 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
8207 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8209 (define_expand "movtf"
8210 [(set (match_operand:TF 0 "general_operand" "")
8211 (match_operand:TF 1 "any_operand" ""))]
8212 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8213 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8214 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8216 ; It's important to list the o->f and f->o moves before f->f because
8217 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8218 ; which doesn't make progress.
8219 (define_insn_and_split "*movtf_internal"
8220 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,rm,r")
8221 (match_operand:TF 1 "input_operand" "f,o,f,r,mGHF"))]
8222 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8223 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8224 && (gpc_reg_operand (operands[0], TFmode)
8225 || gpc_reg_operand (operands[1], TFmode))"
8227 "&& reload_completed"
8229 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8230 [(set_attr "length" "8,8,8,20,20")])
8232 (define_expand "extenddftf2"
8233 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8234 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8235 (use (match_dup 2))])]
8236 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8237 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8239 operands[2] = CONST0_RTX (DFmode);
8242 (define_insn_and_split "*extenddftf2_internal"
8243 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8244 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8245 (use (match_operand:DF 2 "input_operand" "rf,m,f,n"))]
8246 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8247 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8249 "&& reload_completed"
8252 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8253 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8254 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8256 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8261 (define_expand "extendsftf2"
8262 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8263 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8264 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8265 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8267 rtx tmp = gen_reg_rtx (DFmode);
8268 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8269 emit_insn (gen_extenddftf2 (operands[0], tmp));
8273 (define_insn "trunctfdf2"
8274 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8275 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8276 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8277 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8279 [(set_attr "type" "fp")
8280 (set_attr "length" "4")])
8282 (define_insn_and_split "trunctfsf2"
8283 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8284 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8285 (clobber (match_scratch:DF 2 "=f"))]
8286 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8287 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8289 "&& reload_completed"
8291 (float_truncate:DF (match_dup 1)))
8293 (float_truncate:SF (match_dup 2)))]
8296 (define_expand "floatsitf2"
8297 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8298 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8299 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8300 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8302 rtx tmp = gen_reg_rtx (DFmode);
8303 expand_float (tmp, operands[1], false);
8304 emit_insn (gen_extenddftf2 (operands[0], tmp));
8308 ; fadd, but rounding towards zero.
8309 ; This is probably not the optimal code sequence.
8310 (define_insn "fix_trunc_helper"
8311 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8312 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8313 UNSPEC_FIX_TRUNC_TF))
8314 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8315 "TARGET_HARD_FLOAT && TARGET_FPRS"
8316 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8317 [(set_attr "type" "fp")
8318 (set_attr "length" "20")])
8320 (define_expand "fix_trunctfsi2"
8321 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8322 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8323 (clobber (match_dup 2))
8324 (clobber (match_dup 3))
8325 (clobber (match_dup 4))
8326 (clobber (match_dup 5))])]
8327 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8328 && (TARGET_POWER2 || TARGET_POWERPC)
8329 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8331 operands[2] = gen_reg_rtx (DFmode);
8332 operands[3] = gen_reg_rtx (DFmode);
8333 operands[4] = gen_reg_rtx (DImode);
8334 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8337 (define_insn_and_split "*fix_trunctfsi2_internal"
8338 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8339 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8340 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8341 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8342 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8343 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8344 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8345 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8347 "&& reload_completed"
8351 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8353 if (GET_CODE (operands[5]) != MEM)
8355 lowword = XEXP (operands[5], 0);
8356 if (WORDS_BIG_ENDIAN)
8357 lowword = plus_constant (lowword, 4);
8359 emit_insn (gen_fctiwz (operands[4], operands[2]));
8360 emit_move_insn (operands[5], operands[4]);
8361 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
8365 (define_insn "negtf2"
8366 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8367 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8368 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8369 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8372 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8373 return \"fneg %L0,%L1\;fneg %0,%1\";
8375 return \"fneg %0,%1\;fneg %L0,%L1\";
8377 [(set_attr "type" "fp")
8378 (set_attr "length" "8")])
8380 (define_expand "abstf2"
8381 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8382 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8383 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8384 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8387 rtx label = gen_label_rtx ();
8388 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8393 (define_expand "abstf2_internal"
8394 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8395 (match_operand:TF 1 "gpc_reg_operand" "f"))
8396 (set (match_dup 3) (match_dup 5))
8397 (set (match_dup 5) (abs:DF (match_dup 5)))
8398 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8399 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8400 (label_ref (match_operand 2 "" ""))
8402 (set (match_dup 6) (neg:DF (match_dup 6)))]
8403 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8404 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8407 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8408 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8409 operands[3] = gen_reg_rtx (DFmode);
8410 operands[4] = gen_reg_rtx (CCFPmode);
8411 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8412 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8415 ;; Next come the multi-word integer load and store and the load and store
8417 (define_expand "movdi"
8418 [(set (match_operand:DI 0 "general_operand" "")
8419 (match_operand:DI 1 "any_operand" ""))]
8421 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8423 (define_insn "*movdi_internal32"
8424 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8425 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8427 && (gpc_reg_operand (operands[0], DImode)
8428 || gpc_reg_operand (operands[1], DImode))"
8431 switch (which_alternative)
8440 return \"fmr %0,%1\";
8442 return \"lfd%U1%X1 %0,%1\";
8444 return \"stfd%U0%X0 %1,%0\";
8453 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")])
8456 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8457 (match_operand:DI 1 "const_int_operand" ""))]
8458 "! TARGET_POWERPC64 && reload_completed"
8459 [(set (match_dup 2) (match_dup 4))
8460 (set (match_dup 3) (match_dup 1))]
8463 HOST_WIDE_INT value = INTVAL (operands[1]);
8464 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8466 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8468 #if HOST_BITS_PER_WIDE_INT == 32
8469 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8471 operands[4] = GEN_INT (value >> 32);
8472 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8477 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8478 (match_operand:DI 1 "input_operand" ""))]
8479 "reload_completed && !TARGET_POWERPC64
8480 && gpr_or_gpr_p (operands[0], operands[1])"
8482 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8485 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8486 (match_operand:TI 1 "const_double_operand" ""))]
8488 [(set (match_dup 2) (match_dup 4))
8489 (set (match_dup 3) (match_dup 5))]
8492 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8494 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8496 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8498 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8499 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8501 else if (GET_CODE (operands[1]) == CONST_INT)
8503 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8504 operands[5] = operands[1];
8510 (define_insn "*movdi_internal64"
8511 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,?f,f,m,r,*h,*h")
8512 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8514 && (gpc_reg_operand (operands[0], DImode)
8515 || gpc_reg_operand (operands[1], DImode))"
8530 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8531 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8533 ;; immediate value valid for a single instruction hiding in a const_double
8535 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8536 (match_operand:DI 1 "const_double_operand" "F"))]
8537 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8538 && GET_CODE (operands[1]) == CONST_DOUBLE
8539 && num_insns_constant (operands[1], DImode) == 1"
8542 return ((unsigned HOST_WIDE_INT)
8543 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8544 ? \"li %0,%1\" : \"lis %0,%v1\";
8547 ;; Generate all one-bits and clear left or right.
8548 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8550 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8551 (match_operand:DI 1 "mask64_operand" ""))]
8552 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8553 [(set (match_dup 0) (const_int -1))
8555 (and:DI (rotate:DI (match_dup 0)
8560 ;; Split a load of a large constant into the appropriate five-instruction
8561 ;; sequence. Handle anything in a constant number of insns.
8562 ;; When non-easy constants can go in the TOC, this should use
8563 ;; easy_fp_constant predicate.
8565 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8566 (match_operand:DI 1 "const_int_operand" ""))]
8567 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8568 [(set (match_dup 0) (match_dup 2))
8569 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8571 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8573 if (tem == operands[0])
8580 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8581 (match_operand:DI 1 "const_double_operand" ""))]
8582 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8583 [(set (match_dup 0) (match_dup 2))
8584 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8586 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8588 if (tem == operands[0])
8594 (define_insn "*movdi_internal2"
8595 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8596 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "0,r,r")
8598 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8604 [(set_attr "type" "cmp,compare,cmp")
8605 (set_attr "length" "4,4,8")])
8608 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8609 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8611 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8612 "TARGET_POWERPC64 && reload_completed"
8613 [(set (match_dup 0) (match_dup 1))
8615 (compare:CC (match_dup 0)
8619 ;; TImode is similar, except that we usually want to compute the address into
8620 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8621 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8622 (define_expand "movti"
8623 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8624 (match_operand:TI 1 "general_operand" ""))
8625 (clobber (scratch:SI))])]
8627 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8629 ;; We say that MQ is clobbered in the last alternative because the first
8630 ;; alternative would never get used otherwise since it would need a reload
8631 ;; while the 2nd alternative would not. We put memory cases first so they
8632 ;; are preferred. Otherwise, we'd try to reload the output instead of
8633 ;; giving the SCRATCH mq.
8635 (define_insn "*movti_power"
8636 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8637 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
8638 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
8639 "TARGET_POWER && ! TARGET_POWERPC64
8640 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8643 switch (which_alternative)
8650 return \"{stsi|stswi} %1,%P0,16\";
8655 /* If the address is not used in the output, we can use lsi. Otherwise,
8656 fall through to generating four loads. */
8658 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8659 return \"{lsi|lswi} %0,%P1,16\";
8660 /* ... fall through ... */
8665 [(set_attr "type" "store,store,*,load,load")])
8667 (define_insn "*movti_string"
8668 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8669 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))]
8670 "! TARGET_POWER && ! TARGET_POWERPC64
8671 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8674 switch (which_alternative)
8680 return \"{stsi|stswi} %1,%P0,16\";
8685 /* If the address is not used in the output, we can use lsi. Otherwise,
8686 fall through to generating four loads. */
8688 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8689 return \"{lsi|lswi} %0,%P1,16\";
8690 /* ... fall through ... */
8695 [(set_attr "type" "store,store,*,load,load")])
8697 (define_insn "*movti_ppc64"
8698 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,m,r")
8699 (match_operand:TI 1 "input_operand" "r,r,o"))]
8700 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8701 || gpc_reg_operand (operands[1], TImode))"
8706 [(set_attr "type" "*,load,store")])
8709 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8710 (match_operand:TI 1 "input_operand" ""))]
8712 && gpr_or_gpr_p (operands[0], operands[1])"
8714 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8716 (define_expand "load_multiple"
8717 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8718 (match_operand:SI 1 "" ""))
8719 (use (match_operand:SI 2 "" ""))])]
8720 "TARGET_STRING && !TARGET_POWERPC64"
8728 /* Support only loading a constant number of fixed-point registers from
8729 memory and only bother with this if more than two; the machine
8730 doesn't support more than eight. */
8731 if (GET_CODE (operands[2]) != CONST_INT
8732 || INTVAL (operands[2]) <= 2
8733 || INTVAL (operands[2]) > 8
8734 || GET_CODE (operands[1]) != MEM
8735 || GET_CODE (operands[0]) != REG
8736 || REGNO (operands[0]) >= 32)
8739 count = INTVAL (operands[2]);
8740 regno = REGNO (operands[0]);
8742 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8743 op1 = replace_equiv_address (operands[1],
8744 force_reg (SImode, XEXP (operands[1], 0)));
8746 for (i = 0; i < count; i++)
8747 XVECEXP (operands[3], 0, i)
8748 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8749 adjust_address_nv (op1, SImode, i * 4));
8752 (define_insn "*ldmsi8"
8753 [(match_parallel 0 "load_multiple_operation"
8754 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8755 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8756 (set (match_operand:SI 3 "gpc_reg_operand" "")
8757 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8758 (set (match_operand:SI 4 "gpc_reg_operand" "")
8759 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8760 (set (match_operand:SI 5 "gpc_reg_operand" "")
8761 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8762 (set (match_operand:SI 6 "gpc_reg_operand" "")
8763 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8764 (set (match_operand:SI 7 "gpc_reg_operand" "")
8765 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8766 (set (match_operand:SI 8 "gpc_reg_operand" "")
8767 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8768 (set (match_operand:SI 9 "gpc_reg_operand" "")
8769 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8770 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8772 { return rs6000_output_load_multiple (operands); }"
8773 [(set_attr "type" "load")
8774 (set_attr "length" "32")])
8776 (define_insn "*ldmsi7"
8777 [(match_parallel 0 "load_multiple_operation"
8778 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8779 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8780 (set (match_operand:SI 3 "gpc_reg_operand" "")
8781 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8782 (set (match_operand:SI 4 "gpc_reg_operand" "")
8783 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8784 (set (match_operand:SI 5 "gpc_reg_operand" "")
8785 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8786 (set (match_operand:SI 6 "gpc_reg_operand" "")
8787 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8788 (set (match_operand:SI 7 "gpc_reg_operand" "")
8789 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8790 (set (match_operand:SI 8 "gpc_reg_operand" "")
8791 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8792 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8794 { return rs6000_output_load_multiple (operands); }"
8795 [(set_attr "type" "load")
8796 (set_attr "length" "32")])
8798 (define_insn "*ldmsi6"
8799 [(match_parallel 0 "load_multiple_operation"
8800 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8801 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8802 (set (match_operand:SI 3 "gpc_reg_operand" "")
8803 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8804 (set (match_operand:SI 4 "gpc_reg_operand" "")
8805 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8806 (set (match_operand:SI 5 "gpc_reg_operand" "")
8807 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8808 (set (match_operand:SI 6 "gpc_reg_operand" "")
8809 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8810 (set (match_operand:SI 7 "gpc_reg_operand" "")
8811 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8812 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8814 { return rs6000_output_load_multiple (operands); }"
8815 [(set_attr "type" "load")
8816 (set_attr "length" "32")])
8818 (define_insn "*ldmsi5"
8819 [(match_parallel 0 "load_multiple_operation"
8820 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8821 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8822 (set (match_operand:SI 3 "gpc_reg_operand" "")
8823 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8824 (set (match_operand:SI 4 "gpc_reg_operand" "")
8825 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8826 (set (match_operand:SI 5 "gpc_reg_operand" "")
8827 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8828 (set (match_operand:SI 6 "gpc_reg_operand" "")
8829 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8830 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8832 { return rs6000_output_load_multiple (operands); }"
8833 [(set_attr "type" "load")
8834 (set_attr "length" "32")])
8836 (define_insn "*ldmsi4"
8837 [(match_parallel 0 "load_multiple_operation"
8838 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8839 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8840 (set (match_operand:SI 3 "gpc_reg_operand" "")
8841 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8842 (set (match_operand:SI 4 "gpc_reg_operand" "")
8843 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8844 (set (match_operand:SI 5 "gpc_reg_operand" "")
8845 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8846 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8848 { return rs6000_output_load_multiple (operands); }"
8849 [(set_attr "type" "load")
8850 (set_attr "length" "32")])
8852 (define_insn "*ldmsi3"
8853 [(match_parallel 0 "load_multiple_operation"
8854 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8855 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8856 (set (match_operand:SI 3 "gpc_reg_operand" "")
8857 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8858 (set (match_operand:SI 4 "gpc_reg_operand" "")
8859 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8860 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8862 { return rs6000_output_load_multiple (operands); }"
8863 [(set_attr "type" "load")
8864 (set_attr "length" "32")])
8866 (define_expand "store_multiple"
8867 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8868 (match_operand:SI 1 "" ""))
8869 (clobber (scratch:SI))
8870 (use (match_operand:SI 2 "" ""))])]
8871 "TARGET_STRING && !TARGET_POWERPC64"
8880 /* Support only storing a constant number of fixed-point registers to
8881 memory and only bother with this if more than two; the machine
8882 doesn't support more than eight. */
8883 if (GET_CODE (operands[2]) != CONST_INT
8884 || INTVAL (operands[2]) <= 2
8885 || INTVAL (operands[2]) > 8
8886 || GET_CODE (operands[0]) != MEM
8887 || GET_CODE (operands[1]) != REG
8888 || REGNO (operands[1]) >= 32)
8891 count = INTVAL (operands[2]);
8892 regno = REGNO (operands[1]);
8894 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8895 to = force_reg (SImode, XEXP (operands[0], 0));
8896 op0 = replace_equiv_address (operands[0], to);
8898 XVECEXP (operands[3], 0, 0)
8899 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8900 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8901 gen_rtx_SCRATCH (SImode));
8903 for (i = 1; i < count; i++)
8904 XVECEXP (operands[3], 0, i + 1)
8905 = gen_rtx_SET (VOIDmode,
8906 adjust_address_nv (op0, SImode, i * 4),
8907 gen_rtx_REG (SImode, regno + i));
8910 (define_insn "*store_multiple_power"
8911 [(match_parallel 0 "store_multiple_operation"
8912 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8913 (match_operand:SI 2 "gpc_reg_operand" "r"))
8914 (clobber (match_scratch:SI 3 "=q"))])]
8915 "TARGET_STRING && TARGET_POWER"
8916 "{stsi|stswi} %2,%P1,%O0"
8917 [(set_attr "type" "store")])
8919 (define_insn "*stmsi8"
8920 [(match_parallel 0 "store_multiple_operation"
8921 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8922 (match_operand:SI 2 "gpc_reg_operand" "r"))
8923 (clobber (match_scratch:SI 3 "X"))
8924 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8925 (match_operand:SI 4 "gpc_reg_operand" "r"))
8926 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8927 (match_operand:SI 5 "gpc_reg_operand" "r"))
8928 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8929 (match_operand:SI 6 "gpc_reg_operand" "r"))
8930 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8931 (match_operand:SI 7 "gpc_reg_operand" "r"))
8932 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8933 (match_operand:SI 8 "gpc_reg_operand" "r"))
8934 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8935 (match_operand:SI 9 "gpc_reg_operand" "r"))
8936 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8937 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8938 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8939 "{stsi|stswi} %2,%1,%O0"
8940 [(set_attr "type" "store")])
8942 (define_insn "*stmsi7"
8943 [(match_parallel 0 "store_multiple_operation"
8944 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8945 (match_operand:SI 2 "gpc_reg_operand" "r"))
8946 (clobber (match_scratch:SI 3 "X"))
8947 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8948 (match_operand:SI 4 "gpc_reg_operand" "r"))
8949 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8950 (match_operand:SI 5 "gpc_reg_operand" "r"))
8951 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8952 (match_operand:SI 6 "gpc_reg_operand" "r"))
8953 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8954 (match_operand:SI 7 "gpc_reg_operand" "r"))
8955 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8956 (match_operand:SI 8 "gpc_reg_operand" "r"))
8957 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8958 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8959 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
8960 "{stsi|stswi} %2,%1,%O0"
8961 [(set_attr "type" "store")])
8963 (define_insn "*stmsi6"
8964 [(match_parallel 0 "store_multiple_operation"
8965 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8966 (match_operand:SI 2 "gpc_reg_operand" "r"))
8967 (clobber (match_scratch:SI 3 "X"))
8968 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8969 (match_operand:SI 4 "gpc_reg_operand" "r"))
8970 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8971 (match_operand:SI 5 "gpc_reg_operand" "r"))
8972 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8973 (match_operand:SI 6 "gpc_reg_operand" "r"))
8974 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8975 (match_operand:SI 7 "gpc_reg_operand" "r"))
8976 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8977 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
8978 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
8979 "{stsi|stswi} %2,%1,%O0"
8980 [(set_attr "type" "store")])
8982 (define_insn "*stmsi5"
8983 [(match_parallel 0 "store_multiple_operation"
8984 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8985 (match_operand:SI 2 "gpc_reg_operand" "r"))
8986 (clobber (match_scratch:SI 3 "X"))
8987 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8988 (match_operand:SI 4 "gpc_reg_operand" "r"))
8989 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8990 (match_operand:SI 5 "gpc_reg_operand" "r"))
8991 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8992 (match_operand:SI 6 "gpc_reg_operand" "r"))
8993 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8994 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
8995 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
8996 "{stsi|stswi} %2,%1,%O0"
8997 [(set_attr "type" "store")])
8999 (define_insn "*stmsi4"
9000 [(match_parallel 0 "store_multiple_operation"
9001 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9002 (match_operand:SI 2 "gpc_reg_operand" "r"))
9003 (clobber (match_scratch:SI 3 "X"))
9004 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9005 (match_operand:SI 4 "gpc_reg_operand" "r"))
9006 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9007 (match_operand:SI 5 "gpc_reg_operand" "r"))
9008 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9009 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9010 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9011 "{stsi|stswi} %2,%1,%O0"
9012 [(set_attr "type" "store")])
9014 (define_insn "*stmsi3"
9015 [(match_parallel 0 "store_multiple_operation"
9016 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9017 (match_operand:SI 2 "gpc_reg_operand" "r"))
9018 (clobber (match_scratch:SI 3 "X"))
9019 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9020 (match_operand:SI 4 "gpc_reg_operand" "r"))
9021 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9022 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9023 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9024 "{stsi|stswi} %2,%1,%O0"
9025 [(set_attr "type" "store")])
9027 ;; String/block move insn.
9028 ;; Argument 0 is the destination
9029 ;; Argument 1 is the source
9030 ;; Argument 2 is the length
9031 ;; Argument 3 is the alignment
9033 (define_expand "movstrsi"
9034 [(parallel [(set (match_operand:BLK 0 "" "")
9035 (match_operand:BLK 1 "" ""))
9036 (use (match_operand:SI 2 "" ""))
9037 (use (match_operand:SI 3 "" ""))])]
9041 if (expand_block_move (operands))
9047 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9048 ;; register allocator doesn't have a clue about allocating 8 word registers.
9049 ;; rD/rS = r5 is preferred, efficient form.
9050 (define_expand "movstrsi_8reg"
9051 [(parallel [(set (match_operand 0 "" "")
9052 (match_operand 1 "" ""))
9053 (use (match_operand 2 "" ""))
9054 (use (match_operand 3 "" ""))
9055 (clobber (reg:SI 5))
9056 (clobber (reg:SI 6))
9057 (clobber (reg:SI 7))
9058 (clobber (reg:SI 8))
9059 (clobber (reg:SI 9))
9060 (clobber (reg:SI 10))
9061 (clobber (reg:SI 11))
9062 (clobber (reg:SI 12))
9063 (clobber (match_scratch:SI 4 ""))])]
9068 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9069 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9070 (use (match_operand:SI 2 "immediate_operand" "i"))
9071 (use (match_operand:SI 3 "immediate_operand" "i"))
9072 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9073 (clobber (reg:SI 6))
9074 (clobber (reg:SI 7))
9075 (clobber (reg:SI 8))
9076 (clobber (reg:SI 9))
9077 (clobber (reg:SI 10))
9078 (clobber (reg:SI 11))
9079 (clobber (reg:SI 12))
9080 (clobber (match_scratch:SI 5 "=q"))]
9081 "TARGET_STRING && TARGET_POWER
9082 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9083 || INTVAL (operands[2]) == 0)
9084 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9085 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9086 && REGNO (operands[4]) == 5"
9087 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9088 [(set_attr "type" "load")
9089 (set_attr "length" "8")])
9092 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9093 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9094 (use (match_operand:SI 2 "immediate_operand" "i"))
9095 (use (match_operand:SI 3 "immediate_operand" "i"))
9096 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9097 (clobber (reg:SI 6))
9098 (clobber (reg:SI 7))
9099 (clobber (reg:SI 8))
9100 (clobber (reg:SI 9))
9101 (clobber (reg:SI 10))
9102 (clobber (reg:SI 11))
9103 (clobber (reg:SI 12))
9104 (clobber (match_scratch:SI 5 "X"))]
9105 "TARGET_STRING && ! TARGET_POWER
9106 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9107 || INTVAL (operands[2]) == 0)
9108 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9109 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9110 && REGNO (operands[4]) == 5"
9111 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9112 [(set_attr "type" "load")
9113 (set_attr "length" "8")])
9116 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9117 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9118 (use (match_operand:SI 2 "immediate_operand" "i"))
9119 (use (match_operand:SI 3 "immediate_operand" "i"))
9120 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9121 (clobber (reg:SI 6))
9122 (clobber (reg:SI 7))
9123 (clobber (reg:SI 8))
9124 (clobber (reg:SI 9))
9125 (clobber (reg:SI 10))
9126 (clobber (reg:SI 11))
9127 (clobber (reg:SI 12))
9128 (clobber (match_scratch:SI 5 "X"))]
9129 "TARGET_STRING && TARGET_POWERPC64
9130 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9131 || INTVAL (operands[2]) == 0)
9132 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9133 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9134 && REGNO (operands[4]) == 5"
9135 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9136 [(set_attr "type" "load")
9137 (set_attr "length" "8")])
9139 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9140 ;; register allocator doesn't have a clue about allocating 6 word registers.
9141 ;; rD/rS = r5 is preferred, efficient form.
9142 (define_expand "movstrsi_6reg"
9143 [(parallel [(set (match_operand 0 "" "")
9144 (match_operand 1 "" ""))
9145 (use (match_operand 2 "" ""))
9146 (use (match_operand 3 "" ""))
9147 (clobber (reg:SI 5))
9148 (clobber (reg:SI 6))
9149 (clobber (reg:SI 7))
9150 (clobber (reg:SI 8))
9151 (clobber (reg:SI 9))
9152 (clobber (reg:SI 10))
9153 (clobber (match_scratch:SI 4 ""))])]
9158 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9159 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9160 (use (match_operand:SI 2 "immediate_operand" "i"))
9161 (use (match_operand:SI 3 "immediate_operand" "i"))
9162 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9163 (clobber (reg:SI 6))
9164 (clobber (reg:SI 7))
9165 (clobber (reg:SI 8))
9166 (clobber (reg:SI 9))
9167 (clobber (reg:SI 10))
9168 (clobber (match_scratch:SI 5 "=q"))]
9169 "TARGET_STRING && TARGET_POWER
9170 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9171 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9172 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9173 && REGNO (operands[4]) == 5"
9174 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9175 [(set_attr "type" "load")
9176 (set_attr "length" "8")])
9179 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9180 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9181 (use (match_operand:SI 2 "immediate_operand" "i"))
9182 (use (match_operand:SI 3 "immediate_operand" "i"))
9183 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9184 (clobber (reg:SI 6))
9185 (clobber (reg:SI 7))
9186 (clobber (reg:SI 8))
9187 (clobber (reg:SI 9))
9188 (clobber (reg:SI 10))
9189 (clobber (match_scratch:SI 5 "X"))]
9190 "TARGET_STRING && ! TARGET_POWER
9191 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9192 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9193 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9194 && REGNO (operands[4]) == 5"
9195 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9196 [(set_attr "type" "load")
9197 (set_attr "length" "8")])
9200 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9201 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9202 (use (match_operand:SI 2 "immediate_operand" "i"))
9203 (use (match_operand:SI 3 "immediate_operand" "i"))
9204 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9205 (clobber (reg:SI 6))
9206 (clobber (reg:SI 7))
9207 (clobber (reg:SI 8))
9208 (clobber (reg:SI 9))
9209 (clobber (reg:SI 10))
9210 (clobber (match_scratch:SI 5 "X"))]
9211 "TARGET_STRING && TARGET_POWERPC64
9212 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9213 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9214 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9215 && REGNO (operands[4]) == 5"
9216 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9217 [(set_attr "type" "load")
9218 (set_attr "length" "8")])
9220 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9221 ;; problems with TImode.
9222 ;; rD/rS = r5 is preferred, efficient form.
9223 (define_expand "movstrsi_4reg"
9224 [(parallel [(set (match_operand 0 "" "")
9225 (match_operand 1 "" ""))
9226 (use (match_operand 2 "" ""))
9227 (use (match_operand 3 "" ""))
9228 (clobber (reg:SI 5))
9229 (clobber (reg:SI 6))
9230 (clobber (reg:SI 7))
9231 (clobber (reg:SI 8))
9232 (clobber (match_scratch:SI 4 ""))])]
9237 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9238 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9239 (use (match_operand:SI 2 "immediate_operand" "i"))
9240 (use (match_operand:SI 3 "immediate_operand" "i"))
9241 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9242 (clobber (reg:SI 6))
9243 (clobber (reg:SI 7))
9244 (clobber (reg:SI 8))
9245 (clobber (match_scratch:SI 5 "=q"))]
9246 "TARGET_STRING && TARGET_POWER
9247 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9248 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9249 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9250 && REGNO (operands[4]) == 5"
9251 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9252 [(set_attr "type" "load")
9253 (set_attr "length" "8")])
9256 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9257 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9258 (use (match_operand:SI 2 "immediate_operand" "i"))
9259 (use (match_operand:SI 3 "immediate_operand" "i"))
9260 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9261 (clobber (reg:SI 6))
9262 (clobber (reg:SI 7))
9263 (clobber (reg:SI 8))
9264 (clobber (match_scratch:SI 5 "X"))]
9265 "TARGET_STRING && ! TARGET_POWER
9266 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9267 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9268 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9269 && REGNO (operands[4]) == 5"
9270 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9271 [(set_attr "type" "load")
9272 (set_attr "length" "8")])
9275 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9276 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9277 (use (match_operand:SI 2 "immediate_operand" "i"))
9278 (use (match_operand:SI 3 "immediate_operand" "i"))
9279 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9280 (clobber (reg:SI 6))
9281 (clobber (reg:SI 7))
9282 (clobber (reg:SI 8))
9283 (clobber (match_scratch:SI 5 "X"))]
9284 "TARGET_STRING && TARGET_POWERPC64
9285 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9286 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9287 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9288 && REGNO (operands[4]) == 5"
9289 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9290 [(set_attr "type" "load")
9291 (set_attr "length" "8")])
9293 ;; Move up to 8 bytes at a time.
9294 (define_expand "movstrsi_2reg"
9295 [(parallel [(set (match_operand 0 "" "")
9296 (match_operand 1 "" ""))
9297 (use (match_operand 2 "" ""))
9298 (use (match_operand 3 "" ""))
9299 (clobber (match_scratch:DI 4 ""))
9300 (clobber (match_scratch:SI 5 ""))])]
9301 "TARGET_STRING && ! TARGET_POWERPC64"
9305 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9306 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9307 (use (match_operand:SI 2 "immediate_operand" "i"))
9308 (use (match_operand:SI 3 "immediate_operand" "i"))
9309 (clobber (match_scratch:DI 4 "=&r"))
9310 (clobber (match_scratch:SI 5 "=q"))]
9311 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9312 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9313 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9314 [(set_attr "type" "load")
9315 (set_attr "length" "8")])
9318 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9319 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9320 (use (match_operand:SI 2 "immediate_operand" "i"))
9321 (use (match_operand:SI 3 "immediate_operand" "i"))
9322 (clobber (match_scratch:DI 4 "=&r"))
9323 (clobber (match_scratch:SI 5 "X"))]
9324 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9325 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9326 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9327 [(set_attr "type" "load")
9328 (set_attr "length" "8")])
9330 ;; Move up to 4 bytes at a time.
9331 (define_expand "movstrsi_1reg"
9332 [(parallel [(set (match_operand 0 "" "")
9333 (match_operand 1 "" ""))
9334 (use (match_operand 2 "" ""))
9335 (use (match_operand 3 "" ""))
9336 (clobber (match_scratch:SI 4 ""))
9337 (clobber (match_scratch:SI 5 ""))])]
9342 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9343 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9344 (use (match_operand:SI 2 "immediate_operand" "i"))
9345 (use (match_operand:SI 3 "immediate_operand" "i"))
9346 (clobber (match_scratch:SI 4 "=&r"))
9347 (clobber (match_scratch:SI 5 "=q"))]
9348 "TARGET_STRING && TARGET_POWER
9349 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9350 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9351 [(set_attr "type" "load")
9352 (set_attr "length" "8")])
9355 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9356 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9357 (use (match_operand:SI 2 "immediate_operand" "i"))
9358 (use (match_operand:SI 3 "immediate_operand" "i"))
9359 (clobber (match_scratch:SI 4 "=&r"))
9360 (clobber (match_scratch:SI 5 "X"))]
9361 "TARGET_STRING && ! TARGET_POWER
9362 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9363 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9364 [(set_attr "type" "load")
9365 (set_attr "length" "8")])
9368 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9369 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9370 (use (match_operand:SI 2 "immediate_operand" "i"))
9371 (use (match_operand:SI 3 "immediate_operand" "i"))
9372 (clobber (match_scratch:SI 4 "=&r"))
9373 (clobber (match_scratch:SI 5 "X"))]
9374 "TARGET_STRING && TARGET_POWERPC64
9375 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9376 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9377 [(set_attr "type" "load")
9378 (set_attr "length" "8")])
9381 ;; Define insns that do load or store with update. Some of these we can
9382 ;; get by using pre-decrement or pre-increment, but the hardware can also
9383 ;; do cases where the increment is not the size of the object.
9385 ;; In all these cases, we use operands 0 and 1 for the register being
9386 ;; incremented because those are the operands that local-alloc will
9387 ;; tie and these are the pair most likely to be tieable (and the ones
9388 ;; that will benefit the most).
9390 (define_insn "*movdi_update1"
9391 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9392 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9393 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9394 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9395 (plus:DI (match_dup 1) (match_dup 2)))]
9396 "TARGET_POWERPC64 && TARGET_UPDATE"
9400 [(set_attr "type" "load_ux,load_u")])
9402 (define_insn "movdi_update"
9403 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9404 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
9405 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9406 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9407 (plus:DI (match_dup 1) (match_dup 2)))]
9408 "TARGET_POWERPC64 && TARGET_UPDATE"
9412 [(set_attr "type" "store_ux,store_u")])
9414 (define_insn "*movsi_update1"
9415 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9416 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9417 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9418 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9419 (plus:SI (match_dup 1) (match_dup 2)))]
9422 {lux|lwzux} %3,%0,%2
9423 {lu|lwzu} %3,%2(%0)"
9424 [(set_attr "type" "load_ux,load_u")])
9426 (define_insn "*movsi_update2"
9427 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9429 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9430 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9431 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9432 (plus:DI (match_dup 1) (match_dup 2)))]
9435 [(set_attr "type" "load_ext_ux")])
9437 (define_insn "movsi_update"
9438 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9439 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9440 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9441 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9442 (plus:SI (match_dup 1) (match_dup 2)))]
9445 {stux|stwux} %3,%0,%2
9446 {stu|stwu} %3,%2(%0)"
9447 [(set_attr "type" "store_ux,store_u")])
9449 (define_insn "*movhi_update1"
9450 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9451 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9452 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9453 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9454 (plus:SI (match_dup 1) (match_dup 2)))]
9459 [(set_attr "type" "load_ux,load_u")])
9461 (define_insn "*movhi_update2"
9462 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9464 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9465 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9466 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9467 (plus:SI (match_dup 1) (match_dup 2)))]
9472 [(set_attr "type" "load_ux,load_u")])
9474 (define_insn "*movhi_update3"
9475 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9477 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9478 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9479 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9480 (plus:SI (match_dup 1) (match_dup 2)))]
9485 [(set_attr "type" "load_ext_ux,load_ext_u")])
9487 (define_insn "*movhi_update4"
9488 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9489 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9490 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9491 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9492 (plus:SI (match_dup 1) (match_dup 2)))]
9497 [(set_attr "type" "store_ux,store_u")])
9499 (define_insn "*movqi_update1"
9500 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9501 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9502 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9503 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9504 (plus:SI (match_dup 1) (match_dup 2)))]
9509 [(set_attr "type" "load_ux,load_u")])
9511 (define_insn "*movqi_update2"
9512 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9514 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9515 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9516 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9517 (plus:SI (match_dup 1) (match_dup 2)))]
9522 [(set_attr "type" "load_ux,load_u")])
9524 (define_insn "*movqi_update3"
9525 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9526 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9527 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9528 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9529 (plus:SI (match_dup 1) (match_dup 2)))]
9534 [(set_attr "type" "store_ux,store_u")])
9536 (define_insn "*movsf_update1"
9537 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9538 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9539 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9540 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9541 (plus:SI (match_dup 1) (match_dup 2)))]
9542 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9546 [(set_attr "type" "fpload_ux,fpload_u")])
9548 (define_insn "*movsf_update2"
9549 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9550 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9551 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9552 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9553 (plus:SI (match_dup 1) (match_dup 2)))]
9554 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9558 [(set_attr "type" "fpstore_ux,fpstore_u")])
9560 (define_insn "*movsf_update3"
9561 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9562 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9563 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9564 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9565 (plus:SI (match_dup 1) (match_dup 2)))]
9566 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9568 {lux|lwzux} %3,%0,%2
9569 {lu|lwzu} %3,%2(%0)"
9570 [(set_attr "type" "load_ux,load_u")])
9572 (define_insn "*movsf_update4"
9573 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9574 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9575 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9576 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9577 (plus:SI (match_dup 1) (match_dup 2)))]
9578 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9580 {stux|stwux} %3,%0,%2
9581 {stu|stwu} %3,%2(%0)"
9582 [(set_attr "type" "store_ux,store_u")])
9584 (define_insn "*movdf_update1"
9585 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9586 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9587 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9588 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9589 (plus:SI (match_dup 1) (match_dup 2)))]
9590 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9594 [(set_attr "type" "fpload_ux,fpload_u")])
9596 (define_insn "*movdf_update2"
9597 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9598 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9599 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9600 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9601 (plus:SI (match_dup 1) (match_dup 2)))]
9602 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9606 [(set_attr "type" "fpstore_ux,fpstore_u")])
9608 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9611 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
9612 (match_operand:DF 1 "memory_operand" ""))
9613 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
9614 (match_operand:DF 3 "memory_operand" ""))]
9616 && TARGET_HARD_FLOAT && TARGET_FPRS
9617 && registers_ok_for_quad_peep (operands[0], operands[2])
9618 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
9619 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
9623 [(set (match_operand:DF 0 "memory_operand" "")
9624 (match_operand:DF 1 "gpc_reg_operand" "f"))
9625 (set (match_operand:DF 2 "memory_operand" "")
9626 (match_operand:DF 3 "gpc_reg_operand" "f"))]
9628 && TARGET_HARD_FLOAT && TARGET_FPRS
9629 && registers_ok_for_quad_peep (operands[1], operands[3])
9630 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
9631 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
9636 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9637 (define_insn "tls_gd_32"
9638 [(set (match_operand:SI 0 "register_operand" "=b")
9639 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9640 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9642 "HAVE_AS_TLS && !TARGET_64BIT"
9643 "addi %0,%1,%2@got@tlsgd")
9645 (define_insn "tls_gd_64"
9646 [(set (match_operand:DI 0 "register_operand" "=b")
9647 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9648 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9650 "HAVE_AS_TLS && TARGET_64BIT"
9651 "addi %0,%1,%2@got@tlsgd")
9653 (define_insn "tls_ld_32"
9654 [(set (match_operand:SI 0 "register_operand" "=b")
9655 (unspec:SI [(match_operand:SI 1 "register_operand" "b")]
9657 "HAVE_AS_TLS && !TARGET_64BIT"
9658 "addi %0,%1,%&@got@tlsld")
9660 (define_insn "tls_ld_64"
9661 [(set (match_operand:DI 0 "register_operand" "=b")
9662 (unspec:DI [(match_operand:DI 1 "register_operand" "b")]
9664 "HAVE_AS_TLS && TARGET_64BIT"
9665 "addi %0,%1,%&@got@tlsld")
9667 (define_insn "tls_dtprel_32"
9668 [(set (match_operand:SI 0 "register_operand" "=r")
9669 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9670 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9672 "HAVE_AS_TLS && !TARGET_64BIT"
9673 "addi %0,%1,%2@dtprel")
9675 (define_insn "tls_dtprel_64"
9676 [(set (match_operand:DI 0 "register_operand" "=r")
9677 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9678 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9680 "HAVE_AS_TLS && TARGET_64BIT"
9681 "addi %0,%1,%2@dtprel")
9683 (define_insn "tls_dtprel_ha_32"
9684 [(set (match_operand:SI 0 "register_operand" "=r")
9685 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9686 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9687 UNSPEC_TLSDTPRELHA))]
9688 "HAVE_AS_TLS && !TARGET_64BIT"
9689 "addis %0,%1,%2@dtprel@ha")
9691 (define_insn "tls_dtprel_ha_64"
9692 [(set (match_operand:DI 0 "register_operand" "=r")
9693 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9694 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9695 UNSPEC_TLSDTPRELHA))]
9696 "HAVE_AS_TLS && TARGET_64BIT"
9697 "addis %0,%1,%2@dtprel@ha")
9699 (define_insn "tls_dtprel_lo_32"
9700 [(set (match_operand:SI 0 "register_operand" "=r")
9701 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9702 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9703 UNSPEC_TLSDTPRELLO))]
9704 "HAVE_AS_TLS && !TARGET_64BIT"
9705 "addi %0,%1,%2@dtprel@l")
9707 (define_insn "tls_dtprel_lo_64"
9708 [(set (match_operand:DI 0 "register_operand" "=r")
9709 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9710 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9711 UNSPEC_TLSDTPRELLO))]
9712 "HAVE_AS_TLS && TARGET_64BIT"
9713 "addi %0,%1,%2@dtprel@l")
9715 (define_insn "tls_got_dtprel_32"
9716 [(set (match_operand:SI 0 "register_operand" "=r")
9717 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9718 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9719 UNSPEC_TLSGOTDTPREL))]
9720 "HAVE_AS_TLS && !TARGET_64BIT"
9721 "lwz %0,%2@got@dtprel(%1)")
9723 (define_insn "tls_got_dtprel_64"
9724 [(set (match_operand:DI 0 "register_operand" "=r")
9725 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9726 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9727 UNSPEC_TLSGOTDTPREL))]
9728 "HAVE_AS_TLS && TARGET_64BIT"
9729 "ld %0,%2@got@dtprel(%1)")
9731 (define_insn "tls_tprel_32"
9732 [(set (match_operand:SI 0 "register_operand" "=r")
9733 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9734 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9736 "HAVE_AS_TLS && !TARGET_64BIT"
9737 "addi %0,%1,%2@tprel")
9739 (define_insn "tls_tprel_64"
9740 [(set (match_operand:DI 0 "register_operand" "=r")
9741 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9742 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9744 "HAVE_AS_TLS && TARGET_64BIT"
9745 "addi %0,%1,%2@tprel")
9747 (define_insn "tls_tprel_ha_32"
9748 [(set (match_operand:SI 0 "register_operand" "=r")
9749 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9750 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9751 UNSPEC_TLSTPRELHA))]
9752 "HAVE_AS_TLS && !TARGET_64BIT"
9753 "addis %0,%1,%2@tprel@ha")
9755 (define_insn "tls_tprel_ha_64"
9756 [(set (match_operand:DI 0 "register_operand" "=r")
9757 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9758 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9759 UNSPEC_TLSTPRELHA))]
9760 "HAVE_AS_TLS && TARGET_64BIT"
9761 "addis %0,%1,%2@tprel@ha")
9763 (define_insn "tls_tprel_lo_32"
9764 [(set (match_operand:SI 0 "register_operand" "=r")
9765 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9766 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9767 UNSPEC_TLSTPRELLO))]
9768 "HAVE_AS_TLS && !TARGET_64BIT"
9769 "addi %0,%1,%2@tprel@l")
9771 (define_insn "tls_tprel_lo_64"
9772 [(set (match_operand:DI 0 "register_operand" "=r")
9773 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9774 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9775 UNSPEC_TLSTPRELLO))]
9776 "HAVE_AS_TLS && TARGET_64BIT"
9777 "addi %0,%1,%2@tprel@l")
9779 ;; "b" output constraint here and on tls_tls input to support linker tls
9780 ;; optimization. The linker may edit the instructions emitted by a
9781 ;; tls_got_tprel/tls_tls pair to addis,addi.
9782 (define_insn "tls_got_tprel_32"
9783 [(set (match_operand:SI 0 "register_operand" "=b")
9784 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9785 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9786 UNSPEC_TLSGOTTPREL))]
9787 "HAVE_AS_TLS && !TARGET_64BIT"
9788 "lwz %0,%2@got@tprel(%1)")
9790 (define_insn "tls_got_tprel_64"
9791 [(set (match_operand:DI 0 "register_operand" "=b")
9792 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9793 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9794 UNSPEC_TLSGOTTPREL))]
9795 "HAVE_AS_TLS && TARGET_64BIT"
9796 "ld %0,%2@got@tprel(%1)")
9798 (define_insn "tls_tls_32"
9799 [(set (match_operand:SI 0 "register_operand" "=r")
9800 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9801 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9803 "HAVE_AS_TLS && !TARGET_64BIT"
9806 (define_insn "tls_tls_64"
9807 [(set (match_operand:DI 0 "register_operand" "=r")
9808 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9809 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9811 "HAVE_AS_TLS && TARGET_64BIT"
9814 ;; Next come insns related to the calling sequence.
9816 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9817 ;; We move the back-chain and decrement the stack pointer.
9819 (define_expand "allocate_stack"
9820 [(set (match_operand 0 "gpc_reg_operand" "=r")
9821 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9823 (minus (reg 1) (match_dup 1)))]
9826 { rtx chain = gen_reg_rtx (Pmode);
9827 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9830 emit_move_insn (chain, stack_bot);
9832 /* Check stack bounds if necessary. */
9833 if (current_function_limit_stack)
9836 available = expand_binop (Pmode, sub_optab,
9837 stack_pointer_rtx, stack_limit_rtx,
9838 NULL_RTX, 1, OPTAB_WIDEN);
9839 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9842 if (GET_CODE (operands[1]) != CONST_INT
9843 || INTVAL (operands[1]) < -32767
9844 || INTVAL (operands[1]) > 32768)
9846 neg_op0 = gen_reg_rtx (Pmode);
9848 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9850 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9853 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9856 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
9857 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9861 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9862 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9863 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9866 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9870 ;; These patterns say how to save and restore the stack pointer. We need not
9871 ;; save the stack pointer at function level since we are careful to
9872 ;; preserve the backchain. At block level, we have to restore the backchain
9873 ;; when we restore the stack pointer.
9875 ;; For nonlocal gotos, we must save both the stack pointer and its
9876 ;; backchain and restore both. Note that in the nonlocal case, the
9877 ;; save area is a memory location.
9879 (define_expand "save_stack_function"
9880 [(match_operand 0 "any_operand" "")
9881 (match_operand 1 "any_operand" "")]
9885 (define_expand "restore_stack_function"
9886 [(match_operand 0 "any_operand" "")
9887 (match_operand 1 "any_operand" "")]
9891 (define_expand "restore_stack_block"
9892 [(use (match_operand 0 "register_operand" ""))
9893 (set (match_dup 2) (match_dup 3))
9894 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9895 (set (match_dup 3) (match_dup 2))]
9899 operands[2] = gen_reg_rtx (Pmode);
9900 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9903 (define_expand "save_stack_nonlocal"
9904 [(match_operand 0 "memory_operand" "")
9905 (match_operand 1 "register_operand" "")]
9909 rtx temp = gen_reg_rtx (Pmode);
9910 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9912 /* Copy the backchain to the first word, sp to the second. */
9913 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9914 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
9915 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
9920 (define_expand "restore_stack_nonlocal"
9921 [(match_operand 0 "register_operand" "")
9922 (match_operand 1 "memory_operand" "")]
9926 rtx temp = gen_reg_rtx (Pmode);
9927 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9929 /* Restore the backchain from the first word, sp from the second. */
9930 emit_move_insn (temp,
9931 adjust_address_nv (operands[1], Pmode, 0));
9932 emit_move_insn (operands[0],
9933 adjust_address_nv (operands[1], Pmode, units_per_word));
9934 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9938 ;; TOC register handling.
9940 ;; Code to initialize the TOC register...
9942 (define_insn "load_toc_aix_si"
9943 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9944 (unspec:SI [(const_int 0)] UNSPEC_TOC))
9946 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9950 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9951 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9952 operands[2] = gen_rtx_REG (Pmode, 2);
9953 return \"{l|lwz} %0,%1(%2)\";
9955 [(set_attr "type" "load")])
9957 (define_insn "load_toc_aix_di"
9958 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9959 (unspec:DI [(const_int 0)] UNSPEC_TOC))
9961 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9965 #ifdef TARGET_RELOCATABLE
9966 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9967 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9969 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9972 strcat (buf, \"@toc\");
9973 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9974 operands[2] = gen_rtx_REG (Pmode, 2);
9975 return \"ld %0,%1(%2)\";
9977 [(set_attr "type" "load")])
9979 (define_insn "load_toc_v4_pic_si"
9980 [(set (match_operand:SI 0 "register_operand" "=l")
9981 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
9982 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9983 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9984 [(set_attr "type" "branch")
9985 (set_attr "length" "4")])
9987 (define_insn "load_toc_v4_PIC_1"
9988 [(set (match_operand:SI 0 "register_operand" "=l")
9989 (match_operand:SI 1 "immediate_operand" "s"))
9990 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
9991 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9992 "bcl 20,31,%1\\n%1:"
9993 [(set_attr "type" "branch")
9994 (set_attr "length" "4")])
9996 (define_insn "load_toc_v4_PIC_1b"
9997 [(set (match_operand:SI 0 "register_operand" "=l")
9998 (match_operand:SI 1 "immediate_operand" "s"))
9999 (use (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")]
10001 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10002 "bcl 20,31,%1+4\\n%1:\\n\\t.long %2-%1"
10003 [(set_attr "type" "branch")
10004 (set_attr "length" "8")])
10006 (define_insn "load_toc_v4_PIC_2"
10007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10008 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10009 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10010 (match_operand:SI 3 "immediate_operand" "s")))))]
10011 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10012 "{l|lwz} %0,%2-%3(%1)"
10013 [(set_attr "type" "load")])
10015 (define_insn "load_macho_picbase"
10016 [(set (match_operand:SI 0 "register_operand" "=l")
10017 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
10019 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
10020 "bcl 20,31,%1\\n%1:"
10021 [(set_attr "type" "branch")
10022 (set_attr "length" "4")])
10024 (define_insn "macho_correct_pic"
10025 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10026 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10027 (unspec:SI [(match_operand:SI 2 "immediate_operand" "s")
10028 (match_operand:SI 3 "immediate_operand" "s")]
10029 UNSPEC_MPIC_CORRECT)))]
10030 "DEFAULT_ABI == ABI_DARWIN"
10031 "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)"
10032 [(set_attr "length" "8")])
10034 ;; If the TOC is shared over a translation unit, as happens with all
10035 ;; the kinds of PIC that we support, we need to restore the TOC
10036 ;; pointer only when jumping over units of translation.
10037 ;; On Darwin, we need to reload the picbase.
10039 (define_expand "builtin_setjmp_receiver"
10040 [(use (label_ref (match_operand 0 "" "")))]
10041 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10042 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10043 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10047 if (DEFAULT_ABI == ABI_DARWIN)
10049 const char *picbase = machopic_function_base_name ();
10050 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10051 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10055 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10056 CODE_LABEL_NUMBER (operands[0]));
10057 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10059 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10060 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10064 rs6000_emit_load_toc_table (FALSE);
10068 ;; A function pointer under AIX is a pointer to a data area whose first word
10069 ;; contains the actual address of the function, whose second word contains a
10070 ;; pointer to its TOC, and whose third word contains a value to place in the
10071 ;; static chain register (r11). Note that if we load the static chain, our
10072 ;; "trampoline" need not have any executable code.
10074 (define_expand "call_indirect_aix32"
10075 [(set (match_dup 2)
10076 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10077 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10080 (mem:SI (plus:SI (match_dup 0)
10083 (mem:SI (plus:SI (match_dup 0)
10085 (parallel [(call (mem:SI (match_dup 2))
10086 (match_operand 1 "" ""))
10090 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10091 (clobber (scratch:SI))])]
10094 { operands[2] = gen_reg_rtx (SImode); }")
10096 (define_expand "call_indirect_aix64"
10097 [(set (match_dup 2)
10098 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10099 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10102 (mem:DI (plus:DI (match_dup 0)
10105 (mem:DI (plus:DI (match_dup 0)
10107 (parallel [(call (mem:SI (match_dup 2))
10108 (match_operand 1 "" ""))
10112 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10113 (clobber (scratch:SI))])]
10116 { operands[2] = gen_reg_rtx (DImode); }")
10118 (define_expand "call_value_indirect_aix32"
10119 [(set (match_dup 3)
10120 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10121 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10124 (mem:SI (plus:SI (match_dup 1)
10127 (mem:SI (plus:SI (match_dup 1)
10129 (parallel [(set (match_operand 0 "" "")
10130 (call (mem:SI (match_dup 3))
10131 (match_operand 2 "" "")))
10135 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10136 (clobber (scratch:SI))])]
10139 { operands[3] = gen_reg_rtx (SImode); }")
10141 (define_expand "call_value_indirect_aix64"
10142 [(set (match_dup 3)
10143 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10144 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10147 (mem:DI (plus:DI (match_dup 1)
10150 (mem:DI (plus:DI (match_dup 1)
10152 (parallel [(set (match_operand 0 "" "")
10153 (call (mem:SI (match_dup 3))
10154 (match_operand 2 "" "")))
10158 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10159 (clobber (scratch:SI))])]
10162 { operands[3] = gen_reg_rtx (DImode); }")
10164 ;; Now the definitions for the call and call_value insns
10165 (define_expand "call"
10166 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10167 (match_operand 1 "" ""))
10168 (use (match_operand 2 "" ""))
10169 (clobber (scratch:SI))])]
10174 if (MACHOPIC_INDIRECT)
10175 operands[0] = machopic_indirect_call_target (operands[0]);
10178 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10181 operands[0] = XEXP (operands[0], 0);
10183 if (GET_CODE (operands[0]) != SYMBOL_REF
10184 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10185 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10187 if (INTVAL (operands[2]) & CALL_LONG)
10188 operands[0] = rs6000_longcall_ref (operands[0]);
10190 if (DEFAULT_ABI == ABI_V4
10191 || DEFAULT_ABI == ABI_DARWIN)
10192 operands[0] = force_reg (Pmode, operands[0]);
10194 else if (DEFAULT_ABI == ABI_AIX)
10196 /* AIX function pointers are really pointers to a three word
10198 emit_call_insn (TARGET_32BIT
10199 ? gen_call_indirect_aix32 (force_reg (SImode,
10202 : gen_call_indirect_aix64 (force_reg (DImode,
10212 (define_expand "call_value"
10213 [(parallel [(set (match_operand 0 "" "")
10214 (call (mem:SI (match_operand 1 "address_operand" ""))
10215 (match_operand 2 "" "")))
10216 (use (match_operand 3 "" ""))
10217 (clobber (scratch:SI))])]
10222 if (MACHOPIC_INDIRECT)
10223 operands[1] = machopic_indirect_call_target (operands[1]);
10226 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10229 operands[1] = XEXP (operands[1], 0);
10231 if (GET_CODE (operands[1]) != SYMBOL_REF
10232 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10233 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10235 if (INTVAL (operands[3]) & CALL_LONG)
10236 operands[1] = rs6000_longcall_ref (operands[1]);
10238 if (DEFAULT_ABI == ABI_V4
10239 || DEFAULT_ABI == ABI_DARWIN)
10240 operands[1] = force_reg (Pmode, operands[1]);
10242 else if (DEFAULT_ABI == ABI_AIX)
10244 /* AIX function pointers are really pointers to a three word
10246 emit_call_insn (TARGET_32BIT
10247 ? gen_call_value_indirect_aix32 (operands[0],
10251 : gen_call_value_indirect_aix64 (operands[0],
10262 ;; Call to function in current module. No TOC pointer reload needed.
10263 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10264 ;; either the function was not prototyped, or it was prototyped as a
10265 ;; variable argument function. It is > 0 if FP registers were passed
10266 ;; and < 0 if they were not.
10268 (define_insn "*call_local32"
10269 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10270 (match_operand 1 "" "g,g"))
10271 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10272 (clobber (match_scratch:SI 3 "=l,l"))]
10273 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10276 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10277 output_asm_insn (\"crxor 6,6,6\", operands);
10279 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10280 output_asm_insn (\"creqv 6,6,6\", operands);
10282 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10284 [(set_attr "type" "branch")
10285 (set_attr "length" "4,8")])
10287 (define_insn "*call_local64"
10288 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10289 (match_operand 1 "" "g,g"))
10290 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10291 (clobber (match_scratch:SI 3 "=l,l"))]
10292 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10295 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10296 output_asm_insn (\"crxor 6,6,6\", operands);
10298 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10299 output_asm_insn (\"creqv 6,6,6\", operands);
10301 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10303 [(set_attr "type" "branch")
10304 (set_attr "length" "4,8")])
10306 (define_insn "*call_value_local32"
10307 [(set (match_operand 0 "" "")
10308 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10309 (match_operand 2 "" "g,g")))
10310 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10311 (clobber (match_scratch:SI 4 "=l,l"))]
10312 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10315 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10316 output_asm_insn (\"crxor 6,6,6\", operands);
10318 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10319 output_asm_insn (\"creqv 6,6,6\", operands);
10321 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10323 [(set_attr "type" "branch")
10324 (set_attr "length" "4,8")])
10327 (define_insn "*call_value_local64"
10328 [(set (match_operand 0 "" "")
10329 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10330 (match_operand 2 "" "g,g")))
10331 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10332 (clobber (match_scratch:SI 4 "=l,l"))]
10333 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10336 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10337 output_asm_insn (\"crxor 6,6,6\", operands);
10339 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10340 output_asm_insn (\"creqv 6,6,6\", operands);
10342 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10344 [(set_attr "type" "branch")
10345 (set_attr "length" "4,8")])
10347 ;; Call to function which may be in another module. Restore the TOC
10348 ;; pointer (r2) after the call unless this is System V.
10349 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10350 ;; either the function was not prototyped, or it was prototyped as a
10351 ;; variable argument function. It is > 0 if FP registers were passed
10352 ;; and < 0 if they were not.
10354 (define_insn "*call_indirect_nonlocal_aix32"
10355 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10356 (match_operand 1 "" "g"))
10360 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10361 (clobber (match_scratch:SI 2 "=l"))]
10362 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10363 "b%T0l\;{l|lwz} 2,20(1)"
10364 [(set_attr "type" "jmpreg")
10365 (set_attr "length" "8")])
10367 (define_insn "*call_nonlocal_aix32"
10368 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10369 (match_operand 1 "" "g"))
10370 (use (match_operand:SI 2 "immediate_operand" "O"))
10371 (clobber (match_scratch:SI 3 "=l"))]
10373 && DEFAULT_ABI == ABI_AIX
10374 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10376 [(set_attr "type" "branch")
10377 (set_attr "length" "8")])
10379 (define_insn "*call_indirect_nonlocal_aix64"
10380 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10381 (match_operand 1 "" "g"))
10385 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10386 (clobber (match_scratch:SI 2 "=l"))]
10387 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10388 "b%T0l\;ld 2,40(1)"
10389 [(set_attr "type" "jmpreg")
10390 (set_attr "length" "8")])
10392 (define_insn "*call_nonlocal_aix64"
10393 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10394 (match_operand 1 "" "g"))
10395 (use (match_operand:SI 2 "immediate_operand" "O"))
10396 (clobber (match_scratch:SI 3 "=l"))]
10398 && DEFAULT_ABI == ABI_AIX
10399 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10401 [(set_attr "type" "branch")
10402 (set_attr "length" "8")])
10404 (define_insn "*call_value_indirect_nonlocal_aix32"
10405 [(set (match_operand 0 "" "")
10406 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10407 (match_operand 2 "" "g")))
10411 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10412 (clobber (match_scratch:SI 3 "=l"))]
10413 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10414 "b%T1l\;{l|lwz} 2,20(1)"
10415 [(set_attr "type" "jmpreg")
10416 (set_attr "length" "8")])
10418 (define_insn "*call_value_nonlocal_aix32"
10419 [(set (match_operand 0 "" "")
10420 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10421 (match_operand 2 "" "g")))
10422 (use (match_operand:SI 3 "immediate_operand" "O"))
10423 (clobber (match_scratch:SI 4 "=l"))]
10425 && DEFAULT_ABI == ABI_AIX
10426 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10428 [(set_attr "type" "branch")
10429 (set_attr "length" "8")])
10431 (define_insn "*call_value_indirect_nonlocal_aix64"
10432 [(set (match_operand 0 "" "")
10433 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10434 (match_operand 2 "" "g")))
10438 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10439 (clobber (match_scratch:SI 3 "=l"))]
10440 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10441 "b%T1l\;ld 2,40(1)"
10442 [(set_attr "type" "jmpreg")
10443 (set_attr "length" "8")])
10445 (define_insn "*call_value_nonlocal_aix64"
10446 [(set (match_operand 0 "" "")
10447 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10448 (match_operand 2 "" "g")))
10449 (use (match_operand:SI 3 "immediate_operand" "O"))
10450 (clobber (match_scratch:SI 4 "=l"))]
10452 && DEFAULT_ABI == ABI_AIX
10453 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10455 [(set_attr "type" "branch")
10456 (set_attr "length" "8")])
10458 ;; A function pointer under System V is just a normal pointer
10459 ;; operands[0] is the function pointer
10460 ;; operands[1] is the stack size to clean up
10461 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10462 ;; which indicates how to set cr1
10464 (define_insn "*call_indirect_nonlocal_sysv"
10465 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10466 (match_operand 1 "" "g,g"))
10467 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10468 (clobber (match_scratch:SI 3 "=l,l"))]
10469 "DEFAULT_ABI == ABI_V4
10470 || DEFAULT_ABI == ABI_DARWIN"
10472 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10473 output_asm_insn ("crxor 6,6,6", operands);
10475 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10476 output_asm_insn ("creqv 6,6,6", operands);
10480 [(set_attr "type" "jmpreg,jmpreg")
10481 (set_attr "length" "4,8")])
10483 (define_insn "*call_nonlocal_sysv"
10484 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10485 (match_operand 1 "" "g,g"))
10486 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10487 (clobber (match_scratch:SI 3 "=l,l"))]
10488 "(DEFAULT_ABI == ABI_DARWIN
10489 || (DEFAULT_ABI == ABI_V4
10490 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10492 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10493 output_asm_insn ("crxor 6,6,6", operands);
10495 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10496 output_asm_insn ("creqv 6,6,6", operands);
10499 return output_call(insn, operands, 0, 2);
10501 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10504 [(set_attr "type" "branch,branch")
10505 (set_attr "length" "4,8")])
10507 (define_insn "*call_value_indirect_nonlocal_sysv"
10508 [(set (match_operand 0 "" "")
10509 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10510 (match_operand 2 "" "g,g")))
10511 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10512 (clobber (match_scratch:SI 4 "=l,l"))]
10513 "DEFAULT_ABI == ABI_V4
10514 || DEFAULT_ABI == ABI_DARWIN"
10516 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10517 output_asm_insn ("crxor 6,6,6", operands);
10519 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10520 output_asm_insn ("creqv 6,6,6", operands);
10524 [(set_attr "type" "jmpreg,jmpreg")
10525 (set_attr "length" "4,8")])
10527 (define_insn "*call_value_nonlocal_sysv"
10528 [(set (match_operand 0 "" "")
10529 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10530 (match_operand 2 "" "g,g")))
10531 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10532 (clobber (match_scratch:SI 4 "=l,l"))]
10533 "(DEFAULT_ABI == ABI_DARWIN
10534 || (DEFAULT_ABI == ABI_V4
10535 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10537 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10538 output_asm_insn ("crxor 6,6,6", operands);
10540 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10541 output_asm_insn ("creqv 6,6,6", operands);
10544 return output_call(insn, operands, 1, 3);
10546 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10549 [(set_attr "type" "branch,branch")
10550 (set_attr "length" "4,8")])
10552 ;; Call subroutine returning any type.
10553 (define_expand "untyped_call"
10554 [(parallel [(call (match_operand 0 "" "")
10556 (match_operand 1 "" "")
10557 (match_operand 2 "" "")])]
10563 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10565 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10567 rtx set = XVECEXP (operands[2], 0, i);
10568 emit_move_insn (SET_DEST (set), SET_SRC (set));
10571 /* The optimizer does not know that the call sets the function value
10572 registers we stored in the result block. We avoid problems by
10573 claiming that all hard registers are used and clobbered at this
10575 emit_insn (gen_blockage ());
10580 ;; sibling call patterns
10581 (define_expand "sibcall"
10582 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10583 (match_operand 1 "" ""))
10584 (use (match_operand 2 "" ""))
10585 (use (match_operand 3 "" ""))
10591 if (MACHOPIC_INDIRECT)
10592 operands[0] = machopic_indirect_call_target (operands[0]);
10595 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10598 operands[0] = XEXP (operands[0], 0);
10599 operands[3] = gen_reg_rtx (SImode);
10603 ;; this and similar patterns must be marked as using LR, otherwise
10604 ;; dataflow will try to delete the store into it. This is true
10605 ;; even when the actual reg to jump to is in CTR, when LR was
10606 ;; saved and restored around the PIC-setting BCL.
10607 (define_insn "*sibcall_local32"
10608 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10609 (match_operand 1 "" "g,g"))
10610 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10611 (use (match_operand:SI 3 "register_operand" "l,l"))
10613 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10616 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10617 output_asm_insn (\"crxor 6,6,6\", operands);
10619 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10620 output_asm_insn (\"creqv 6,6,6\", operands);
10622 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10624 [(set_attr "type" "branch")
10625 (set_attr "length" "4,8")])
10627 (define_insn "*sibcall_local64"
10628 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10629 (match_operand 1 "" "g,g"))
10630 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10631 (use (match_operand:SI 3 "register_operand" "l,l"))
10633 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10636 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10637 output_asm_insn (\"crxor 6,6,6\", operands);
10639 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10640 output_asm_insn (\"creqv 6,6,6\", operands);
10642 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10644 [(set_attr "type" "branch")
10645 (set_attr "length" "4,8")])
10647 (define_insn "*sibcall_value_local32"
10648 [(set (match_operand 0 "" "")
10649 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10650 (match_operand 2 "" "g,g")))
10651 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10652 (use (match_operand:SI 4 "register_operand" "l,l"))
10654 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10657 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10658 output_asm_insn (\"crxor 6,6,6\", operands);
10660 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10661 output_asm_insn (\"creqv 6,6,6\", operands);
10663 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10665 [(set_attr "type" "branch")
10666 (set_attr "length" "4,8")])
10669 (define_insn "*sibcall_value_local64"
10670 [(set (match_operand 0 "" "")
10671 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10672 (match_operand 2 "" "g,g")))
10673 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10674 (use (match_operand:SI 4 "register_operand" "l,l"))
10676 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10679 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10680 output_asm_insn (\"crxor 6,6,6\", operands);
10682 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10683 output_asm_insn (\"creqv 6,6,6\", operands);
10685 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10687 [(set_attr "type" "branch")
10688 (set_attr "length" "4,8")])
10690 (define_insn "*sibcall_nonlocal_aix32"
10691 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10692 (match_operand 1 "" "g"))
10693 (use (match_operand:SI 2 "immediate_operand" "O"))
10694 (use (match_operand:SI 3 "register_operand" "l"))
10697 && DEFAULT_ABI == ABI_AIX
10698 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10700 [(set_attr "type" "branch")
10701 (set_attr "length" "4")])
10703 (define_insn "*sibcall_nonlocal_aix64"
10704 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10705 (match_operand 1 "" "g"))
10706 (use (match_operand:SI 2 "immediate_operand" "O"))
10707 (use (match_operand:SI 3 "register_operand" "l"))
10710 && DEFAULT_ABI == ABI_AIX
10711 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10713 [(set_attr "type" "branch")
10714 (set_attr "length" "4")])
10716 (define_insn "*sibcall_value_nonlocal_aix32"
10717 [(set (match_operand 0 "" "")
10718 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10719 (match_operand 2 "" "g")))
10720 (use (match_operand:SI 3 "immediate_operand" "O"))
10721 (use (match_operand:SI 4 "register_operand" "l"))
10724 && DEFAULT_ABI == ABI_AIX
10725 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10727 [(set_attr "type" "branch")
10728 (set_attr "length" "4")])
10730 (define_insn "*sibcall_value_nonlocal_aix64"
10731 [(set (match_operand 0 "" "")
10732 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10733 (match_operand 2 "" "g")))
10734 (use (match_operand:SI 3 "immediate_operand" "O"))
10735 (use (match_operand:SI 4 "register_operand" "l"))
10738 && DEFAULT_ABI == ABI_AIX
10739 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10741 [(set_attr "type" "branch")
10742 (set_attr "length" "4")])
10744 (define_insn "*sibcall_nonlocal_sysv"
10745 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10746 (match_operand 1 "" ""))
10747 (use (match_operand 2 "immediate_operand" "O,n"))
10748 (use (match_operand:SI 3 "register_operand" "l,l"))
10750 "(DEFAULT_ABI == ABI_DARWIN
10751 || DEFAULT_ABI == ABI_V4)
10752 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10755 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10756 output_asm_insn (\"crxor 6,6,6\", operands);
10758 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10759 output_asm_insn (\"creqv 6,6,6\", operands);
10761 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
10763 [(set_attr "type" "branch,branch")
10764 (set_attr "length" "4,8")])
10766 (define_expand "sibcall_value"
10767 [(parallel [(set (match_operand 0 "register_operand" "")
10768 (call (mem:SI (match_operand 1 "address_operand" ""))
10769 (match_operand 2 "" "")))
10770 (use (match_operand 3 "" ""))
10771 (use (match_operand 4 "" ""))
10777 if (MACHOPIC_INDIRECT)
10778 operands[1] = machopic_indirect_call_target (operands[1]);
10781 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10784 operands[1] = XEXP (operands[1], 0);
10785 operands[4] = gen_reg_rtx (SImode);
10789 (define_insn "*sibcall_value_nonlocal_sysv"
10790 [(set (match_operand 0 "" "")
10791 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10792 (match_operand 2 "" "")))
10793 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10794 (use (match_operand:SI 4 "register_operand" "l,l"))
10796 "(DEFAULT_ABI == ABI_DARWIN
10797 || DEFAULT_ABI == ABI_V4)
10798 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10801 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10802 output_asm_insn (\"crxor 6,6,6\", operands);
10804 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10805 output_asm_insn (\"creqv 6,6,6\", operands);
10807 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
10809 [(set_attr "type" "branch,branch")
10810 (set_attr "length" "4,8")])
10812 (define_expand "sibcall_epilogue"
10813 [(use (const_int 0))]
10814 "TARGET_SCHED_PROLOG"
10817 rs6000_emit_epilogue (TRUE);
10821 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10822 ;; all of memory. This blocks insns from being moved across this point.
10824 (define_insn "blockage"
10825 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10829 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10830 ;; signed & unsigned, and one type of branch.
10832 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10833 ;; insns, and branches. We store the operands of compares until we see
10835 (define_expand "cmpsi"
10837 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10838 (match_operand:SI 1 "reg_or_short_operand" "")))]
10842 /* Take care of the possibility that operands[1] might be negative but
10843 this might be a logical operation. That insn doesn't exist. */
10844 if (GET_CODE (operands[1]) == CONST_INT
10845 && INTVAL (operands[1]) < 0)
10846 operands[1] = force_reg (SImode, operands[1]);
10848 rs6000_compare_op0 = operands[0];
10849 rs6000_compare_op1 = operands[1];
10850 rs6000_compare_fp_p = 0;
10854 (define_expand "cmpdi"
10856 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10857 (match_operand:DI 1 "reg_or_short_operand" "")))]
10861 /* Take care of the possibility that operands[1] might be negative but
10862 this might be a logical operation. That insn doesn't exist. */
10863 if (GET_CODE (operands[1]) == CONST_INT
10864 && INTVAL (operands[1]) < 0)
10865 operands[1] = force_reg (DImode, operands[1]);
10867 rs6000_compare_op0 = operands[0];
10868 rs6000_compare_op1 = operands[1];
10869 rs6000_compare_fp_p = 0;
10873 (define_expand "cmpsf"
10874 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10875 (match_operand:SF 1 "gpc_reg_operand" "")))]
10876 "TARGET_HARD_FLOAT"
10879 rs6000_compare_op0 = operands[0];
10880 rs6000_compare_op1 = operands[1];
10881 rs6000_compare_fp_p = 1;
10885 (define_expand "cmpdf"
10886 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10887 (match_operand:DF 1 "gpc_reg_operand" "")))]
10888 "TARGET_HARD_FLOAT && TARGET_FPRS"
10891 rs6000_compare_op0 = operands[0];
10892 rs6000_compare_op1 = operands[1];
10893 rs6000_compare_fp_p = 1;
10897 (define_expand "cmptf"
10898 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
10899 (match_operand:TF 1 "gpc_reg_operand" "")))]
10900 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
10901 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10904 rs6000_compare_op0 = operands[0];
10905 rs6000_compare_op1 = operands[1];
10906 rs6000_compare_fp_p = 1;
10910 (define_expand "beq"
10911 [(use (match_operand 0 "" ""))]
10913 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10915 (define_expand "bne"
10916 [(use (match_operand 0 "" ""))]
10918 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10920 (define_expand "bge"
10921 [(use (match_operand 0 "" ""))]
10923 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10925 (define_expand "bgt"
10926 [(use (match_operand 0 "" ""))]
10928 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10930 (define_expand "ble"
10931 [(use (match_operand 0 "" ""))]
10933 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10935 (define_expand "blt"
10936 [(use (match_operand 0 "" ""))]
10938 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10940 (define_expand "bgeu"
10941 [(use (match_operand 0 "" ""))]
10943 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10945 (define_expand "bgtu"
10946 [(use (match_operand 0 "" ""))]
10948 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10950 (define_expand "bleu"
10951 [(use (match_operand 0 "" ""))]
10953 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10955 (define_expand "bltu"
10956 [(use (match_operand 0 "" ""))]
10958 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10960 (define_expand "bunordered"
10961 [(use (match_operand 0 "" ""))]
10963 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10965 (define_expand "bordered"
10966 [(use (match_operand 0 "" ""))]
10968 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10970 (define_expand "buneq"
10971 [(use (match_operand 0 "" ""))]
10973 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10975 (define_expand "bunge"
10976 [(use (match_operand 0 "" ""))]
10978 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10980 (define_expand "bungt"
10981 [(use (match_operand 0 "" ""))]
10983 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10985 (define_expand "bunle"
10986 [(use (match_operand 0 "" ""))]
10988 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10990 (define_expand "bunlt"
10991 [(use (match_operand 0 "" ""))]
10993 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10995 (define_expand "bltgt"
10996 [(use (match_operand 0 "" ""))]
10998 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11000 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11001 ;; For SEQ, likewise, except that comparisons with zero should be done
11002 ;; with an scc insns. However, due to the order that combine see the
11003 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11004 ;; the cases we don't want to handle.
11005 (define_expand "seq"
11006 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11008 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11010 (define_expand "sne"
11011 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11015 if (! rs6000_compare_fp_p)
11018 rs6000_emit_sCOND (NE, operands[0]);
11022 ;; A >= 0 is best done the portable way for A an integer.
11023 (define_expand "sge"
11024 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11028 if (! rs6000_compare_fp_p
11029 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11032 rs6000_emit_sCOND (GE, operands[0]);
11036 ;; A > 0 is best done using the portable sequence, so fail in that case.
11037 (define_expand "sgt"
11038 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11042 if (! rs6000_compare_fp_p
11043 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11046 rs6000_emit_sCOND (GT, operands[0]);
11050 ;; A <= 0 is best done the portable way for A an integer.
11051 (define_expand "sle"
11052 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11056 if (! rs6000_compare_fp_p
11057 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11060 rs6000_emit_sCOND (LE, operands[0]);
11064 ;; A < 0 is best done in the portable way for A an integer.
11065 (define_expand "slt"
11066 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11070 if (! rs6000_compare_fp_p
11071 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11074 rs6000_emit_sCOND (LT, operands[0]);
11078 (define_expand "sgeu"
11079 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11081 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11083 (define_expand "sgtu"
11084 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11086 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11088 (define_expand "sleu"
11089 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11091 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11093 (define_expand "sltu"
11094 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11096 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11098 (define_expand "sunordered"
11099 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11101 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11103 (define_expand "sordered"
11104 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11106 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11108 (define_expand "suneq"
11109 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11111 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11113 (define_expand "sunge"
11114 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11116 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11118 (define_expand "sungt"
11119 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11121 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11123 (define_expand "sunle"
11124 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11126 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11128 (define_expand "sunlt"
11129 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11131 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11133 (define_expand "sltgt"
11134 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11136 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11139 ;; Here are the actual compare insns.
11140 (define_insn "*cmpsi_internal1"
11141 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11142 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11143 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11145 "{cmp%I2|cmpw%I2} %0,%1,%2"
11146 [(set_attr "type" "cmp")])
11148 (define_insn "*cmpdi_internal1"
11149 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11150 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11151 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11154 [(set_attr "type" "cmp")])
11156 ;; If we are comparing a register for equality with a large constant,
11157 ;; we can do this with an XOR followed by a compare. But we need a scratch
11158 ;; register for the result of the XOR.
11161 [(set (match_operand:CC 0 "cc_reg_operand" "")
11162 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11163 (match_operand:SI 2 "non_short_cint_operand" "")))
11164 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11165 "find_single_use (operands[0], insn, 0)
11166 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11167 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11168 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11169 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11172 /* Get the constant we are comparing against, C, and see what it looks like
11173 sign-extended to 16 bits. Then see what constant could be XOR'ed
11174 with C to get the sign-extended value. */
11176 HOST_WIDE_INT c = INTVAL (operands[2]);
11177 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11178 HOST_WIDE_INT xorv = c ^ sextc;
11180 operands[4] = GEN_INT (xorv);
11181 operands[5] = GEN_INT (sextc);
11184 (define_insn "*cmpsi_internal2"
11185 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11186 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11187 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11189 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11190 [(set_attr "type" "cmp")])
11192 (define_insn "*cmpdi_internal2"
11193 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11194 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11195 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11197 "cmpld%I2 %0,%1,%b2"
11198 [(set_attr "type" "cmp")])
11200 ;; The following two insns don't exist as single insns, but if we provide
11201 ;; them, we can swap an add and compare, which will enable us to overlap more
11202 ;; of the required delay between a compare and branch. We generate code for
11203 ;; them by splitting.
11206 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11207 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11208 (match_operand:SI 2 "short_cint_operand" "i")))
11209 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11210 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11213 [(set_attr "length" "8")])
11216 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11217 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11218 (match_operand:SI 2 "u_short_cint_operand" "i")))
11219 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11220 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11223 [(set_attr "length" "8")])
11226 [(set (match_operand:CC 3 "cc_reg_operand" "")
11227 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11228 (match_operand:SI 2 "short_cint_operand" "")))
11229 (set (match_operand:SI 0 "gpc_reg_operand" "")
11230 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11232 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11233 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11236 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11237 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11238 (match_operand:SI 2 "u_short_cint_operand" "")))
11239 (set (match_operand:SI 0 "gpc_reg_operand" "")
11240 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11242 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11243 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11245 (define_insn "*cmpsf_internal1"
11246 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11247 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11248 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11249 "TARGET_HARD_FLOAT && TARGET_FPRS"
11251 [(set_attr "type" "fpcompare")])
11253 (define_insn "*cmpdf_internal1"
11254 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11255 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11256 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11257 "TARGET_HARD_FLOAT && TARGET_FPRS"
11259 [(set_attr "type" "fpcompare")])
11261 ;; Only need to compare second words if first words equal
11262 (define_insn "*cmptf_internal1"
11263 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11264 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11265 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11266 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
11267 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11268 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11269 [(set_attr "type" "fpcompare")
11270 (set_attr "length" "12")])
11272 ;; Now we have the scc insns. We can do some combinations because of the
11273 ;; way the machine works.
11275 ;; Note that this is probably faster if we can put an insn between the
11276 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11277 ;; cases the insns below which don't use an intermediate CR field will
11278 ;; be used instead.
11280 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11281 (match_operator:SI 1 "scc_comparison_operator"
11282 [(match_operand 2 "cc_reg_operand" "y")
11285 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11286 [(set (attr "type")
11287 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11288 (const_string "mfcrf")
11290 (const_string "mfcr")))
11291 (set_attr "length" "12")])
11293 ;; Same as above, but get the OV/ORDERED bit.
11294 (define_insn "move_from_CR_ov_bit"
11295 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11296 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11298 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11299 [(set_attr "type" "mfcr")
11300 (set_attr "length" "12")])
11303 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11304 (match_operator:DI 1 "scc_comparison_operator"
11305 [(match_operand 2 "cc_reg_operand" "y")
11308 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11309 [(set (attr "type")
11310 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11311 (const_string "mfcrf")
11313 (const_string "mfcr")))
11314 (set_attr "length" "12")])
11317 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11318 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11319 [(match_operand 2 "cc_reg_operand" "y,y")
11322 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11323 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11326 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11328 [(set_attr "type" "delayed_compare")
11329 (set_attr "length" "12,16")])
11332 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11333 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11334 [(match_operand 2 "cc_reg_operand" "")
11337 (set (match_operand:SI 3 "gpc_reg_operand" "")
11338 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11339 "TARGET_32BIT && reload_completed"
11340 [(set (match_dup 3)
11341 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11343 (compare:CC (match_dup 3)
11348 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11349 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11350 [(match_operand 2 "cc_reg_operand" "y")
11352 (match_operand:SI 3 "const_int_operand" "n")))]
11356 int is_bit = ccr_bit (operands[1], 1);
11357 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11360 if (is_bit >= put_bit)
11361 count = is_bit - put_bit;
11363 count = 32 - (put_bit - is_bit);
11365 operands[4] = GEN_INT (count);
11366 operands[5] = GEN_INT (put_bit);
11368 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11370 [(set (attr "type")
11371 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11372 (const_string "mfcrf")
11374 (const_string "mfcr")))
11375 (set_attr "length" "12")])
11378 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11380 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11381 [(match_operand 2 "cc_reg_operand" "y,y")
11383 (match_operand:SI 3 "const_int_operand" "n,n"))
11385 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11386 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11391 int is_bit = ccr_bit (operands[1], 1);
11392 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11395 /* Force split for non-cc0 compare. */
11396 if (which_alternative == 1)
11399 if (is_bit >= put_bit)
11400 count = is_bit - put_bit;
11402 count = 32 - (put_bit - is_bit);
11404 operands[5] = GEN_INT (count);
11405 operands[6] = GEN_INT (put_bit);
11407 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11409 [(set_attr "type" "delayed_compare")
11410 (set_attr "length" "12,16")])
11413 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11415 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11416 [(match_operand 2 "cc_reg_operand" "")
11418 (match_operand:SI 3 "const_int_operand" ""))
11420 (set (match_operand:SI 4 "gpc_reg_operand" "")
11421 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11424 [(set (match_dup 4)
11425 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11428 (compare:CC (match_dup 4)
11432 ;; There is a 3 cycle delay between consecutive mfcr instructions
11433 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11436 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11437 (match_operator:SI 1 "scc_comparison_operator"
11438 [(match_operand 2 "cc_reg_operand" "y")
11440 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11441 (match_operator:SI 4 "scc_comparison_operator"
11442 [(match_operand 5 "cc_reg_operand" "y")
11444 "REGNO (operands[2]) != REGNO (operands[5])"
11445 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11446 [(set_attr "type" "mfcr")
11447 (set_attr "length" "20")])
11450 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11451 (match_operator:DI 1 "scc_comparison_operator"
11452 [(match_operand 2 "cc_reg_operand" "y")
11454 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11455 (match_operator:DI 4 "scc_comparison_operator"
11456 [(match_operand 5 "cc_reg_operand" "y")
11458 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11459 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11460 [(set_attr "type" "mfcr")
11461 (set_attr "length" "20")])
11463 ;; There are some scc insns that can be done directly, without a compare.
11464 ;; These are faster because they don't involve the communications between
11465 ;; the FXU and branch units. In fact, we will be replacing all of the
11466 ;; integer scc insns here or in the portable methods in emit_store_flag.
11468 ;; Also support (neg (scc ..)) since that construct is used to replace
11469 ;; branches, (plus (scc ..) ..) since that construct is common and
11470 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11471 ;; cases where it is no more expensive than (neg (scc ..)).
11473 ;; Have reload force a constant into a register for the simple insns that
11474 ;; otherwise won't accept constants. We do this because it is faster than
11475 ;; the cmp/mfcr sequence we would otherwise generate.
11478 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11479 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11480 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11481 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11484 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11485 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11486 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11487 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11488 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11489 [(set_attr "length" "12,8,12,12,12")])
11492 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11493 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11494 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11495 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11498 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11499 subfic %3,%1,0\;adde %0,%3,%1
11500 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11501 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11502 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11503 [(set_attr "length" "12,8,12,12,12")])
11506 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11508 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11509 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11511 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11512 (eq:SI (match_dup 1) (match_dup 2)))
11513 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11516 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11517 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11518 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11519 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11520 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11526 [(set_attr "type" "compare")
11527 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11530 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11532 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11533 (match_operand:SI 2 "reg_or_cint_operand" ""))
11535 (set (match_operand:SI 0 "gpc_reg_operand" "")
11536 (eq:SI (match_dup 1) (match_dup 2)))
11537 (clobber (match_scratch:SI 3 ""))]
11538 "TARGET_32BIT && reload_completed"
11539 [(parallel [(set (match_dup 0)
11540 (eq:SI (match_dup 1) (match_dup 2)))
11541 (clobber (match_dup 3))])
11543 (compare:CC (match_dup 0)
11548 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11550 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11551 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11553 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11554 (eq:DI (match_dup 1) (match_dup 2)))
11555 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11558 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11559 subfic %3,%1,0\;adde. %0,%3,%1
11560 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11561 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11562 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11568 [(set_attr "type" "compare")
11569 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11572 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11574 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11575 (match_operand:DI 2 "reg_or_cint_operand" ""))
11577 (set (match_operand:DI 0 "gpc_reg_operand" "")
11578 (eq:DI (match_dup 1) (match_dup 2)))
11579 (clobber (match_scratch:DI 3 ""))]
11580 "TARGET_64BIT && reload_completed"
11581 [(parallel [(set (match_dup 0)
11582 (eq:DI (match_dup 1) (match_dup 2)))
11583 (clobber (match_dup 3))])
11585 (compare:CC (match_dup 0)
11589 ;; We have insns of the form shown by the first define_insn below. If
11590 ;; there is something inside the comparison operation, we must split it.
11592 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11593 (plus:SI (match_operator 1 "comparison_operator"
11594 [(match_operand:SI 2 "" "")
11595 (match_operand:SI 3
11596 "reg_or_cint_operand" "")])
11597 (match_operand:SI 4 "gpc_reg_operand" "")))
11598 (clobber (match_operand:SI 5 "register_operand" ""))]
11599 "! gpc_reg_operand (operands[2], SImode)"
11600 [(set (match_dup 5) (match_dup 2))
11601 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11605 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11606 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11607 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11608 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11611 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11612 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11613 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11614 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11615 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11616 [(set_attr "length" "12,8,12,12,12")])
11619 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11622 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11623 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11624 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11626 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11629 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11630 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11631 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11632 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11633 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11639 [(set_attr "type" "compare")
11640 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11643 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11646 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11647 (match_operand:SI 2 "reg_or_cint_operand" ""))
11648 (match_operand:SI 3 "gpc_reg_operand" ""))
11650 (clobber (match_scratch:SI 4 ""))]
11651 "TARGET_32BIT && reload_completed"
11652 [(set (match_dup 4)
11653 (plus:SI (eq:SI (match_dup 1)
11657 (compare:CC (match_dup 4)
11662 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11665 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11666 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11667 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11669 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11670 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11673 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11674 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11675 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11676 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11677 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11683 [(set_attr "type" "compare")
11684 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11687 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11690 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11691 (match_operand:SI 2 "reg_or_cint_operand" ""))
11692 (match_operand:SI 3 "gpc_reg_operand" ""))
11694 (set (match_operand:SI 0 "gpc_reg_operand" "")
11695 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11696 "TARGET_32BIT && reload_completed"
11697 [(set (match_dup 0)
11698 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11700 (compare:CC (match_dup 0)
11705 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11706 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11707 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11710 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11711 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11712 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11713 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11714 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11715 [(set_attr "length" "12,8,12,12,12")])
11717 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11718 ;; since it nabs/sr is just as fast.
11719 (define_insn "*ne0"
11720 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11721 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11723 (clobber (match_scratch:SI 2 "=&r"))]
11724 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11725 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11726 [(set_attr "length" "8")])
11729 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11730 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11732 (clobber (match_scratch:DI 2 "=&r"))]
11734 "addic %2,%1,-1\;subfe %0,%2,%1"
11735 [(set_attr "length" "8")])
11737 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11739 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11740 (plus:SI (lshiftrt:SI
11741 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11743 (match_operand:SI 2 "gpc_reg_operand" "r")))
11744 (clobber (match_scratch:SI 3 "=&r"))]
11746 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11747 [(set_attr "length" "8")])
11750 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11751 (plus:DI (lshiftrt:DI
11752 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11754 (match_operand:DI 2 "gpc_reg_operand" "r")))
11755 (clobber (match_scratch:DI 3 "=&r"))]
11757 "addic %3,%1,-1\;addze %0,%2"
11758 [(set_attr "length" "8")])
11761 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11763 (plus:SI (lshiftrt:SI
11764 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11766 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11768 (clobber (match_scratch:SI 3 "=&r,&r"))
11769 (clobber (match_scratch:SI 4 "=X,&r"))]
11772 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11774 [(set_attr "type" "compare")
11775 (set_attr "length" "8,12")])
11778 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11780 (plus:SI (lshiftrt:SI
11781 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11783 (match_operand:SI 2 "gpc_reg_operand" ""))
11785 (clobber (match_scratch:SI 3 ""))
11786 (clobber (match_scratch:SI 4 ""))]
11787 "TARGET_32BIT && reload_completed"
11788 [(parallel [(set (match_dup 3)
11789 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11792 (clobber (match_dup 4))])
11794 (compare:CC (match_dup 3)
11799 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11801 (plus:DI (lshiftrt:DI
11802 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11804 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11806 (clobber (match_scratch:DI 3 "=&r,&r"))]
11809 addic %3,%1,-1\;addze. %3,%2
11811 [(set_attr "type" "compare")
11812 (set_attr "length" "8,12")])
11815 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11817 (plus:DI (lshiftrt:DI
11818 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11820 (match_operand:DI 2 "gpc_reg_operand" ""))
11822 (clobber (match_scratch:DI 3 ""))]
11823 "TARGET_64BIT && reload_completed"
11824 [(set (match_dup 3)
11825 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11829 (compare:CC (match_dup 3)
11834 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11836 (plus:SI (lshiftrt:SI
11837 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11839 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11841 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11842 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11844 (clobber (match_scratch:SI 3 "=&r,&r"))]
11847 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11849 [(set_attr "type" "compare")
11850 (set_attr "length" "8,12")])
11853 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11855 (plus:SI (lshiftrt:SI
11856 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11858 (match_operand:SI 2 "gpc_reg_operand" ""))
11860 (set (match_operand:SI 0 "gpc_reg_operand" "")
11861 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11863 (clobber (match_scratch:SI 3 ""))]
11864 "TARGET_32BIT && reload_completed"
11865 [(parallel [(set (match_dup 0)
11866 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11868 (clobber (match_dup 3))])
11870 (compare:CC (match_dup 0)
11875 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11877 (plus:DI (lshiftrt:DI
11878 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11880 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11882 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11883 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11885 (clobber (match_scratch:DI 3 "=&r,&r"))]
11888 addic %3,%1,-1\;addze. %0,%2
11890 [(set_attr "type" "compare")
11891 (set_attr "length" "8,12")])
11894 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11896 (plus:DI (lshiftrt:DI
11897 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11899 (match_operand:DI 2 "gpc_reg_operand" ""))
11901 (set (match_operand:DI 0 "gpc_reg_operand" "")
11902 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11904 (clobber (match_scratch:DI 3 ""))]
11905 "TARGET_64BIT && reload_completed"
11906 [(parallel [(set (match_dup 0)
11907 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11909 (clobber (match_dup 3))])
11911 (compare:CC (match_dup 0)
11916 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11917 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11918 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11919 (clobber (match_scratch:SI 3 "=r,X"))]
11922 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11923 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11924 [(set_attr "length" "12")])
11927 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11929 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11930 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11932 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11933 (le:SI (match_dup 1) (match_dup 2)))
11934 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11937 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11938 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11941 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11942 (set_attr "length" "12,12,16,16")])
11945 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11947 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11948 (match_operand:SI 2 "reg_or_short_operand" ""))
11950 (set (match_operand:SI 0 "gpc_reg_operand" "")
11951 (le:SI (match_dup 1) (match_dup 2)))
11952 (clobber (match_scratch:SI 3 ""))]
11953 "TARGET_POWER && reload_completed"
11954 [(parallel [(set (match_dup 0)
11955 (le:SI (match_dup 1) (match_dup 2)))
11956 (clobber (match_dup 3))])
11958 (compare:CC (match_dup 0)
11963 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11964 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11965 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11966 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11969 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11970 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11971 [(set_attr "length" "12")])
11974 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11976 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11977 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11978 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11980 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11983 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11984 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11987 [(set_attr "type" "compare")
11988 (set_attr "length" "12,12,16,16")])
11991 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11993 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11994 (match_operand:SI 2 "reg_or_short_operand" ""))
11995 (match_operand:SI 3 "gpc_reg_operand" ""))
11997 (clobber (match_scratch:SI 4 ""))]
11998 "TARGET_POWER && reload_completed"
11999 [(set (match_dup 4)
12000 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12003 (compare:CC (match_dup 4)
12008 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12010 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12011 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12012 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12014 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12015 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12018 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12019 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12022 [(set_attr "type" "compare")
12023 (set_attr "length" "12,12,16,16")])
12026 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12028 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12029 (match_operand:SI 2 "reg_or_short_operand" ""))
12030 (match_operand:SI 3 "gpc_reg_operand" ""))
12032 (set (match_operand:SI 0 "gpc_reg_operand" "")
12033 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12034 "TARGET_POWER && reload_completed"
12035 [(set (match_dup 0)
12036 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12038 (compare:CC (match_dup 0)
12043 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12044 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12045 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12048 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12049 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12050 [(set_attr "length" "12")])
12053 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12054 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12055 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12057 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12058 [(set_attr "length" "12")])
12061 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12062 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12063 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12065 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12066 [(set_attr "length" "12")])
12069 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12071 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12072 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12074 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12075 (leu:DI (match_dup 1) (match_dup 2)))]
12078 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12080 [(set_attr "type" "compare")
12081 (set_attr "length" "12,16")])
12084 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12086 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12087 (match_operand:DI 2 "reg_or_short_operand" ""))
12089 (set (match_operand:DI 0 "gpc_reg_operand" "")
12090 (leu:DI (match_dup 1) (match_dup 2)))]
12091 "TARGET_64BIT && reload_completed"
12092 [(set (match_dup 0)
12093 (leu:DI (match_dup 1) (match_dup 2)))
12095 (compare:CC (match_dup 0)
12100 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12102 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12103 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12105 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12106 (leu:SI (match_dup 1) (match_dup 2)))]
12109 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12111 [(set_attr "type" "compare")
12112 (set_attr "length" "12,16")])
12115 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12117 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12118 (match_operand:SI 2 "reg_or_short_operand" ""))
12120 (set (match_operand:SI 0 "gpc_reg_operand" "")
12121 (leu:SI (match_dup 1) (match_dup 2)))]
12122 "TARGET_32BIT && reload_completed"
12123 [(set (match_dup 0)
12124 (leu:SI (match_dup 1) (match_dup 2)))
12126 (compare:CC (match_dup 0)
12131 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12132 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12133 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12134 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12136 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12137 [(set_attr "length" "8")])
12140 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12142 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12143 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12144 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12146 (clobber (match_scratch:SI 4 "=&r,&r"))]
12149 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12151 [(set_attr "type" "compare")
12152 (set_attr "length" "8,12")])
12155 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12157 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12158 (match_operand:SI 2 "reg_or_short_operand" ""))
12159 (match_operand:SI 3 "gpc_reg_operand" ""))
12161 (clobber (match_scratch:SI 4 ""))]
12162 "TARGET_32BIT && reload_completed"
12163 [(set (match_dup 4)
12164 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12167 (compare:CC (match_dup 4)
12172 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12174 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12175 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12176 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12178 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12179 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12182 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12184 [(set_attr "type" "compare")
12185 (set_attr "length" "8,12")])
12188 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12190 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12191 (match_operand:SI 2 "reg_or_short_operand" ""))
12192 (match_operand:SI 3 "gpc_reg_operand" ""))
12194 (set (match_operand:SI 0 "gpc_reg_operand" "")
12195 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12196 "TARGET_32BIT && reload_completed"
12197 [(set (match_dup 0)
12198 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12200 (compare:CC (match_dup 0)
12205 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12206 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12207 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12209 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12210 [(set_attr "length" "12")])
12213 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12215 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12216 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12217 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12219 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12220 [(set_attr "length" "12")])
12223 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12226 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12227 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12228 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12230 (clobber (match_scratch:SI 4 "=&r,&r"))]
12233 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12235 [(set_attr "type" "compare")
12236 (set_attr "length" "12,16")])
12239 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12242 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12243 (match_operand:SI 2 "reg_or_short_operand" "")))
12244 (match_operand:SI 3 "gpc_reg_operand" ""))
12246 (clobber (match_scratch:SI 4 ""))]
12247 "TARGET_32BIT && reload_completed"
12248 [(set (match_dup 4)
12249 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12252 (compare:CC (match_dup 4)
12257 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12260 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12261 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12262 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12264 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12265 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12268 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12270 [(set_attr "type" "compare")
12271 (set_attr "length" "12,16")])
12274 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12277 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12278 (match_operand:SI 2 "reg_or_short_operand" "")))
12279 (match_operand:SI 3 "gpc_reg_operand" ""))
12281 (set (match_operand:SI 0 "gpc_reg_operand" "")
12282 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12283 "TARGET_32BIT && reload_completed"
12284 [(set (match_dup 0)
12285 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12288 (compare:CC (match_dup 0)
12293 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12294 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12295 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12297 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12298 [(set_attr "length" "12")])
12301 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12303 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12304 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12306 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12307 (lt:SI (match_dup 1) (match_dup 2)))]
12310 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12312 [(set_attr "type" "delayed_compare")
12313 (set_attr "length" "12,16")])
12316 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12318 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12319 (match_operand:SI 2 "reg_or_short_operand" ""))
12321 (set (match_operand:SI 0 "gpc_reg_operand" "")
12322 (lt:SI (match_dup 1) (match_dup 2)))]
12323 "TARGET_POWER && reload_completed"
12324 [(set (match_dup 0)
12325 (lt:SI (match_dup 1) (match_dup 2)))
12327 (compare:CC (match_dup 0)
12332 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12333 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12334 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12335 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12337 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12338 [(set_attr "length" "12")])
12341 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12343 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12344 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12345 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12347 (clobber (match_scratch:SI 4 "=&r,&r"))]
12350 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12352 [(set_attr "type" "compare")
12353 (set_attr "length" "12,16")])
12356 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12358 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12359 (match_operand:SI 2 "reg_or_short_operand" ""))
12360 (match_operand:SI 3 "gpc_reg_operand" ""))
12362 (clobber (match_scratch:SI 4 ""))]
12363 "TARGET_POWER && reload_completed"
12364 [(set (match_dup 4)
12365 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12368 (compare:CC (match_dup 4)
12373 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12375 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12376 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12377 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12379 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12380 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12383 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12385 [(set_attr "type" "compare")
12386 (set_attr "length" "12,16")])
12389 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12391 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12392 (match_operand:SI 2 "reg_or_short_operand" ""))
12393 (match_operand:SI 3 "gpc_reg_operand" ""))
12395 (set (match_operand:SI 0 "gpc_reg_operand" "")
12396 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12397 "TARGET_POWER && reload_completed"
12398 [(set (match_dup 0)
12399 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12401 (compare:CC (match_dup 0)
12406 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12407 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12408 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12410 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12411 [(set_attr "length" "12")])
12414 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12415 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12416 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12419 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
12420 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12421 [(set_attr "length" "12")])
12424 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12426 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12427 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12429 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12430 (ltu:SI (match_dup 1) (match_dup 2)))]
12433 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12434 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12437 [(set_attr "type" "compare")
12438 (set_attr "length" "12,12,16,16")])
12441 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12443 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12444 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12446 (set (match_operand:SI 0 "gpc_reg_operand" "")
12447 (ltu:SI (match_dup 1) (match_dup 2)))]
12448 "TARGET_32BIT && reload_completed"
12449 [(set (match_dup 0)
12450 (ltu:SI (match_dup 1) (match_dup 2)))
12452 (compare:CC (match_dup 0)
12457 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12458 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12459 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12460 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12463 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
12464 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12465 [(set_attr "length" "12")])
12468 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12470 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12471 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12472 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12474 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12477 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12478 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12481 [(set_attr "type" "compare")
12482 (set_attr "length" "12,12,16,16")])
12485 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12487 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12488 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12489 (match_operand:SI 3 "gpc_reg_operand" ""))
12491 (clobber (match_scratch:SI 4 ""))]
12492 "TARGET_32BIT && reload_completed"
12493 [(set (match_dup 4)
12494 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12497 (compare:CC (match_dup 4)
12502 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12504 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12505 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12506 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12508 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12509 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12512 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12513 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12516 [(set_attr "type" "compare")
12517 (set_attr "length" "12,12,16,16")])
12520 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12522 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12523 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12524 (match_operand:SI 3 "gpc_reg_operand" ""))
12526 (set (match_operand:SI 0 "gpc_reg_operand" "")
12527 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12528 "TARGET_32BIT && reload_completed"
12529 [(set (match_dup 0)
12530 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12532 (compare:CC (match_dup 0)
12537 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12538 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12539 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12542 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12543 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12544 [(set_attr "length" "8")])
12547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12548 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12549 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12550 (clobber (match_scratch:SI 3 "=r"))]
12552 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12553 [(set_attr "length" "12")])
12556 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12558 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12559 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12561 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12562 (ge:SI (match_dup 1) (match_dup 2)))
12563 (clobber (match_scratch:SI 3 "=r,r"))]
12566 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12568 [(set_attr "type" "compare")
12569 (set_attr "length" "12,16")])
12572 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12574 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12575 (match_operand:SI 2 "reg_or_short_operand" ""))
12577 (set (match_operand:SI 0 "gpc_reg_operand" "")
12578 (ge:SI (match_dup 1) (match_dup 2)))
12579 (clobber (match_scratch:SI 3 ""))]
12580 "TARGET_POWER && reload_completed"
12581 [(parallel [(set (match_dup 0)
12582 (ge:SI (match_dup 1) (match_dup 2)))
12583 (clobber (match_dup 3))])
12585 (compare:CC (match_dup 0)
12590 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12591 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12592 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12593 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12595 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12596 [(set_attr "length" "12")])
12599 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12601 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12602 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12603 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12605 (clobber (match_scratch:SI 4 "=&r,&r"))]
12608 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12610 [(set_attr "type" "compare")
12611 (set_attr "length" "12,16")])
12614 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12616 (plus:SI (ge: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 (clobber (match_scratch:SI 4 ""))]
12621 "TARGET_POWER && reload_completed"
12622 [(set (match_dup 4)
12623 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12626 (compare:CC (match_dup 4)
12631 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12633 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12634 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12635 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12637 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12638 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12641 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12643 [(set_attr "type" "compare")
12644 (set_attr "length" "12,16")])
12647 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12649 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12650 (match_operand:SI 2 "reg_or_short_operand" ""))
12651 (match_operand:SI 3 "gpc_reg_operand" ""))
12653 (set (match_operand:SI 0 "gpc_reg_operand" "")
12654 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12655 "TARGET_POWER && reload_completed"
12656 [(set (match_dup 0)
12657 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12659 (compare:CC (match_dup 0)
12664 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12665 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12666 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12668 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12669 [(set_attr "length" "12")])
12672 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12673 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12674 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12677 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12678 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12679 [(set_attr "length" "12")])
12682 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12683 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12684 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12687 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12688 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12689 [(set_attr "length" "12")])
12692 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12694 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12695 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12697 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12698 (geu:SI (match_dup 1) (match_dup 2)))]
12701 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12702 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12705 [(set_attr "type" "compare")
12706 (set_attr "length" "12,12,16,16")])
12709 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12711 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12712 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12714 (set (match_operand:SI 0 "gpc_reg_operand" "")
12715 (geu:SI (match_dup 1) (match_dup 2)))]
12716 "TARGET_32BIT && reload_completed"
12717 [(set (match_dup 0)
12718 (geu:SI (match_dup 1) (match_dup 2)))
12720 (compare:CC (match_dup 0)
12725 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12727 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12728 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12730 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12731 (geu:DI (match_dup 1) (match_dup 2)))]
12734 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12735 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12738 [(set_attr "type" "compare")
12739 (set_attr "length" "12,12,16,16")])
12742 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12744 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12745 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12747 (set (match_operand:DI 0 "gpc_reg_operand" "")
12748 (geu:DI (match_dup 1) (match_dup 2)))]
12749 "TARGET_64BIT && reload_completed"
12750 [(set (match_dup 0)
12751 (geu:DI (match_dup 1) (match_dup 2)))
12753 (compare:CC (match_dup 0)
12758 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12759 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12760 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12761 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12764 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12765 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12766 [(set_attr "length" "8")])
12769 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12771 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12772 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12773 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12775 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12778 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12779 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12782 [(set_attr "type" "compare")
12783 (set_attr "length" "8,8,12,12")])
12786 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12788 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12789 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12790 (match_operand:SI 3 "gpc_reg_operand" ""))
12792 (clobber (match_scratch:SI 4 ""))]
12793 "TARGET_32BIT && reload_completed"
12794 [(set (match_dup 4)
12795 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12798 (compare:CC (match_dup 4)
12803 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12805 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12806 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12807 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12809 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12810 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12813 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12814 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12817 [(set_attr "type" "compare")
12818 (set_attr "length" "8,8,12,12")])
12821 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12823 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12824 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12825 (match_operand:SI 3 "gpc_reg_operand" ""))
12827 (set (match_operand:SI 0 "gpc_reg_operand" "")
12828 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12829 "TARGET_32BIT && reload_completed"
12830 [(set (match_dup 0)
12831 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12833 (compare:CC (match_dup 0)
12838 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12839 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12840 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12843 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12844 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12845 [(set_attr "length" "12")])
12848 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12850 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12851 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12852 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12855 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12856 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12857 [(set_attr "length" "12")])
12860 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12863 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12864 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12865 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12867 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12870 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12871 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12874 [(set_attr "type" "compare")
12875 (set_attr "length" "12,12,16,16")])
12878 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12881 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12882 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12883 (match_operand:SI 3 "gpc_reg_operand" ""))
12885 (clobber (match_scratch:SI 4 ""))]
12886 "TARGET_32BIT && reload_completed"
12887 [(set (match_dup 4)
12888 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12891 (compare:CC (match_dup 4)
12896 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12899 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12900 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12901 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12903 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12904 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12907 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12908 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12911 [(set_attr "type" "compare")
12912 (set_attr "length" "12,12,16,16")])
12915 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12918 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12919 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12920 (match_operand:SI 3 "gpc_reg_operand" ""))
12922 (set (match_operand:SI 0 "gpc_reg_operand" "")
12923 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12924 "TARGET_32BIT && reload_completed"
12925 [(set (match_dup 0)
12926 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12928 (compare:CC (match_dup 0)
12933 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12934 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12937 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12938 [(set_attr "length" "12")])
12941 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12942 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12945 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12946 [(set_attr "length" "12")])
12949 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12951 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12954 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12955 (gt:SI (match_dup 1) (const_int 0)))]
12958 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12960 [(set_attr "type" "delayed_compare")
12961 (set_attr "length" "12,16")])
12964 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12966 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12969 (set (match_operand:SI 0 "gpc_reg_operand" "")
12970 (gt:SI (match_dup 1) (const_int 0)))]
12971 "TARGET_32BIT && reload_completed"
12972 [(set (match_dup 0)
12973 (gt:SI (match_dup 1) (const_int 0)))
12975 (compare:CC (match_dup 0)
12980 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12982 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12985 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12986 (gt:DI (match_dup 1) (const_int 0)))]
12989 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12991 [(set_attr "type" "delayed_compare")
12992 (set_attr "length" "12,16")])
12995 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12997 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13000 (set (match_operand:DI 0 "gpc_reg_operand" "")
13001 (gt:DI (match_dup 1) (const_int 0)))]
13002 "TARGET_64BIT && reload_completed"
13003 [(set (match_dup 0)
13004 (gt:DI (match_dup 1) (const_int 0)))
13006 (compare:CC (match_dup 0)
13011 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13012 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13013 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13015 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13016 [(set_attr "length" "12")])
13019 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13021 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13022 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13024 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13025 (gt:SI (match_dup 1) (match_dup 2)))]
13028 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13030 [(set_attr "type" "delayed_compare")
13031 (set_attr "length" "12,16")])
13034 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13036 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13037 (match_operand:SI 2 "reg_or_short_operand" ""))
13039 (set (match_operand:SI 0 "gpc_reg_operand" "")
13040 (gt:SI (match_dup 1) (match_dup 2)))]
13041 "TARGET_POWER && reload_completed"
13042 [(set (match_dup 0)
13043 (gt:SI (match_dup 1) (match_dup 2)))
13045 (compare:CC (match_dup 0)
13050 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13051 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13053 (match_operand:SI 2 "gpc_reg_operand" "r")))]
13055 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13056 [(set_attr "length" "12")])
13059 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13060 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13062 (match_operand:DI 2 "gpc_reg_operand" "r")))]
13064 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13065 [(set_attr "length" "12")])
13068 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13070 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13072 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13074 (clobber (match_scratch:SI 3 "=&r,&r"))]
13077 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13079 [(set_attr "type" "compare")
13080 (set_attr "length" "12,16")])
13083 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13085 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13087 (match_operand:SI 2 "gpc_reg_operand" ""))
13089 (clobber (match_scratch:SI 3 ""))]
13090 "TARGET_32BIT && reload_completed"
13091 [(set (match_dup 3)
13092 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13095 (compare:CC (match_dup 3)
13100 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13102 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13104 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13106 (clobber (match_scratch:DI 3 "=&r,&r"))]
13109 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13111 [(set_attr "type" "compare")
13112 (set_attr "length" "12,16")])
13115 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13117 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13119 (match_operand:DI 2 "gpc_reg_operand" ""))
13121 (clobber (match_scratch:DI 3 ""))]
13122 "TARGET_64BIT && reload_completed"
13123 [(set (match_dup 3)
13124 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13127 (compare:CC (match_dup 3)
13132 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13134 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13136 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13138 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13139 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13142 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13144 [(set_attr "type" "compare")
13145 (set_attr "length" "12,16")])
13148 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13150 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13152 (match_operand:SI 2 "gpc_reg_operand" ""))
13154 (set (match_operand:SI 0 "gpc_reg_operand" "")
13155 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13156 "TARGET_32BIT && reload_completed"
13157 [(set (match_dup 0)
13158 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13160 (compare:CC (match_dup 0)
13165 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13167 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13169 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13171 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13172 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13175 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13177 [(set_attr "type" "compare")
13178 (set_attr "length" "12,16")])
13181 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13183 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13185 (match_operand:DI 2 "gpc_reg_operand" ""))
13187 (set (match_operand:DI 0 "gpc_reg_operand" "")
13188 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13189 "TARGET_64BIT && reload_completed"
13190 [(set (match_dup 0)
13191 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13193 (compare:CC (match_dup 0)
13198 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13199 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13200 (match_operand:SI 2 "reg_or_short_operand" "r"))
13201 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13203 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13204 [(set_attr "length" "12")])
13207 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13209 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13210 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13211 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13213 (clobber (match_scratch:SI 4 "=&r,&r"))]
13216 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13218 [(set_attr "type" "compare")
13219 (set_attr "length" "12,16")])
13222 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13224 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13225 (match_operand:SI 2 "reg_or_short_operand" ""))
13226 (match_operand:SI 3 "gpc_reg_operand" ""))
13228 (clobber (match_scratch:SI 4 ""))]
13229 "TARGET_POWER && reload_completed"
13230 [(set (match_dup 4)
13231 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13233 (compare:CC (match_dup 4)
13238 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13240 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13241 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13242 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13244 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13245 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13248 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13250 [(set_attr "type" "compare")
13251 (set_attr "length" "12,16")])
13254 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13256 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13257 (match_operand:SI 2 "reg_or_short_operand" ""))
13258 (match_operand:SI 3 "gpc_reg_operand" ""))
13260 (set (match_operand:SI 0 "gpc_reg_operand" "")
13261 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13262 "TARGET_POWER && reload_completed"
13263 [(set (match_dup 0)
13264 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13266 (compare:CC (match_dup 0)
13271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13272 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13275 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13276 [(set_attr "length" "12")])
13279 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13280 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13283 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13284 [(set_attr "length" "12")])
13287 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13288 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13289 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13291 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13292 [(set_attr "length" "12")])
13295 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13296 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13297 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13299 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
13300 [(set_attr "length" "12")])
13303 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13304 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13305 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13307 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
13308 [(set_attr "length" "12")])
13311 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13313 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13314 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13316 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13317 (gtu:SI (match_dup 1) (match_dup 2)))]
13320 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13322 [(set_attr "type" "compare")
13323 (set_attr "length" "12,16")])
13326 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13328 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13329 (match_operand:SI 2 "reg_or_short_operand" ""))
13331 (set (match_operand:SI 0 "gpc_reg_operand" "")
13332 (gtu:SI (match_dup 1) (match_dup 2)))]
13333 "TARGET_32BIT && reload_completed"
13334 [(set (match_dup 0)
13335 (gtu:SI (match_dup 1) (match_dup 2)))
13337 (compare:CC (match_dup 0)
13342 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13344 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13345 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13347 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13348 (gtu:DI (match_dup 1) (match_dup 2)))]
13351 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13353 [(set_attr "type" "compare")
13354 (set_attr "length" "12,16")])
13357 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13359 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13360 (match_operand:DI 2 "reg_or_short_operand" ""))
13362 (set (match_operand:DI 0 "gpc_reg_operand" "")
13363 (gtu:DI (match_dup 1) (match_dup 2)))]
13364 "TARGET_64BIT && reload_completed"
13365 [(set (match_dup 0)
13366 (gtu:DI (match_dup 1) (match_dup 2)))
13368 (compare:CC (match_dup 0)
13373 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13374 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13375 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
13376 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
13379 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
13380 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
13381 [(set_attr "length" "8,12")])
13384 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13385 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13386 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
13387 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))]
13390 addic %0,%1,%k2\;addze %0,%3
13391 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf%I3c %0,%0,%3"
13392 [(set_attr "length" "8,12")])
13395 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13397 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13398 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13399 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13401 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13404 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13405 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
13408 [(set_attr "type" "compare")
13409 (set_attr "length" "8,12,12,16")])
13412 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13414 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13415 (match_operand:SI 2 "reg_or_short_operand" ""))
13416 (match_operand:SI 3 "gpc_reg_operand" ""))
13418 (clobber (match_scratch:SI 4 ""))]
13419 "TARGET_32BIT && reload_completed"
13420 [(set (match_dup 4)
13421 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13424 (compare:CC (match_dup 4)
13429 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13431 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13432 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13433 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13435 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13438 addic %4,%1,%k2\;addze. %4,%3
13439 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
13442 [(set_attr "type" "compare")
13443 (set_attr "length" "8,12,12,16")])
13446 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13448 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13449 (match_operand:DI 2 "reg_or_short_operand" ""))
13450 (match_operand:DI 3 "gpc_reg_operand" ""))
13452 (clobber (match_scratch:DI 4 ""))]
13453 "TARGET_64BIT && reload_completed"
13454 [(set (match_dup 4)
13455 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13458 (compare:CC (match_dup 4)
13463 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13465 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13466 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13467 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13469 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13470 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13473 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13474 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
13477 [(set_attr "type" "compare")
13478 (set_attr "length" "8,12,12,16")])
13481 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13483 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13484 (match_operand:SI 2 "reg_or_short_operand" ""))
13485 (match_operand:SI 3 "gpc_reg_operand" ""))
13487 (set (match_operand:SI 0 "gpc_reg_operand" "")
13488 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13489 "TARGET_32BIT && reload_completed"
13490 [(set (match_dup 0)
13491 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13493 (compare:CC (match_dup 0)
13498 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13500 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13501 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13502 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13504 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13505 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13508 addic %0,%1,%k2\;addze. %0,%3
13509 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subfc. %0,%0,%3
13512 [(set_attr "type" "compare")
13513 (set_attr "length" "8,12,12,16")])
13516 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13518 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13519 (match_operand:DI 2 "reg_or_short_operand" ""))
13520 (match_operand:DI 3 "gpc_reg_operand" ""))
13522 (set (match_operand:DI 0 "gpc_reg_operand" "")
13523 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13524 "TARGET_64BIT && reload_completed"
13525 [(set (match_dup 0)
13526 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13528 (compare:CC (match_dup 0)
13533 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13534 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13535 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13537 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13538 [(set_attr "length" "8")])
13541 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13542 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13543 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13545 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13546 [(set_attr "length" "8")])
13548 ;; Define both directions of branch and return. If we need a reload
13549 ;; register, we'd rather use CR0 since it is much easier to copy a
13550 ;; register CC value to there.
13554 (if_then_else (match_operator 1 "branch_comparison_operator"
13556 "cc_reg_operand" "y")
13558 (label_ref (match_operand 0 "" ""))
13563 return output_cbranch (operands[1], \"%l0\", 0, insn);
13565 [(set_attr "type" "branch")])
13569 (if_then_else (match_operator 0 "branch_comparison_operator"
13571 "cc_reg_operand" "y")
13578 return output_cbranch (operands[0], NULL, 0, insn);
13580 [(set_attr "type" "branch")
13581 (set_attr "length" "4")])
13585 (if_then_else (match_operator 1 "branch_comparison_operator"
13587 "cc_reg_operand" "y")
13590 (label_ref (match_operand 0 "" ""))))]
13594 return output_cbranch (operands[1], \"%l0\", 1, insn);
13596 [(set_attr "type" "branch")])
13600 (if_then_else (match_operator 0 "branch_comparison_operator"
13602 "cc_reg_operand" "y")
13609 return output_cbranch (operands[0], NULL, 1, insn);
13611 [(set_attr "type" "branch")
13612 (set_attr "length" "4")])
13614 ;; Logic on condition register values.
13616 ; This pattern matches things like
13617 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13618 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13620 ; which are generated by the branch logic.
13621 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13624 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13625 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13626 [(match_operator:SI 2
13627 "branch_positive_comparison_operator"
13629 "cc_reg_operand" "y,y")
13631 (match_operator:SI 4
13632 "branch_positive_comparison_operator"
13634 "cc_reg_operand" "0,y")
13638 "cr%q1 %E0,%j2,%j4"
13639 [(set_attr "type" "cr_logical,delayed_cr")])
13641 ; Why is the constant -1 here, but 1 in the previous pattern?
13642 ; Because ~1 has all but the low bit set.
13644 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13645 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13646 [(not:SI (match_operator:SI 2
13647 "branch_positive_comparison_operator"
13649 "cc_reg_operand" "y,y")
13651 (match_operator:SI 4
13652 "branch_positive_comparison_operator"
13654 "cc_reg_operand" "0,y")
13658 "cr%q1 %E0,%j2,%j4"
13659 [(set_attr "type" "cr_logical,delayed_cr")])
13662 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13663 (compare:CCEQ (match_operator:SI 1
13664 "branch_positive_comparison_operator"
13666 "cc_reg_operand" "0,y")
13670 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13671 [(set_attr "type" "cr_logical,delayed_cr")])
13673 ;; If we are comparing the result of two comparisons, this can be done
13674 ;; using creqv or crxor.
13676 (define_insn_and_split ""
13677 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13678 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13679 [(match_operand 2 "cc_reg_operand" "y")
13681 (match_operator 3 "branch_comparison_operator"
13682 [(match_operand 4 "cc_reg_operand" "y")
13687 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13691 int positive_1, positive_2;
13693 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13694 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13697 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13698 GET_CODE (operands[1])),
13700 operands[2], const0_rtx);
13701 else if (GET_MODE (operands[1]) != SImode)
13702 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13703 operands[2], const0_rtx);
13706 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13707 GET_CODE (operands[3])),
13709 operands[4], const0_rtx);
13710 else if (GET_MODE (operands[3]) != SImode)
13711 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13712 operands[4], const0_rtx);
13714 if (positive_1 == positive_2)
13716 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13717 operands[5] = constm1_rtx;
13721 operands[5] = const1_rtx;
13725 ;; Unconditional branch and return.
13727 (define_insn "jump"
13729 (label_ref (match_operand 0 "" "")))]
13732 [(set_attr "type" "branch")])
13734 (define_insn "return"
13738 [(set_attr "type" "jmpreg")])
13740 (define_expand "indirect_jump"
13741 [(set (pc) (match_operand 0 "register_operand" ""))]
13746 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13748 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13752 (define_insn "indirect_jumpsi"
13753 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13758 [(set_attr "type" "jmpreg")])
13760 (define_insn "indirect_jumpdi"
13761 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13766 [(set_attr "type" "jmpreg")])
13768 ;; Table jump for switch statements:
13769 (define_expand "tablejump"
13770 [(use (match_operand 0 "" ""))
13771 (use (label_ref (match_operand 1 "" "")))]
13776 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13778 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13782 (define_expand "tablejumpsi"
13783 [(set (match_dup 3)
13784 (plus:SI (match_operand:SI 0 "" "")
13786 (parallel [(set (pc) (match_dup 3))
13787 (use (label_ref (match_operand 1 "" "")))])]
13790 { operands[0] = force_reg (SImode, operands[0]);
13791 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13792 operands[3] = gen_reg_rtx (SImode);
13795 (define_expand "tablejumpdi"
13796 [(set (match_dup 4)
13797 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13799 (plus:DI (match_dup 4)
13801 (parallel [(set (pc) (match_dup 3))
13802 (use (label_ref (match_operand 1 "" "")))])]
13805 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13806 operands[3] = gen_reg_rtx (DImode);
13807 operands[4] = gen_reg_rtx (DImode);
13812 (match_operand:SI 0 "register_operand" "c,*l"))
13813 (use (label_ref (match_operand 1 "" "")))]
13818 [(set_attr "type" "jmpreg")])
13822 (match_operand:DI 0 "register_operand" "c,*l"))
13823 (use (label_ref (match_operand 1 "" "")))]
13828 [(set_attr "type" "jmpreg")])
13833 "{cror 0,0,0|nop}")
13835 ;; Define the subtract-one-and-jump insns, starting with the template
13836 ;; so loop.c knows what to generate.
13838 (define_expand "doloop_end"
13839 [(use (match_operand 0 "" "")) ; loop pseudo
13840 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13841 (use (match_operand 2 "" "")) ; max iterations
13842 (use (match_operand 3 "" "")) ; loop level
13843 (use (match_operand 4 "" ""))] ; label
13847 /* Only use this on innermost loops. */
13848 if (INTVAL (operands[3]) > 1)
13852 if (GET_MODE (operands[0]) != DImode)
13854 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13858 if (GET_MODE (operands[0]) != SImode)
13860 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13865 (define_expand "ctrsi"
13866 [(parallel [(set (pc)
13867 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
13869 (label_ref (match_operand 1 "" ""))
13872 (plus:SI (match_dup 0)
13874 (clobber (match_scratch:CC 2 ""))
13875 (clobber (match_scratch:SI 3 ""))])]
13879 (define_expand "ctrdi"
13880 [(parallel [(set (pc)
13881 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
13883 (label_ref (match_operand 1 "" ""))
13886 (plus:DI (match_dup 0)
13888 (clobber (match_scratch:CC 2 ""))
13889 (clobber (match_scratch:DI 3 ""))])]
13893 ;; We need to be able to do this for any operand, including MEM, or we
13894 ;; will cause reload to blow up since we don't allow output reloads on
13896 ;; For the length attribute to be calculated correctly, the
13897 ;; label MUST be operand 0.
13899 (define_insn "*ctrsi_internal1"
13901 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
13903 (label_ref (match_operand 0 "" ""))
13905 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
13906 (plus:SI (match_dup 1)
13908 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13909 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
13913 if (which_alternative != 0)
13915 else if (get_attr_length (insn) == 4)
13916 return \"{bdn|bdnz} %l0\";
13918 return \"bdz $+8\;b %l0\";
13920 [(set_attr "type" "branch")
13921 (set_attr "length" "*,12,16,16")])
13923 (define_insn "*ctrsi_internal2"
13925 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
13928 (label_ref (match_operand 0 "" ""))))
13929 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
13930 (plus:SI (match_dup 1)
13932 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13933 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
13937 if (which_alternative != 0)
13939 else if (get_attr_length (insn) == 4)
13940 return \"bdz %l0\";
13942 return \"{bdn|bdnz} $+8\;b %l0\";
13944 [(set_attr "type" "branch")
13945 (set_attr "length" "*,12,16,16")])
13947 (define_insn "*ctrdi_internal1"
13949 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
13951 (label_ref (match_operand 0 "" ""))
13953 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
13954 (plus:DI (match_dup 1)
13956 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13957 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
13961 if (which_alternative != 0)
13963 else if (get_attr_length (insn) == 4)
13964 return \"{bdn|bdnz} %l0\";
13966 return \"bdz $+8\;b %l0\";
13968 [(set_attr "type" "branch")
13969 (set_attr "length" "*,12,16,16")])
13971 (define_insn "*ctrdi_internal2"
13973 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
13976 (label_ref (match_operand 0 "" ""))))
13977 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
13978 (plus:DI (match_dup 1)
13980 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13981 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
13985 if (which_alternative != 0)
13987 else if (get_attr_length (insn) == 4)
13988 return \"bdz %l0\";
13990 return \"{bdn|bdnz} $+8\;b %l0\";
13992 [(set_attr "type" "branch")
13993 (set_attr "length" "*,12,16,16")])
13995 ;; Similar, but we can use GE since we have a REG_NONNEG.
13997 (define_insn "*ctrsi_internal3"
13999 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14001 (label_ref (match_operand 0 "" ""))
14003 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14004 (plus:SI (match_dup 1)
14006 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14007 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14008 "TARGET_32BIT && find_reg_note (insn, REG_NONNEG, 0)"
14011 if (which_alternative != 0)
14013 else if (get_attr_length (insn) == 4)
14014 return \"{bdn|bdnz} %l0\";
14016 return \"bdz $+8\;b %l0\";
14018 [(set_attr "type" "branch")
14019 (set_attr "length" "*,12,16,16")])
14021 (define_insn "*ctrsi_internal4"
14023 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14026 (label_ref (match_operand 0 "" ""))))
14027 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14028 (plus:SI (match_dup 1)
14030 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14031 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14032 "TARGET_32BIT && find_reg_note (insn, REG_NONNEG, 0)"
14035 if (which_alternative != 0)
14037 else if (get_attr_length (insn) == 4)
14038 return \"bdz %l0\";
14040 return \"{bdn|bdnz} $+8\;b %l0\";
14042 [(set_attr "type" "branch")
14043 (set_attr "length" "*,12,16,16")])
14045 (define_insn "*ctrdi_internal3"
14047 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14049 (label_ref (match_operand 0 "" ""))
14051 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14052 (plus:DI (match_dup 1)
14054 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14055 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14056 "TARGET_64BIT && find_reg_note (insn, REG_NONNEG, 0)"
14059 if (which_alternative != 0)
14061 else if (get_attr_length (insn) == 4)
14062 return \"{bdn|bdnz} %l0\";
14064 return \"bdz $+8\;b %l0\";
14066 [(set_attr "type" "branch")
14067 (set_attr "length" "*,12,16,16")])
14069 (define_insn "*ctrdi_internal4"
14071 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14074 (label_ref (match_operand 0 "" ""))))
14075 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14076 (plus:DI (match_dup 1)
14078 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14079 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14080 "TARGET_64BIT && find_reg_note (insn, REG_NONNEG, 0)"
14083 if (which_alternative != 0)
14085 else if (get_attr_length (insn) == 4)
14086 return \"bdz %l0\";
14088 return \"{bdn|bdnz} $+8\;b %l0\";
14090 [(set_attr "type" "branch")
14091 (set_attr "length" "*,12,16,16")])
14093 ;; Similar but use EQ
14095 (define_insn "*ctrsi_internal5"
14097 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14099 (label_ref (match_operand 0 "" ""))
14101 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14102 (plus:SI (match_dup 1)
14104 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14105 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14109 if (which_alternative != 0)
14111 else if (get_attr_length (insn) == 4)
14112 return \"bdz %l0\";
14114 return \"{bdn|bdnz} $+8\;b %l0\";
14116 [(set_attr "type" "branch")
14117 (set_attr "length" "*,12,16,16")])
14119 (define_insn "*ctrsi_internal6"
14121 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14124 (label_ref (match_operand 0 "" ""))))
14125 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14126 (plus:SI (match_dup 1)
14128 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14129 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14133 if (which_alternative != 0)
14135 else if (get_attr_length (insn) == 4)
14136 return \"{bdn|bdnz} %l0\";
14138 return \"bdz $+8\;b %l0\";
14140 [(set_attr "type" "branch")
14141 (set_attr "length" "*,12,16,16")])
14143 (define_insn "*ctrdi_internal5"
14145 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14147 (label_ref (match_operand 0 "" ""))
14149 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14150 (plus:DI (match_dup 1)
14152 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14153 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14157 if (which_alternative != 0)
14159 else if (get_attr_length (insn) == 4)
14160 return \"bdz %l0\";
14162 return \"{bdn|bdnz} $+8\;b %l0\";
14164 [(set_attr "type" "branch")
14165 (set_attr "length" "*,12,16,16")])
14167 (define_insn "*ctrdi_internal6"
14169 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14172 (label_ref (match_operand 0 "" ""))))
14173 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14174 (plus:DI (match_dup 1)
14176 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14177 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14181 if (which_alternative != 0)
14183 else if (get_attr_length (insn) == 4)
14184 return \"{bdn|bdnz} %l0\";
14186 return \"bdz $+8\;b %l0\";
14188 [(set_attr "type" "branch")
14189 (set_attr "length" "*,12,16,16")])
14191 ;; Now the splitters if we could not allocate the CTR register
14195 (if_then_else (match_operator 2 "comparison_operator"
14196 [(match_operand:SI 1 "gpc_reg_operand" "")
14198 (match_operand 5 "" "")
14199 (match_operand 6 "" "")))
14200 (set (match_operand:SI 0 "gpc_reg_operand" "")
14201 (plus:SI (match_dup 1)
14203 (clobber (match_scratch:CC 3 ""))
14204 (clobber (match_scratch:SI 4 ""))]
14205 "TARGET_32BIT && reload_completed"
14206 [(parallel [(set (match_dup 3)
14207 (compare:CC (plus:SI (match_dup 1)
14211 (plus:SI (match_dup 1)
14213 (set (pc) (if_then_else (match_dup 7)
14217 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14218 operands[3], const0_rtx); }")
14222 (if_then_else (match_operator 2 "comparison_operator"
14223 [(match_operand:SI 1 "gpc_reg_operand" "")
14225 (match_operand 5 "" "")
14226 (match_operand 6 "" "")))
14227 (set (match_operand:SI 0 "nonimmediate_operand" "")
14228 (plus:SI (match_dup 1) (const_int -1)))
14229 (clobber (match_scratch:CC 3 ""))
14230 (clobber (match_scratch:SI 4 ""))]
14231 "TARGET_32BIT && reload_completed
14232 && ! gpc_reg_operand (operands[0], SImode)"
14233 [(parallel [(set (match_dup 3)
14234 (compare:CC (plus:SI (match_dup 1)
14238 (plus:SI (match_dup 1)
14242 (set (pc) (if_then_else (match_dup 7)
14246 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14247 operands[3], const0_rtx); }")
14250 (if_then_else (match_operator 2 "comparison_operator"
14251 [(match_operand:DI 1 "gpc_reg_operand" "")
14253 (match_operand 5 "" "")
14254 (match_operand 6 "" "")))
14255 (set (match_operand:DI 0 "gpc_reg_operand" "")
14256 (plus:DI (match_dup 1)
14258 (clobber (match_scratch:CC 3 ""))
14259 (clobber (match_scratch:DI 4 ""))]
14260 "TARGET_64BIT && reload_completed"
14261 [(parallel [(set (match_dup 3)
14262 (compare:CC (plus:DI (match_dup 1)
14266 (plus:DI (match_dup 1)
14268 (set (pc) (if_then_else (match_dup 7)
14272 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14273 operands[3], const0_rtx); }")
14277 (if_then_else (match_operator 2 "comparison_operator"
14278 [(match_operand:DI 1 "gpc_reg_operand" "")
14280 (match_operand 5 "" "")
14281 (match_operand 6 "" "")))
14282 (set (match_operand:DI 0 "nonimmediate_operand" "")
14283 (plus:DI (match_dup 1) (const_int -1)))
14284 (clobber (match_scratch:CC 3 ""))
14285 (clobber (match_scratch:DI 4 ""))]
14286 "TARGET_64BIT && reload_completed
14287 && ! gpc_reg_operand (operands[0], DImode)"
14288 [(parallel [(set (match_dup 3)
14289 (compare:CC (plus:DI (match_dup 1)
14293 (plus:DI (match_dup 1)
14297 (set (pc) (if_then_else (match_dup 7)
14301 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14302 operands[3], const0_rtx); }")
14304 (define_insn "trap"
14305 [(trap_if (const_int 1) (const_int 0))]
14309 (define_expand "conditional_trap"
14310 [(trap_if (match_operator 0 "trap_comparison_operator"
14311 [(match_dup 2) (match_dup 3)])
14312 (match_operand 1 "const_int_operand" ""))]
14314 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14315 operands[2] = rs6000_compare_op0;
14316 operands[3] = rs6000_compare_op1;")
14319 [(trap_if (match_operator 0 "trap_comparison_operator"
14320 [(match_operand:SI 1 "register_operand" "r")
14321 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14324 "{t|tw}%V0%I2 %1,%2")
14327 [(trap_if (match_operator 0 "trap_comparison_operator"
14328 [(match_operand:DI 1 "register_operand" "r")
14329 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14334 ;; Insns related to generating the function prologue and epilogue.
14336 (define_expand "prologue"
14337 [(use (const_int 0))]
14338 "TARGET_SCHED_PROLOG"
14341 rs6000_emit_prologue ();
14345 (define_insn "*movesi_from_cr_one"
14346 [(match_parallel 0 "mfcr_operation"
14347 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14348 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14349 (match_operand 3 "immediate_operand" "n")]
14350 UNSPEC_MOVESI_FROM_CR))])]
14356 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14358 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14359 operands[4] = GEN_INT (mask);
14360 output_asm_insn (\"mfcr %1,%4\", operands);
14364 [(set_attr "type" "mfcrf")])
14366 (define_insn "movesi_from_cr"
14367 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14368 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14369 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14370 UNSPEC_MOVESI_FROM_CR))]
14373 [(set_attr "type" "mfcr")])
14375 (define_insn "*stmw"
14376 [(match_parallel 0 "stmw_operation"
14377 [(set (match_operand:SI 1 "memory_operand" "=m")
14378 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14380 "{stm|stmw} %2,%1")
14382 (define_insn "*save_fpregs_si"
14383 [(match_parallel 0 "any_operand"
14384 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14385 (use (match_operand:SI 2 "call_operand" "s"))
14386 (set (match_operand:DF 3 "memory_operand" "=m")
14387 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14390 [(set_attr "type" "branch")
14391 (set_attr "length" "4")])
14393 (define_insn "*save_fpregs_di"
14394 [(match_parallel 0 "any_operand"
14395 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14396 (use (match_operand:DI 2 "call_operand" "s"))
14397 (set (match_operand:DF 3 "memory_operand" "=m")
14398 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14401 [(set_attr "type" "branch")
14402 (set_attr "length" "4")])
14404 ; These are to explain that changes to the stack pointer should
14405 ; not be moved over stores to stack memory.
14406 (define_insn "stack_tie"
14407 [(set (match_operand:BLK 0 "memory_operand" "+m")
14408 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14411 [(set_attr "length" "0")])
14414 (define_expand "epilogue"
14415 [(use (const_int 0))]
14416 "TARGET_SCHED_PROLOG"
14419 rs6000_emit_epilogue (FALSE);
14423 ; On some processors, doing the mtcrf one CC register at a time is
14424 ; faster (like on the 604e). On others, doing them all at once is
14425 ; faster; for instance, on the 601 and 750.
14427 (define_expand "movsi_to_cr_one"
14428 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14429 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14430 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14432 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14434 (define_insn "*movsi_to_cr"
14435 [(match_parallel 0 "mtcrf_operation"
14436 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14437 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14438 (match_operand 3 "immediate_operand" "n")]
14439 UNSPEC_MOVESI_TO_CR))])]
14445 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14446 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14447 operands[4] = GEN_INT (mask);
14448 return \"mtcrf %4,%2\";
14450 [(set_attr "type" "mtcr")])
14452 (define_insn "*mtcrfsi"
14453 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14454 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14455 (match_operand 2 "immediate_operand" "n")]
14456 UNSPEC_MOVESI_TO_CR))]
14457 "GET_CODE (operands[0]) == REG
14458 && CR_REGNO_P (REGNO (operands[0]))
14459 && GET_CODE (operands[2]) == CONST_INT
14460 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14462 [(set_attr "type" "mtcr")])
14464 ; The load-multiple instructions have similar properties.
14465 ; Note that "load_multiple" is a name known to the machine-independent
14466 ; code that actually corresponds to the powerpc load-string.
14468 (define_insn "*lmw"
14469 [(match_parallel 0 "lmw_operation"
14470 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14471 (match_operand:SI 2 "memory_operand" "m"))])]
14475 (define_insn "*return_internal_si"
14477 (use (match_operand:SI 0 "register_operand" "lc"))]
14480 [(set_attr "type" "jmpreg")])
14482 (define_insn "*return_internal_di"
14484 (use (match_operand:DI 0 "register_operand" "lc"))]
14487 [(set_attr "type" "jmpreg")])
14489 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14490 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
14492 (define_insn "*return_and_restore_fpregs_si"
14493 [(match_parallel 0 "any_operand"
14495 (use (match_operand:SI 1 "register_operand" "l"))
14496 (use (match_operand:SI 2 "call_operand" "s"))
14497 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14498 (match_operand:DF 4 "memory_operand" "m"))])]
14502 (define_insn "*return_and_restore_fpregs_di"
14503 [(match_parallel 0 "any_operand"
14505 (use (match_operand:DI 1 "register_operand" "l"))
14506 (use (match_operand:DI 2 "call_operand" "s"))
14507 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14508 (match_operand:DF 4 "memory_operand" "m"))])]
14512 ; This is used in compiling the unwind routines.
14513 (define_expand "eh_return"
14514 [(use (match_operand 0 "general_operand" ""))]
14519 emit_insn (gen_eh_set_lr_si (operands[0]));
14521 emit_insn (gen_eh_set_lr_di (operands[0]));
14525 ; We can't expand this before we know where the link register is stored.
14526 (define_insn "eh_set_lr_si"
14527 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")]
14529 (clobber (match_scratch:SI 1 "=&b"))]
14533 (define_insn "eh_set_lr_di"
14534 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
14536 (clobber (match_scratch:DI 1 "=&b"))]
14541 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14542 (clobber (match_scratch 1 ""))]
14547 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14551 (define_insn "prefetch"
14552 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14553 (match_operand:SI 1 "const_int_operand" "n")
14554 (match_operand:SI 2 "const_int_operand" "n"))]
14558 if (GET_CODE (operands[0]) == REG)
14559 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14560 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14562 [(set_attr "type" "load")])
14564 (include "altivec.md")