1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005 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
53 (UNSPEC_MV_CR_GT 31) ; move_from_CR_eq_bit
57 ;; UNSPEC_VOLATILE usage
62 (UNSPECV_EH_RR 9) ; eh_reg_restore
65 ;; Define an insn type attribute. This is used in function unit delay
67 (define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,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"
68 (const_string "integer"))
71 ; '(pc)' in the following doesn't include the instruction itself; it is
72 ; calculated as if the instruction had zero size.
73 (define_attr "length" ""
74 (if_then_else (eq_attr "type" "branch")
75 (if_then_else (and (ge (minus (match_dup 0) (pc))
77 (lt (minus (match_dup 0) (pc))
83 ;; Processor type -- this attribute must exactly match the processor_type
84 ;; enumeration in rs6000.h.
86 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
87 (const (symbol_ref "rs6000_cpu_attr")))
89 (automata_option "ndfa")
102 (include "power4.md")
103 (include "power5.md")
104 (include "darwin.md")
107 ;; This mode macro allows :P to be used for patterns that operate on
108 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
109 (define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
111 ;; Start with fixed-point load and store insns. Here we put only the more
112 ;; complex forms. Basic data transfer is done later.
114 (define_expand "zero_extendqidi2"
115 [(set (match_operand:DI 0 "gpc_reg_operand" "")
116 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
121 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
122 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
127 [(set_attr "type" "load,*")])
130 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
131 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
133 (clobber (match_scratch:DI 2 "=r,r"))]
138 [(set_attr "type" "compare")
139 (set_attr "length" "4,8")])
142 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
143 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
145 (clobber (match_scratch:DI 2 ""))]
146 "TARGET_POWERPC64 && reload_completed"
148 (zero_extend:DI (match_dup 1)))
150 (compare:CC (match_dup 2)
155 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
156 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
158 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
159 (zero_extend:DI (match_dup 1)))]
164 [(set_attr "type" "compare")
165 (set_attr "length" "4,8")])
168 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
169 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
171 (set (match_operand:DI 0 "gpc_reg_operand" "")
172 (zero_extend:DI (match_dup 1)))]
173 "TARGET_POWERPC64 && reload_completed"
175 (zero_extend:DI (match_dup 1)))
177 (compare:CC (match_dup 0)
181 (define_insn "extendqidi2"
182 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
183 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
188 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
189 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
191 (clobber (match_scratch:DI 2 "=r,r"))]
196 [(set_attr "type" "compare")
197 (set_attr "length" "4,8")])
200 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
201 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
203 (clobber (match_scratch:DI 2 ""))]
204 "TARGET_POWERPC64 && reload_completed"
206 (sign_extend:DI (match_dup 1)))
208 (compare:CC (match_dup 2)
213 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
214 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
216 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
217 (sign_extend:DI (match_dup 1)))]
222 [(set_attr "type" "compare")
223 (set_attr "length" "4,8")])
226 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
227 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
229 (set (match_operand:DI 0 "gpc_reg_operand" "")
230 (sign_extend:DI (match_dup 1)))]
231 "TARGET_POWERPC64 && reload_completed"
233 (sign_extend:DI (match_dup 1)))
235 (compare:CC (match_dup 0)
239 (define_expand "zero_extendhidi2"
240 [(set (match_operand:DI 0 "gpc_reg_operand" "")
241 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
246 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
247 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
252 [(set_attr "type" "load,*")])
255 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
256 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
258 (clobber (match_scratch:DI 2 "=r,r"))]
263 [(set_attr "type" "compare")
264 (set_attr "length" "4,8")])
267 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
268 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
270 (clobber (match_scratch:DI 2 ""))]
271 "TARGET_POWERPC64 && reload_completed"
273 (zero_extend:DI (match_dup 1)))
275 (compare:CC (match_dup 2)
280 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
281 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
283 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
284 (zero_extend:DI (match_dup 1)))]
289 [(set_attr "type" "compare")
290 (set_attr "length" "4,8")])
293 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
294 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
296 (set (match_operand:DI 0 "gpc_reg_operand" "")
297 (zero_extend:DI (match_dup 1)))]
298 "TARGET_POWERPC64 && reload_completed"
300 (zero_extend:DI (match_dup 1)))
302 (compare:CC (match_dup 0)
306 (define_expand "extendhidi2"
307 [(set (match_operand:DI 0 "gpc_reg_operand" "")
308 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
313 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
314 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
319 [(set_attr "type" "load_ext,*")])
322 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
323 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
325 (clobber (match_scratch:DI 2 "=r,r"))]
330 [(set_attr "type" "compare")
331 (set_attr "length" "4,8")])
334 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
335 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
337 (clobber (match_scratch:DI 2 ""))]
338 "TARGET_POWERPC64 && reload_completed"
340 (sign_extend:DI (match_dup 1)))
342 (compare:CC (match_dup 2)
347 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
348 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
350 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
351 (sign_extend:DI (match_dup 1)))]
356 [(set_attr "type" "compare")
357 (set_attr "length" "4,8")])
360 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
361 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
363 (set (match_operand:DI 0 "gpc_reg_operand" "")
364 (sign_extend:DI (match_dup 1)))]
365 "TARGET_POWERPC64 && reload_completed"
367 (sign_extend:DI (match_dup 1)))
369 (compare:CC (match_dup 0)
373 (define_expand "zero_extendsidi2"
374 [(set (match_operand:DI 0 "gpc_reg_operand" "")
375 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
380 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
381 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
386 [(set_attr "type" "load,*")])
389 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
390 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
392 (clobber (match_scratch:DI 2 "=r,r"))]
397 [(set_attr "type" "compare")
398 (set_attr "length" "4,8")])
401 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
402 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
404 (clobber (match_scratch:DI 2 ""))]
405 "TARGET_POWERPC64 && reload_completed"
407 (zero_extend:DI (match_dup 1)))
409 (compare:CC (match_dup 2)
414 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
415 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
417 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
418 (zero_extend:DI (match_dup 1)))]
423 [(set_attr "type" "compare")
424 (set_attr "length" "4,8")])
427 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
428 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
430 (set (match_operand:DI 0 "gpc_reg_operand" "")
431 (zero_extend:DI (match_dup 1)))]
432 "TARGET_POWERPC64 && reload_completed"
434 (zero_extend:DI (match_dup 1)))
436 (compare:CC (match_dup 0)
440 (define_expand "extendsidi2"
441 [(set (match_operand:DI 0 "gpc_reg_operand" "")
442 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
447 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
448 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
453 [(set_attr "type" "load_ext,*")])
456 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
457 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
459 (clobber (match_scratch:DI 2 "=r,r"))]
464 [(set_attr "type" "compare")
465 (set_attr "length" "4,8")])
468 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
469 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
471 (clobber (match_scratch:DI 2 ""))]
472 "TARGET_POWERPC64 && reload_completed"
474 (sign_extend:DI (match_dup 1)))
476 (compare:CC (match_dup 2)
481 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
482 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
484 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
485 (sign_extend:DI (match_dup 1)))]
490 [(set_attr "type" "compare")
491 (set_attr "length" "4,8")])
494 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
495 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
497 (set (match_operand:DI 0 "gpc_reg_operand" "")
498 (sign_extend:DI (match_dup 1)))]
499 "TARGET_POWERPC64 && reload_completed"
501 (sign_extend:DI (match_dup 1)))
503 (compare:CC (match_dup 0)
507 (define_expand "zero_extendqisi2"
508 [(set (match_operand:SI 0 "gpc_reg_operand" "")
509 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
514 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
515 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
519 {rlinm|rlwinm} %0,%1,0,0xff"
520 [(set_attr "type" "load,*")])
523 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
524 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
526 (clobber (match_scratch:SI 2 "=r,r"))]
529 {andil.|andi.} %2,%1,0xff
531 [(set_attr "type" "compare")
532 (set_attr "length" "4,8")])
535 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
536 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
538 (clobber (match_scratch:SI 2 ""))]
541 (zero_extend:SI (match_dup 1)))
543 (compare:CC (match_dup 2)
548 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
549 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
551 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
552 (zero_extend:SI (match_dup 1)))]
555 {andil.|andi.} %0,%1,0xff
557 [(set_attr "type" "compare")
558 (set_attr "length" "4,8")])
561 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
562 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
564 (set (match_operand:SI 0 "gpc_reg_operand" "")
565 (zero_extend:SI (match_dup 1)))]
568 (zero_extend:SI (match_dup 1)))
570 (compare:CC (match_dup 0)
574 (define_expand "extendqisi2"
575 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
576 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
581 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
582 else if (TARGET_POWER)
583 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
585 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
589 (define_insn "extendqisi2_ppc"
590 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
591 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
596 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
597 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
599 (clobber (match_scratch:SI 2 "=r,r"))]
604 [(set_attr "type" "compare")
605 (set_attr "length" "4,8")])
608 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
609 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
611 (clobber (match_scratch:SI 2 ""))]
612 "TARGET_POWERPC && reload_completed"
614 (sign_extend:SI (match_dup 1)))
616 (compare:CC (match_dup 2)
621 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
622 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
624 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
625 (sign_extend:SI (match_dup 1)))]
630 [(set_attr "type" "compare")
631 (set_attr "length" "4,8")])
634 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
635 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
637 (set (match_operand:SI 0 "gpc_reg_operand" "")
638 (sign_extend:SI (match_dup 1)))]
639 "TARGET_POWERPC && reload_completed"
641 (sign_extend:SI (match_dup 1)))
643 (compare:CC (match_dup 0)
647 (define_expand "extendqisi2_power"
648 [(parallel [(set (match_dup 2)
649 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
651 (clobber (scratch:SI))])
652 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
653 (ashiftrt:SI (match_dup 2)
655 (clobber (scratch:SI))])]
658 { operands[1] = gen_lowpart (SImode, operands[1]);
659 operands[2] = gen_reg_rtx (SImode); }")
661 (define_expand "extendqisi2_no_power"
663 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
665 (set (match_operand:SI 0 "gpc_reg_operand" "")
666 (ashiftrt:SI (match_dup 2)
668 "! TARGET_POWER && ! TARGET_POWERPC"
670 { operands[1] = gen_lowpart (SImode, operands[1]);
671 operands[2] = gen_reg_rtx (SImode); }")
673 (define_expand "zero_extendqihi2"
674 [(set (match_operand:HI 0 "gpc_reg_operand" "")
675 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
680 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
681 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
685 {rlinm|rlwinm} %0,%1,0,0xff"
686 [(set_attr "type" "load,*")])
689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
690 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
692 (clobber (match_scratch:HI 2 "=r,r"))]
695 {andil.|andi.} %2,%1,0xff
697 [(set_attr "type" "compare")
698 (set_attr "length" "4,8")])
701 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
702 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
704 (clobber (match_scratch:HI 2 ""))]
707 (zero_extend:HI (match_dup 1)))
709 (compare:CC (match_dup 2)
714 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
715 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
717 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
718 (zero_extend:HI (match_dup 1)))]
721 {andil.|andi.} %0,%1,0xff
723 [(set_attr "type" "compare")
724 (set_attr "length" "4,8")])
727 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
728 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
730 (set (match_operand:HI 0 "gpc_reg_operand" "")
731 (zero_extend:HI (match_dup 1)))]
734 (zero_extend:HI (match_dup 1)))
736 (compare:CC (match_dup 0)
740 (define_expand "extendqihi2"
741 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
742 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
747 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
748 else if (TARGET_POWER)
749 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
751 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
755 (define_insn "extendqihi2_ppc"
756 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
757 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
762 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
763 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
765 (clobber (match_scratch:HI 2 "=r,r"))]
770 [(set_attr "type" "compare")
771 (set_attr "length" "4,8")])
774 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
775 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
777 (clobber (match_scratch:HI 2 ""))]
778 "TARGET_POWERPC && reload_completed"
780 (sign_extend:HI (match_dup 1)))
782 (compare:CC (match_dup 2)
787 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
788 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
790 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
791 (sign_extend:HI (match_dup 1)))]
796 [(set_attr "type" "compare")
797 (set_attr "length" "4,8")])
800 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
801 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
803 (set (match_operand:HI 0 "gpc_reg_operand" "")
804 (sign_extend:HI (match_dup 1)))]
805 "TARGET_POWERPC && reload_completed"
807 (sign_extend:HI (match_dup 1)))
809 (compare:CC (match_dup 0)
813 (define_expand "extendqihi2_power"
814 [(parallel [(set (match_dup 2)
815 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
817 (clobber (scratch:SI))])
818 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
819 (ashiftrt:SI (match_dup 2)
821 (clobber (scratch:SI))])]
824 { operands[0] = gen_lowpart (SImode, operands[0]);
825 operands[1] = gen_lowpart (SImode, operands[1]);
826 operands[2] = gen_reg_rtx (SImode); }")
828 (define_expand "extendqihi2_no_power"
830 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
832 (set (match_operand:HI 0 "gpc_reg_operand" "")
833 (ashiftrt:SI (match_dup 2)
835 "! TARGET_POWER && ! TARGET_POWERPC"
837 { operands[0] = gen_lowpart (SImode, operands[0]);
838 operands[1] = gen_lowpart (SImode, operands[1]);
839 operands[2] = gen_reg_rtx (SImode); }")
841 (define_expand "zero_extendhisi2"
842 [(set (match_operand:SI 0 "gpc_reg_operand" "")
843 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
848 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
849 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
853 {rlinm|rlwinm} %0,%1,0,0xffff"
854 [(set_attr "type" "load,*")])
857 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
858 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
860 (clobber (match_scratch:SI 2 "=r,r"))]
863 {andil.|andi.} %2,%1,0xffff
865 [(set_attr "type" "compare")
866 (set_attr "length" "4,8")])
869 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
870 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
872 (clobber (match_scratch:SI 2 ""))]
875 (zero_extend:SI (match_dup 1)))
877 (compare:CC (match_dup 2)
882 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
883 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
885 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
886 (zero_extend:SI (match_dup 1)))]
889 {andil.|andi.} %0,%1,0xffff
891 [(set_attr "type" "compare")
892 (set_attr "length" "4,8")])
895 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
896 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
898 (set (match_operand:SI 0 "gpc_reg_operand" "")
899 (zero_extend:SI (match_dup 1)))]
902 (zero_extend:SI (match_dup 1)))
904 (compare:CC (match_dup 0)
908 (define_expand "extendhisi2"
909 [(set (match_operand:SI 0 "gpc_reg_operand" "")
910 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
915 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
916 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
921 [(set_attr "type" "load_ext,*")])
924 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
925 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
927 (clobber (match_scratch:SI 2 "=r,r"))]
932 [(set_attr "type" "compare")
933 (set_attr "length" "4,8")])
936 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
937 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
939 (clobber (match_scratch:SI 2 ""))]
942 (sign_extend:SI (match_dup 1)))
944 (compare:CC (match_dup 2)
949 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
950 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
952 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
953 (sign_extend:SI (match_dup 1)))]
958 [(set_attr "type" "compare")
959 (set_attr "length" "4,8")])
962 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
963 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
965 (set (match_operand:SI 0 "gpc_reg_operand" "")
966 (sign_extend:SI (match_dup 1)))]
969 (sign_extend:SI (match_dup 1)))
971 (compare:CC (match_dup 0)
975 ;; Fixed-point arithmetic insns.
977 ;; Discourage ai/addic because of carry but provide it in an alternative
978 ;; allowing register zero as source.
979 (define_expand "addsi3"
980 [(set (match_operand:SI 0 "gpc_reg_operand" "")
981 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
982 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
986 if (GET_CODE (operands[2]) == CONST_INT
987 && ! add_operand (operands[2], SImode))
989 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
990 ? operands[0] : gen_reg_rtx (SImode));
992 HOST_WIDE_INT val = INTVAL (operands[2]);
993 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
994 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
996 /* The ordering here is important for the prolog expander.
997 When space is allocated from the stack, adding 'low' first may
998 produce a temporary deallocation (which would be bad). */
999 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
1000 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
1005 (define_insn "*addsi3_internal1"
1006 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1007 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1008 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1012 {cal %0,%2(%1)|addi %0,%1,%2}
1014 {cau|addis} %0,%1,%v2"
1015 [(set_attr "length" "4,4,4,4")])
1017 (define_insn "addsi3_high"
1018 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1019 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1020 (high:SI (match_operand 2 "" ""))))]
1021 "TARGET_MACHO && !TARGET_64BIT"
1022 "{cau|addis} %0,%1,ha16(%2)"
1023 [(set_attr "length" "4")])
1025 (define_insn "*addsi3_internal2"
1026 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1027 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1028 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1030 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1033 {cax.|add.} %3,%1,%2
1034 {ai.|addic.} %3,%1,%2
1037 [(set_attr "type" "fast_compare,compare,compare,compare")
1038 (set_attr "length" "4,4,8,8")])
1041 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1042 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1043 (match_operand:SI 2 "reg_or_short_operand" ""))
1045 (clobber (match_scratch:SI 3 ""))]
1046 "TARGET_32BIT && reload_completed"
1048 (plus:SI (match_dup 1)
1051 (compare:CC (match_dup 3)
1055 (define_insn "*addsi3_internal3"
1056 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1057 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1058 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1060 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1061 (plus:SI (match_dup 1)
1065 {cax.|add.} %0,%1,%2
1066 {ai.|addic.} %0,%1,%2
1069 [(set_attr "type" "fast_compare,compare,compare,compare")
1070 (set_attr "length" "4,4,8,8")])
1073 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1074 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1075 (match_operand:SI 2 "reg_or_short_operand" ""))
1077 (set (match_operand:SI 0 "gpc_reg_operand" "")
1078 (plus:SI (match_dup 1) (match_dup 2)))]
1079 "TARGET_32BIT && reload_completed"
1081 (plus:SI (match_dup 1)
1084 (compare:CC (match_dup 0)
1088 ;; Split an add that we can't do in one insn into two insns, each of which
1089 ;; does one 16-bit part. This is used by combine. Note that the low-order
1090 ;; add should be last in case the result gets used in an address.
1093 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1094 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1095 (match_operand:SI 2 "non_add_cint_operand" "")))]
1097 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1098 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1101 HOST_WIDE_INT val = INTVAL (operands[2]);
1102 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1103 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1105 operands[3] = GEN_INT (rest);
1106 operands[4] = GEN_INT (low);
1109 (define_insn "one_cmplsi2"
1110 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1111 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1116 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1117 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1119 (clobber (match_scratch:SI 2 "=r,r"))]
1124 [(set_attr "type" "compare")
1125 (set_attr "length" "4,8")])
1128 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1129 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1131 (clobber (match_scratch:SI 2 ""))]
1132 "TARGET_32BIT && reload_completed"
1134 (not:SI (match_dup 1)))
1136 (compare:CC (match_dup 2)
1141 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1142 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1144 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1145 (not:SI (match_dup 1)))]
1150 [(set_attr "type" "compare")
1151 (set_attr "length" "4,8")])
1154 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1155 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1157 (set (match_operand:SI 0 "gpc_reg_operand" "")
1158 (not:SI (match_dup 1)))]
1159 "TARGET_32BIT && reload_completed"
1161 (not:SI (match_dup 1)))
1163 (compare:CC (match_dup 0)
1168 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1169 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1170 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1172 "{sf%I1|subf%I1c} %0,%2,%1")
1175 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1176 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1177 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1184 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1185 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1186 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1188 (clobber (match_scratch:SI 3 "=r,r"))]
1191 {sf.|subfc.} %3,%2,%1
1193 [(set_attr "type" "compare")
1194 (set_attr "length" "4,8")])
1197 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1198 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1199 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1201 (clobber (match_scratch:SI 3 "=r,r"))]
1202 "TARGET_POWERPC && TARGET_32BIT"
1206 [(set_attr "type" "fast_compare")
1207 (set_attr "length" "4,8")])
1210 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1211 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1212 (match_operand:SI 2 "gpc_reg_operand" ""))
1214 (clobber (match_scratch:SI 3 ""))]
1215 "TARGET_32BIT && reload_completed"
1217 (minus:SI (match_dup 1)
1220 (compare:CC (match_dup 3)
1225 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1226 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1227 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1229 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1230 (minus:SI (match_dup 1) (match_dup 2)))]
1233 {sf.|subfc.} %0,%2,%1
1235 [(set_attr "type" "compare")
1236 (set_attr "length" "4,8")])
1239 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1240 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1241 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1243 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1244 (minus:SI (match_dup 1)
1246 "TARGET_POWERPC && TARGET_32BIT"
1250 [(set_attr "type" "fast_compare")
1251 (set_attr "length" "4,8")])
1254 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1255 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1256 (match_operand:SI 2 "gpc_reg_operand" ""))
1258 (set (match_operand:SI 0 "gpc_reg_operand" "")
1259 (minus:SI (match_dup 1)
1261 "TARGET_32BIT && reload_completed"
1263 (minus:SI (match_dup 1)
1266 (compare:CC (match_dup 0)
1270 (define_expand "subsi3"
1271 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1272 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1273 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1277 if (GET_CODE (operands[2]) == CONST_INT)
1279 emit_insn (gen_addsi3 (operands[0], operands[1],
1280 negate_rtx (SImode, operands[2])));
1285 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1286 ;; instruction and some auxiliary computations. Then we just have a single
1287 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1290 (define_expand "sminsi3"
1292 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1293 (match_operand:SI 2 "reg_or_short_operand" ""))
1295 (minus:SI (match_dup 2) (match_dup 1))))
1296 (set (match_operand:SI 0 "gpc_reg_operand" "")
1297 (minus:SI (match_dup 2) (match_dup 3)))]
1298 "TARGET_POWER || TARGET_ISEL"
1303 operands[2] = force_reg (SImode, operands[2]);
1304 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1308 operands[3] = gen_reg_rtx (SImode);
1312 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1313 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1314 (match_operand:SI 2 "reg_or_short_operand" "")))
1315 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1318 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1320 (minus:SI (match_dup 2) (match_dup 1))))
1321 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1324 (define_expand "smaxsi3"
1326 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1327 (match_operand:SI 2 "reg_or_short_operand" ""))
1329 (minus:SI (match_dup 2) (match_dup 1))))
1330 (set (match_operand:SI 0 "gpc_reg_operand" "")
1331 (plus:SI (match_dup 3) (match_dup 1)))]
1332 "TARGET_POWER || TARGET_ISEL"
1337 operands[2] = force_reg (SImode, operands[2]);
1338 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1341 operands[3] = gen_reg_rtx (SImode);
1345 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1346 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1347 (match_operand:SI 2 "reg_or_short_operand" "")))
1348 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1351 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1353 (minus:SI (match_dup 2) (match_dup 1))))
1354 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1357 (define_expand "uminsi3"
1358 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1360 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1362 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1364 (minus:SI (match_dup 4) (match_dup 3))))
1365 (set (match_operand:SI 0 "gpc_reg_operand" "")
1366 (minus:SI (match_dup 2) (match_dup 3)))]
1367 "TARGET_POWER || TARGET_ISEL"
1372 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1375 operands[3] = gen_reg_rtx (SImode);
1376 operands[4] = gen_reg_rtx (SImode);
1377 operands[5] = GEN_INT (-2147483647 - 1);
1380 (define_expand "umaxsi3"
1381 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1383 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1385 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1387 (minus:SI (match_dup 4) (match_dup 3))))
1388 (set (match_operand:SI 0 "gpc_reg_operand" "")
1389 (plus:SI (match_dup 3) (match_dup 1)))]
1390 "TARGET_POWER || TARGET_ISEL"
1395 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1398 operands[3] = gen_reg_rtx (SImode);
1399 operands[4] = gen_reg_rtx (SImode);
1400 operands[5] = GEN_INT (-2147483647 - 1);
1404 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1405 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1406 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1408 (minus:SI (match_dup 2) (match_dup 1))))]
1413 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1415 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1416 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1418 (minus:SI (match_dup 2) (match_dup 1)))
1420 (clobber (match_scratch:SI 3 "=r,r"))]
1425 [(set_attr "type" "delayed_compare")
1426 (set_attr "length" "4,8")])
1429 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1431 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1432 (match_operand:SI 2 "reg_or_short_operand" ""))
1434 (minus:SI (match_dup 2) (match_dup 1)))
1436 (clobber (match_scratch:SI 3 ""))]
1437 "TARGET_POWER && reload_completed"
1439 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1441 (minus:SI (match_dup 2) (match_dup 1))))
1443 (compare:CC (match_dup 3)
1448 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1450 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1451 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1453 (minus:SI (match_dup 2) (match_dup 1)))
1455 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1456 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1458 (minus:SI (match_dup 2) (match_dup 1))))]
1463 [(set_attr "type" "delayed_compare")
1464 (set_attr "length" "4,8")])
1467 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1469 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1470 (match_operand:SI 2 "reg_or_short_operand" ""))
1472 (minus:SI (match_dup 2) (match_dup 1)))
1474 (set (match_operand:SI 0 "gpc_reg_operand" "")
1475 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1477 (minus:SI (match_dup 2) (match_dup 1))))]
1478 "TARGET_POWER && reload_completed"
1480 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1482 (minus:SI (match_dup 2) (match_dup 1))))
1484 (compare:CC (match_dup 0)
1488 ;; We don't need abs with condition code because such comparisons should
1490 (define_expand "abssi2"
1491 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1492 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1498 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1501 else if (! TARGET_POWER)
1503 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1508 (define_insn "*abssi2_power"
1509 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1510 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1514 (define_insn_and_split "abssi2_isel"
1515 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1516 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1517 (clobber (match_scratch:SI 2 "=&b"))
1518 (clobber (match_scratch:CC 3 "=y"))]
1521 "&& reload_completed"
1522 [(set (match_dup 2) (neg:SI (match_dup 1)))
1524 (compare:CC (match_dup 1)
1527 (if_then_else:SI (ge (match_dup 3)
1533 (define_insn_and_split "abssi2_nopower"
1534 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1535 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1536 (clobber (match_scratch:SI 2 "=&r,&r"))]
1537 "! TARGET_POWER && ! TARGET_ISEL"
1539 "&& reload_completed"
1540 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1541 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1542 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1545 (define_insn "*nabs_power"
1546 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1547 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1551 (define_insn_and_split "*nabs_nopower"
1552 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1553 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1554 (clobber (match_scratch:SI 2 "=&r,&r"))]
1557 "&& reload_completed"
1558 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1559 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1560 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1563 (define_insn "negsi2"
1564 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1565 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1570 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1571 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1573 (clobber (match_scratch:SI 2 "=r,r"))]
1578 [(set_attr "type" "fast_compare")
1579 (set_attr "length" "4,8")])
1582 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1583 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1585 (clobber (match_scratch:SI 2 ""))]
1586 "TARGET_32BIT && reload_completed"
1588 (neg:SI (match_dup 1)))
1590 (compare:CC (match_dup 2)
1595 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1596 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1598 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1599 (neg:SI (match_dup 1)))]
1604 [(set_attr "type" "fast_compare")
1605 (set_attr "length" "4,8")])
1608 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1609 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1611 (set (match_operand:SI 0 "gpc_reg_operand" "")
1612 (neg:SI (match_dup 1)))]
1613 "TARGET_32BIT && reload_completed"
1615 (neg:SI (match_dup 1)))
1617 (compare:CC (match_dup 0)
1621 (define_insn "clzsi2"
1622 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1623 (clz:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1625 "{cntlz|cntlzw} %0,%1")
1627 (define_expand "ctzsi2"
1629 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1630 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1632 (clobber (scratch:CC))])
1633 (set (match_dup 4) (clz:SI (match_dup 3)))
1634 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1635 (minus:SI (const_int 31) (match_dup 4)))]
1638 operands[2] = gen_reg_rtx (SImode);
1639 operands[3] = gen_reg_rtx (SImode);
1640 operands[4] = gen_reg_rtx (SImode);
1643 (define_expand "ffssi2"
1645 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1646 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1648 (clobber (scratch:CC))])
1649 (set (match_dup 4) (clz:SI (match_dup 3)))
1650 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1651 (minus:SI (const_int 32) (match_dup 4)))]
1654 operands[2] = gen_reg_rtx (SImode);
1655 operands[3] = gen_reg_rtx (SImode);
1656 operands[4] = gen_reg_rtx (SImode);
1659 (define_expand "mulsi3"
1660 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1661 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1662 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1667 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1669 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1673 (define_insn "mulsi3_mq"
1674 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1675 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1676 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1677 (clobber (match_scratch:SI 3 "=q,q"))]
1680 {muls|mullw} %0,%1,%2
1681 {muli|mulli} %0,%1,%2"
1683 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1684 (const_string "imul3")
1685 (match_operand:SI 2 "short_cint_operand" "")
1686 (const_string "imul2")]
1687 (const_string "imul")))])
1689 (define_insn "mulsi3_no_mq"
1690 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1691 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1692 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1695 {muls|mullw} %0,%1,%2
1696 {muli|mulli} %0,%1,%2"
1698 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1699 (const_string "imul3")
1700 (match_operand:SI 2 "short_cint_operand" "")
1701 (const_string "imul2")]
1702 (const_string "imul")))])
1704 (define_insn "*mulsi3_mq_internal1"
1705 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1706 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1707 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1709 (clobber (match_scratch:SI 3 "=r,r"))
1710 (clobber (match_scratch:SI 4 "=q,q"))]
1713 {muls.|mullw.} %3,%1,%2
1715 [(set_attr "type" "imul_compare")
1716 (set_attr "length" "4,8")])
1719 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1720 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1721 (match_operand:SI 2 "gpc_reg_operand" ""))
1723 (clobber (match_scratch:SI 3 ""))
1724 (clobber (match_scratch:SI 4 ""))]
1725 "TARGET_POWER && reload_completed"
1726 [(parallel [(set (match_dup 3)
1727 (mult:SI (match_dup 1) (match_dup 2)))
1728 (clobber (match_dup 4))])
1730 (compare:CC (match_dup 3)
1734 (define_insn "*mulsi3_no_mq_internal1"
1735 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1736 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1737 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1739 (clobber (match_scratch:SI 3 "=r,r"))]
1742 {muls.|mullw.} %3,%1,%2
1744 [(set_attr "type" "imul_compare")
1745 (set_attr "length" "4,8")])
1748 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1749 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1750 (match_operand:SI 2 "gpc_reg_operand" ""))
1752 (clobber (match_scratch:SI 3 ""))]
1753 "! TARGET_POWER && reload_completed"
1755 (mult:SI (match_dup 1) (match_dup 2)))
1757 (compare:CC (match_dup 3)
1761 (define_insn "*mulsi3_mq_internal2"
1762 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1763 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1764 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1766 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1767 (mult:SI (match_dup 1) (match_dup 2)))
1768 (clobber (match_scratch:SI 4 "=q,q"))]
1771 {muls.|mullw.} %0,%1,%2
1773 [(set_attr "type" "imul_compare")
1774 (set_attr "length" "4,8")])
1777 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1778 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1779 (match_operand:SI 2 "gpc_reg_operand" ""))
1781 (set (match_operand:SI 0 "gpc_reg_operand" "")
1782 (mult:SI (match_dup 1) (match_dup 2)))
1783 (clobber (match_scratch:SI 4 ""))]
1784 "TARGET_POWER && reload_completed"
1785 [(parallel [(set (match_dup 0)
1786 (mult:SI (match_dup 1) (match_dup 2)))
1787 (clobber (match_dup 4))])
1789 (compare:CC (match_dup 0)
1793 (define_insn "*mulsi3_no_mq_internal2"
1794 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1795 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1796 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1798 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1799 (mult:SI (match_dup 1) (match_dup 2)))]
1802 {muls.|mullw.} %0,%1,%2
1804 [(set_attr "type" "imul_compare")
1805 (set_attr "length" "4,8")])
1808 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1809 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1810 (match_operand:SI 2 "gpc_reg_operand" ""))
1812 (set (match_operand:SI 0 "gpc_reg_operand" "")
1813 (mult:SI (match_dup 1) (match_dup 2)))]
1814 "! TARGET_POWER && reload_completed"
1816 (mult:SI (match_dup 1) (match_dup 2)))
1818 (compare:CC (match_dup 0)
1822 ;; Operand 1 is divided by operand 2; quotient goes to operand
1823 ;; 0 and remainder to operand 3.
1824 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1826 (define_expand "divmodsi4"
1827 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1828 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1829 (match_operand:SI 2 "gpc_reg_operand" "")))
1830 (set (match_operand:SI 3 "register_operand" "")
1831 (mod:SI (match_dup 1) (match_dup 2)))])]
1832 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1835 if (! TARGET_POWER && ! TARGET_POWERPC)
1837 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1838 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1839 emit_insn (gen_divss_call ());
1840 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1841 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1846 (define_insn "*divmodsi4_internal"
1847 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1848 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1849 (match_operand:SI 2 "gpc_reg_operand" "r")))
1850 (set (match_operand:SI 3 "register_operand" "=q")
1851 (mod:SI (match_dup 1) (match_dup 2)))]
1854 [(set_attr "type" "idiv")])
1856 (define_expand "udivsi3"
1857 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1858 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1859 (match_operand:SI 2 "gpc_reg_operand" "")))]
1860 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1863 if (! TARGET_POWER && ! TARGET_POWERPC)
1865 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1866 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1867 emit_insn (gen_quous_call ());
1868 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1871 else if (TARGET_POWER)
1873 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1878 (define_insn "udivsi3_mq"
1879 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1880 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1881 (match_operand:SI 2 "gpc_reg_operand" "r")))
1882 (clobber (match_scratch:SI 3 "=q"))]
1883 "TARGET_POWERPC && TARGET_POWER"
1885 [(set_attr "type" "idiv")])
1887 (define_insn "*udivsi3_no_mq"
1888 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1889 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1890 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1891 "TARGET_POWERPC && ! TARGET_POWER"
1893 [(set_attr "type" "idiv")])
1895 ;; For powers of two we can do srai/aze for divide and then adjust for
1896 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1897 ;; used; for PowerPC, force operands into register and do a normal divide;
1898 ;; for AIX common-mode, use quoss call on register operands.
1899 (define_expand "divsi3"
1900 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1901 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1902 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1906 if (GET_CODE (operands[2]) == CONST_INT
1907 && INTVAL (operands[2]) > 0
1908 && exact_log2 (INTVAL (operands[2])) >= 0)
1910 else if (TARGET_POWERPC)
1912 operands[2] = force_reg (SImode, operands[2]);
1915 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1919 else if (TARGET_POWER)
1923 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1924 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1925 emit_insn (gen_quoss_call ());
1926 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1931 (define_insn "divsi3_mq"
1932 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1933 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1934 (match_operand:SI 2 "gpc_reg_operand" "r")))
1935 (clobber (match_scratch:SI 3 "=q"))]
1936 "TARGET_POWERPC && TARGET_POWER"
1938 [(set_attr "type" "idiv")])
1940 (define_insn "*divsi3_no_mq"
1941 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1942 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1943 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1944 "TARGET_POWERPC && ! TARGET_POWER"
1946 [(set_attr "type" "idiv")])
1948 (define_expand "modsi3"
1949 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1950 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1951 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1959 if (GET_CODE (operands[2]) != CONST_INT
1960 || INTVAL (operands[2]) <= 0
1961 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
1964 temp1 = gen_reg_rtx (SImode);
1965 temp2 = gen_reg_rtx (SImode);
1967 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1968 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1969 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1974 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1975 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1976 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
1978 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1979 [(set_attr "type" "two")
1980 (set_attr "length" "8")])
1983 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1984 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1985 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1987 (clobber (match_scratch:SI 3 "=r,r"))]
1990 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
1992 [(set_attr "type" "compare")
1993 (set_attr "length" "8,12")])
1996 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1997 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1998 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2000 (clobber (match_scratch:SI 3 ""))]
2003 (div:SI (match_dup 1) (match_dup 2)))
2005 (compare:CC (match_dup 3)
2010 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2011 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2012 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2014 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2015 (div:SI (match_dup 1) (match_dup 2)))]
2018 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2020 [(set_attr "type" "compare")
2021 (set_attr "length" "8,12")])
2024 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2025 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2026 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2028 (set (match_operand:SI 0 "gpc_reg_operand" "")
2029 (div:SI (match_dup 1) (match_dup 2)))]
2032 (div:SI (match_dup 1) (match_dup 2)))
2034 (compare:CC (match_dup 0)
2039 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2042 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2044 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2045 (match_operand:SI 3 "gpc_reg_operand" "r")))
2046 (set (match_operand:SI 2 "register_operand" "=*q")
2049 (zero_extend:DI (match_dup 1)) (const_int 32))
2050 (zero_extend:DI (match_dup 4)))
2054 [(set_attr "type" "idiv")])
2056 ;; To do unsigned divide we handle the cases of the divisor looking like a
2057 ;; negative number. If it is a constant that is less than 2**31, we don't
2058 ;; have to worry about the branches. So make a few subroutines here.
2060 ;; First comes the normal case.
2061 (define_expand "udivmodsi4_normal"
2062 [(set (match_dup 4) (const_int 0))
2063 (parallel [(set (match_operand:SI 0 "" "")
2064 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2066 (zero_extend:DI (match_operand:SI 1 "" "")))
2067 (match_operand:SI 2 "" "")))
2068 (set (match_operand:SI 3 "" "")
2069 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2071 (zero_extend:DI (match_dup 1)))
2075 { operands[4] = gen_reg_rtx (SImode); }")
2077 ;; This handles the branches.
2078 (define_expand "udivmodsi4_tests"
2079 [(set (match_operand:SI 0 "" "") (const_int 0))
2080 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2081 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2082 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2083 (label_ref (match_operand:SI 4 "" "")) (pc)))
2084 (set (match_dup 0) (const_int 1))
2085 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2086 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2087 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2088 (label_ref (match_dup 4)) (pc)))]
2091 { operands[5] = gen_reg_rtx (CCUNSmode);
2092 operands[6] = gen_reg_rtx (CCmode);
2095 (define_expand "udivmodsi4"
2096 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2097 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2098 (match_operand:SI 2 "reg_or_cint_operand" "")))
2099 (set (match_operand:SI 3 "gpc_reg_operand" "")
2100 (umod:SI (match_dup 1) (match_dup 2)))])]
2108 if (! TARGET_POWERPC)
2110 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2111 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2112 emit_insn (gen_divus_call ());
2113 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2114 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2121 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2123 operands[2] = force_reg (SImode, operands[2]);
2124 label = gen_label_rtx ();
2125 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2126 operands[3], label));
2129 operands[2] = force_reg (SImode, operands[2]);
2131 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2139 ;; AIX architecture-independent common-mode multiply (DImode),
2140 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2141 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2142 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2143 ;; assumed unused if generating common-mode, so ignore.
2144 (define_insn "mulh_call"
2147 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2148 (sign_extend:DI (reg:SI 4)))
2150 (clobber (match_scratch:SI 0 "=l"))]
2151 "! TARGET_POWER && ! TARGET_POWERPC"
2153 [(set_attr "type" "imul")])
2155 (define_insn "mull_call"
2157 (mult:DI (sign_extend:DI (reg:SI 3))
2158 (sign_extend:DI (reg:SI 4))))
2159 (clobber (match_scratch:SI 0 "=l"))
2160 (clobber (reg:SI 0))]
2161 "! TARGET_POWER && ! TARGET_POWERPC"
2163 [(set_attr "type" "imul")])
2165 (define_insn "divss_call"
2167 (div:SI (reg:SI 3) (reg:SI 4)))
2169 (mod:SI (reg:SI 3) (reg:SI 4)))
2170 (clobber (match_scratch:SI 0 "=l"))
2171 (clobber (reg:SI 0))]
2172 "! TARGET_POWER && ! TARGET_POWERPC"
2174 [(set_attr "type" "idiv")])
2176 (define_insn "divus_call"
2178 (udiv:SI (reg:SI 3) (reg:SI 4)))
2180 (umod:SI (reg:SI 3) (reg:SI 4)))
2181 (clobber (match_scratch:SI 0 "=l"))
2182 (clobber (reg:SI 0))
2183 (clobber (match_scratch:CC 1 "=x"))
2184 (clobber (reg:CC 69))]
2185 "! TARGET_POWER && ! TARGET_POWERPC"
2187 [(set_attr "type" "idiv")])
2189 (define_insn "quoss_call"
2191 (div:SI (reg:SI 3) (reg:SI 4)))
2192 (clobber (match_scratch:SI 0 "=l"))]
2193 "! TARGET_POWER && ! TARGET_POWERPC"
2195 [(set_attr "type" "idiv")])
2197 (define_insn "quous_call"
2199 (udiv:SI (reg:SI 3) (reg:SI 4)))
2200 (clobber (match_scratch:SI 0 "=l"))
2201 (clobber (reg:SI 0))
2202 (clobber (match_scratch:CC 1 "=x"))
2203 (clobber (reg:CC 69))]
2204 "! TARGET_POWER && ! TARGET_POWERPC"
2206 [(set_attr "type" "idiv")])
2208 ;; Logical instructions
2209 ;; The logical instructions are mostly combined by using match_operator,
2210 ;; but the plain AND insns are somewhat different because there is no
2211 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2212 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2214 (define_insn "andsi3"
2215 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2216 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2217 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2218 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2222 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2223 {andil.|andi.} %0,%1,%b2
2224 {andiu.|andis.} %0,%1,%u2"
2225 [(set_attr "type" "*,*,compare,compare")])
2227 ;; Note to set cr's other than cr0 we do the and immediate and then
2228 ;; the test again -- this avoids a mfcr which on the higher end
2229 ;; machines causes an execution serialization
2231 (define_insn "*andsi3_internal2"
2232 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2233 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2234 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2236 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2237 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2241 {andil.|andi.} %3,%1,%b2
2242 {andiu.|andis.} %3,%1,%u2
2243 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2248 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2249 (set_attr "length" "4,4,4,4,8,8,8,8")])
2251 (define_insn "*andsi3_internal3"
2252 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2253 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2254 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2256 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2257 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2261 {andil.|andi.} %3,%1,%b2
2262 {andiu.|andis.} %3,%1,%u2
2263 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2268 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2269 (set_attr "length" "8,4,4,4,8,8,8,8")])
2272 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2273 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2274 (match_operand:SI 2 "and_operand" ""))
2276 (clobber (match_scratch:SI 3 ""))
2277 (clobber (match_scratch:CC 4 ""))]
2279 [(parallel [(set (match_dup 3)
2280 (and:SI (match_dup 1)
2282 (clobber (match_dup 4))])
2284 (compare:CC (match_dup 3)
2288 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2289 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2292 [(set (match_operand:CC 0 "cc_reg_operand" "")
2293 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2294 (match_operand:SI 2 "gpc_reg_operand" ""))
2296 (clobber (match_scratch:SI 3 ""))
2297 (clobber (match_scratch:CC 4 ""))]
2298 "TARGET_POWERPC64 && reload_completed"
2299 [(parallel [(set (match_dup 3)
2300 (and:SI (match_dup 1)
2302 (clobber (match_dup 4))])
2304 (compare:CC (match_dup 3)
2308 (define_insn "*andsi3_internal4"
2309 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2310 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2311 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2313 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2314 (and:SI (match_dup 1)
2316 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2320 {andil.|andi.} %0,%1,%b2
2321 {andiu.|andis.} %0,%1,%u2
2322 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2327 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2328 (set_attr "length" "4,4,4,4,8,8,8,8")])
2330 (define_insn "*andsi3_internal5"
2331 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2332 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2333 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2335 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2336 (and:SI (match_dup 1)
2338 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2342 {andil.|andi.} %0,%1,%b2
2343 {andiu.|andis.} %0,%1,%u2
2344 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2349 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2350 (set_attr "length" "8,4,4,4,8,8,8,8")])
2353 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2354 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2355 (match_operand:SI 2 "and_operand" ""))
2357 (set (match_operand:SI 0 "gpc_reg_operand" "")
2358 (and:SI (match_dup 1)
2360 (clobber (match_scratch:CC 4 ""))]
2362 [(parallel [(set (match_dup 0)
2363 (and:SI (match_dup 1)
2365 (clobber (match_dup 4))])
2367 (compare:CC (match_dup 0)
2372 [(set (match_operand:CC 3 "cc_reg_operand" "")
2373 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2374 (match_operand:SI 2 "gpc_reg_operand" ""))
2376 (set (match_operand:SI 0 "gpc_reg_operand" "")
2377 (and:SI (match_dup 1)
2379 (clobber (match_scratch:CC 4 ""))]
2380 "TARGET_POWERPC64 && reload_completed"
2381 [(parallel [(set (match_dup 0)
2382 (and:SI (match_dup 1)
2384 (clobber (match_dup 4))])
2386 (compare:CC (match_dup 0)
2390 ;; Handle the PowerPC64 rlwinm corner case
2392 (define_insn_and_split "*andsi3_internal6"
2393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2394 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2395 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2400 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2403 (rotate:SI (match_dup 0) (match_dup 5)))]
2406 int mb = extract_MB (operands[2]);
2407 int me = extract_ME (operands[2]);
2408 operands[3] = GEN_INT (me + 1);
2409 operands[5] = GEN_INT (32 - (me + 1));
2410 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2412 [(set_attr "length" "8")])
2414 (define_expand "iorsi3"
2415 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2416 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2417 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2421 if (GET_CODE (operands[2]) == CONST_INT
2422 && ! logical_operand (operands[2], SImode))
2424 HOST_WIDE_INT value = INTVAL (operands[2]);
2425 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2426 ? operands[0] : gen_reg_rtx (SImode));
2428 emit_insn (gen_iorsi3 (tmp, operands[1],
2429 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2430 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2435 (define_expand "xorsi3"
2436 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2437 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2438 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2442 if (GET_CODE (operands[2]) == CONST_INT
2443 && ! logical_operand (operands[2], SImode))
2445 HOST_WIDE_INT value = INTVAL (operands[2]);
2446 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2447 ? operands[0] : gen_reg_rtx (SImode));
2449 emit_insn (gen_xorsi3 (tmp, operands[1],
2450 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2451 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2456 (define_insn "*boolsi3_internal1"
2457 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2458 (match_operator:SI 3 "boolean_or_operator"
2459 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2460 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2464 {%q3il|%q3i} %0,%1,%b2
2465 {%q3iu|%q3is} %0,%1,%u2")
2467 (define_insn "*boolsi3_internal2"
2468 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2469 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2470 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2471 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2473 (clobber (match_scratch:SI 3 "=r,r"))]
2478 [(set_attr "type" "compare")
2479 (set_attr "length" "4,8")])
2482 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2483 (compare:CC (match_operator:SI 4 "boolean_operator"
2484 [(match_operand:SI 1 "gpc_reg_operand" "")
2485 (match_operand:SI 2 "gpc_reg_operand" "")])
2487 (clobber (match_scratch:SI 3 ""))]
2488 "TARGET_32BIT && reload_completed"
2489 [(set (match_dup 3) (match_dup 4))
2491 (compare:CC (match_dup 3)
2495 (define_insn "*boolsi3_internal3"
2496 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2497 (compare:CC (match_operator:SI 4 "boolean_operator"
2498 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2499 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2501 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2507 [(set_attr "type" "compare")
2508 (set_attr "length" "4,8")])
2511 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2512 (compare:CC (match_operator:SI 4 "boolean_operator"
2513 [(match_operand:SI 1 "gpc_reg_operand" "")
2514 (match_operand:SI 2 "gpc_reg_operand" "")])
2516 (set (match_operand:SI 0 "gpc_reg_operand" "")
2518 "TARGET_32BIT && reload_completed"
2519 [(set (match_dup 0) (match_dup 4))
2521 (compare:CC (match_dup 0)
2525 ;; Split a logical operation that we can't do in one insn into two insns,
2526 ;; each of which does one 16-bit part. This is used by combine.
2529 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2530 (match_operator:SI 3 "boolean_or_operator"
2531 [(match_operand:SI 1 "gpc_reg_operand" "")
2532 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2534 [(set (match_dup 0) (match_dup 4))
2535 (set (match_dup 0) (match_dup 5))]
2539 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2540 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2542 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2543 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2547 (define_insn "*boolcsi3_internal1"
2548 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2549 (match_operator:SI 3 "boolean_operator"
2550 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2551 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2555 (define_insn "*boolcsi3_internal2"
2556 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2557 (compare:CC (match_operator:SI 4 "boolean_operator"
2558 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2559 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2561 (clobber (match_scratch:SI 3 "=r,r"))]
2566 [(set_attr "type" "compare")
2567 (set_attr "length" "4,8")])
2570 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2571 (compare:CC (match_operator:SI 4 "boolean_operator"
2572 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2573 (match_operand:SI 2 "gpc_reg_operand" "")])
2575 (clobber (match_scratch:SI 3 ""))]
2576 "TARGET_32BIT && reload_completed"
2577 [(set (match_dup 3) (match_dup 4))
2579 (compare:CC (match_dup 3)
2583 (define_insn "*boolcsi3_internal3"
2584 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2585 (compare:CC (match_operator:SI 4 "boolean_operator"
2586 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2587 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2589 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2595 [(set_attr "type" "compare")
2596 (set_attr "length" "4,8")])
2599 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2600 (compare:CC (match_operator:SI 4 "boolean_operator"
2601 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2602 (match_operand:SI 2 "gpc_reg_operand" "")])
2604 (set (match_operand:SI 0 "gpc_reg_operand" "")
2606 "TARGET_32BIT && reload_completed"
2607 [(set (match_dup 0) (match_dup 4))
2609 (compare:CC (match_dup 0)
2613 (define_insn "*boolccsi3_internal1"
2614 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2615 (match_operator:SI 3 "boolean_operator"
2616 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2617 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2621 (define_insn "*boolccsi3_internal2"
2622 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2623 (compare:CC (match_operator:SI 4 "boolean_operator"
2624 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2625 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2627 (clobber (match_scratch:SI 3 "=r,r"))]
2632 [(set_attr "type" "compare")
2633 (set_attr "length" "4,8")])
2636 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2637 (compare:CC (match_operator:SI 4 "boolean_operator"
2638 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2639 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2641 (clobber (match_scratch:SI 3 ""))]
2642 "TARGET_32BIT && reload_completed"
2643 [(set (match_dup 3) (match_dup 4))
2645 (compare:CC (match_dup 3)
2649 (define_insn "*boolccsi3_internal3"
2650 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2651 (compare:CC (match_operator:SI 4 "boolean_operator"
2652 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2653 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2655 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2661 [(set_attr "type" "compare")
2662 (set_attr "length" "4,8")])
2665 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2666 (compare:CC (match_operator:SI 4 "boolean_operator"
2667 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2668 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2670 (set (match_operand:SI 0 "gpc_reg_operand" "")
2672 "TARGET_32BIT && reload_completed"
2673 [(set (match_dup 0) (match_dup 4))
2675 (compare:CC (match_dup 0)
2679 ;; maskir insn. We need four forms because things might be in arbitrary
2680 ;; orders. Don't define forms that only set CR fields because these
2681 ;; would modify an input register.
2683 (define_insn "*maskir_internal1"
2684 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2685 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2686 (match_operand:SI 1 "gpc_reg_operand" "0"))
2687 (and:SI (match_dup 2)
2688 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2692 (define_insn "*maskir_internal2"
2693 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2694 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2695 (match_operand:SI 1 "gpc_reg_operand" "0"))
2696 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2701 (define_insn "*maskir_internal3"
2702 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2703 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2704 (match_operand:SI 3 "gpc_reg_operand" "r"))
2705 (and:SI (not:SI (match_dup 2))
2706 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2710 (define_insn "*maskir_internal4"
2711 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2712 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2713 (match_operand:SI 2 "gpc_reg_operand" "r"))
2714 (and:SI (not:SI (match_dup 2))
2715 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2719 (define_insn "*maskir_internal5"
2720 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2722 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2723 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2724 (and:SI (match_dup 2)
2725 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2727 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2728 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2729 (and:SI (match_dup 2) (match_dup 3))))]
2734 [(set_attr "type" "compare")
2735 (set_attr "length" "4,8")])
2738 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2740 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2741 (match_operand:SI 1 "gpc_reg_operand" ""))
2742 (and:SI (match_dup 2)
2743 (match_operand:SI 3 "gpc_reg_operand" "")))
2745 (set (match_operand:SI 0 "gpc_reg_operand" "")
2746 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2747 (and:SI (match_dup 2) (match_dup 3))))]
2748 "TARGET_POWER && reload_completed"
2750 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2751 (and:SI (match_dup 2) (match_dup 3))))
2753 (compare:CC (match_dup 0)
2757 (define_insn "*maskir_internal6"
2758 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2760 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2761 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2762 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2765 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2766 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2767 (and:SI (match_dup 3) (match_dup 2))))]
2772 [(set_attr "type" "compare")
2773 (set_attr "length" "4,8")])
2776 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2778 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2779 (match_operand:SI 1 "gpc_reg_operand" ""))
2780 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2783 (set (match_operand:SI 0 "gpc_reg_operand" "")
2784 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2785 (and:SI (match_dup 3) (match_dup 2))))]
2786 "TARGET_POWER && reload_completed"
2788 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2789 (and:SI (match_dup 3) (match_dup 2))))
2791 (compare:CC (match_dup 0)
2795 (define_insn "*maskir_internal7"
2796 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2798 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2799 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2800 (and:SI (not:SI (match_dup 2))
2801 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2803 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2804 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2805 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2810 [(set_attr "type" "compare")
2811 (set_attr "length" "4,8")])
2814 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2816 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2817 (match_operand:SI 3 "gpc_reg_operand" ""))
2818 (and:SI (not:SI (match_dup 2))
2819 (match_operand:SI 1 "gpc_reg_operand" "")))
2821 (set (match_operand:SI 0 "gpc_reg_operand" "")
2822 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2823 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2824 "TARGET_POWER && reload_completed"
2826 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2827 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2829 (compare:CC (match_dup 0)
2833 (define_insn "*maskir_internal8"
2834 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2836 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2837 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2838 (and:SI (not:SI (match_dup 2))
2839 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2841 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2842 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2843 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2848 [(set_attr "type" "compare")
2849 (set_attr "length" "4,8")])
2852 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2854 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2855 (match_operand:SI 2 "gpc_reg_operand" ""))
2856 (and:SI (not:SI (match_dup 2))
2857 (match_operand:SI 1 "gpc_reg_operand" "")))
2859 (set (match_operand:SI 0 "gpc_reg_operand" "")
2860 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2861 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2862 "TARGET_POWER && reload_completed"
2864 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2865 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2867 (compare:CC (match_dup 0)
2871 ;; Rotate and shift insns, in all their variants. These support shifts,
2872 ;; field inserts and extracts, and various combinations thereof.
2873 (define_expand "insv"
2874 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2875 (match_operand:SI 1 "const_int_operand" "")
2876 (match_operand:SI 2 "const_int_operand" ""))
2877 (match_operand 3 "gpc_reg_operand" ""))]
2881 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2882 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2883 compiler if the address of the structure is taken later. */
2884 if (GET_CODE (operands[0]) == SUBREG
2885 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2888 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2889 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2891 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2895 (define_insn "insvsi"
2896 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2897 (match_operand:SI 1 "const_int_operand" "i")
2898 (match_operand:SI 2 "const_int_operand" "i"))
2899 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2903 int start = INTVAL (operands[2]) & 31;
2904 int size = INTVAL (operands[1]) & 31;
2906 operands[4] = GEN_INT (32 - start - size);
2907 operands[1] = GEN_INT (start + size - 1);
2908 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2910 [(set_attr "type" "insert_word")])
2912 (define_insn "*insvsi_internal1"
2913 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2914 (match_operand:SI 1 "const_int_operand" "i")
2915 (match_operand:SI 2 "const_int_operand" "i"))
2916 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2917 (match_operand:SI 4 "const_int_operand" "i")))]
2918 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2921 int shift = INTVAL (operands[4]) & 31;
2922 int start = INTVAL (operands[2]) & 31;
2923 int size = INTVAL (operands[1]) & 31;
2925 operands[4] = GEN_INT (shift - start - size);
2926 operands[1] = GEN_INT (start + size - 1);
2927 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2929 [(set_attr "type" "insert_word")])
2931 (define_insn "*insvsi_internal2"
2932 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2933 (match_operand:SI 1 "const_int_operand" "i")
2934 (match_operand:SI 2 "const_int_operand" "i"))
2935 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2936 (match_operand:SI 4 "const_int_operand" "i")))]
2937 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2940 int shift = INTVAL (operands[4]) & 31;
2941 int start = INTVAL (operands[2]) & 31;
2942 int size = INTVAL (operands[1]) & 31;
2944 operands[4] = GEN_INT (32 - shift - start - size);
2945 operands[1] = GEN_INT (start + size - 1);
2946 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2948 [(set_attr "type" "insert_word")])
2950 (define_insn "*insvsi_internal3"
2951 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2952 (match_operand:SI 1 "const_int_operand" "i")
2953 (match_operand:SI 2 "const_int_operand" "i"))
2954 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2955 (match_operand:SI 4 "const_int_operand" "i")))]
2956 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2959 int shift = INTVAL (operands[4]) & 31;
2960 int start = INTVAL (operands[2]) & 31;
2961 int size = INTVAL (operands[1]) & 31;
2963 operands[4] = GEN_INT (32 - shift - start - size);
2964 operands[1] = GEN_INT (start + size - 1);
2965 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2967 [(set_attr "type" "insert_word")])
2969 (define_insn "*insvsi_internal4"
2970 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2971 (match_operand:SI 1 "const_int_operand" "i")
2972 (match_operand:SI 2 "const_int_operand" "i"))
2973 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2974 (match_operand:SI 4 "const_int_operand" "i")
2975 (match_operand:SI 5 "const_int_operand" "i")))]
2976 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2979 int extract_start = INTVAL (operands[5]) & 31;
2980 int extract_size = INTVAL (operands[4]) & 31;
2981 int insert_start = INTVAL (operands[2]) & 31;
2982 int insert_size = INTVAL (operands[1]) & 31;
2984 /* Align extract field with insert field */
2985 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
2986 operands[1] = GEN_INT (insert_start + insert_size - 1);
2987 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
2989 [(set_attr "type" "insert_word")])
2991 ;; combine patterns for rlwimi
2992 (define_insn "*insvsi_internal5"
2993 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2994 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
2995 (match_operand:SI 1 "mask_operand" "i"))
2996 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2997 (match_operand:SI 2 "const_int_operand" "i"))
2998 (match_operand:SI 5 "mask_operand" "i"))))]
2999 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3002 int me = extract_ME(operands[5]);
3003 int mb = extract_MB(operands[5]);
3004 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3005 operands[2] = GEN_INT(mb);
3006 operands[1] = GEN_INT(me);
3007 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3009 [(set_attr "type" "insert_word")])
3011 (define_insn "*insvsi_internal6"
3012 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3013 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3014 (match_operand:SI 2 "const_int_operand" "i"))
3015 (match_operand:SI 5 "mask_operand" "i"))
3016 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3017 (match_operand:SI 1 "mask_operand" "i"))))]
3018 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3021 int me = extract_ME(operands[5]);
3022 int mb = extract_MB(operands[5]);
3023 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3024 operands[2] = GEN_INT(mb);
3025 operands[1] = GEN_INT(me);
3026 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3028 [(set_attr "type" "insert_word")])
3030 (define_insn "insvdi"
3031 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3032 (match_operand:SI 1 "const_int_operand" "i")
3033 (match_operand:SI 2 "const_int_operand" "i"))
3034 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3038 int start = INTVAL (operands[2]) & 63;
3039 int size = INTVAL (operands[1]) & 63;
3041 operands[1] = GEN_INT (64 - start - size);
3042 return \"rldimi %0,%3,%H1,%H2\";
3045 (define_insn "*insvdi_internal2"
3046 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3047 (match_operand:SI 1 "const_int_operand" "i")
3048 (match_operand:SI 2 "const_int_operand" "i"))
3049 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3050 (match_operand:SI 4 "const_int_operand" "i")))]
3052 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3055 int shift = INTVAL (operands[4]) & 63;
3056 int start = (INTVAL (operands[2]) & 63) - 32;
3057 int size = INTVAL (operands[1]) & 63;
3059 operands[4] = GEN_INT (64 - shift - start - size);
3060 operands[2] = GEN_INT (start);
3061 operands[1] = GEN_INT (start + size - 1);
3062 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3065 (define_insn "*insvdi_internal3"
3066 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3067 (match_operand:SI 1 "const_int_operand" "i")
3068 (match_operand:SI 2 "const_int_operand" "i"))
3069 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3070 (match_operand:SI 4 "const_int_operand" "i")))]
3072 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3075 int shift = INTVAL (operands[4]) & 63;
3076 int start = (INTVAL (operands[2]) & 63) - 32;
3077 int size = INTVAL (operands[1]) & 63;
3079 operands[4] = GEN_INT (64 - shift - start - size);
3080 operands[2] = GEN_INT (start);
3081 operands[1] = GEN_INT (start + size - 1);
3082 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3085 (define_expand "extzv"
3086 [(set (match_operand 0 "gpc_reg_operand" "")
3087 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3088 (match_operand:SI 2 "const_int_operand" "")
3089 (match_operand:SI 3 "const_int_operand" "")))]
3093 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3094 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3095 compiler if the address of the structure is taken later. */
3096 if (GET_CODE (operands[0]) == SUBREG
3097 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3100 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3101 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3103 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3107 (define_insn "extzvsi"
3108 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3109 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3110 (match_operand:SI 2 "const_int_operand" "i")
3111 (match_operand:SI 3 "const_int_operand" "i")))]
3115 int start = INTVAL (operands[3]) & 31;
3116 int size = INTVAL (operands[2]) & 31;
3118 if (start + size >= 32)
3119 operands[3] = const0_rtx;
3121 operands[3] = GEN_INT (start + size);
3122 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3125 (define_insn "*extzvsi_internal1"
3126 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3127 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3128 (match_operand:SI 2 "const_int_operand" "i,i")
3129 (match_operand:SI 3 "const_int_operand" "i,i"))
3131 (clobber (match_scratch:SI 4 "=r,r"))]
3135 int start = INTVAL (operands[3]) & 31;
3136 int size = INTVAL (operands[2]) & 31;
3138 /* Force split for non-cc0 compare. */
3139 if (which_alternative == 1)
3142 /* If the bit-field being tested fits in the upper or lower half of a
3143 word, it is possible to use andiu. or andil. to test it. This is
3144 useful because the condition register set-use delay is smaller for
3145 andi[ul]. than for rlinm. This doesn't work when the starting bit
3146 position is 0 because the LT and GT bits may be set wrong. */
3148 if ((start > 0 && start + size <= 16) || start >= 16)
3150 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3151 - (1 << (16 - (start & 15) - size))));
3153 return \"{andiu.|andis.} %4,%1,%3\";
3155 return \"{andil.|andi.} %4,%1,%3\";
3158 if (start + size >= 32)
3159 operands[3] = const0_rtx;
3161 operands[3] = GEN_INT (start + size);
3162 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3164 [(set_attr "type" "compare")
3165 (set_attr "length" "4,8")])
3168 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3169 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3170 (match_operand:SI 2 "const_int_operand" "")
3171 (match_operand:SI 3 "const_int_operand" ""))
3173 (clobber (match_scratch:SI 4 ""))]
3176 (zero_extract:SI (match_dup 1) (match_dup 2)
3179 (compare:CC (match_dup 4)
3183 (define_insn "*extzvsi_internal2"
3184 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3185 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3186 (match_operand:SI 2 "const_int_operand" "i,i")
3187 (match_operand:SI 3 "const_int_operand" "i,i"))
3189 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3190 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3194 int start = INTVAL (operands[3]) & 31;
3195 int size = INTVAL (operands[2]) & 31;
3197 /* Force split for non-cc0 compare. */
3198 if (which_alternative == 1)
3201 /* Since we are using the output value, we can't ignore any need for
3202 a shift. The bit-field must end at the LSB. */
3203 if (start >= 16 && start + size == 32)
3205 operands[3] = GEN_INT ((1 << size) - 1);
3206 return \"{andil.|andi.} %0,%1,%3\";
3209 if (start + size >= 32)
3210 operands[3] = const0_rtx;
3212 operands[3] = GEN_INT (start + size);
3213 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3215 [(set_attr "type" "compare")
3216 (set_attr "length" "4,8")])
3219 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3220 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3221 (match_operand:SI 2 "const_int_operand" "")
3222 (match_operand:SI 3 "const_int_operand" ""))
3224 (set (match_operand:SI 0 "gpc_reg_operand" "")
3225 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3228 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3230 (compare:CC (match_dup 0)
3234 (define_insn "extzvdi"
3235 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3236 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3237 (match_operand:SI 2 "const_int_operand" "i")
3238 (match_operand:SI 3 "const_int_operand" "i")))]
3242 int start = INTVAL (operands[3]) & 63;
3243 int size = INTVAL (operands[2]) & 63;
3245 if (start + size >= 64)
3246 operands[3] = const0_rtx;
3248 operands[3] = GEN_INT (start + size);
3249 operands[2] = GEN_INT (64 - size);
3250 return \"rldicl %0,%1,%3,%2\";
3253 (define_insn "*extzvdi_internal1"
3254 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3255 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3256 (match_operand:SI 2 "const_int_operand" "i")
3257 (match_operand:SI 3 "const_int_operand" "i"))
3259 (clobber (match_scratch:DI 4 "=r"))]
3263 int start = INTVAL (operands[3]) & 63;
3264 int size = INTVAL (operands[2]) & 63;
3266 if (start + size >= 64)
3267 operands[3] = const0_rtx;
3269 operands[3] = GEN_INT (start + size);
3270 operands[2] = GEN_INT (64 - size);
3271 return \"rldicl. %4,%1,%3,%2\";
3273 [(set_attr "type" "compare")])
3275 (define_insn "*extzvdi_internal2"
3276 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3277 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3278 (match_operand:SI 2 "const_int_operand" "i")
3279 (match_operand:SI 3 "const_int_operand" "i"))
3281 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3282 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3286 int start = INTVAL (operands[3]) & 63;
3287 int size = INTVAL (operands[2]) & 63;
3289 if (start + size >= 64)
3290 operands[3] = const0_rtx;
3292 operands[3] = GEN_INT (start + size);
3293 operands[2] = GEN_INT (64 - size);
3294 return \"rldicl. %0,%1,%3,%2\";
3296 [(set_attr "type" "compare")])
3298 (define_insn "rotlsi3"
3299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3300 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3301 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3303 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3305 (define_insn "*rotlsi3_internal2"
3306 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3307 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3308 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3310 (clobber (match_scratch:SI 3 "=r,r"))]
3313 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3315 [(set_attr "type" "delayed_compare")
3316 (set_attr "length" "4,8")])
3319 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3320 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3321 (match_operand:SI 2 "reg_or_cint_operand" ""))
3323 (clobber (match_scratch:SI 3 ""))]
3326 (rotate:SI (match_dup 1) (match_dup 2)))
3328 (compare:CC (match_dup 3)
3332 (define_insn "*rotlsi3_internal3"
3333 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3334 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3335 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3337 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3338 (rotate:SI (match_dup 1) (match_dup 2)))]
3341 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3343 [(set_attr "type" "delayed_compare")
3344 (set_attr "length" "4,8")])
3347 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3348 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3349 (match_operand:SI 2 "reg_or_cint_operand" ""))
3351 (set (match_operand:SI 0 "gpc_reg_operand" "")
3352 (rotate:SI (match_dup 1) (match_dup 2)))]
3355 (rotate:SI (match_dup 1) (match_dup 2)))
3357 (compare:CC (match_dup 0)
3361 (define_insn "*rotlsi3_internal4"
3362 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3363 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3364 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3365 (match_operand:SI 3 "mask_operand" "n")))]
3367 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3369 (define_insn "*rotlsi3_internal5"
3370 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3372 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3373 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3374 (match_operand:SI 3 "mask_operand" "n,n"))
3376 (clobber (match_scratch:SI 4 "=r,r"))]
3379 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3381 [(set_attr "type" "delayed_compare")
3382 (set_attr "length" "4,8")])
3385 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 4 ""))]
3394 (and:SI (rotate:SI (match_dup 1)
3398 (compare:CC (match_dup 4)
3402 (define_insn "*rotlsi3_internal6"
3403 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3405 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3406 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3407 (match_operand:SI 3 "mask_operand" "n,n"))
3409 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3410 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3413 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3415 [(set_attr "type" "delayed_compare")
3416 (set_attr "length" "4,8")])
3419 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3421 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3422 (match_operand:SI 2 "reg_or_cint_operand" ""))
3423 (match_operand:SI 3 "mask_operand" ""))
3425 (set (match_operand:SI 0 "gpc_reg_operand" "")
3426 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3429 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3431 (compare:CC (match_dup 0)
3435 (define_insn "*rotlsi3_internal7"
3436 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3439 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3440 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3442 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3444 (define_insn "*rotlsi3_internal8"
3445 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3446 (compare:CC (zero_extend:SI
3448 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3449 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3451 (clobber (match_scratch:SI 3 "=r,r"))]
3454 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3456 [(set_attr "type" "delayed_compare")
3457 (set_attr "length" "4,8")])
3460 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 ""))]
3469 (zero_extend:SI (subreg:QI
3470 (rotate:SI (match_dup 1)
3473 (compare:CC (match_dup 3)
3477 (define_insn "*rotlsi3_internal9"
3478 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3479 (compare:CC (zero_extend:SI
3481 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3482 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3484 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3485 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3488 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3490 [(set_attr "type" "delayed_compare")
3491 (set_attr "length" "4,8")])
3494 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3495 (compare:CC (zero_extend:SI
3497 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3498 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3500 (set (match_operand:SI 0 "gpc_reg_operand" "")
3501 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3504 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3506 (compare:CC (match_dup 0)
3510 (define_insn "*rotlsi3_internal10"
3511 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3514 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3515 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3517 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3519 (define_insn "*rotlsi3_internal11"
3520 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3521 (compare:CC (zero_extend:SI
3523 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3524 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3526 (clobber (match_scratch:SI 3 "=r,r"))]
3529 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3531 [(set_attr "type" "delayed_compare")
3532 (set_attr "length" "4,8")])
3535 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 ""))]
3544 (zero_extend:SI (subreg:HI
3545 (rotate:SI (match_dup 1)
3548 (compare:CC (match_dup 3)
3552 (define_insn "*rotlsi3_internal12"
3553 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3554 (compare:CC (zero_extend:SI
3556 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3557 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3559 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3560 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3563 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3565 [(set_attr "type" "delayed_compare")
3566 (set_attr "length" "4,8")])
3569 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3570 (compare:CC (zero_extend:SI
3572 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3573 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3575 (set (match_operand:SI 0 "gpc_reg_operand" "")
3576 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3579 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3581 (compare:CC (match_dup 0)
3585 ;; Note that we use "sle." instead of "sl." so that we can set
3586 ;; SHIFT_COUNT_TRUNCATED.
3588 (define_expand "ashlsi3"
3589 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3590 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3591 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3596 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3598 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3602 (define_insn "ashlsi3_power"
3603 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3604 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3605 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3606 (clobber (match_scratch:SI 3 "=q,X"))]
3610 {sli|slwi} %0,%1,%h2")
3612 (define_insn "ashlsi3_no_power"
3613 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3614 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3615 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3617 "{sl|slw}%I2 %0,%1,%h2")
3620 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3621 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3622 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3624 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3625 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3629 {sli.|slwi.} %3,%1,%h2
3632 [(set_attr "type" "delayed_compare")
3633 (set_attr "length" "4,4,8,8")])
3636 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3637 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3638 (match_operand:SI 2 "reg_or_cint_operand" ""))
3640 (clobber (match_scratch:SI 3 ""))
3641 (clobber (match_scratch:SI 4 ""))]
3642 "TARGET_POWER && reload_completed"
3643 [(parallel [(set (match_dup 3)
3644 (ashift:SI (match_dup 1) (match_dup 2)))
3645 (clobber (match_dup 4))])
3647 (compare:CC (match_dup 3)
3652 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3653 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3654 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3656 (clobber (match_scratch:SI 3 "=r,r"))]
3657 "! TARGET_POWER && TARGET_32BIT"
3659 {sl|slw}%I2. %3,%1,%h2
3661 [(set_attr "type" "delayed_compare")
3662 (set_attr "length" "4,8")])
3665 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3666 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3667 (match_operand:SI 2 "reg_or_cint_operand" ""))
3669 (clobber (match_scratch:SI 3 ""))]
3670 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3672 (ashift:SI (match_dup 1) (match_dup 2)))
3674 (compare:CC (match_dup 3)
3679 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3680 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3681 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3683 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3684 (ashift:SI (match_dup 1) (match_dup 2)))
3685 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3689 {sli.|slwi.} %0,%1,%h2
3692 [(set_attr "type" "delayed_compare")
3693 (set_attr "length" "4,4,8,8")])
3696 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3697 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3698 (match_operand:SI 2 "reg_or_cint_operand" ""))
3700 (set (match_operand:SI 0 "gpc_reg_operand" "")
3701 (ashift:SI (match_dup 1) (match_dup 2)))
3702 (clobber (match_scratch:SI 4 ""))]
3703 "TARGET_POWER && reload_completed"
3704 [(parallel [(set (match_dup 0)
3705 (ashift:SI (match_dup 1) (match_dup 2)))
3706 (clobber (match_dup 4))])
3708 (compare:CC (match_dup 0)
3713 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3714 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3715 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3717 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3718 (ashift:SI (match_dup 1) (match_dup 2)))]
3719 "! TARGET_POWER && TARGET_32BIT"
3721 {sl|slw}%I2. %0,%1,%h2
3723 [(set_attr "type" "delayed_compare")
3724 (set_attr "length" "4,8")])
3727 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3728 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3729 (match_operand:SI 2 "reg_or_cint_operand" ""))
3731 (set (match_operand:SI 0 "gpc_reg_operand" "")
3732 (ashift:SI (match_dup 1) (match_dup 2)))]
3733 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3735 (ashift:SI (match_dup 1) (match_dup 2)))
3737 (compare:CC (match_dup 0)
3742 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3743 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3744 (match_operand:SI 2 "const_int_operand" "i"))
3745 (match_operand:SI 3 "mask_operand" "n")))]
3746 "includes_lshift_p (operands[2], operands[3])"
3747 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3750 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3752 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3753 (match_operand:SI 2 "const_int_operand" "i,i"))
3754 (match_operand:SI 3 "mask_operand" "n,n"))
3756 (clobber (match_scratch:SI 4 "=r,r"))]
3757 "includes_lshift_p (operands[2], operands[3])"
3759 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3761 [(set_attr "type" "delayed_compare")
3762 (set_attr "length" "4,8")])
3765 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3767 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3768 (match_operand:SI 2 "const_int_operand" ""))
3769 (match_operand:SI 3 "mask_operand" ""))
3771 (clobber (match_scratch:SI 4 ""))]
3772 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3774 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3777 (compare:CC (match_dup 4)
3782 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3784 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3785 (match_operand:SI 2 "const_int_operand" "i,i"))
3786 (match_operand:SI 3 "mask_operand" "n,n"))
3788 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3789 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3790 "includes_lshift_p (operands[2], operands[3])"
3792 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3794 [(set_attr "type" "delayed_compare")
3795 (set_attr "length" "4,8")])
3798 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3800 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3801 (match_operand:SI 2 "const_int_operand" ""))
3802 (match_operand:SI 3 "mask_operand" ""))
3804 (set (match_operand:SI 0 "gpc_reg_operand" "")
3805 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3806 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3808 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3810 (compare:CC (match_dup 0)
3814 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3816 (define_expand "lshrsi3"
3817 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3818 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3819 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3824 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3826 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3830 (define_insn "lshrsi3_power"
3831 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3832 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3833 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3834 (clobber (match_scratch:SI 3 "=q,X,X"))]
3839 {s%A2i|s%A2wi} %0,%1,%h2")
3841 (define_insn "lshrsi3_no_power"
3842 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3843 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3844 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3848 {sr|srw}%I2 %0,%1,%h2")
3851 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3852 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3853 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3855 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3856 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3861 {s%A2i.|s%A2wi.} %3,%1,%h2
3865 [(set_attr "type" "delayed_compare")
3866 (set_attr "length" "4,4,4,8,8,8")])
3869 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3870 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3871 (match_operand:SI 2 "reg_or_cint_operand" ""))
3873 (clobber (match_scratch:SI 3 ""))
3874 (clobber (match_scratch:SI 4 ""))]
3875 "TARGET_POWER && reload_completed"
3876 [(parallel [(set (match_dup 3)
3877 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3878 (clobber (match_dup 4))])
3880 (compare:CC (match_dup 3)
3885 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3886 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3887 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3889 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3890 "! TARGET_POWER && TARGET_32BIT"
3893 {sr|srw}%I2. %3,%1,%h2
3896 [(set_attr "type" "delayed_compare")
3897 (set_attr "length" "4,4,8,8")])
3900 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3901 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3902 (match_operand:SI 2 "reg_or_cint_operand" ""))
3904 (clobber (match_scratch:SI 3 ""))]
3905 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3907 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3909 (compare:CC (match_dup 3)
3914 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3915 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3916 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3918 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3919 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3920 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3925 {s%A2i.|s%A2wi.} %0,%1,%h2
3929 [(set_attr "type" "delayed_compare")
3930 (set_attr "length" "4,4,4,8,8,8")])
3933 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3934 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3935 (match_operand:SI 2 "reg_or_cint_operand" ""))
3937 (set (match_operand:SI 0 "gpc_reg_operand" "")
3938 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3939 (clobber (match_scratch:SI 4 ""))]
3940 "TARGET_POWER && reload_completed"
3941 [(parallel [(set (match_dup 0)
3942 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3943 (clobber (match_dup 4))])
3945 (compare:CC (match_dup 0)
3950 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3951 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3952 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3954 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3955 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3956 "! TARGET_POWER && TARGET_32BIT"
3959 {sr|srw}%I2. %0,%1,%h2
3962 [(set_attr "type" "delayed_compare")
3963 (set_attr "length" "4,4,8,8")])
3966 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3967 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3968 (match_operand:SI 2 "reg_or_cint_operand" ""))
3970 (set (match_operand:SI 0 "gpc_reg_operand" "")
3971 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3972 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3974 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3976 (compare:CC (match_dup 0)
3981 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3982 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3983 (match_operand:SI 2 "const_int_operand" "i"))
3984 (match_operand:SI 3 "mask_operand" "n")))]
3985 "includes_rshift_p (operands[2], operands[3])"
3986 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3989 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3991 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3992 (match_operand:SI 2 "const_int_operand" "i,i"))
3993 (match_operand:SI 3 "mask_operand" "n,n"))
3995 (clobber (match_scratch:SI 4 "=r,r"))]
3996 "includes_rshift_p (operands[2], operands[3])"
3998 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4000 [(set_attr "type" "delayed_compare")
4001 (set_attr "length" "4,8")])
4004 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4006 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4007 (match_operand:SI 2 "const_int_operand" ""))
4008 (match_operand:SI 3 "mask_operand" ""))
4010 (clobber (match_scratch:SI 4 ""))]
4011 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4013 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4016 (compare:CC (match_dup 4)
4021 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4023 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4024 (match_operand:SI 2 "const_int_operand" "i,i"))
4025 (match_operand:SI 3 "mask_operand" "n,n"))
4027 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4028 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4029 "includes_rshift_p (operands[2], operands[3])"
4031 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4033 [(set_attr "type" "delayed_compare")
4034 (set_attr "length" "4,8")])
4037 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4039 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4040 (match_operand:SI 2 "const_int_operand" ""))
4041 (match_operand:SI 3 "mask_operand" ""))
4043 (set (match_operand:SI 0 "gpc_reg_operand" "")
4044 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4045 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4047 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4049 (compare:CC (match_dup 0)
4054 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4057 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4058 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4059 "includes_rshift_p (operands[2], GEN_INT (255))"
4060 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4063 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4067 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4068 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4070 (clobber (match_scratch:SI 3 "=r,r"))]
4071 "includes_rshift_p (operands[2], GEN_INT (255))"
4073 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4075 [(set_attr "type" "delayed_compare")
4076 (set_attr "length" "4,8")])
4079 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4083 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4084 (match_operand:SI 2 "const_int_operand" "")) 0))
4086 (clobber (match_scratch:SI 3 ""))]
4087 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4089 (zero_extend:SI (subreg:QI
4090 (lshiftrt:SI (match_dup 1)
4093 (compare:CC (match_dup 3)
4098 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4102 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4103 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4105 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4106 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4107 "includes_rshift_p (operands[2], GEN_INT (255))"
4109 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4111 [(set_attr "type" "delayed_compare")
4112 (set_attr "length" "4,8")])
4115 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4119 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4120 (match_operand:SI 2 "const_int_operand" "")) 0))
4122 (set (match_operand:SI 0 "gpc_reg_operand" "")
4123 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4124 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4126 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4128 (compare:CC (match_dup 0)
4133 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4136 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4137 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4138 "includes_rshift_p (operands[2], GEN_INT (65535))"
4139 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4142 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4146 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4147 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4149 (clobber (match_scratch:SI 3 "=r,r"))]
4150 "includes_rshift_p (operands[2], GEN_INT (65535))"
4152 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4154 [(set_attr "type" "delayed_compare")
4155 (set_attr "length" "4,8")])
4158 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4162 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4163 (match_operand:SI 2 "const_int_operand" "")) 0))
4165 (clobber (match_scratch:SI 3 ""))]
4166 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4168 (zero_extend:SI (subreg:HI
4169 (lshiftrt:SI (match_dup 1)
4172 (compare:CC (match_dup 3)
4177 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4181 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4182 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4184 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4185 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4186 "includes_rshift_p (operands[2], GEN_INT (65535))"
4188 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4190 [(set_attr "type" "delayed_compare")
4191 (set_attr "length" "4,8")])
4194 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4198 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4199 (match_operand:SI 2 "const_int_operand" "")) 0))
4201 (set (match_operand:SI 0 "gpc_reg_operand" "")
4202 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4203 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4205 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4207 (compare:CC (match_dup 0)
4212 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4214 (match_operand:SI 1 "gpc_reg_operand" "r"))
4215 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4221 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4223 (match_operand:SI 1 "gpc_reg_operand" "r"))
4224 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4230 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4232 (match_operand:SI 1 "gpc_reg_operand" "r"))
4233 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4239 (define_expand "ashrsi3"
4240 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4241 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4242 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4247 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4249 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4253 (define_insn "ashrsi3_power"
4254 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4255 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4256 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4257 (clobber (match_scratch:SI 3 "=q,X"))]
4261 {srai|srawi} %0,%1,%h2")
4263 (define_insn "ashrsi3_no_power"
4264 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4265 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4266 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4268 "{sra|sraw}%I2 %0,%1,%h2")
4271 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4272 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4273 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4275 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4276 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4280 {srai.|srawi.} %3,%1,%h2
4283 [(set_attr "type" "delayed_compare")
4284 (set_attr "length" "4,4,8,8")])
4287 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4288 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4289 (match_operand:SI 2 "reg_or_cint_operand" ""))
4291 (clobber (match_scratch:SI 3 ""))
4292 (clobber (match_scratch:SI 4 ""))]
4293 "TARGET_POWER && reload_completed"
4294 [(parallel [(set (match_dup 3)
4295 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4296 (clobber (match_dup 4))])
4298 (compare:CC (match_dup 3)
4303 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4304 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4305 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4307 (clobber (match_scratch:SI 3 "=r,r"))]
4310 {sra|sraw}%I2. %3,%1,%h2
4312 [(set_attr "type" "delayed_compare")
4313 (set_attr "length" "4,8")])
4316 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4317 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4318 (match_operand:SI 2 "reg_or_cint_operand" ""))
4320 (clobber (match_scratch:SI 3 ""))]
4321 "! TARGET_POWER && reload_completed"
4323 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4325 (compare:CC (match_dup 3)
4330 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4331 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4332 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4334 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4335 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4336 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4340 {srai.|srawi.} %0,%1,%h2
4343 [(set_attr "type" "delayed_compare")
4344 (set_attr "length" "4,4,8,8")])
4347 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4348 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4349 (match_operand:SI 2 "reg_or_cint_operand" ""))
4351 (set (match_operand:SI 0 "gpc_reg_operand" "")
4352 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4353 (clobber (match_scratch:SI 4 ""))]
4354 "TARGET_POWER && reload_completed"
4355 [(parallel [(set (match_dup 0)
4356 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4357 (clobber (match_dup 4))])
4359 (compare:CC (match_dup 0)
4364 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4365 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4366 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4368 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4369 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4372 {sra|sraw}%I2. %0,%1,%h2
4374 [(set_attr "type" "delayed_compare")
4375 (set_attr "length" "4,8")])
4378 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4379 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4380 (match_operand:SI 2 "reg_or_cint_operand" ""))
4382 (set (match_operand:SI 0 "gpc_reg_operand" "")
4383 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4384 "! TARGET_POWER && reload_completed"
4386 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4388 (compare:CC (match_dup 0)
4392 ;; Floating-point insns, excluding normal data motion.
4394 ;; PowerPC has a full set of single-precision floating point instructions.
4396 ;; For the POWER architecture, we pretend that we have both SFmode and
4397 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4398 ;; The only conversions we will do will be when storing to memory. In that
4399 ;; case, we will use the "frsp" instruction before storing.
4401 ;; Note that when we store into a single-precision memory location, we need to
4402 ;; use the frsp insn first. If the register being stored isn't dead, we
4403 ;; need a scratch register for the frsp. But this is difficult when the store
4404 ;; is done by reload. It is not incorrect to do the frsp on the register in
4405 ;; this case, we just lose precision that we would have otherwise gotten but
4406 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4408 (define_expand "extendsfdf2"
4409 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4410 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4411 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4414 (define_insn_and_split "*extendsfdf2_fpr"
4415 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4416 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4417 "TARGET_HARD_FLOAT && TARGET_FPRS"
4422 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4425 emit_note (NOTE_INSN_DELETED);
4428 [(set_attr "type" "fp,fp,fpload")])
4430 (define_expand "truncdfsf2"
4431 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4432 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4433 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4436 (define_insn "*truncdfsf2_fpr"
4437 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4438 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4439 "TARGET_HARD_FLOAT && TARGET_FPRS"
4441 [(set_attr "type" "fp")])
4443 (define_insn "aux_truncdfsf2"
4444 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4445 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4446 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4448 [(set_attr "type" "fp")])
4450 (define_expand "negsf2"
4451 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4452 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4456 (define_insn "*negsf2"
4457 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4458 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4459 "TARGET_HARD_FLOAT && TARGET_FPRS"
4461 [(set_attr "type" "fp")])
4463 (define_expand "abssf2"
4464 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4465 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4469 (define_insn "*abssf2"
4470 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4471 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4472 "TARGET_HARD_FLOAT && TARGET_FPRS"
4474 [(set_attr "type" "fp")])
4477 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4478 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4479 "TARGET_HARD_FLOAT && TARGET_FPRS"
4481 [(set_attr "type" "fp")])
4483 (define_expand "addsf3"
4484 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4485 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4486 (match_operand:SF 2 "gpc_reg_operand" "")))]
4491 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4492 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4493 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4494 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4496 [(set_attr "type" "fp")])
4499 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4500 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4501 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4502 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4503 "{fa|fadd} %0,%1,%2"
4504 [(set_attr "type" "fp")])
4506 (define_expand "subsf3"
4507 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4508 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4509 (match_operand:SF 2 "gpc_reg_operand" "")))]
4514 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4515 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4516 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4517 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4519 [(set_attr "type" "fp")])
4522 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4523 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4524 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4525 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4526 "{fs|fsub} %0,%1,%2"
4527 [(set_attr "type" "fp")])
4529 (define_expand "mulsf3"
4530 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4531 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4532 (match_operand:SF 2 "gpc_reg_operand" "")))]
4537 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4538 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4539 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4540 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4542 [(set_attr "type" "fp")])
4545 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4546 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4547 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4548 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4549 "{fm|fmul} %0,%1,%2"
4550 [(set_attr "type" "dmul")])
4552 (define_expand "divsf3"
4553 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4554 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4555 (match_operand:SF 2 "gpc_reg_operand" "")))]
4560 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4561 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4562 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4563 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4565 [(set_attr "type" "sdiv")])
4568 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4569 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4570 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4571 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4572 "{fd|fdiv} %0,%1,%2"
4573 [(set_attr "type" "ddiv")])
4576 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4577 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4578 (match_operand:SF 2 "gpc_reg_operand" "f"))
4579 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4580 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4581 "fmadds %0,%1,%2,%3"
4582 [(set_attr "type" "fp")])
4585 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4586 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4587 (match_operand:SF 2 "gpc_reg_operand" "f"))
4588 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4589 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4590 "{fma|fmadd} %0,%1,%2,%3"
4591 [(set_attr "type" "dmul")])
4594 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4595 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4596 (match_operand:SF 2 "gpc_reg_operand" "f"))
4597 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4598 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4599 "fmsubs %0,%1,%2,%3"
4600 [(set_attr "type" "fp")])
4603 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4604 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4605 (match_operand:SF 2 "gpc_reg_operand" "f"))
4606 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4607 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4608 "{fms|fmsub} %0,%1,%2,%3"
4609 [(set_attr "type" "dmul")])
4612 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4613 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4614 (match_operand:SF 2 "gpc_reg_operand" "f"))
4615 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4616 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4617 && HONOR_SIGNED_ZEROS (SFmode)"
4618 "fnmadds %0,%1,%2,%3"
4619 [(set_attr "type" "fp")])
4622 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4623 (minus:SF (mult:SF (neg: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 && ! HONOR_SIGNED_ZEROS (SFmode)"
4628 "fnmadds %0,%1,%2,%3"
4629 [(set_attr "type" "fp")])
4632 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4633 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4634 (match_operand:SF 2 "gpc_reg_operand" "f"))
4635 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4636 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4637 "{fnma|fnmadd} %0,%1,%2,%3"
4638 [(set_attr "type" "dmul")])
4641 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4642 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4643 (match_operand:SF 2 "gpc_reg_operand" "f"))
4644 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4645 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4646 && ! HONOR_SIGNED_ZEROS (SFmode)"
4647 "{fnma|fnmadd} %0,%1,%2,%3"
4648 [(set_attr "type" "dmul")])
4651 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4652 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4653 (match_operand:SF 2 "gpc_reg_operand" "f"))
4654 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4655 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4656 && HONOR_SIGNED_ZEROS (SFmode)"
4657 "fnmsubs %0,%1,%2,%3"
4658 [(set_attr "type" "fp")])
4661 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4662 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4663 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4664 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4665 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4666 && ! HONOR_SIGNED_ZEROS (SFmode)"
4667 "fnmsubs %0,%1,%2,%3"
4668 [(set_attr "type" "fp")])
4671 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4672 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4673 (match_operand:SF 2 "gpc_reg_operand" "f"))
4674 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4675 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4676 "{fnms|fnmsub} %0,%1,%2,%3"
4677 [(set_attr "type" "dmul")])
4680 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4681 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4682 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4683 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4684 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4685 && ! HONOR_SIGNED_ZEROS (SFmode)"
4686 "{fnms|fnmsub} %0,%1,%2,%3"
4687 [(set_attr "type" "fp")])
4689 (define_expand "sqrtsf2"
4690 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4691 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4692 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4696 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4697 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4698 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4700 [(set_attr "type" "ssqrt")])
4703 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4704 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4705 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4707 [(set_attr "type" "dsqrt")])
4709 (define_expand "copysignsf3"
4711 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
4713 (neg:SF (abs:SF (match_dup 1))))
4714 (set (match_operand:SF 0 "gpc_reg_operand" "")
4715 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
4719 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4720 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
4722 operands[3] = gen_reg_rtx (SFmode);
4723 operands[4] = gen_reg_rtx (SFmode);
4724 operands[5] = CONST0_RTX (SFmode);
4727 (define_expand "copysigndf3"
4729 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
4731 (neg:DF (abs:DF (match_dup 1))))
4732 (set (match_operand:DF 0 "gpc_reg_operand" "")
4733 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
4737 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4738 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
4740 operands[3] = gen_reg_rtx (DFmode);
4741 operands[4] = gen_reg_rtx (DFmode);
4742 operands[5] = CONST0_RTX (DFmode);
4745 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4746 ;; fsel instruction and some auxiliary computations. Then we just have a
4747 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4749 (define_expand "smaxsf3"
4750 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4751 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4752 (match_operand:SF 2 "gpc_reg_operand" ""))
4755 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4756 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4758 (define_expand "sminsf3"
4759 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4760 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4761 (match_operand:SF 2 "gpc_reg_operand" ""))
4764 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4765 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4768 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4769 (match_operator:SF 3 "min_max_operator"
4770 [(match_operand:SF 1 "gpc_reg_operand" "")
4771 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4772 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4775 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4776 operands[1], operands[2]);
4780 (define_expand "movsicc"
4781 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4782 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4783 (match_operand:SI 2 "gpc_reg_operand" "")
4784 (match_operand:SI 3 "gpc_reg_operand" "")))]
4788 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4794 ;; We use the BASE_REGS for the isel input operands because, if rA is
4795 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4796 ;; because we may switch the operands and rB may end up being rA.
4798 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4799 ;; leave out the mode in operand 4 and use one pattern, but reload can
4800 ;; change the mode underneath our feet and then gets confused trying
4801 ;; to reload the value.
4802 (define_insn "isel_signed"
4803 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4805 (match_operator 1 "comparison_operator"
4806 [(match_operand:CC 4 "cc_reg_operand" "y")
4808 (match_operand:SI 2 "gpc_reg_operand" "b")
4809 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4812 { return output_isel (operands); }"
4813 [(set_attr "length" "4")])
4815 (define_insn "isel_unsigned"
4816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4818 (match_operator 1 "comparison_operator"
4819 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4821 (match_operand:SI 2 "gpc_reg_operand" "b")
4822 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4825 { return output_isel (operands); }"
4826 [(set_attr "length" "4")])
4828 (define_expand "movsfcc"
4829 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4830 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4831 (match_operand:SF 2 "gpc_reg_operand" "")
4832 (match_operand:SF 3 "gpc_reg_operand" "")))]
4833 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4836 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4842 (define_insn "*fselsfsf4"
4843 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4844 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4845 (match_operand:SF 4 "zero_fp_constant" "F"))
4846 (match_operand:SF 2 "gpc_reg_operand" "f")
4847 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4848 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4850 [(set_attr "type" "fp")])
4852 (define_insn "*fseldfsf4"
4853 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4854 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4855 (match_operand:DF 4 "zero_fp_constant" "F"))
4856 (match_operand:SF 2 "gpc_reg_operand" "f")
4857 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4858 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4860 [(set_attr "type" "fp")])
4862 (define_expand "negdf2"
4863 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4864 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4865 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4868 (define_insn "*negdf2_fpr"
4869 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4870 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4871 "TARGET_HARD_FLOAT && TARGET_FPRS"
4873 [(set_attr "type" "fp")])
4875 (define_expand "absdf2"
4876 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4877 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4878 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4881 (define_insn "*absdf2_fpr"
4882 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4883 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4884 "TARGET_HARD_FLOAT && TARGET_FPRS"
4886 [(set_attr "type" "fp")])
4888 (define_insn "*nabsdf2_fpr"
4889 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4890 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4891 "TARGET_HARD_FLOAT && TARGET_FPRS"
4893 [(set_attr "type" "fp")])
4895 (define_expand "adddf3"
4896 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4897 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4898 (match_operand:DF 2 "gpc_reg_operand" "")))]
4899 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4902 (define_insn "*adddf3_fpr"
4903 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4904 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4905 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4906 "TARGET_HARD_FLOAT && TARGET_FPRS"
4907 "{fa|fadd} %0,%1,%2"
4908 [(set_attr "type" "fp")])
4910 (define_expand "subdf3"
4911 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4912 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4913 (match_operand:DF 2 "gpc_reg_operand" "")))]
4914 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4917 (define_insn "*subdf3_fpr"
4918 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4919 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4920 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4921 "TARGET_HARD_FLOAT && TARGET_FPRS"
4922 "{fs|fsub} %0,%1,%2"
4923 [(set_attr "type" "fp")])
4925 (define_expand "muldf3"
4926 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4927 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
4928 (match_operand:DF 2 "gpc_reg_operand" "")))]
4929 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4932 (define_insn "*muldf3_fpr"
4933 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4934 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4935 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4936 "TARGET_HARD_FLOAT && TARGET_FPRS"
4937 "{fm|fmul} %0,%1,%2"
4938 [(set_attr "type" "dmul")])
4940 (define_expand "divdf3"
4941 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4942 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
4943 (match_operand:DF 2 "gpc_reg_operand" "")))]
4944 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4947 (define_insn "*divdf3_fpr"
4948 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4949 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4950 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4951 "TARGET_HARD_FLOAT && TARGET_FPRS"
4952 "{fd|fdiv} %0,%1,%2"
4953 [(set_attr "type" "ddiv")])
4956 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4957 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4958 (match_operand:DF 2 "gpc_reg_operand" "f"))
4959 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4960 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4961 "{fma|fmadd} %0,%1,%2,%3"
4962 [(set_attr "type" "dmul")])
4965 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4966 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4967 (match_operand:DF 2 "gpc_reg_operand" "f"))
4968 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4969 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4970 "{fms|fmsub} %0,%1,%2,%3"
4971 [(set_attr "type" "dmul")])
4974 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4975 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4976 (match_operand:DF 2 "gpc_reg_operand" "f"))
4977 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4978 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4979 && HONOR_SIGNED_ZEROS (DFmode)"
4980 "{fnma|fnmadd} %0,%1,%2,%3"
4981 [(set_attr "type" "dmul")])
4984 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4985 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
4986 (match_operand:DF 2 "gpc_reg_operand" "f"))
4987 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4988 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4989 && ! HONOR_SIGNED_ZEROS (DFmode)"
4990 "{fnma|fnmadd} %0,%1,%2,%3"
4991 [(set_attr "type" "dmul")])
4994 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4995 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4996 (match_operand:DF 2 "gpc_reg_operand" "f"))
4997 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4998 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4999 && HONOR_SIGNED_ZEROS (DFmode)"
5000 "{fnms|fnmsub} %0,%1,%2,%3"
5001 [(set_attr "type" "dmul")])
5004 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5005 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5006 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5007 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5008 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5009 && ! HONOR_SIGNED_ZEROS (DFmode)"
5010 "{fnms|fnmsub} %0,%1,%2,%3"
5011 [(set_attr "type" "dmul")])
5013 (define_insn "sqrtdf2"
5014 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5015 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5016 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5018 [(set_attr "type" "dsqrt")])
5020 ;; The conditional move instructions allow us to perform max and min
5021 ;; operations even when
5023 (define_expand "smaxdf3"
5024 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5025 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5026 (match_operand:DF 2 "gpc_reg_operand" ""))
5029 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5030 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5032 (define_expand "smindf3"
5033 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5034 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5035 (match_operand:DF 2 "gpc_reg_operand" ""))
5038 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5039 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5042 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5043 (match_operator:DF 3 "min_max_operator"
5044 [(match_operand:DF 1 "gpc_reg_operand" "")
5045 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5046 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5049 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5050 operands[1], operands[2]);
5054 (define_expand "movdfcc"
5055 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5056 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5057 (match_operand:DF 2 "gpc_reg_operand" "")
5058 (match_operand:DF 3 "gpc_reg_operand" "")))]
5059 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5062 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5068 (define_insn "*fseldfdf4"
5069 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5070 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5071 (match_operand:DF 4 "zero_fp_constant" "F"))
5072 (match_operand:DF 2 "gpc_reg_operand" "f")
5073 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5074 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5076 [(set_attr "type" "fp")])
5078 (define_insn "*fselsfdf4"
5079 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5080 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5081 (match_operand:SF 4 "zero_fp_constant" "F"))
5082 (match_operand:DF 2 "gpc_reg_operand" "f")
5083 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5086 [(set_attr "type" "fp")])
5088 ;; Conversions to and from floating-point.
5090 (define_expand "fixuns_truncsfsi2"
5091 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5092 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5093 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5096 (define_expand "fix_truncsfsi2"
5097 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5098 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5099 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5102 ; For each of these conversions, there is a define_expand, a define_insn
5103 ; with a '#' template, and a define_split (with C code). The idea is
5104 ; to allow constant folding with the template of the define_insn,
5105 ; then to have the insns split later (between sched1 and final).
5107 (define_expand "floatsidf2"
5108 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5109 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5112 (clobber (match_dup 4))
5113 (clobber (match_dup 5))
5114 (clobber (match_dup 6))])]
5115 "TARGET_HARD_FLOAT && TARGET_FPRS"
5118 if (TARGET_E500_DOUBLE)
5120 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5123 if (TARGET_POWERPC64)
5125 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5126 rtx t1 = gen_reg_rtx (DImode);
5127 rtx t2 = gen_reg_rtx (DImode);
5128 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5132 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5133 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5134 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5135 operands[5] = gen_reg_rtx (DFmode);
5136 operands[6] = gen_reg_rtx (SImode);
5139 (define_insn "*floatsidf2_internal"
5140 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5141 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5142 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5143 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5144 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5145 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5146 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5147 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5149 [(set_attr "length" "24")])
5152 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5153 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5154 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5155 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5156 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5157 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5158 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5159 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5160 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5161 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5162 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5163 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5164 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5165 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5166 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5169 rtx lowword, highword;
5170 if (GET_CODE (operands[4]) != MEM)
5172 highword = XEXP (operands[4], 0);
5173 lowword = plus_constant (highword, 4);
5174 if (! WORDS_BIG_ENDIAN)
5177 tmp = highword; highword = lowword; lowword = tmp;
5180 emit_insn (gen_xorsi3 (operands[6], operands[1],
5181 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5182 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5183 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5184 emit_move_insn (operands[5], operands[4]);
5185 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5189 (define_expand "floatunssisf2"
5190 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5191 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5192 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5195 (define_expand "floatunssidf2"
5196 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5197 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5200 (clobber (match_dup 4))
5201 (clobber (match_dup 5))])]
5202 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5205 if (TARGET_E500_DOUBLE)
5207 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5210 if (TARGET_POWERPC64)
5212 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5213 rtx t1 = gen_reg_rtx (DImode);
5214 rtx t2 = gen_reg_rtx (DImode);
5215 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5220 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5221 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5222 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5223 operands[5] = gen_reg_rtx (DFmode);
5226 (define_insn "*floatunssidf2_internal"
5227 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5228 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5229 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5230 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5231 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5232 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5233 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5235 [(set_attr "length" "20")])
5238 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5239 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5240 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5241 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5242 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5243 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5244 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5245 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5246 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5247 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5248 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5249 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5250 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5253 rtx lowword, highword;
5254 if (GET_CODE (operands[4]) != MEM)
5256 highword = XEXP (operands[4], 0);
5257 lowword = plus_constant (highword, 4);
5258 if (! WORDS_BIG_ENDIAN)
5261 tmp = highword; highword = lowword; lowword = tmp;
5264 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5265 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5266 emit_move_insn (operands[5], operands[4]);
5267 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5271 (define_expand "fix_truncdfsi2"
5272 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5273 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5274 (clobber (match_dup 2))
5275 (clobber (match_dup 3))])]
5276 "(TARGET_POWER2 || TARGET_POWERPC)
5277 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5280 if (TARGET_E500_DOUBLE)
5282 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5285 operands[2] = gen_reg_rtx (DImode);
5286 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5289 (define_insn "*fix_truncdfsi2_internal"
5290 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5291 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5292 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5293 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5294 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5296 [(set_attr "length" "16")])
5299 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5300 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5301 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5302 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5303 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5304 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5305 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5306 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5307 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5311 if (GET_CODE (operands[3]) != MEM)
5313 lowword = XEXP (operands[3], 0);
5314 if (WORDS_BIG_ENDIAN)
5315 lowword = plus_constant (lowword, 4);
5317 emit_insn (gen_fctiwz (operands[2], operands[1]));
5318 emit_move_insn (operands[3], operands[2]);
5319 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5323 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5324 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5325 ; because the first makes it clear that operand 0 is not live
5326 ; before the instruction.
5327 (define_insn "fctiwz"
5328 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5329 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5331 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5332 "{fcirz|fctiwz} %0,%1"
5333 [(set_attr "type" "fp")])
5335 (define_expand "floatsisf2"
5336 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5337 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5338 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5341 (define_insn "floatdidf2"
5342 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5343 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5344 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5346 [(set_attr "type" "fp")])
5348 (define_insn_and_split "floatsidf_ppc64"
5349 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5350 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5351 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5352 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5353 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5354 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5357 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5358 (set (match_dup 2) (match_dup 3))
5359 (set (match_dup 4) (match_dup 2))
5360 (set (match_dup 0) (float:DF (match_dup 4)))]
5363 (define_insn_and_split "floatunssidf_ppc64"
5364 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5365 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5366 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5367 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5368 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5369 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5372 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5373 (set (match_dup 2) (match_dup 3))
5374 (set (match_dup 4) (match_dup 2))
5375 (set (match_dup 0) (float:DF (match_dup 4)))]
5378 (define_insn "fix_truncdfdi2"
5379 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5380 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5381 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5383 [(set_attr "type" "fp")])
5385 (define_expand "floatdisf2"
5386 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5387 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5388 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5391 rtx val = operands[1];
5392 if (!flag_unsafe_math_optimizations)
5394 rtx label = gen_label_rtx ();
5395 val = gen_reg_rtx (DImode);
5396 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5399 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5403 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5404 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5405 ;; from double rounding.
5406 (define_insn_and_split "floatdisf2_internal1"
5407 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5408 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5409 (clobber (match_scratch:DF 2 "=f"))]
5410 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5412 "&& reload_completed"
5414 (float:DF (match_dup 1)))
5416 (float_truncate:SF (match_dup 2)))]
5419 ;; Twiddles bits to avoid double rounding.
5420 ;; Bits that might be truncated when converting to DFmode are replaced
5421 ;; by a bit that won't be lost at that stage, but is below the SFmode
5422 ;; rounding position.
5423 (define_expand "floatdisf2_internal2"
5424 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
5426 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
5428 (clobber (scratch:CC))])
5429 (set (match_dup 3) (plus:DI (match_dup 3)
5431 (set (match_dup 0) (plus:DI (match_dup 0)
5433 (set (match_dup 4) (compare:CCUNS (match_dup 3)
5435 (set (match_dup 0) (ior:DI (match_dup 0)
5437 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
5439 (clobber (scratch:CC))])
5440 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
5441 (label_ref (match_operand:DI 2 "" ""))
5443 (set (match_dup 0) (match_dup 1))]
5444 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5447 operands[3] = gen_reg_rtx (DImode);
5448 operands[4] = gen_reg_rtx (CCUNSmode);
5451 ;; Define the DImode operations that can be done in a small number
5452 ;; of instructions. The & constraints are to prevent the register
5453 ;; allocator from allocating registers that overlap with the inputs
5454 ;; (for example, having an input in 7,8 and an output in 6,7). We
5455 ;; also allow for the output being the same as one of the inputs.
5457 (define_insn "*adddi3_noppc64"
5458 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5459 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5460 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5461 "! TARGET_POWERPC64"
5464 if (WORDS_BIG_ENDIAN)
5465 return (GET_CODE (operands[2])) != CONST_INT
5466 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5467 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5469 return (GET_CODE (operands[2])) != CONST_INT
5470 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5471 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5473 [(set_attr "type" "two")
5474 (set_attr "length" "8")])
5476 (define_insn "*subdi3_noppc64"
5477 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5478 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5479 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5480 "! TARGET_POWERPC64"
5483 if (WORDS_BIG_ENDIAN)
5484 return (GET_CODE (operands[1]) != CONST_INT)
5485 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5486 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5488 return (GET_CODE (operands[1]) != CONST_INT)
5489 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5490 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5492 [(set_attr "type" "two")
5493 (set_attr "length" "8")])
5495 (define_insn "*negdi2_noppc64"
5496 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5497 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5498 "! TARGET_POWERPC64"
5501 return (WORDS_BIG_ENDIAN)
5502 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5503 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5505 [(set_attr "type" "two")
5506 (set_attr "length" "8")])
5508 (define_expand "mulsidi3"
5509 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5510 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5511 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5512 "! TARGET_POWERPC64"
5515 if (! TARGET_POWER && ! TARGET_POWERPC)
5517 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5518 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5519 emit_insn (gen_mull_call ());
5520 if (WORDS_BIG_ENDIAN)
5521 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5524 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5525 gen_rtx_REG (SImode, 3));
5526 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5527 gen_rtx_REG (SImode, 4));
5531 else if (TARGET_POWER)
5533 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5538 (define_insn "mulsidi3_mq"
5539 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5540 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5541 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5542 (clobber (match_scratch:SI 3 "=q"))]
5544 "mul %0,%1,%2\;mfmq %L0"
5545 [(set_attr "type" "imul")
5546 (set_attr "length" "8")])
5548 (define_insn "*mulsidi3_no_mq"
5549 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5550 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5551 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5552 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5555 return (WORDS_BIG_ENDIAN)
5556 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5557 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5559 [(set_attr "type" "imul")
5560 (set_attr "length" "8")])
5563 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5564 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5565 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5566 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5569 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5570 (sign_extend:DI (match_dup 2)))
5573 (mult:SI (match_dup 1)
5577 int endian = (WORDS_BIG_ENDIAN == 0);
5578 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5579 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5582 (define_expand "umulsidi3"
5583 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5584 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5585 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5586 "TARGET_POWERPC && ! TARGET_POWERPC64"
5591 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5596 (define_insn "umulsidi3_mq"
5597 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5598 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5599 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5600 (clobber (match_scratch:SI 3 "=q"))]
5601 "TARGET_POWERPC && TARGET_POWER"
5604 return (WORDS_BIG_ENDIAN)
5605 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5606 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5608 [(set_attr "type" "imul")
5609 (set_attr "length" "8")])
5611 (define_insn "*umulsidi3_no_mq"
5612 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5613 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5614 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5615 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5618 return (WORDS_BIG_ENDIAN)
5619 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5620 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5622 [(set_attr "type" "imul")
5623 (set_attr "length" "8")])
5626 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5627 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5628 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5629 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5632 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5633 (zero_extend:DI (match_dup 2)))
5636 (mult:SI (match_dup 1)
5640 int endian = (WORDS_BIG_ENDIAN == 0);
5641 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5642 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5645 (define_expand "smulsi3_highpart"
5646 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5648 (lshiftrt:DI (mult:DI (sign_extend:DI
5649 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5651 (match_operand:SI 2 "gpc_reg_operand" "r")))
5656 if (! TARGET_POWER && ! TARGET_POWERPC)
5658 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5659 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5660 emit_insn (gen_mulh_call ());
5661 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5664 else if (TARGET_POWER)
5666 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5671 (define_insn "smulsi3_highpart_mq"
5672 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5674 (lshiftrt:DI (mult:DI (sign_extend:DI
5675 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5677 (match_operand:SI 2 "gpc_reg_operand" "r")))
5679 (clobber (match_scratch:SI 3 "=q"))]
5682 [(set_attr "type" "imul")])
5684 (define_insn "*smulsi3_highpart_no_mq"
5685 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5687 (lshiftrt:DI (mult:DI (sign_extend:DI
5688 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5690 (match_operand:SI 2 "gpc_reg_operand" "r")))
5692 "TARGET_POWERPC && ! TARGET_POWER"
5694 [(set_attr "type" "imul")])
5696 (define_expand "umulsi3_highpart"
5697 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5699 (lshiftrt:DI (mult:DI (zero_extend:DI
5700 (match_operand:SI 1 "gpc_reg_operand" ""))
5702 (match_operand:SI 2 "gpc_reg_operand" "")))
5709 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5714 (define_insn "umulsi3_highpart_mq"
5715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5717 (lshiftrt:DI (mult:DI (zero_extend:DI
5718 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5720 (match_operand:SI 2 "gpc_reg_operand" "r")))
5722 (clobber (match_scratch:SI 3 "=q"))]
5723 "TARGET_POWERPC && TARGET_POWER"
5725 [(set_attr "type" "imul")])
5727 (define_insn "*umulsi3_highpart_no_mq"
5728 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5730 (lshiftrt:DI (mult:DI (zero_extend:DI
5731 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5733 (match_operand:SI 2 "gpc_reg_operand" "r")))
5735 "TARGET_POWERPC && ! TARGET_POWER"
5737 [(set_attr "type" "imul")])
5739 ;; If operands 0 and 2 are in the same register, we have a problem. But
5740 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5741 ;; why we have the strange constraints below.
5742 (define_insn "ashldi3_power"
5743 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5744 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5745 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5746 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5749 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5750 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5751 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5752 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5753 [(set_attr "length" "8")])
5755 (define_insn "lshrdi3_power"
5756 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5757 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5758 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5759 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5762 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5763 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5764 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5765 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5766 [(set_attr "length" "8")])
5768 ;; Shift by a variable amount is too complex to be worth open-coding. We
5769 ;; just handle shifts by constants.
5770 (define_insn "ashrdi3_power"
5771 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5772 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5773 (match_operand:SI 2 "const_int_operand" "M,i")))
5774 (clobber (match_scratch:SI 3 "=X,q"))]
5777 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5778 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5779 [(set_attr "length" "8")])
5781 (define_insn "ashrdi3_no_power"
5782 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5783 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5784 (match_operand:SI 2 "const_int_operand" "M,i")))]
5785 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5787 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5788 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5789 [(set_attr "type" "two,three")
5790 (set_attr "length" "8,12")])
5792 (define_insn "*ashrdisi3_noppc64"
5793 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5794 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5795 (const_int 32)) 4))]
5796 "TARGET_32BIT && !TARGET_POWERPC64"
5799 if (REGNO (operands[0]) == REGNO (operands[1]))
5802 return \"mr %0,%1\";
5804 [(set_attr "length" "4")])
5807 ;; PowerPC64 DImode operations.
5809 (define_expand "adddi3"
5810 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5811 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5812 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5816 if (! TARGET_POWERPC64)
5818 if (non_short_cint_operand (operands[2], DImode))
5822 if (GET_CODE (operands[2]) == CONST_INT
5823 && ! add_operand (operands[2], DImode))
5825 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5826 ? operands[0] : gen_reg_rtx (DImode));
5828 HOST_WIDE_INT val = INTVAL (operands[2]);
5829 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5830 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5832 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5835 /* The ordering here is important for the prolog expander.
5836 When space is allocated from the stack, adding 'low' first may
5837 produce a temporary deallocation (which would be bad). */
5838 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5839 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5844 ;; Discourage ai/addic because of carry but provide it in an alternative
5845 ;; allowing register zero as source.
5847 (define_insn "*adddi3_internal1"
5848 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5849 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5850 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5858 (define_insn "*adddi3_internal2"
5859 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5860 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5861 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5863 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5870 [(set_attr "type" "fast_compare,compare,compare,compare")
5871 (set_attr "length" "4,4,8,8")])
5874 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5875 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5876 (match_operand:DI 2 "reg_or_short_operand" ""))
5878 (clobber (match_scratch:DI 3 ""))]
5879 "TARGET_POWERPC64 && reload_completed"
5881 (plus:DI (match_dup 1) (match_dup 2)))
5883 (compare:CC (match_dup 3)
5887 (define_insn "*adddi3_internal3"
5888 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5889 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5890 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5892 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5893 (plus:DI (match_dup 1) (match_dup 2)))]
5900 [(set_attr "type" "fast_compare,compare,compare,compare")
5901 (set_attr "length" "4,4,8,8")])
5904 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5905 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5906 (match_operand:DI 2 "reg_or_short_operand" ""))
5908 (set (match_operand:DI 0 "gpc_reg_operand" "")
5909 (plus:DI (match_dup 1) (match_dup 2)))]
5910 "TARGET_POWERPC64 && reload_completed"
5912 (plus:DI (match_dup 1) (match_dup 2)))
5914 (compare:CC (match_dup 0)
5918 ;; Split an add that we can't do in one insn into two insns, each of which
5919 ;; does one 16-bit part. This is used by combine. Note that the low-order
5920 ;; add should be last in case the result gets used in an address.
5923 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5924 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5925 (match_operand:DI 2 "non_add_cint_operand" "")))]
5927 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5928 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5931 HOST_WIDE_INT val = INTVAL (operands[2]);
5932 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5933 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5935 operands[4] = GEN_INT (low);
5936 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5937 operands[3] = GEN_INT (rest);
5938 else if (! no_new_pseudos)
5940 operands[3] = gen_reg_rtx (DImode);
5941 emit_move_insn (operands[3], operands[2]);
5942 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5949 (define_insn "one_cmpldi2"
5950 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5951 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5956 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5957 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5959 (clobber (match_scratch:DI 2 "=r,r"))]
5964 [(set_attr "type" "compare")
5965 (set_attr "length" "4,8")])
5968 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5969 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5971 (clobber (match_scratch:DI 2 ""))]
5972 "TARGET_POWERPC64 && reload_completed"
5974 (not:DI (match_dup 1)))
5976 (compare:CC (match_dup 2)
5981 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5982 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5984 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5985 (not:DI (match_dup 1)))]
5990 [(set_attr "type" "compare")
5991 (set_attr "length" "4,8")])
5994 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5995 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5997 (set (match_operand:DI 0 "gpc_reg_operand" "")
5998 (not:DI (match_dup 1)))]
5999 "TARGET_POWERPC64 && reload_completed"
6001 (not:DI (match_dup 1)))
6003 (compare:CC (match_dup 0)
6008 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6009 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
6010 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
6017 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6018 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6019 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6021 (clobber (match_scratch:DI 3 "=r,r"))]
6026 [(set_attr "type" "fast_compare")
6027 (set_attr "length" "4,8")])
6030 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6031 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6032 (match_operand:DI 2 "gpc_reg_operand" ""))
6034 (clobber (match_scratch:DI 3 ""))]
6035 "TARGET_POWERPC64 && reload_completed"
6037 (minus:DI (match_dup 1) (match_dup 2)))
6039 (compare:CC (match_dup 3)
6044 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6045 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6046 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6048 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6049 (minus:DI (match_dup 1) (match_dup 2)))]
6054 [(set_attr "type" "fast_compare")
6055 (set_attr "length" "4,8")])
6058 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6059 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6060 (match_operand:DI 2 "gpc_reg_operand" ""))
6062 (set (match_operand:DI 0 "gpc_reg_operand" "")
6063 (minus:DI (match_dup 1) (match_dup 2)))]
6064 "TARGET_POWERPC64 && reload_completed"
6066 (minus:DI (match_dup 1) (match_dup 2)))
6068 (compare:CC (match_dup 0)
6072 (define_expand "subdi3"
6073 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6074 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
6075 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
6079 if (GET_CODE (operands[2]) == CONST_INT)
6081 emit_insn (gen_adddi3 (operands[0], operands[1],
6082 negate_rtx (DImode, operands[2])));
6087 (define_insn_and_split "absdi2"
6088 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6089 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6090 (clobber (match_scratch:DI 2 "=&r,&r"))]
6093 "&& reload_completed"
6094 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6095 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6096 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6099 (define_insn_and_split "*nabsdi2"
6100 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6101 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6102 (clobber (match_scratch:DI 2 "=&r,&r"))]
6105 "&& reload_completed"
6106 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6107 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6108 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6111 (define_expand "negdi2"
6112 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6113 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
6118 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6119 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6124 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6125 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6127 (clobber (match_scratch:DI 2 "=r,r"))]
6132 [(set_attr "type" "fast_compare")
6133 (set_attr "length" "4,8")])
6136 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6137 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6139 (clobber (match_scratch:DI 2 ""))]
6140 "TARGET_POWERPC64 && reload_completed"
6142 (neg:DI (match_dup 1)))
6144 (compare:CC (match_dup 2)
6149 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6150 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6152 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6153 (neg:DI (match_dup 1)))]
6158 [(set_attr "type" "fast_compare")
6159 (set_attr "length" "4,8")])
6162 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6163 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6165 (set (match_operand:DI 0 "gpc_reg_operand" "")
6166 (neg:DI (match_dup 1)))]
6167 "TARGET_POWERPC64 && reload_completed"
6169 (neg:DI (match_dup 1)))
6171 (compare:CC (match_dup 0)
6175 (define_insn "clzdi2"
6176 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6177 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6181 (define_expand "ctzdi2"
6183 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6184 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6186 (clobber (scratch:CC))])
6187 (set (match_dup 4) (clz:DI (match_dup 3)))
6188 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6189 (minus:DI (const_int 63) (match_dup 4)))]
6192 operands[2] = gen_reg_rtx (DImode);
6193 operands[3] = gen_reg_rtx (DImode);
6194 operands[4] = gen_reg_rtx (DImode);
6197 (define_expand "ffsdi2"
6199 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6200 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6202 (clobber (scratch:CC))])
6203 (set (match_dup 4) (clz:DI (match_dup 3)))
6204 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6205 (minus:DI (const_int 64) (match_dup 4)))]
6208 operands[2] = gen_reg_rtx (DImode);
6209 operands[3] = gen_reg_rtx (DImode);
6210 operands[4] = gen_reg_rtx (DImode);
6213 (define_insn "muldi3"
6214 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6215 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6216 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6219 [(set_attr "type" "lmul")])
6221 (define_insn "*muldi3_internal1"
6222 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6223 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6224 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6226 (clobber (match_scratch:DI 3 "=r,r"))]
6231 [(set_attr "type" "lmul_compare")
6232 (set_attr "length" "4,8")])
6235 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6236 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6237 (match_operand:DI 2 "gpc_reg_operand" ""))
6239 (clobber (match_scratch:DI 3 ""))]
6240 "TARGET_POWERPC64 && reload_completed"
6242 (mult:DI (match_dup 1) (match_dup 2)))
6244 (compare:CC (match_dup 3)
6248 (define_insn "*muldi3_internal2"
6249 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6250 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6251 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6253 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6254 (mult:DI (match_dup 1) (match_dup 2)))]
6259 [(set_attr "type" "lmul_compare")
6260 (set_attr "length" "4,8")])
6263 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6264 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6265 (match_operand:DI 2 "gpc_reg_operand" ""))
6267 (set (match_operand:DI 0 "gpc_reg_operand" "")
6268 (mult:DI (match_dup 1) (match_dup 2)))]
6269 "TARGET_POWERPC64 && reload_completed"
6271 (mult:DI (match_dup 1) (match_dup 2)))
6273 (compare:CC (match_dup 0)
6277 (define_insn "smuldi3_highpart"
6278 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6280 (lshiftrt:TI (mult:TI (sign_extend:TI
6281 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6283 (match_operand:DI 2 "gpc_reg_operand" "r")))
6287 [(set_attr "type" "lmul")])
6289 (define_insn "umuldi3_highpart"
6290 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6292 (lshiftrt:TI (mult:TI (zero_extend:TI
6293 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6295 (match_operand:DI 2 "gpc_reg_operand" "r")))
6299 [(set_attr "type" "lmul")])
6301 (define_expand "divdi3"
6302 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6303 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6304 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6308 if (GET_CODE (operands[2]) == CONST_INT
6309 && INTVAL (operands[2]) > 0
6310 && exact_log2 (INTVAL (operands[2])) >= 0)
6313 operands[2] = force_reg (DImode, operands[2]);
6316 (define_expand "moddi3"
6317 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6318 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6319 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6327 if (GET_CODE (operands[2]) != CONST_INT
6328 || INTVAL (operands[2]) <= 0
6329 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6332 temp1 = gen_reg_rtx (DImode);
6333 temp2 = gen_reg_rtx (DImode);
6335 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6336 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6337 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6342 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6343 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6344 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6346 "sradi %0,%1,%p2\;addze %0,%0"
6347 [(set_attr "type" "two")
6348 (set_attr "length" "8")])
6351 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6352 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6353 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6355 (clobber (match_scratch:DI 3 "=r,r"))]
6358 sradi %3,%1,%p2\;addze. %3,%3
6360 [(set_attr "type" "compare")
6361 (set_attr "length" "8,12")])
6364 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6365 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6366 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6368 (clobber (match_scratch:DI 3 ""))]
6369 "TARGET_POWERPC64 && reload_completed"
6371 (div:DI (match_dup 1) (match_dup 2)))
6373 (compare:CC (match_dup 3)
6378 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6379 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6380 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6382 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6383 (div:DI (match_dup 1) (match_dup 2)))]
6386 sradi %0,%1,%p2\;addze. %0,%0
6388 [(set_attr "type" "compare")
6389 (set_attr "length" "8,12")])
6392 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6393 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6394 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6396 (set (match_operand:DI 0 "gpc_reg_operand" "")
6397 (div:DI (match_dup 1) (match_dup 2)))]
6398 "TARGET_POWERPC64 && reload_completed"
6400 (div:DI (match_dup 1) (match_dup 2)))
6402 (compare:CC (match_dup 0)
6407 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6408 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6409 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6412 [(set_attr "type" "ldiv")])
6414 (define_insn "udivdi3"
6415 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6416 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6417 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6420 [(set_attr "type" "ldiv")])
6422 (define_insn "rotldi3"
6423 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6424 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6425 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6427 "rld%I2cl %0,%1,%H2,0")
6429 (define_insn "*rotldi3_internal2"
6430 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6431 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6432 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6434 (clobber (match_scratch:DI 3 "=r,r"))]
6437 rld%I2cl. %3,%1,%H2,0
6439 [(set_attr "type" "delayed_compare")
6440 (set_attr "length" "4,8")])
6443 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6444 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6445 (match_operand:DI 2 "reg_or_cint_operand" ""))
6447 (clobber (match_scratch:DI 3 ""))]
6448 "TARGET_POWERPC64 && reload_completed"
6450 (rotate:DI (match_dup 1) (match_dup 2)))
6452 (compare:CC (match_dup 3)
6456 (define_insn "*rotldi3_internal3"
6457 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6458 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6459 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6461 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6462 (rotate:DI (match_dup 1) (match_dup 2)))]
6465 rld%I2cl. %0,%1,%H2,0
6467 [(set_attr "type" "delayed_compare")
6468 (set_attr "length" "4,8")])
6471 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6472 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6473 (match_operand:DI 2 "reg_or_cint_operand" ""))
6475 (set (match_operand:DI 0 "gpc_reg_operand" "")
6476 (rotate:DI (match_dup 1) (match_dup 2)))]
6477 "TARGET_POWERPC64 && reload_completed"
6479 (rotate:DI (match_dup 1) (match_dup 2)))
6481 (compare:CC (match_dup 0)
6485 (define_insn "*rotldi3_internal4"
6486 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6487 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6488 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6489 (match_operand:DI 3 "mask64_operand" "n")))]
6491 "rld%I2c%B3 %0,%1,%H2,%S3")
6493 (define_insn "*rotldi3_internal5"
6494 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6496 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6497 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6498 (match_operand:DI 3 "mask64_operand" "n,n"))
6500 (clobber (match_scratch:DI 4 "=r,r"))]
6503 rld%I2c%B3. %4,%1,%H2,%S3
6505 [(set_attr "type" "delayed_compare")
6506 (set_attr "length" "4,8")])
6509 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6511 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6512 (match_operand:DI 2 "reg_or_cint_operand" ""))
6513 (match_operand:DI 3 "mask64_operand" ""))
6515 (clobber (match_scratch:DI 4 ""))]
6516 "TARGET_POWERPC64 && reload_completed"
6518 (and:DI (rotate:DI (match_dup 1)
6522 (compare:CC (match_dup 4)
6526 (define_insn "*rotldi3_internal6"
6527 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6529 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6530 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6531 (match_operand:DI 3 "mask64_operand" "n,n"))
6533 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6534 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6537 rld%I2c%B3. %0,%1,%H2,%S3
6539 [(set_attr "type" "delayed_compare")
6540 (set_attr "length" "4,8")])
6543 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6545 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6546 (match_operand:DI 2 "reg_or_cint_operand" ""))
6547 (match_operand:DI 3 "mask64_operand" ""))
6549 (set (match_operand:DI 0 "gpc_reg_operand" "")
6550 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6551 "TARGET_POWERPC64 && reload_completed"
6553 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6555 (compare:CC (match_dup 0)
6559 (define_insn "*rotldi3_internal7"
6560 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6563 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6564 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6566 "rld%I2cl %0,%1,%H2,56")
6568 (define_insn "*rotldi3_internal8"
6569 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6570 (compare:CC (zero_extend:DI
6572 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6573 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6575 (clobber (match_scratch:DI 3 "=r,r"))]
6578 rld%I2cl. %3,%1,%H2,56
6580 [(set_attr "type" "delayed_compare")
6581 (set_attr "length" "4,8")])
6584 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6585 (compare:CC (zero_extend:DI
6587 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6588 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6590 (clobber (match_scratch:DI 3 ""))]
6591 "TARGET_POWERPC64 && reload_completed"
6593 (zero_extend:DI (subreg:QI
6594 (rotate:DI (match_dup 1)
6597 (compare:CC (match_dup 3)
6601 (define_insn "*rotldi3_internal9"
6602 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6603 (compare:CC (zero_extend:DI
6605 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6606 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6608 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6609 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6612 rld%I2cl. %0,%1,%H2,56
6614 [(set_attr "type" "delayed_compare")
6615 (set_attr "length" "4,8")])
6618 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6619 (compare:CC (zero_extend:DI
6621 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6622 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6624 (set (match_operand:DI 0 "gpc_reg_operand" "")
6625 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6626 "TARGET_POWERPC64 && reload_completed"
6628 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6630 (compare:CC (match_dup 0)
6634 (define_insn "*rotldi3_internal10"
6635 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6638 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6639 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6641 "rld%I2cl %0,%1,%H2,48")
6643 (define_insn "*rotldi3_internal11"
6644 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6645 (compare:CC (zero_extend:DI
6647 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6648 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6650 (clobber (match_scratch:DI 3 "=r,r"))]
6653 rld%I2cl. %3,%1,%H2,48
6655 [(set_attr "type" "delayed_compare")
6656 (set_attr "length" "4,8")])
6659 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6660 (compare:CC (zero_extend:DI
6662 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6663 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6665 (clobber (match_scratch:DI 3 ""))]
6666 "TARGET_POWERPC64 && reload_completed"
6668 (zero_extend:DI (subreg:HI
6669 (rotate:DI (match_dup 1)
6672 (compare:CC (match_dup 3)
6676 (define_insn "*rotldi3_internal12"
6677 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6678 (compare:CC (zero_extend:DI
6680 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6681 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6683 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6684 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6687 rld%I2cl. %0,%1,%H2,48
6689 [(set_attr "type" "delayed_compare")
6690 (set_attr "length" "4,8")])
6693 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6694 (compare:CC (zero_extend:DI
6696 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6697 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6699 (set (match_operand:DI 0 "gpc_reg_operand" "")
6700 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6701 "TARGET_POWERPC64 && reload_completed"
6703 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6705 (compare:CC (match_dup 0)
6709 (define_insn "*rotldi3_internal13"
6710 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6713 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6714 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6716 "rld%I2cl %0,%1,%H2,32")
6718 (define_insn "*rotldi3_internal14"
6719 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6720 (compare:CC (zero_extend:DI
6722 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6723 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6725 (clobber (match_scratch:DI 3 "=r,r"))]
6728 rld%I2cl. %3,%1,%H2,32
6730 [(set_attr "type" "delayed_compare")
6731 (set_attr "length" "4,8")])
6734 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6735 (compare:CC (zero_extend:DI
6737 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6738 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6740 (clobber (match_scratch:DI 3 ""))]
6741 "TARGET_POWERPC64 && reload_completed"
6743 (zero_extend:DI (subreg:SI
6744 (rotate:DI (match_dup 1)
6747 (compare:CC (match_dup 3)
6751 (define_insn "*rotldi3_internal15"
6752 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6753 (compare:CC (zero_extend:DI
6755 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6756 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6758 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6759 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6762 rld%I2cl. %0,%1,%H2,32
6764 [(set_attr "type" "delayed_compare")
6765 (set_attr "length" "4,8")])
6768 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6769 (compare:CC (zero_extend:DI
6771 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6772 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6774 (set (match_operand:DI 0 "gpc_reg_operand" "")
6775 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6776 "TARGET_POWERPC64 && reload_completed"
6778 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6780 (compare:CC (match_dup 0)
6784 (define_expand "ashldi3"
6785 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6786 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6787 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6788 "TARGET_POWERPC64 || TARGET_POWER"
6791 if (TARGET_POWERPC64)
6793 else if (TARGET_POWER)
6795 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6802 (define_insn "*ashldi3_internal1"
6803 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6804 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6805 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6809 (define_insn "*ashldi3_internal2"
6810 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6811 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6812 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6814 (clobber (match_scratch:DI 3 "=r,r"))]
6819 [(set_attr "type" "delayed_compare")
6820 (set_attr "length" "4,8")])
6823 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6824 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6825 (match_operand:SI 2 "reg_or_cint_operand" ""))
6827 (clobber (match_scratch:DI 3 ""))]
6828 "TARGET_POWERPC64 && reload_completed"
6830 (ashift:DI (match_dup 1) (match_dup 2)))
6832 (compare:CC (match_dup 3)
6836 (define_insn "*ashldi3_internal3"
6837 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6838 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6839 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6841 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6842 (ashift:DI (match_dup 1) (match_dup 2)))]
6847 [(set_attr "type" "delayed_compare")
6848 (set_attr "length" "4,8")])
6851 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6852 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6853 (match_operand:SI 2 "reg_or_cint_operand" ""))
6855 (set (match_operand:DI 0 "gpc_reg_operand" "")
6856 (ashift:DI (match_dup 1) (match_dup 2)))]
6857 "TARGET_POWERPC64 && reload_completed"
6859 (ashift:DI (match_dup 1) (match_dup 2)))
6861 (compare:CC (match_dup 0)
6865 (define_insn "*ashldi3_internal4"
6866 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6867 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6868 (match_operand:SI 2 "const_int_operand" "i"))
6869 (match_operand:DI 3 "const_int_operand" "n")))]
6870 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6871 "rldic %0,%1,%H2,%W3")
6873 (define_insn "ashldi3_internal5"
6874 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6876 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6877 (match_operand:SI 2 "const_int_operand" "i,i"))
6878 (match_operand:DI 3 "const_int_operand" "n,n"))
6880 (clobber (match_scratch:DI 4 "=r,r"))]
6881 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6883 rldic. %4,%1,%H2,%W3
6885 [(set_attr "type" "delayed_compare")
6886 (set_attr "length" "4,8")])
6889 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6891 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6892 (match_operand:SI 2 "const_int_operand" ""))
6893 (match_operand:DI 3 "const_int_operand" ""))
6895 (clobber (match_scratch:DI 4 ""))]
6896 "TARGET_POWERPC64 && reload_completed
6897 && includes_rldic_lshift_p (operands[2], operands[3])"
6899 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6902 (compare:CC (match_dup 4)
6906 (define_insn "*ashldi3_internal6"
6907 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6909 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6910 (match_operand:SI 2 "const_int_operand" "i,i"))
6911 (match_operand:DI 3 "const_int_operand" "n,n"))
6913 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6914 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6915 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6917 rldic. %0,%1,%H2,%W3
6919 [(set_attr "type" "delayed_compare")
6920 (set_attr "length" "4,8")])
6923 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6925 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6926 (match_operand:SI 2 "const_int_operand" ""))
6927 (match_operand:DI 3 "const_int_operand" ""))
6929 (set (match_operand:DI 0 "gpc_reg_operand" "")
6930 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6931 "TARGET_POWERPC64 && reload_completed
6932 && includes_rldic_lshift_p (operands[2], operands[3])"
6934 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6937 (compare:CC (match_dup 0)
6941 (define_insn "*ashldi3_internal7"
6942 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6943 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6944 (match_operand:SI 2 "const_int_operand" "i"))
6945 (match_operand:DI 3 "mask64_operand" "n")))]
6946 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6947 "rldicr %0,%1,%H2,%S3")
6949 (define_insn "ashldi3_internal8"
6950 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6952 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6953 (match_operand:SI 2 "const_int_operand" "i,i"))
6954 (match_operand:DI 3 "mask64_operand" "n,n"))
6956 (clobber (match_scratch:DI 4 "=r,r"))]
6957 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6959 rldicr. %4,%1,%H2,%S3
6961 [(set_attr "type" "delayed_compare")
6962 (set_attr "length" "4,8")])
6965 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6967 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6968 (match_operand:SI 2 "const_int_operand" ""))
6969 (match_operand:DI 3 "mask64_operand" ""))
6971 (clobber (match_scratch:DI 4 ""))]
6972 "TARGET_POWERPC64 && reload_completed
6973 && includes_rldicr_lshift_p (operands[2], operands[3])"
6975 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6978 (compare:CC (match_dup 4)
6982 (define_insn "*ashldi3_internal9"
6983 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6985 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6986 (match_operand:SI 2 "const_int_operand" "i,i"))
6987 (match_operand:DI 3 "mask64_operand" "n,n"))
6989 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6990 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6991 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6993 rldicr. %0,%1,%H2,%S3
6995 [(set_attr "type" "delayed_compare")
6996 (set_attr "length" "4,8")])
6999 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7001 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7002 (match_operand:SI 2 "const_int_operand" ""))
7003 (match_operand:DI 3 "mask64_operand" ""))
7005 (set (match_operand:DI 0 "gpc_reg_operand" "")
7006 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7007 "TARGET_POWERPC64 && reload_completed
7008 && includes_rldicr_lshift_p (operands[2], operands[3])"
7010 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7013 (compare:CC (match_dup 0)
7017 (define_expand "lshrdi3"
7018 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7019 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7020 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7021 "TARGET_POWERPC64 || TARGET_POWER"
7024 if (TARGET_POWERPC64)
7026 else if (TARGET_POWER)
7028 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7035 (define_insn "*lshrdi3_internal1"
7036 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7037 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7038 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7042 (define_insn "*lshrdi3_internal2"
7043 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7044 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7045 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7047 (clobber (match_scratch:DI 3 "=r,r"))]
7052 [(set_attr "type" "delayed_compare")
7053 (set_attr "length" "4,8")])
7056 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7057 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7058 (match_operand:SI 2 "reg_or_cint_operand" ""))
7060 (clobber (match_scratch:DI 3 ""))]
7061 "TARGET_POWERPC64 && reload_completed"
7063 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7065 (compare:CC (match_dup 3)
7069 (define_insn "*lshrdi3_internal3"
7070 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7071 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7072 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7074 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7075 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7080 [(set_attr "type" "delayed_compare")
7081 (set_attr "length" "4,8")])
7084 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7085 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7086 (match_operand:SI 2 "reg_or_cint_operand" ""))
7088 (set (match_operand:DI 0 "gpc_reg_operand" "")
7089 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7090 "TARGET_POWERPC64 && reload_completed"
7092 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7094 (compare:CC (match_dup 0)
7098 (define_expand "ashrdi3"
7099 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7100 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7101 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7105 if (TARGET_POWERPC64)
7107 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7109 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7112 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7113 && WORDS_BIG_ENDIAN)
7115 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7122 (define_insn "*ashrdi3_internal1"
7123 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7124 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7125 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7127 "srad%I2 %0,%1,%H2")
7129 (define_insn "*ashrdi3_internal2"
7130 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7131 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7132 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7134 (clobber (match_scratch:DI 3 "=r,r"))]
7139 [(set_attr "type" "delayed_compare")
7140 (set_attr "length" "4,8")])
7143 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7144 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7145 (match_operand:SI 2 "reg_or_cint_operand" ""))
7147 (clobber (match_scratch:DI 3 ""))]
7148 "TARGET_POWERPC64 && reload_completed"
7150 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7152 (compare:CC (match_dup 3)
7156 (define_insn "*ashrdi3_internal3"
7157 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7158 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7159 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7161 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7162 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7167 [(set_attr "type" "delayed_compare")
7168 (set_attr "length" "4,8")])
7171 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7172 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7173 (match_operand:SI 2 "reg_or_cint_operand" ""))
7175 (set (match_operand:DI 0 "gpc_reg_operand" "")
7176 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7177 "TARGET_POWERPC64 && reload_completed"
7179 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7181 (compare:CC (match_dup 0)
7185 (define_insn "anddi3"
7186 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7187 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7188 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7189 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7193 rldic%B2 %0,%1,0,%S2
7194 rlwinm %0,%1,0,%m2,%M2
7198 [(set_attr "type" "*,*,*,compare,compare,*")
7199 (set_attr "length" "4,4,4,4,4,8")])
7202 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7203 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7204 (match_operand:DI 2 "mask64_2_operand" "")))
7205 (clobber (match_scratch:CC 3 ""))]
7207 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7208 && !mask64_operand (operands[2], DImode)"
7210 (and:DI (rotate:DI (match_dup 1)
7214 (and:DI (rotate:DI (match_dup 0)
7218 build_mask64_2_operands (operands[2], &operands[4]);
7221 (define_insn "*anddi3_internal2"
7222 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7223 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7224 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7226 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7227 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7231 rldic%B2. %3,%1,0,%S2
7240 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7241 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7244 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7245 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7246 (match_operand:DI 2 "and64_operand" ""))
7248 (clobber (match_scratch:DI 3 ""))
7249 (clobber (match_scratch:CC 4 ""))]
7250 "TARGET_POWERPC64 && reload_completed"
7251 [(parallel [(set (match_dup 3)
7252 (and:DI (match_dup 1)
7254 (clobber (match_dup 4))])
7256 (compare:CC (match_dup 3)
7261 [(set (match_operand:CC 0 "cc_reg_operand" "")
7262 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7263 (match_operand:DI 2 "mask64_2_operand" ""))
7265 (clobber (match_scratch:DI 3 ""))
7266 (clobber (match_scratch:CC 4 ""))]
7267 "TARGET_POWERPC64 && reload_completed
7268 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7269 && !mask64_operand (operands[2], DImode)"
7271 (and:DI (rotate:DI (match_dup 1)
7274 (parallel [(set (match_dup 0)
7275 (compare:CC (and:DI (rotate:DI (match_dup 3)
7279 (clobber (match_dup 3))])]
7282 build_mask64_2_operands (operands[2], &operands[5]);
7285 (define_insn "*anddi3_internal3"
7286 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7287 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7288 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7290 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7291 (and:DI (match_dup 1) (match_dup 2)))
7292 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7296 rldic%B2. %0,%1,0,%S2
7305 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7306 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7309 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7310 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7311 (match_operand:DI 2 "and64_operand" ""))
7313 (set (match_operand:DI 0 "gpc_reg_operand" "")
7314 (and:DI (match_dup 1) (match_dup 2)))
7315 (clobber (match_scratch:CC 4 ""))]
7316 "TARGET_POWERPC64 && reload_completed"
7317 [(parallel [(set (match_dup 0)
7318 (and:DI (match_dup 1) (match_dup 2)))
7319 (clobber (match_dup 4))])
7321 (compare:CC (match_dup 0)
7326 [(set (match_operand:CC 3 "cc_reg_operand" "")
7327 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7328 (match_operand:DI 2 "mask64_2_operand" ""))
7330 (set (match_operand:DI 0 "gpc_reg_operand" "")
7331 (and:DI (match_dup 1) (match_dup 2)))
7332 (clobber (match_scratch:CC 4 ""))]
7333 "TARGET_POWERPC64 && reload_completed
7334 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7335 && !mask64_operand (operands[2], DImode)"
7337 (and:DI (rotate:DI (match_dup 1)
7340 (parallel [(set (match_dup 3)
7341 (compare:CC (and:DI (rotate:DI (match_dup 0)
7346 (and:DI (rotate:DI (match_dup 0)
7351 build_mask64_2_operands (operands[2], &operands[5]);
7354 (define_expand "iordi3"
7355 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7356 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7357 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7361 if (non_logical_cint_operand (operands[2], DImode))
7363 HOST_WIDE_INT value;
7364 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7365 ? operands[0] : gen_reg_rtx (DImode));
7367 if (GET_CODE (operands[2]) == CONST_INT)
7369 value = INTVAL (operands[2]);
7370 emit_insn (gen_iordi3 (tmp, operands[1],
7371 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7375 value = CONST_DOUBLE_LOW (operands[2]);
7376 emit_insn (gen_iordi3 (tmp, operands[1],
7377 immed_double_const (value
7378 & (~ (HOST_WIDE_INT) 0xffff),
7382 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7387 (define_expand "xordi3"
7388 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7389 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7390 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7394 if (non_logical_cint_operand (operands[2], DImode))
7396 HOST_WIDE_INT value;
7397 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7398 ? operands[0] : gen_reg_rtx (DImode));
7400 if (GET_CODE (operands[2]) == CONST_INT)
7402 value = INTVAL (operands[2]);
7403 emit_insn (gen_xordi3 (tmp, operands[1],
7404 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7408 value = CONST_DOUBLE_LOW (operands[2]);
7409 emit_insn (gen_xordi3 (tmp, operands[1],
7410 immed_double_const (value
7411 & (~ (HOST_WIDE_INT) 0xffff),
7415 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7420 (define_insn "*booldi3_internal1"
7421 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7422 (match_operator:DI 3 "boolean_or_operator"
7423 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7424 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7431 (define_insn "*booldi3_internal2"
7432 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7433 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7434 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7435 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7437 (clobber (match_scratch:DI 3 "=r,r"))]
7442 [(set_attr "type" "compare")
7443 (set_attr "length" "4,8")])
7446 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7447 (compare:CC (match_operator:DI 4 "boolean_operator"
7448 [(match_operand:DI 1 "gpc_reg_operand" "")
7449 (match_operand:DI 2 "gpc_reg_operand" "")])
7451 (clobber (match_scratch:DI 3 ""))]
7452 "TARGET_POWERPC64 && reload_completed"
7453 [(set (match_dup 3) (match_dup 4))
7455 (compare:CC (match_dup 3)
7459 (define_insn "*booldi3_internal3"
7460 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7461 (compare:CC (match_operator:DI 4 "boolean_operator"
7462 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7463 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7465 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7471 [(set_attr "type" "compare")
7472 (set_attr "length" "4,8")])
7475 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7476 (compare:CC (match_operator:DI 4 "boolean_operator"
7477 [(match_operand:DI 1 "gpc_reg_operand" "")
7478 (match_operand:DI 2 "gpc_reg_operand" "")])
7480 (set (match_operand:DI 0 "gpc_reg_operand" "")
7482 "TARGET_POWERPC64 && reload_completed"
7483 [(set (match_dup 0) (match_dup 4))
7485 (compare:CC (match_dup 0)
7489 ;; Split a logical operation that we can't do in one insn into two insns,
7490 ;; each of which does one 16-bit part. This is used by combine.
7493 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7494 (match_operator:DI 3 "boolean_or_operator"
7495 [(match_operand:DI 1 "gpc_reg_operand" "")
7496 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7498 [(set (match_dup 0) (match_dup 4))
7499 (set (match_dup 0) (match_dup 5))]
7504 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7506 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7507 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7509 i4 = GEN_INT (value & 0xffff);
7513 i3 = GEN_INT (INTVAL (operands[2])
7514 & (~ (HOST_WIDE_INT) 0xffff));
7515 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7517 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7519 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7523 (define_insn "*boolcdi3_internal1"
7524 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7525 (match_operator:DI 3 "boolean_operator"
7526 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7527 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7531 (define_insn "*boolcdi3_internal2"
7532 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7533 (compare:CC (match_operator:DI 4 "boolean_operator"
7534 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7535 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7537 (clobber (match_scratch:DI 3 "=r,r"))]
7542 [(set_attr "type" "compare")
7543 (set_attr "length" "4,8")])
7546 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7547 (compare:CC (match_operator:DI 4 "boolean_operator"
7548 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7549 (match_operand:DI 2 "gpc_reg_operand" "")])
7551 (clobber (match_scratch:DI 3 ""))]
7552 "TARGET_POWERPC64 && reload_completed"
7553 [(set (match_dup 3) (match_dup 4))
7555 (compare:CC (match_dup 3)
7559 (define_insn "*boolcdi3_internal3"
7560 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7561 (compare:CC (match_operator:DI 4 "boolean_operator"
7562 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7563 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7565 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7571 [(set_attr "type" "compare")
7572 (set_attr "length" "4,8")])
7575 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7576 (compare:CC (match_operator:DI 4 "boolean_operator"
7577 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7578 (match_operand:DI 2 "gpc_reg_operand" "")])
7580 (set (match_operand:DI 0 "gpc_reg_operand" "")
7582 "TARGET_POWERPC64 && reload_completed"
7583 [(set (match_dup 0) (match_dup 4))
7585 (compare:CC (match_dup 0)
7589 (define_insn "*boolccdi3_internal1"
7590 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7591 (match_operator:DI 3 "boolean_operator"
7592 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7593 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7597 (define_insn "*boolccdi3_internal2"
7598 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7599 (compare:CC (match_operator:DI 4 "boolean_operator"
7600 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7601 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7603 (clobber (match_scratch:DI 3 "=r,r"))]
7608 [(set_attr "type" "compare")
7609 (set_attr "length" "4,8")])
7612 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7613 (compare:CC (match_operator:DI 4 "boolean_operator"
7614 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7615 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7617 (clobber (match_scratch:DI 3 ""))]
7618 "TARGET_POWERPC64 && reload_completed"
7619 [(set (match_dup 3) (match_dup 4))
7621 (compare:CC (match_dup 3)
7625 (define_insn "*boolccdi3_internal3"
7626 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7627 (compare:CC (match_operator:DI 4 "boolean_operator"
7628 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7629 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7631 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7637 [(set_attr "type" "compare")
7638 (set_attr "length" "4,8")])
7641 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7642 (compare:CC (match_operator:DI 4 "boolean_operator"
7643 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7644 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7646 (set (match_operand:DI 0 "gpc_reg_operand" "")
7648 "TARGET_POWERPC64 && reload_completed"
7649 [(set (match_dup 0) (match_dup 4))
7651 (compare:CC (match_dup 0)
7655 ;; Now define ways of moving data around.
7657 ;; Elf specific ways of loading addresses for non-PIC code.
7658 ;; The output of this could be r0, but we make a very strong
7659 ;; preference for a base register because it will usually
7661 (define_insn "elf_high"
7662 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7663 (high:SI (match_operand 1 "" "")))]
7664 "TARGET_ELF && ! TARGET_64BIT"
7665 "{liu|lis} %0,%1@ha")
7667 (define_insn "elf_low"
7668 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7669 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7670 (match_operand 2 "" "")))]
7671 "TARGET_ELF && ! TARGET_64BIT"
7673 {cal|la} %0,%2@l(%1)
7674 {ai|addic} %0,%1,%K2")
7677 ;; Set up a register with a value from the GOT table
7679 (define_expand "movsi_got"
7680 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7681 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7682 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7683 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7686 if (GET_CODE (operands[1]) == CONST)
7688 rtx offset = const0_rtx;
7689 HOST_WIDE_INT value;
7691 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7692 value = INTVAL (offset);
7695 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7696 emit_insn (gen_movsi_got (tmp, operands[1]));
7697 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7702 operands[2] = rs6000_got_register (operands[1]);
7705 (define_insn "*movsi_got_internal"
7706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7707 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7708 (match_operand:SI 2 "gpc_reg_operand" "b")]
7710 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7711 "{l|lwz} %0,%a1@got(%2)"
7712 [(set_attr "type" "load")])
7714 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7715 ;; didn't get allocated to a hard register.
7717 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7718 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7719 (match_operand:SI 2 "memory_operand" "")]
7721 "DEFAULT_ABI == ABI_V4
7723 && (reload_in_progress || reload_completed)"
7724 [(set (match_dup 0) (match_dup 2))
7725 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7729 ;; For SI, we special-case integers that can't be loaded in one insn. We
7730 ;; do the load 16-bits at a time. We could do this by loading from memory,
7731 ;; and this is even supposed to be faster, but it is simpler not to get
7732 ;; integers in the TOC.
7733 (define_expand "movsi"
7734 [(set (match_operand:SI 0 "general_operand" "")
7735 (match_operand:SI 1 "any_operand" ""))]
7737 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7739 (define_insn "movsi_low"
7740 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7741 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7742 (match_operand 2 "" ""))))]
7743 "TARGET_MACHO && ! TARGET_64BIT"
7744 "{l|lwz} %0,lo16(%2)(%1)"
7745 [(set_attr "type" "load")
7746 (set_attr "length" "4")])
7748 (define_insn "*movsi_internal1"
7749 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7750 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7751 "gpc_reg_operand (operands[0], SImode)
7752 || gpc_reg_operand (operands[1], SImode)"
7756 {l%U1%X1|lwz%U1%X1} %0,%1
7757 {st%U0%X0|stw%U0%X0} %1,%0
7767 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7768 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7770 ;; Split a load of a large constant into the appropriate two-insn
7774 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7775 (match_operand:SI 1 "const_int_operand" ""))]
7776 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7777 && (INTVAL (operands[1]) & 0xffff) != 0"
7781 (ior:SI (match_dup 0)
7784 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7786 if (tem == operands[0])
7792 (define_insn "*movsi_internal2"
7793 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7794 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "0,r,r")
7796 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7799 {cmpi|cmpwi} %2,%0,0
7802 [(set_attr "type" "cmp,compare,cmp")
7803 (set_attr "length" "4,4,8")])
7806 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7807 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7809 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7810 "TARGET_32BIT && reload_completed"
7811 [(set (match_dup 0) (match_dup 1))
7813 (compare:CC (match_dup 0)
7817 (define_expand "movhi"
7818 [(set (match_operand:HI 0 "general_operand" "")
7819 (match_operand:HI 1 "any_operand" ""))]
7821 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7823 (define_insn "*movhi_internal"
7824 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7825 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7826 "gpc_reg_operand (operands[0], HImode)
7827 || gpc_reg_operand (operands[1], HImode)"
7837 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7839 (define_expand "movqi"
7840 [(set (match_operand:QI 0 "general_operand" "")
7841 (match_operand:QI 1 "any_operand" ""))]
7843 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7845 (define_insn "*movqi_internal"
7846 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7847 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7848 "gpc_reg_operand (operands[0], QImode)
7849 || gpc_reg_operand (operands[1], QImode)"
7859 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7861 ;; Here is how to move condition codes around. When we store CC data in
7862 ;; an integer register or memory, we store just the high-order 4 bits.
7863 ;; This lets us not shift in the most common case of CR0.
7864 (define_expand "movcc"
7865 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7866 (match_operand:CC 1 "nonimmediate_operand" ""))]
7870 (define_insn "*movcc_internal1"
7871 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7872 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7873 "register_operand (operands[0], CCmode)
7874 || register_operand (operands[1], CCmode)"
7878 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7880 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7885 {l%U1%X1|lwz%U1%X1} %0,%1
7886 {st%U0%U1|stw%U0%U1} %1,%0"
7888 (cond [(eq_attr "alternative" "0")
7889 (const_string "cr_logical")
7890 (eq_attr "alternative" "1,2")
7891 (const_string "mtcr")
7892 (eq_attr "alternative" "5,7")
7893 (const_string "integer")
7894 (eq_attr "alternative" "6")
7895 (const_string "mfjmpr")
7896 (eq_attr "alternative" "8")
7897 (const_string "mtjmpr")
7898 (eq_attr "alternative" "9")
7899 (const_string "load")
7900 (eq_attr "alternative" "10")
7901 (const_string "store")
7902 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7903 (const_string "mfcrf")
7905 (const_string "mfcr")))
7906 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7908 ;; For floating-point, we normally deal with the floating-point registers
7909 ;; unless -msoft-float is used. The sole exception is that parameter passing
7910 ;; can produce floating-point values in fixed-point registers. Unless the
7911 ;; value is a simple constant or already in memory, we deal with this by
7912 ;; allocating memory and copying the value explicitly via that memory location.
7913 (define_expand "movsf"
7914 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7915 (match_operand:SF 1 "any_operand" ""))]
7917 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7920 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7921 (match_operand:SF 1 "const_double_operand" ""))]
7923 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7924 || (GET_CODE (operands[0]) == SUBREG
7925 && GET_CODE (SUBREG_REG (operands[0])) == REG
7926 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7927 [(set (match_dup 2) (match_dup 3))]
7933 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7934 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7936 if (! TARGET_POWERPC64)
7937 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7939 operands[2] = gen_lowpart (SImode, operands[0]);
7941 operands[3] = gen_int_mode (l, SImode);
7944 (define_insn "*movsf_hardfloat"
7945 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7946 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7947 "(gpc_reg_operand (operands[0], SFmode)
7948 || gpc_reg_operand (operands[1], SFmode))
7949 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7952 {l%U1%X1|lwz%U1%X1} %0,%1
7953 {st%U0%X0|stw%U0%X0} %1,%0
7963 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7964 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7966 (define_insn "*movsf_softfloat"
7967 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7968 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7969 "(gpc_reg_operand (operands[0], SFmode)
7970 || gpc_reg_operand (operands[1], SFmode))
7971 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7977 {l%U1%X1|lwz%U1%X1} %0,%1
7978 {st%U0%X0|stw%U0%X0} %1,%0
7985 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
7986 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7989 (define_expand "movdf"
7990 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7991 (match_operand:DF 1 "any_operand" ""))]
7993 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7996 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7997 (match_operand:DF 1 "const_int_operand" ""))]
7998 "! TARGET_POWERPC64 && reload_completed
7999 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8000 || (GET_CODE (operands[0]) == SUBREG
8001 && GET_CODE (SUBREG_REG (operands[0])) == REG
8002 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8003 [(set (match_dup 2) (match_dup 4))
8004 (set (match_dup 3) (match_dup 1))]
8007 int endian = (WORDS_BIG_ENDIAN == 0);
8008 HOST_WIDE_INT value = INTVAL (operands[1]);
8010 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8011 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8012 #if HOST_BITS_PER_WIDE_INT == 32
8013 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8015 operands[4] = GEN_INT (value >> 32);
8016 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8021 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8022 (match_operand:DF 1 "const_double_operand" ""))]
8023 "! TARGET_POWERPC64 && reload_completed
8024 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8025 || (GET_CODE (operands[0]) == SUBREG
8026 && GET_CODE (SUBREG_REG (operands[0])) == REG
8027 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8028 [(set (match_dup 2) (match_dup 4))
8029 (set (match_dup 3) (match_dup 5))]
8032 int endian = (WORDS_BIG_ENDIAN == 0);
8036 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8037 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8039 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8040 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8041 operands[4] = gen_int_mode (l[endian], SImode);
8042 operands[5] = gen_int_mode (l[1 - endian], SImode);
8046 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8047 (match_operand:DF 1 "const_double_operand" ""))]
8048 "TARGET_POWERPC64 && reload_completed
8049 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8050 || (GET_CODE (operands[0]) == SUBREG
8051 && GET_CODE (SUBREG_REG (operands[0])) == REG
8052 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8053 [(set (match_dup 2) (match_dup 3))]
8056 int endian = (WORDS_BIG_ENDIAN == 0);
8059 #if HOST_BITS_PER_WIDE_INT >= 64
8063 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8064 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8066 operands[2] = gen_lowpart (DImode, operands[0]);
8067 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8068 #if HOST_BITS_PER_WIDE_INT >= 64
8069 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8070 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8072 operands[3] = gen_int_mode (val, DImode);
8074 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8078 ;; Don't have reload use general registers to load a constant. First,
8079 ;; it might not work if the output operand is the equivalent of
8080 ;; a non-offsettable memref, but also it is less efficient than loading
8081 ;; the constant into an FP register, since it will probably be used there.
8082 ;; The "??" is a kludge until we can figure out a more reasonable way
8083 ;; of handling these non-offsettable values.
8084 (define_insn "*movdf_hardfloat32"
8085 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8086 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8087 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8088 && (gpc_reg_operand (operands[0], DFmode)
8089 || gpc_reg_operand (operands[1], DFmode))"
8092 switch (which_alternative)
8097 /* We normally copy the low-numbered register first. However, if
8098 the first register operand 0 is the same as the second register
8099 of operand 1, we must copy in the opposite order. */
8100 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8101 return \"mr %L0,%L1\;mr %0,%1\";
8103 return \"mr %0,%1\;mr %L0,%L1\";
8105 if (GET_CODE (operands[1]) == MEM
8106 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[1], 0),
8107 reload_completed || reload_in_progress)
8108 || rs6000_legitimate_small_data_p (DFmode, XEXP (operands[1], 0))
8109 || GET_CODE (XEXP (operands[1], 0)) == REG
8110 || GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8111 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8112 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC))
8114 /* If the low-address word is used in the address, we must load
8115 it last. Otherwise, load it first. Note that we cannot have
8116 auto-increment in that case since the address register is
8117 known to be dead. */
8118 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8120 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8122 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8128 addreg = find_addr_reg (XEXP (operands[1], 0));
8129 if (refers_to_regno_p (REGNO (operands[0]),
8130 REGNO (operands[0]) + 1,
8133 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8134 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8135 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8136 return \"{lx|lwzx} %0,%1\";
8140 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8141 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8142 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8143 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8148 if (GET_CODE (operands[0]) == MEM
8149 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[0], 0),
8150 reload_completed || reload_in_progress)
8151 || rs6000_legitimate_small_data_p (DFmode, XEXP (operands[0], 0))
8152 || GET_CODE (XEXP (operands[0], 0)) == REG
8153 || GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8154 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8155 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))
8156 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8161 addreg = find_addr_reg (XEXP (operands[0], 0));
8162 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8163 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8164 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8165 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8169 return \"fmr %0,%1\";
8171 return \"lfd%U1%X1 %0,%1\";
8173 return \"stfd%U0%X0 %1,%0\";
8180 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8181 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8183 (define_insn "*movdf_softfloat32"
8184 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8185 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8186 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8187 && (gpc_reg_operand (operands[0], DFmode)
8188 || gpc_reg_operand (operands[1], DFmode))"
8191 switch (which_alternative)
8196 /* We normally copy the low-numbered register first. However, if
8197 the first register operand 0 is the same as the second register of
8198 operand 1, we must copy in the opposite order. */
8199 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8200 return \"mr %L0,%L1\;mr %0,%1\";
8202 return \"mr %0,%1\;mr %L0,%L1\";
8204 /* If the low-address word is used in the address, we must load
8205 it last. Otherwise, load it first. Note that we cannot have
8206 auto-increment in that case since the address register is
8207 known to be dead. */
8208 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8210 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8212 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8214 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8221 [(set_attr "type" "two,load,store,*,*,*")
8222 (set_attr "length" "8,8,8,8,12,16")])
8224 ; ld/std require word-aligned displacements -> 'Y' constraint.
8225 ; List Y->r and r->Y before r->r for reload.
8226 (define_insn "*movdf_hardfloat64"
8227 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
8228 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8229 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8230 && (gpc_reg_operand (operands[0], DFmode)
8231 || gpc_reg_operand (operands[1], DFmode))"
8245 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
8246 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8248 (define_insn "*movdf_softfloat64"
8249 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8250 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8251 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8252 && (gpc_reg_operand (operands[0], DFmode)
8253 || gpc_reg_operand (operands[1], DFmode))"
8264 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
8265 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8267 (define_expand "movtf"
8268 [(set (match_operand:TF 0 "general_operand" "")
8269 (match_operand:TF 1 "any_operand" ""))]
8270 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8271 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8272 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8274 ; It's important to list the o->f and f->o moves before f->f because
8275 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8276 ; which doesn't make progress. Likewise r->Y must be before r->r.
8277 (define_insn_and_split "*movtf_internal"
8278 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8279 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8280 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8281 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8282 && (gpc_reg_operand (operands[0], TFmode)
8283 || gpc_reg_operand (operands[1], TFmode))"
8285 "&& reload_completed"
8287 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8288 [(set_attr "length" "8,8,8,20,20,16")])
8290 (define_expand "extenddftf2"
8291 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8292 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8293 (use (match_dup 2))])]
8294 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8295 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8297 operands[2] = CONST0_RTX (DFmode);
8300 (define_insn_and_split "*extenddftf2_internal"
8301 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8302 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8303 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8304 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8305 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8307 "&& reload_completed"
8310 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8311 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8312 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8314 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8319 (define_expand "extendsftf2"
8320 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8321 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8322 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8323 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8325 rtx tmp = gen_reg_rtx (DFmode);
8326 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8327 emit_insn (gen_extenddftf2 (operands[0], tmp));
8331 (define_expand "trunctfdf2"
8332 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8333 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8334 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8335 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8338 (define_insn_and_split "trunctfdf2_internal1"
8339 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8340 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8341 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
8342 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8346 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8349 emit_note (NOTE_INSN_DELETED);
8352 [(set_attr "type" "fp")])
8354 (define_insn "trunctfdf2_internal2"
8355 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8356 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8357 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
8358 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8360 [(set_attr "type" "fp")])
8362 (define_insn_and_split "trunctfsf2"
8363 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8364 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8365 (clobber (match_scratch:DF 2 "=f"))]
8366 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8367 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8369 "&& reload_completed"
8371 (float_truncate:DF (match_dup 1)))
8373 (float_truncate:SF (match_dup 2)))]
8376 (define_expand "floatsitf2"
8377 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8378 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8379 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8380 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8382 rtx tmp = gen_reg_rtx (DFmode);
8383 expand_float (tmp, operands[1], false);
8384 emit_insn (gen_extenddftf2 (operands[0], tmp));
8388 ; fadd, but rounding towards zero.
8389 ; This is probably not the optimal code sequence.
8390 (define_insn "fix_trunc_helper"
8391 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8392 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8393 UNSPEC_FIX_TRUNC_TF))
8394 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8395 "TARGET_HARD_FLOAT && TARGET_FPRS"
8396 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8397 [(set_attr "type" "fp")
8398 (set_attr "length" "20")])
8400 (define_expand "fix_trunctfsi2"
8401 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8402 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8403 (clobber (match_dup 2))
8404 (clobber (match_dup 3))
8405 (clobber (match_dup 4))
8406 (clobber (match_dup 5))])]
8407 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8408 && (TARGET_POWER2 || TARGET_POWERPC)
8409 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8411 operands[2] = gen_reg_rtx (DFmode);
8412 operands[3] = gen_reg_rtx (DFmode);
8413 operands[4] = gen_reg_rtx (DImode);
8414 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8417 (define_insn_and_split "*fix_trunctfsi2_internal"
8418 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8419 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8420 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8421 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8422 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8423 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8424 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8425 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8427 "&& reload_completed"
8431 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8433 if (GET_CODE (operands[5]) != MEM)
8435 lowword = XEXP (operands[5], 0);
8436 if (WORDS_BIG_ENDIAN)
8437 lowword = plus_constant (lowword, 4);
8439 emit_insn (gen_fctiwz (operands[4], operands[2]));
8440 emit_move_insn (operands[5], operands[4]);
8441 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
8445 (define_insn "negtf2"
8446 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8447 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8448 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8449 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8452 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8453 return \"fneg %L0,%L1\;fneg %0,%1\";
8455 return \"fneg %0,%1\;fneg %L0,%L1\";
8457 [(set_attr "type" "fp")
8458 (set_attr "length" "8")])
8460 (define_expand "abstf2"
8461 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8462 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8463 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8464 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8467 rtx label = gen_label_rtx ();
8468 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8473 (define_expand "abstf2_internal"
8474 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8475 (match_operand:TF 1 "gpc_reg_operand" "f"))
8476 (set (match_dup 3) (match_dup 5))
8477 (set (match_dup 5) (abs:DF (match_dup 5)))
8478 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8479 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8480 (label_ref (match_operand 2 "" ""))
8482 (set (match_dup 6) (neg:DF (match_dup 6)))]
8483 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8484 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8487 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8488 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8489 operands[3] = gen_reg_rtx (DFmode);
8490 operands[4] = gen_reg_rtx (CCFPmode);
8491 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8492 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8495 (define_expand "copysigntf3"
8496 [(match_operand:TF 0 "general_operand" "")
8497 (match_operand:TF 1 "general_operand" "")
8498 (match_operand:TF 2 "general_operand" "")]
8499 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8500 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8502 rtx target, op0, op1, temp;
8503 bool op0_is_abs = false;
8505 target = operands[0];
8509 if (GET_CODE (op0) == CONST_DOUBLE)
8511 if (real_isneg (CONST_DOUBLE_REAL_VALUE (op0)))
8512 op0 = simplify_unary_operation (ABS, TFmode, op0, TFmode);
8516 temp = expand_copysign_absneg (TFmode, op0, op1, target, 127, op0_is_abs);
8518 emit_move_insn (target, temp);
8522 ;; Next come the multi-word integer load and store and the load and store
8524 (define_expand "movdi"
8525 [(set (match_operand:DI 0 "general_operand" "")
8526 (match_operand:DI 1 "any_operand" ""))]
8528 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8530 ; List r->r after r->"o<>", otherwise reload will try to reload a
8531 ; non-offsettable address by using r->r which won't make progress.
8532 (define_insn "*movdi_internal32"
8533 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8534 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8536 && (gpc_reg_operand (operands[0], DImode)
8537 || gpc_reg_operand (operands[1], DImode))"
8546 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8549 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8550 (match_operand:DI 1 "const_int_operand" ""))]
8551 "! TARGET_POWERPC64 && reload_completed"
8552 [(set (match_dup 2) (match_dup 4))
8553 (set (match_dup 3) (match_dup 1))]
8556 HOST_WIDE_INT value = INTVAL (operands[1]);
8557 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8559 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8561 #if HOST_BITS_PER_WIDE_INT == 32
8562 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8564 operands[4] = GEN_INT (value >> 32);
8565 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8570 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8571 (match_operand:DI 1 "input_operand" ""))]
8572 "reload_completed && !TARGET_POWERPC64
8573 && gpr_or_gpr_p (operands[0], operands[1])"
8575 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8577 (define_insn "*movdi_internal64"
8578 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8579 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8581 && (gpc_reg_operand (operands[0], DImode)
8582 || gpc_reg_operand (operands[1], DImode))"
8597 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8598 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8600 ;; immediate value valid for a single instruction hiding in a const_double
8602 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8603 (match_operand:DI 1 "const_double_operand" "F"))]
8604 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8605 && GET_CODE (operands[1]) == CONST_DOUBLE
8606 && num_insns_constant (operands[1], DImode) == 1"
8609 return ((unsigned HOST_WIDE_INT)
8610 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8611 ? \"li %0,%1\" : \"lis %0,%v1\";
8614 ;; Generate all one-bits and clear left or right.
8615 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8617 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8618 (match_operand:DI 1 "mask64_operand" ""))]
8619 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8620 [(set (match_dup 0) (const_int -1))
8622 (and:DI (rotate:DI (match_dup 0)
8627 ;; Split a load of a large constant into the appropriate five-instruction
8628 ;; sequence. Handle anything in a constant number of insns.
8629 ;; When non-easy constants can go in the TOC, this should use
8630 ;; easy_fp_constant predicate.
8632 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8633 (match_operand:DI 1 "const_int_operand" ""))]
8634 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8635 [(set (match_dup 0) (match_dup 2))
8636 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8638 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8640 if (tem == operands[0])
8647 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8648 (match_operand:DI 1 "const_double_operand" ""))]
8649 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8650 [(set (match_dup 0) (match_dup 2))
8651 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8653 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8655 if (tem == operands[0])
8661 (define_insn "*movdi_internal2"
8662 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8663 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "0,r,r")
8665 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8671 [(set_attr "type" "cmp,compare,cmp")
8672 (set_attr "length" "4,4,8")])
8675 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8676 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8678 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8679 "TARGET_POWERPC64 && reload_completed"
8680 [(set (match_dup 0) (match_dup 1))
8682 (compare:CC (match_dup 0)
8686 ;; TImode is similar, except that we usually want to compute the address into
8687 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8688 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8689 (define_expand "movti"
8690 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8691 (match_operand:TI 1 "general_operand" ""))
8692 (clobber (scratch:SI))])]
8694 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8696 ;; We say that MQ is clobbered in the last alternative because the first
8697 ;; alternative would never get used otherwise since it would need a reload
8698 ;; while the 2nd alternative would not. We put memory cases first so they
8699 ;; are preferred. Otherwise, we'd try to reload the output instead of
8700 ;; giving the SCRATCH mq.
8702 (define_insn "*movti_power"
8703 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8704 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8705 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8706 "TARGET_POWER && ! TARGET_POWERPC64
8707 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8710 switch (which_alternative)
8717 return \"{stsi|stswi} %1,%P0,16\";
8722 /* If the address is not used in the output, we can use lsi. Otherwise,
8723 fall through to generating four loads. */
8725 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8726 return \"{lsi|lswi} %0,%P1,16\";
8727 /* ... fall through ... */
8733 [(set_attr "type" "store,store,*,load,load,*")])
8735 (define_insn "*movti_string"
8736 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8737 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8738 "! TARGET_POWER && ! TARGET_POWERPC64
8739 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8742 switch (which_alternative)
8748 return \"{stsi|stswi} %1,%P0,16\";
8753 /* If the address is not used in the output, we can use lsi. Otherwise,
8754 fall through to generating four loads. */
8756 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8757 return \"{lsi|lswi} %0,%P1,16\";
8758 /* ... fall through ... */
8764 [(set_attr "type" "store,store,*,load,load,*")])
8766 (define_insn "*movti_ppc64"
8767 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8768 (match_operand:TI 1 "input_operand" "r,r,m"))]
8769 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8770 || gpc_reg_operand (operands[1], TImode))"
8772 [(set_attr "type" "*,load,store")])
8775 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8776 (match_operand:TI 1 "const_double_operand" ""))]
8778 [(set (match_dup 2) (match_dup 4))
8779 (set (match_dup 3) (match_dup 5))]
8782 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8784 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8786 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8788 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8789 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8791 else if (GET_CODE (operands[1]) == CONST_INT)
8793 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8794 operands[5] = operands[1];
8801 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8802 (match_operand:TI 1 "input_operand" ""))]
8804 && gpr_or_gpr_p (operands[0], operands[1])"
8806 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8808 (define_expand "load_multiple"
8809 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8810 (match_operand:SI 1 "" ""))
8811 (use (match_operand:SI 2 "" ""))])]
8812 "TARGET_STRING && !TARGET_POWERPC64"
8820 /* Support only loading a constant number of fixed-point registers from
8821 memory and only bother with this if more than two; the machine
8822 doesn't support more than eight. */
8823 if (GET_CODE (operands[2]) != CONST_INT
8824 || INTVAL (operands[2]) <= 2
8825 || INTVAL (operands[2]) > 8
8826 || GET_CODE (operands[1]) != MEM
8827 || GET_CODE (operands[0]) != REG
8828 || REGNO (operands[0]) >= 32)
8831 count = INTVAL (operands[2]);
8832 regno = REGNO (operands[0]);
8834 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8835 op1 = replace_equiv_address (operands[1],
8836 force_reg (SImode, XEXP (operands[1], 0)));
8838 for (i = 0; i < count; i++)
8839 XVECEXP (operands[3], 0, i)
8840 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8841 adjust_address_nv (op1, SImode, i * 4));
8844 (define_insn "*ldmsi8"
8845 [(match_parallel 0 "load_multiple_operation"
8846 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8847 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8848 (set (match_operand:SI 3 "gpc_reg_operand" "")
8849 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8850 (set (match_operand:SI 4 "gpc_reg_operand" "")
8851 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8852 (set (match_operand:SI 5 "gpc_reg_operand" "")
8853 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8854 (set (match_operand:SI 6 "gpc_reg_operand" "")
8855 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8856 (set (match_operand:SI 7 "gpc_reg_operand" "")
8857 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8858 (set (match_operand:SI 8 "gpc_reg_operand" "")
8859 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8860 (set (match_operand:SI 9 "gpc_reg_operand" "")
8861 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8862 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8864 { return rs6000_output_load_multiple (operands); }"
8865 [(set_attr "type" "load")
8866 (set_attr "length" "32")])
8868 (define_insn "*ldmsi7"
8869 [(match_parallel 0 "load_multiple_operation"
8870 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8871 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8872 (set (match_operand:SI 3 "gpc_reg_operand" "")
8873 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8874 (set (match_operand:SI 4 "gpc_reg_operand" "")
8875 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8876 (set (match_operand:SI 5 "gpc_reg_operand" "")
8877 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8878 (set (match_operand:SI 6 "gpc_reg_operand" "")
8879 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8880 (set (match_operand:SI 7 "gpc_reg_operand" "")
8881 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8882 (set (match_operand:SI 8 "gpc_reg_operand" "")
8883 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8884 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8886 { return rs6000_output_load_multiple (operands); }"
8887 [(set_attr "type" "load")
8888 (set_attr "length" "32")])
8890 (define_insn "*ldmsi6"
8891 [(match_parallel 0 "load_multiple_operation"
8892 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8893 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8894 (set (match_operand:SI 3 "gpc_reg_operand" "")
8895 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8896 (set (match_operand:SI 4 "gpc_reg_operand" "")
8897 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8898 (set (match_operand:SI 5 "gpc_reg_operand" "")
8899 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8900 (set (match_operand:SI 6 "gpc_reg_operand" "")
8901 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8902 (set (match_operand:SI 7 "gpc_reg_operand" "")
8903 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8904 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8906 { return rs6000_output_load_multiple (operands); }"
8907 [(set_attr "type" "load")
8908 (set_attr "length" "32")])
8910 (define_insn "*ldmsi5"
8911 [(match_parallel 0 "load_multiple_operation"
8912 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8913 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8914 (set (match_operand:SI 3 "gpc_reg_operand" "")
8915 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8916 (set (match_operand:SI 4 "gpc_reg_operand" "")
8917 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8918 (set (match_operand:SI 5 "gpc_reg_operand" "")
8919 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8920 (set (match_operand:SI 6 "gpc_reg_operand" "")
8921 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8922 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8924 { return rs6000_output_load_multiple (operands); }"
8925 [(set_attr "type" "load")
8926 (set_attr "length" "32")])
8928 (define_insn "*ldmsi4"
8929 [(match_parallel 0 "load_multiple_operation"
8930 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8931 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8932 (set (match_operand:SI 3 "gpc_reg_operand" "")
8933 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8934 (set (match_operand:SI 4 "gpc_reg_operand" "")
8935 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8936 (set (match_operand:SI 5 "gpc_reg_operand" "")
8937 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8938 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8940 { return rs6000_output_load_multiple (operands); }"
8941 [(set_attr "type" "load")
8942 (set_attr "length" "32")])
8944 (define_insn "*ldmsi3"
8945 [(match_parallel 0 "load_multiple_operation"
8946 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8947 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8948 (set (match_operand:SI 3 "gpc_reg_operand" "")
8949 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8950 (set (match_operand:SI 4 "gpc_reg_operand" "")
8951 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8952 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8954 { return rs6000_output_load_multiple (operands); }"
8955 [(set_attr "type" "load")
8956 (set_attr "length" "32")])
8958 (define_expand "store_multiple"
8959 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8960 (match_operand:SI 1 "" ""))
8961 (clobber (scratch:SI))
8962 (use (match_operand:SI 2 "" ""))])]
8963 "TARGET_STRING && !TARGET_POWERPC64"
8972 /* Support only storing a constant number of fixed-point registers to
8973 memory and only bother with this if more than two; the machine
8974 doesn't support more than eight. */
8975 if (GET_CODE (operands[2]) != CONST_INT
8976 || INTVAL (operands[2]) <= 2
8977 || INTVAL (operands[2]) > 8
8978 || GET_CODE (operands[0]) != MEM
8979 || GET_CODE (operands[1]) != REG
8980 || REGNO (operands[1]) >= 32)
8983 count = INTVAL (operands[2]);
8984 regno = REGNO (operands[1]);
8986 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8987 to = force_reg (SImode, XEXP (operands[0], 0));
8988 op0 = replace_equiv_address (operands[0], to);
8990 XVECEXP (operands[3], 0, 0)
8991 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8992 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8993 gen_rtx_SCRATCH (SImode));
8995 for (i = 1; i < count; i++)
8996 XVECEXP (operands[3], 0, i + 1)
8997 = gen_rtx_SET (VOIDmode,
8998 adjust_address_nv (op0, SImode, i * 4),
8999 gen_rtx_REG (SImode, regno + i));
9002 (define_insn "*store_multiple_power"
9003 [(match_parallel 0 "store_multiple_operation"
9004 [(set (match_operand:SI 1 "indirect_operand" "=Q")
9005 (match_operand:SI 2 "gpc_reg_operand" "r"))
9006 (clobber (match_scratch:SI 3 "=q"))])]
9007 "TARGET_STRING && TARGET_POWER"
9008 "{stsi|stswi} %2,%P1,%O0"
9009 [(set_attr "type" "store")])
9011 (define_insn "*stmsi8"
9012 [(match_parallel 0 "store_multiple_operation"
9013 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9014 (match_operand:SI 2 "gpc_reg_operand" "r"))
9015 (clobber (match_scratch:SI 3 "X"))
9016 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9017 (match_operand:SI 4 "gpc_reg_operand" "r"))
9018 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9019 (match_operand:SI 5 "gpc_reg_operand" "r"))
9020 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9021 (match_operand:SI 6 "gpc_reg_operand" "r"))
9022 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9023 (match_operand:SI 7 "gpc_reg_operand" "r"))
9024 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9025 (match_operand:SI 8 "gpc_reg_operand" "r"))
9026 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9027 (match_operand:SI 9 "gpc_reg_operand" "r"))
9028 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9029 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9030 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9031 "{stsi|stswi} %2,%1,%O0"
9032 [(set_attr "type" "store")])
9034 (define_insn "*stmsi7"
9035 [(match_parallel 0 "store_multiple_operation"
9036 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9037 (match_operand:SI 2 "gpc_reg_operand" "r"))
9038 (clobber (match_scratch:SI 3 "X"))
9039 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9040 (match_operand:SI 4 "gpc_reg_operand" "r"))
9041 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9042 (match_operand:SI 5 "gpc_reg_operand" "r"))
9043 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9044 (match_operand:SI 6 "gpc_reg_operand" "r"))
9045 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9046 (match_operand:SI 7 "gpc_reg_operand" "r"))
9047 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9048 (match_operand:SI 8 "gpc_reg_operand" "r"))
9049 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9050 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9051 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9052 "{stsi|stswi} %2,%1,%O0"
9053 [(set_attr "type" "store")])
9055 (define_insn "*stmsi6"
9056 [(match_parallel 0 "store_multiple_operation"
9057 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9058 (match_operand:SI 2 "gpc_reg_operand" "r"))
9059 (clobber (match_scratch:SI 3 "X"))
9060 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9061 (match_operand:SI 4 "gpc_reg_operand" "r"))
9062 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9063 (match_operand:SI 5 "gpc_reg_operand" "r"))
9064 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9065 (match_operand:SI 6 "gpc_reg_operand" "r"))
9066 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9067 (match_operand:SI 7 "gpc_reg_operand" "r"))
9068 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9069 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9070 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9071 "{stsi|stswi} %2,%1,%O0"
9072 [(set_attr "type" "store")])
9074 (define_insn "*stmsi5"
9075 [(match_parallel 0 "store_multiple_operation"
9076 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9077 (match_operand:SI 2 "gpc_reg_operand" "r"))
9078 (clobber (match_scratch:SI 3 "X"))
9079 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9080 (match_operand:SI 4 "gpc_reg_operand" "r"))
9081 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9082 (match_operand:SI 5 "gpc_reg_operand" "r"))
9083 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9084 (match_operand:SI 6 "gpc_reg_operand" "r"))
9085 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9086 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9087 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9088 "{stsi|stswi} %2,%1,%O0"
9089 [(set_attr "type" "store")])
9091 (define_insn "*stmsi4"
9092 [(match_parallel 0 "store_multiple_operation"
9093 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9094 (match_operand:SI 2 "gpc_reg_operand" "r"))
9095 (clobber (match_scratch:SI 3 "X"))
9096 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9097 (match_operand:SI 4 "gpc_reg_operand" "r"))
9098 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9099 (match_operand:SI 5 "gpc_reg_operand" "r"))
9100 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9101 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9102 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9103 "{stsi|stswi} %2,%1,%O0"
9104 [(set_attr "type" "store")])
9106 (define_insn "*stmsi3"
9107 [(match_parallel 0 "store_multiple_operation"
9108 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9109 (match_operand:SI 2 "gpc_reg_operand" "r"))
9110 (clobber (match_scratch:SI 3 "X"))
9111 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9112 (match_operand:SI 4 "gpc_reg_operand" "r"))
9113 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9114 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9115 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9116 "{stsi|stswi} %2,%1,%O0"
9117 [(set_attr "type" "store")])
9119 (define_expand "clrmemsi"
9120 [(parallel [(set (match_operand:BLK 0 "" "")
9122 (use (match_operand:SI 1 "" ""))
9123 (use (match_operand:SI 2 "" ""))])]
9127 if (expand_block_clear (operands))
9133 ;; String/block move insn.
9134 ;; Argument 0 is the destination
9135 ;; Argument 1 is the source
9136 ;; Argument 2 is the length
9137 ;; Argument 3 is the alignment
9139 (define_expand "movmemsi"
9140 [(parallel [(set (match_operand:BLK 0 "" "")
9141 (match_operand:BLK 1 "" ""))
9142 (use (match_operand:SI 2 "" ""))
9143 (use (match_operand:SI 3 "" ""))])]
9147 if (expand_block_move (operands))
9153 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9154 ;; register allocator doesn't have a clue about allocating 8 word registers.
9155 ;; rD/rS = r5 is preferred, efficient form.
9156 (define_expand "movmemsi_8reg"
9157 [(parallel [(set (match_operand 0 "" "")
9158 (match_operand 1 "" ""))
9159 (use (match_operand 2 "" ""))
9160 (use (match_operand 3 "" ""))
9161 (clobber (reg:SI 5))
9162 (clobber (reg:SI 6))
9163 (clobber (reg:SI 7))
9164 (clobber (reg:SI 8))
9165 (clobber (reg:SI 9))
9166 (clobber (reg:SI 10))
9167 (clobber (reg:SI 11))
9168 (clobber (reg:SI 12))
9169 (clobber (match_scratch:SI 4 ""))])]
9174 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9175 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9176 (use (match_operand:SI 2 "immediate_operand" "i"))
9177 (use (match_operand:SI 3 "immediate_operand" "i"))
9178 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9179 (clobber (reg:SI 6))
9180 (clobber (reg:SI 7))
9181 (clobber (reg:SI 8))
9182 (clobber (reg:SI 9))
9183 (clobber (reg:SI 10))
9184 (clobber (reg:SI 11))
9185 (clobber (reg:SI 12))
9186 (clobber (match_scratch:SI 5 "=q"))]
9187 "TARGET_STRING && TARGET_POWER
9188 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9189 || INTVAL (operands[2]) == 0)
9190 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9191 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9192 && REGNO (operands[4]) == 5"
9193 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9194 [(set_attr "type" "load")
9195 (set_attr "length" "8")])
9198 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9199 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9200 (use (match_operand:SI 2 "immediate_operand" "i"))
9201 (use (match_operand:SI 3 "immediate_operand" "i"))
9202 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9203 (clobber (reg:SI 6))
9204 (clobber (reg:SI 7))
9205 (clobber (reg:SI 8))
9206 (clobber (reg:SI 9))
9207 (clobber (reg:SI 10))
9208 (clobber (reg:SI 11))
9209 (clobber (reg:SI 12))
9210 (clobber (match_scratch:SI 5 "X"))]
9211 "TARGET_STRING && ! TARGET_POWER
9212 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9213 || INTVAL (operands[2]) == 0)
9214 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9215 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9216 && REGNO (operands[4]) == 5"
9217 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9218 [(set_attr "type" "load")
9219 (set_attr "length" "8")])
9222 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9223 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9224 (use (match_operand:SI 2 "immediate_operand" "i"))
9225 (use (match_operand:SI 3 "immediate_operand" "i"))
9226 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9227 (clobber (reg:SI 6))
9228 (clobber (reg:SI 7))
9229 (clobber (reg:SI 8))
9230 (clobber (reg:SI 9))
9231 (clobber (reg:SI 10))
9232 (clobber (reg:SI 11))
9233 (clobber (reg:SI 12))
9234 (clobber (match_scratch:SI 5 "X"))]
9235 "TARGET_STRING && TARGET_POWERPC64
9236 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9237 || INTVAL (operands[2]) == 0)
9238 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9239 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9240 && REGNO (operands[4]) == 5"
9241 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9242 [(set_attr "type" "load")
9243 (set_attr "length" "8")])
9245 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9246 ;; register allocator doesn't have a clue about allocating 6 word registers.
9247 ;; rD/rS = r5 is preferred, efficient form.
9248 (define_expand "movmemsi_6reg"
9249 [(parallel [(set (match_operand 0 "" "")
9250 (match_operand 1 "" ""))
9251 (use (match_operand 2 "" ""))
9252 (use (match_operand 3 "" ""))
9253 (clobber (reg:SI 5))
9254 (clobber (reg:SI 6))
9255 (clobber (reg:SI 7))
9256 (clobber (reg:SI 8))
9257 (clobber (reg:SI 9))
9258 (clobber (reg:SI 10))
9259 (clobber (match_scratch:SI 4 ""))])]
9264 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9265 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9266 (use (match_operand:SI 2 "immediate_operand" "i"))
9267 (use (match_operand:SI 3 "immediate_operand" "i"))
9268 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9269 (clobber (reg:SI 6))
9270 (clobber (reg:SI 7))
9271 (clobber (reg:SI 8))
9272 (clobber (reg:SI 9))
9273 (clobber (reg:SI 10))
9274 (clobber (match_scratch:SI 5 "=q"))]
9275 "TARGET_STRING && TARGET_POWER
9276 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9277 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9278 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9279 && REGNO (operands[4]) == 5"
9280 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9281 [(set_attr "type" "load")
9282 (set_attr "length" "8")])
9285 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9286 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9287 (use (match_operand:SI 2 "immediate_operand" "i"))
9288 (use (match_operand:SI 3 "immediate_operand" "i"))
9289 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9290 (clobber (reg:SI 6))
9291 (clobber (reg:SI 7))
9292 (clobber (reg:SI 8))
9293 (clobber (reg:SI 9))
9294 (clobber (reg:SI 10))
9295 (clobber (match_scratch:SI 5 "X"))]
9296 "TARGET_STRING && ! TARGET_POWER
9297 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9298 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9299 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9300 && REGNO (operands[4]) == 5"
9301 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9302 [(set_attr "type" "load")
9303 (set_attr "length" "8")])
9306 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9307 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9308 (use (match_operand:SI 2 "immediate_operand" "i"))
9309 (use (match_operand:SI 3 "immediate_operand" "i"))
9310 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9311 (clobber (reg:SI 6))
9312 (clobber (reg:SI 7))
9313 (clobber (reg:SI 8))
9314 (clobber (reg:SI 9))
9315 (clobber (reg:SI 10))
9316 (clobber (match_scratch:SI 5 "X"))]
9317 "TARGET_STRING && TARGET_POWERPC64
9318 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9319 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9320 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9321 && REGNO (operands[4]) == 5"
9322 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9323 [(set_attr "type" "load")
9324 (set_attr "length" "8")])
9326 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9327 ;; problems with TImode.
9328 ;; rD/rS = r5 is preferred, efficient form.
9329 (define_expand "movmemsi_4reg"
9330 [(parallel [(set (match_operand 0 "" "")
9331 (match_operand 1 "" ""))
9332 (use (match_operand 2 "" ""))
9333 (use (match_operand 3 "" ""))
9334 (clobber (reg:SI 5))
9335 (clobber (reg:SI 6))
9336 (clobber (reg:SI 7))
9337 (clobber (reg:SI 8))
9338 (clobber (match_scratch:SI 4 ""))])]
9343 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9344 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9345 (use (match_operand:SI 2 "immediate_operand" "i"))
9346 (use (match_operand:SI 3 "immediate_operand" "i"))
9347 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9348 (clobber (reg:SI 6))
9349 (clobber (reg:SI 7))
9350 (clobber (reg:SI 8))
9351 (clobber (match_scratch:SI 5 "=q"))]
9352 "TARGET_STRING && TARGET_POWER
9353 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9354 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9355 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9356 && REGNO (operands[4]) == 5"
9357 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9358 [(set_attr "type" "load")
9359 (set_attr "length" "8")])
9362 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9363 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9364 (use (match_operand:SI 2 "immediate_operand" "i"))
9365 (use (match_operand:SI 3 "immediate_operand" "i"))
9366 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9367 (clobber (reg:SI 6))
9368 (clobber (reg:SI 7))
9369 (clobber (reg:SI 8))
9370 (clobber (match_scratch:SI 5 "X"))]
9371 "TARGET_STRING && ! TARGET_POWER
9372 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9373 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9374 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9375 && REGNO (operands[4]) == 5"
9376 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9377 [(set_attr "type" "load")
9378 (set_attr "length" "8")])
9381 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9382 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9383 (use (match_operand:SI 2 "immediate_operand" "i"))
9384 (use (match_operand:SI 3 "immediate_operand" "i"))
9385 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9386 (clobber (reg:SI 6))
9387 (clobber (reg:SI 7))
9388 (clobber (reg:SI 8))
9389 (clobber (match_scratch:SI 5 "X"))]
9390 "TARGET_STRING && TARGET_POWERPC64
9391 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9392 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9393 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9394 && REGNO (operands[4]) == 5"
9395 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9396 [(set_attr "type" "load")
9397 (set_attr "length" "8")])
9399 ;; Move up to 8 bytes at a time.
9400 (define_expand "movmemsi_2reg"
9401 [(parallel [(set (match_operand 0 "" "")
9402 (match_operand 1 "" ""))
9403 (use (match_operand 2 "" ""))
9404 (use (match_operand 3 "" ""))
9405 (clobber (match_scratch:DI 4 ""))
9406 (clobber (match_scratch:SI 5 ""))])]
9407 "TARGET_STRING && ! TARGET_POWERPC64"
9411 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9412 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9413 (use (match_operand:SI 2 "immediate_operand" "i"))
9414 (use (match_operand:SI 3 "immediate_operand" "i"))
9415 (clobber (match_scratch:DI 4 "=&r"))
9416 (clobber (match_scratch:SI 5 "=q"))]
9417 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9418 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9419 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9420 [(set_attr "type" "load")
9421 (set_attr "length" "8")])
9424 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9425 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9426 (use (match_operand:SI 2 "immediate_operand" "i"))
9427 (use (match_operand:SI 3 "immediate_operand" "i"))
9428 (clobber (match_scratch:DI 4 "=&r"))
9429 (clobber (match_scratch:SI 5 "X"))]
9430 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9431 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9432 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9433 [(set_attr "type" "load")
9434 (set_attr "length" "8")])
9436 ;; Move up to 4 bytes at a time.
9437 (define_expand "movmemsi_1reg"
9438 [(parallel [(set (match_operand 0 "" "")
9439 (match_operand 1 "" ""))
9440 (use (match_operand 2 "" ""))
9441 (use (match_operand 3 "" ""))
9442 (clobber (match_scratch:SI 4 ""))
9443 (clobber (match_scratch:SI 5 ""))])]
9448 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9449 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9450 (use (match_operand:SI 2 "immediate_operand" "i"))
9451 (use (match_operand:SI 3 "immediate_operand" "i"))
9452 (clobber (match_scratch:SI 4 "=&r"))
9453 (clobber (match_scratch:SI 5 "=q"))]
9454 "TARGET_STRING && TARGET_POWER
9455 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9456 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9457 [(set_attr "type" "load")
9458 (set_attr "length" "8")])
9461 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9462 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9463 (use (match_operand:SI 2 "immediate_operand" "i"))
9464 (use (match_operand:SI 3 "immediate_operand" "i"))
9465 (clobber (match_scratch:SI 4 "=&r"))
9466 (clobber (match_scratch:SI 5 "X"))]
9467 "TARGET_STRING && ! TARGET_POWER
9468 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9469 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9470 [(set_attr "type" "load")
9471 (set_attr "length" "8")])
9474 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9475 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9476 (use (match_operand:SI 2 "immediate_operand" "i"))
9477 (use (match_operand:SI 3 "immediate_operand" "i"))
9478 (clobber (match_scratch:SI 4 "=&r"))
9479 (clobber (match_scratch:SI 5 "X"))]
9480 "TARGET_STRING && TARGET_POWERPC64
9481 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9482 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9483 [(set_attr "type" "load")
9484 (set_attr "length" "8")])
9487 ;; Define insns that do load or store with update. Some of these we can
9488 ;; get by using pre-decrement or pre-increment, but the hardware can also
9489 ;; do cases where the increment is not the size of the object.
9491 ;; In all these cases, we use operands 0 and 1 for the register being
9492 ;; incremented because those are the operands that local-alloc will
9493 ;; tie and these are the pair most likely to be tieable (and the ones
9494 ;; that will benefit the most).
9496 (define_insn "*movdi_update1"
9497 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9498 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9499 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9500 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9501 (plus:DI (match_dup 1) (match_dup 2)))]
9502 "TARGET_POWERPC64 && TARGET_UPDATE"
9506 [(set_attr "type" "load_ux,load_u")])
9508 (define_insn "movdi_<mode>_update"
9509 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9510 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9511 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9512 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9513 (plus:P (match_dup 1) (match_dup 2)))]
9514 "TARGET_POWERPC64 && TARGET_UPDATE"
9518 [(set_attr "type" "store_ux,store_u")])
9520 (define_insn "*movsi_update1"
9521 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9522 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9523 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9524 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9525 (plus:SI (match_dup 1) (match_dup 2)))]
9528 {lux|lwzux} %3,%0,%2
9529 {lu|lwzu} %3,%2(%0)"
9530 [(set_attr "type" "load_ux,load_u")])
9532 (define_insn "*movsi_update2"
9533 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9535 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9536 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9537 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9538 (plus:DI (match_dup 1) (match_dup 2)))]
9541 [(set_attr "type" "load_ext_ux")])
9543 (define_insn "movsi_update"
9544 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9545 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9546 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9547 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9548 (plus:SI (match_dup 1) (match_dup 2)))]
9551 {stux|stwux} %3,%0,%2
9552 {stu|stwu} %3,%2(%0)"
9553 [(set_attr "type" "store_ux,store_u")])
9555 (define_insn "*movhi_update1"
9556 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9557 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9558 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9559 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9560 (plus:SI (match_dup 1) (match_dup 2)))]
9565 [(set_attr "type" "load_ux,load_u")])
9567 (define_insn "*movhi_update2"
9568 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9570 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9571 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9572 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9573 (plus:SI (match_dup 1) (match_dup 2)))]
9578 [(set_attr "type" "load_ux,load_u")])
9580 (define_insn "*movhi_update3"
9581 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9583 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9584 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9585 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9586 (plus:SI (match_dup 1) (match_dup 2)))]
9591 [(set_attr "type" "load_ext_ux,load_ext_u")])
9593 (define_insn "*movhi_update4"
9594 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9595 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9596 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9597 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9598 (plus:SI (match_dup 1) (match_dup 2)))]
9603 [(set_attr "type" "store_ux,store_u")])
9605 (define_insn "*movqi_update1"
9606 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9607 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9608 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9609 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9610 (plus:SI (match_dup 1) (match_dup 2)))]
9615 [(set_attr "type" "load_ux,load_u")])
9617 (define_insn "*movqi_update2"
9618 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9620 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9621 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9622 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9623 (plus:SI (match_dup 1) (match_dup 2)))]
9628 [(set_attr "type" "load_ux,load_u")])
9630 (define_insn "*movqi_update3"
9631 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9632 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9633 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9634 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9635 (plus:SI (match_dup 1) (match_dup 2)))]
9640 [(set_attr "type" "store_ux,store_u")])
9642 (define_insn "*movsf_update1"
9643 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9644 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9645 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9646 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9647 (plus:SI (match_dup 1) (match_dup 2)))]
9648 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9652 [(set_attr "type" "fpload_ux,fpload_u")])
9654 (define_insn "*movsf_update2"
9655 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9656 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9657 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9658 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9659 (plus:SI (match_dup 1) (match_dup 2)))]
9660 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9664 [(set_attr "type" "fpstore_ux,fpstore_u")])
9666 (define_insn "*movsf_update3"
9667 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9668 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9669 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9670 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9671 (plus:SI (match_dup 1) (match_dup 2)))]
9672 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9674 {lux|lwzux} %3,%0,%2
9675 {lu|lwzu} %3,%2(%0)"
9676 [(set_attr "type" "load_ux,load_u")])
9678 (define_insn "*movsf_update4"
9679 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9680 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9681 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9682 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9683 (plus:SI (match_dup 1) (match_dup 2)))]
9684 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9686 {stux|stwux} %3,%0,%2
9687 {stu|stwu} %3,%2(%0)"
9688 [(set_attr "type" "store_ux,store_u")])
9690 (define_insn "*movdf_update1"
9691 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9692 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9693 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9694 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9695 (plus:SI (match_dup 1) (match_dup 2)))]
9696 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9700 [(set_attr "type" "fpload_ux,fpload_u")])
9702 (define_insn "*movdf_update2"
9703 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9704 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9705 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9706 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9707 (plus:SI (match_dup 1) (match_dup 2)))]
9708 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9712 [(set_attr "type" "fpstore_ux,fpstore_u")])
9714 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9716 (define_insn "*lfq_power2"
9717 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9718 (match_operand:TF 1 "memory_operand" ""))]
9720 && TARGET_HARD_FLOAT && TARGET_FPRS"
9724 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9725 (match_operand:DF 1 "memory_operand" ""))
9726 (set (match_operand:DF 2 "gpc_reg_operand" "")
9727 (match_operand:DF 3 "memory_operand" ""))]
9729 && TARGET_HARD_FLOAT && TARGET_FPRS
9730 && registers_ok_for_quad_peep (operands[0], operands[2])
9731 && mems_ok_for_quad_peep (operands[1], operands[3])"
9734 "operands[1] = widen_memory_access (operands[1], TFmode, 0);
9735 operands[0] = gen_rtx_REG (TFmode, REGNO (operands[0]));")
9737 (define_insn "*stfq_power2"
9738 [(set (match_operand:TF 0 "memory_operand" "")
9739 (match_operand:TF 1 "gpc_reg_operand" "f"))]
9741 && TARGET_HARD_FLOAT && TARGET_FPRS"
9746 [(set (match_operand:DF 0 "memory_operand" "")
9747 (match_operand:DF 1 "gpc_reg_operand" ""))
9748 (set (match_operand:DF 2 "memory_operand" "")
9749 (match_operand:DF 3 "gpc_reg_operand" ""))]
9751 && TARGET_HARD_FLOAT && TARGET_FPRS
9752 && registers_ok_for_quad_peep (operands[1], operands[3])
9753 && mems_ok_for_quad_peep (operands[0], operands[2])"
9756 "operands[0] = widen_memory_access (operands[0], TFmode, 0);
9757 operands[1] = gen_rtx_REG (TFmode, REGNO (operands[1]));")
9759 ;; after inserting conditional returns we can sometimes have
9760 ;; unnecessary register moves. Unfortunately we cannot have a
9761 ;; modeless peephole here, because some single SImode sets have early
9762 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9763 ;; sequences, using get_attr_length here will smash the operands
9764 ;; array. Neither is there an early_cobbler_p predicate.
9766 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9767 (match_operand:DF 1 "any_operand" ""))
9768 (set (match_operand:DF 2 "gpc_reg_operand" "")
9770 "peep2_reg_dead_p (2, operands[0])"
9771 [(set (match_dup 2) (match_dup 1))])
9774 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9775 (match_operand:SF 1 "any_operand" ""))
9776 (set (match_operand:SF 2 "gpc_reg_operand" "")
9778 "peep2_reg_dead_p (2, operands[0])"
9779 [(set (match_dup 2) (match_dup 1))])
9784 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9785 (define_insn "tls_gd_32"
9786 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9787 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9788 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9790 "HAVE_AS_TLS && !TARGET_64BIT"
9791 "addi %0,%1,%2@got@tlsgd")
9793 (define_insn "tls_gd_64"
9794 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9795 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9796 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9798 "HAVE_AS_TLS && TARGET_64BIT"
9799 "addi %0,%1,%2@got@tlsgd")
9801 (define_insn "tls_ld_32"
9802 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9803 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9805 "HAVE_AS_TLS && !TARGET_64BIT"
9806 "addi %0,%1,%&@got@tlsld")
9808 (define_insn "tls_ld_64"
9809 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9810 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9812 "HAVE_AS_TLS && TARGET_64BIT"
9813 "addi %0,%1,%&@got@tlsld")
9815 (define_insn "tls_dtprel_32"
9816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9817 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9818 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9820 "HAVE_AS_TLS && !TARGET_64BIT"
9821 "addi %0,%1,%2@dtprel")
9823 (define_insn "tls_dtprel_64"
9824 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9825 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9826 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9828 "HAVE_AS_TLS && TARGET_64BIT"
9829 "addi %0,%1,%2@dtprel")
9831 (define_insn "tls_dtprel_ha_32"
9832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9833 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9834 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9835 UNSPEC_TLSDTPRELHA))]
9836 "HAVE_AS_TLS && !TARGET_64BIT"
9837 "addis %0,%1,%2@dtprel@ha")
9839 (define_insn "tls_dtprel_ha_64"
9840 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9841 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9842 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9843 UNSPEC_TLSDTPRELHA))]
9844 "HAVE_AS_TLS && TARGET_64BIT"
9845 "addis %0,%1,%2@dtprel@ha")
9847 (define_insn "tls_dtprel_lo_32"
9848 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9849 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9850 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9851 UNSPEC_TLSDTPRELLO))]
9852 "HAVE_AS_TLS && !TARGET_64BIT"
9853 "addi %0,%1,%2@dtprel@l")
9855 (define_insn "tls_dtprel_lo_64"
9856 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9857 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9858 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9859 UNSPEC_TLSDTPRELLO))]
9860 "HAVE_AS_TLS && TARGET_64BIT"
9861 "addi %0,%1,%2@dtprel@l")
9863 (define_insn "tls_got_dtprel_32"
9864 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9865 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9866 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9867 UNSPEC_TLSGOTDTPREL))]
9868 "HAVE_AS_TLS && !TARGET_64BIT"
9869 "lwz %0,%2@got@dtprel(%1)")
9871 (define_insn "tls_got_dtprel_64"
9872 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9873 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9874 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9875 UNSPEC_TLSGOTDTPREL))]
9876 "HAVE_AS_TLS && TARGET_64BIT"
9877 "ld %0,%2@got@dtprel(%1)")
9879 (define_insn "tls_tprel_32"
9880 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9881 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9882 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9884 "HAVE_AS_TLS && !TARGET_64BIT"
9885 "addi %0,%1,%2@tprel")
9887 (define_insn "tls_tprel_64"
9888 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9889 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9890 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9892 "HAVE_AS_TLS && TARGET_64BIT"
9893 "addi %0,%1,%2@tprel")
9895 (define_insn "tls_tprel_ha_32"
9896 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9897 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9898 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9899 UNSPEC_TLSTPRELHA))]
9900 "HAVE_AS_TLS && !TARGET_64BIT"
9901 "addis %0,%1,%2@tprel@ha")
9903 (define_insn "tls_tprel_ha_64"
9904 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9905 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9906 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9907 UNSPEC_TLSTPRELHA))]
9908 "HAVE_AS_TLS && TARGET_64BIT"
9909 "addis %0,%1,%2@tprel@ha")
9911 (define_insn "tls_tprel_lo_32"
9912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9913 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9914 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9915 UNSPEC_TLSTPRELLO))]
9916 "HAVE_AS_TLS && !TARGET_64BIT"
9917 "addi %0,%1,%2@tprel@l")
9919 (define_insn "tls_tprel_lo_64"
9920 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9921 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9922 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9923 UNSPEC_TLSTPRELLO))]
9924 "HAVE_AS_TLS && TARGET_64BIT"
9925 "addi %0,%1,%2@tprel@l")
9927 ;; "b" output constraint here and on tls_tls input to support linker tls
9928 ;; optimization. The linker may edit the instructions emitted by a
9929 ;; tls_got_tprel/tls_tls pair to addis,addi.
9930 (define_insn "tls_got_tprel_32"
9931 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9932 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9933 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9934 UNSPEC_TLSGOTTPREL))]
9935 "HAVE_AS_TLS && !TARGET_64BIT"
9936 "lwz %0,%2@got@tprel(%1)")
9938 (define_insn "tls_got_tprel_64"
9939 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9940 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9941 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9942 UNSPEC_TLSGOTTPREL))]
9943 "HAVE_AS_TLS && TARGET_64BIT"
9944 "ld %0,%2@got@tprel(%1)")
9946 (define_insn "tls_tls_32"
9947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9948 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9949 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9951 "HAVE_AS_TLS && !TARGET_64BIT"
9954 (define_insn "tls_tls_64"
9955 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9956 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9957 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9959 "HAVE_AS_TLS && TARGET_64BIT"
9962 ;; Next come insns related to the calling sequence.
9964 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9965 ;; We move the back-chain and decrement the stack pointer.
9967 (define_expand "allocate_stack"
9968 [(set (match_operand 0 "gpc_reg_operand" "=r")
9969 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9971 (minus (reg 1) (match_dup 1)))]
9974 { rtx chain = gen_reg_rtx (Pmode);
9975 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9978 emit_move_insn (chain, stack_bot);
9980 /* Check stack bounds if necessary. */
9981 if (current_function_limit_stack)
9984 available = expand_binop (Pmode, sub_optab,
9985 stack_pointer_rtx, stack_limit_rtx,
9986 NULL_RTX, 1, OPTAB_WIDEN);
9987 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9990 if (GET_CODE (operands[1]) != CONST_INT
9991 || INTVAL (operands[1]) < -32767
9992 || INTVAL (operands[1]) > 32768)
9994 neg_op0 = gen_reg_rtx (Pmode);
9996 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9998 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10001 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10004 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
10005 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10009 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10010 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10011 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10014 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10018 ;; These patterns say how to save and restore the stack pointer. We need not
10019 ;; save the stack pointer at function level since we are careful to
10020 ;; preserve the backchain. At block level, we have to restore the backchain
10021 ;; when we restore the stack pointer.
10023 ;; For nonlocal gotos, we must save both the stack pointer and its
10024 ;; backchain and restore both. Note that in the nonlocal case, the
10025 ;; save area is a memory location.
10027 (define_expand "save_stack_function"
10028 [(match_operand 0 "any_operand" "")
10029 (match_operand 1 "any_operand" "")]
10033 (define_expand "restore_stack_function"
10034 [(match_operand 0 "any_operand" "")
10035 (match_operand 1 "any_operand" "")]
10039 ;; Adjust stack pointer (op0) to a new value (op1).
10040 ;; First copy old stack backchain to new location, and ensure that the
10041 ;; scheduler won't reorder the sp assignment before the backchain write.
10042 (define_expand "restore_stack_block"
10043 [(set (match_dup 2) (match_dup 3))
10044 (set (match_dup 4) (match_dup 2))
10045 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10046 (set (match_operand 0 "register_operand" "")
10047 (match_operand 1 "register_operand" ""))]
10051 operands[2] = gen_reg_rtx (Pmode);
10052 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
10053 operands[4] = gen_rtx_MEM (Pmode, operands[1]);
10054 operands[5] = gen_rtx_MEM (BLKmode, operands[0]);
10057 (define_expand "save_stack_nonlocal"
10058 [(set (match_dup 3) (match_dup 4))
10059 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10060 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10064 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10066 /* Copy the backchain to the first word, sp to the second. */
10067 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10068 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10069 operands[3] = gen_reg_rtx (Pmode);
10070 operands[4] = gen_rtx_MEM (Pmode, operands[1]);
10073 (define_expand "restore_stack_nonlocal"
10074 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10075 (set (match_dup 3) (match_dup 4))
10076 (set (match_dup 5) (match_dup 2))
10077 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10078 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10082 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10084 /* Restore the backchain from the first word, sp from the second. */
10085 operands[2] = gen_reg_rtx (Pmode);
10086 operands[3] = gen_reg_rtx (Pmode);
10087 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10088 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10089 operands[5] = gen_rtx_MEM (Pmode, operands[3]);
10090 operands[6] = gen_rtx_MEM (BLKmode, operands[0]);
10093 ;; TOC register handling.
10095 ;; Code to initialize the TOC register...
10097 (define_insn "load_toc_aix_si"
10098 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10099 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10100 (use (reg:SI 2))])]
10101 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10105 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10106 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10107 operands[2] = gen_rtx_REG (Pmode, 2);
10108 return \"{l|lwz} %0,%1(%2)\";
10110 [(set_attr "type" "load")])
10112 (define_insn "load_toc_aix_di"
10113 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10114 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10115 (use (reg:DI 2))])]
10116 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10120 #ifdef TARGET_RELOCATABLE
10121 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10122 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10124 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10127 strcat (buf, \"@toc\");
10128 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10129 operands[2] = gen_rtx_REG (Pmode, 2);
10130 return \"ld %0,%1(%2)\";
10132 [(set_attr "type" "load")])
10134 (define_insn "load_toc_v4_pic_si"
10135 [(set (match_operand:SI 0 "register_operand" "=l")
10136 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10137 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10138 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10139 [(set_attr "type" "branch")
10140 (set_attr "length" "4")])
10142 (define_insn "load_toc_v4_PIC_1"
10143 [(set (match_operand:SI 0 "register_operand" "=l")
10144 (match_operand:SI 1 "immediate_operand" "s"))
10145 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
10146 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10147 "bcl 20,31,%1\\n%1:"
10148 [(set_attr "type" "branch")
10149 (set_attr "length" "4")])
10151 (define_insn "load_toc_v4_PIC_1b"
10152 [(set (match_operand:SI 0 "register_operand" "=l")
10153 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
10155 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10156 "bcl 20,31,$+8\\n\\t.long %1-$"
10157 [(set_attr "type" "branch")
10158 (set_attr "length" "8")])
10160 (define_insn "load_toc_v4_PIC_2"
10161 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10162 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10163 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10164 (match_operand:SI 3 "immediate_operand" "s")))))]
10165 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10166 "{l|lwz} %0,%2-%3(%1)"
10167 [(set_attr "type" "load")])
10170 ;; If the TOC is shared over a translation unit, as happens with all
10171 ;; the kinds of PIC that we support, we need to restore the TOC
10172 ;; pointer only when jumping over units of translation.
10173 ;; On Darwin, we need to reload the picbase.
10175 (define_expand "builtin_setjmp_receiver"
10176 [(use (label_ref (match_operand 0 "" "")))]
10177 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10178 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10179 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10183 if (DEFAULT_ABI == ABI_DARWIN)
10185 const char *picbase = machopic_function_base_name ();
10186 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10187 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10191 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10192 CODE_LABEL_NUMBER (operands[0]));
10193 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10195 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10196 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10200 rs6000_emit_load_toc_table (FALSE);
10204 ;; A function pointer under AIX is a pointer to a data area whose first word
10205 ;; contains the actual address of the function, whose second word contains a
10206 ;; pointer to its TOC, and whose third word contains a value to place in the
10207 ;; static chain register (r11). Note that if we load the static chain, our
10208 ;; "trampoline" need not have any executable code.
10210 (define_expand "call_indirect_aix32"
10211 [(set (match_dup 2)
10212 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10213 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10216 (mem:SI (plus:SI (match_dup 0)
10219 (mem:SI (plus:SI (match_dup 0)
10221 (parallel [(call (mem:SI (match_dup 2))
10222 (match_operand 1 "" ""))
10226 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10227 (clobber (scratch:SI))])]
10230 { operands[2] = gen_reg_rtx (SImode); }")
10232 (define_expand "call_indirect_aix64"
10233 [(set (match_dup 2)
10234 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10235 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10238 (mem:DI (plus:DI (match_dup 0)
10241 (mem:DI (plus:DI (match_dup 0)
10243 (parallel [(call (mem:SI (match_dup 2))
10244 (match_operand 1 "" ""))
10248 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10249 (clobber (scratch:SI))])]
10252 { operands[2] = gen_reg_rtx (DImode); }")
10254 (define_expand "call_value_indirect_aix32"
10255 [(set (match_dup 3)
10256 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10257 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10260 (mem:SI (plus:SI (match_dup 1)
10263 (mem:SI (plus:SI (match_dup 1)
10265 (parallel [(set (match_operand 0 "" "")
10266 (call (mem:SI (match_dup 3))
10267 (match_operand 2 "" "")))
10271 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10272 (clobber (scratch:SI))])]
10275 { operands[3] = gen_reg_rtx (SImode); }")
10277 (define_expand "call_value_indirect_aix64"
10278 [(set (match_dup 3)
10279 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10280 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10283 (mem:DI (plus:DI (match_dup 1)
10286 (mem:DI (plus:DI (match_dup 1)
10288 (parallel [(set (match_operand 0 "" "")
10289 (call (mem:SI (match_dup 3))
10290 (match_operand 2 "" "")))
10294 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10295 (clobber (scratch:SI))])]
10298 { operands[3] = gen_reg_rtx (DImode); }")
10300 ;; Now the definitions for the call and call_value insns
10301 (define_expand "call"
10302 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10303 (match_operand 1 "" ""))
10304 (use (match_operand 2 "" ""))
10305 (clobber (scratch:SI))])]
10310 if (MACHOPIC_INDIRECT)
10311 operands[0] = machopic_indirect_call_target (operands[0]);
10314 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10317 operands[0] = XEXP (operands[0], 0);
10319 if (GET_CODE (operands[0]) != SYMBOL_REF
10320 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10321 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10323 if (INTVAL (operands[2]) & CALL_LONG)
10324 operands[0] = rs6000_longcall_ref (operands[0]);
10326 if (DEFAULT_ABI == ABI_V4
10327 || DEFAULT_ABI == ABI_DARWIN)
10328 operands[0] = force_reg (Pmode, operands[0]);
10330 else if (DEFAULT_ABI == ABI_AIX)
10332 /* AIX function pointers are really pointers to a three word
10334 emit_call_insn (TARGET_32BIT
10335 ? gen_call_indirect_aix32 (force_reg (SImode,
10338 : gen_call_indirect_aix64 (force_reg (DImode,
10348 (define_expand "call_value"
10349 [(parallel [(set (match_operand 0 "" "")
10350 (call (mem:SI (match_operand 1 "address_operand" ""))
10351 (match_operand 2 "" "")))
10352 (use (match_operand 3 "" ""))
10353 (clobber (scratch:SI))])]
10358 if (MACHOPIC_INDIRECT)
10359 operands[1] = machopic_indirect_call_target (operands[1]);
10362 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10365 operands[1] = XEXP (operands[1], 0);
10367 if (GET_CODE (operands[1]) != SYMBOL_REF
10368 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10369 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10371 if (INTVAL (operands[3]) & CALL_LONG)
10372 operands[1] = rs6000_longcall_ref (operands[1]);
10374 if (DEFAULT_ABI == ABI_V4
10375 || DEFAULT_ABI == ABI_DARWIN)
10376 operands[1] = force_reg (Pmode, operands[1]);
10378 else if (DEFAULT_ABI == ABI_AIX)
10380 /* AIX function pointers are really pointers to a three word
10382 emit_call_insn (TARGET_32BIT
10383 ? gen_call_value_indirect_aix32 (operands[0],
10387 : gen_call_value_indirect_aix64 (operands[0],
10398 ;; Call to function in current module. No TOC pointer reload needed.
10399 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10400 ;; either the function was not prototyped, or it was prototyped as a
10401 ;; variable argument function. It is > 0 if FP registers were passed
10402 ;; and < 0 if they were not.
10404 (define_insn "*call_local32"
10405 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10406 (match_operand 1 "" "g,g"))
10407 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10408 (clobber (match_scratch:SI 3 "=l,l"))]
10409 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10412 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10413 output_asm_insn (\"crxor 6,6,6\", operands);
10415 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10416 output_asm_insn (\"creqv 6,6,6\", operands);
10418 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10420 [(set_attr "type" "branch")
10421 (set_attr "length" "4,8")])
10423 (define_insn "*call_local64"
10424 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10425 (match_operand 1 "" "g,g"))
10426 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10427 (clobber (match_scratch:SI 3 "=l,l"))]
10428 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10431 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10432 output_asm_insn (\"crxor 6,6,6\", operands);
10434 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10435 output_asm_insn (\"creqv 6,6,6\", operands);
10437 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10439 [(set_attr "type" "branch")
10440 (set_attr "length" "4,8")])
10442 (define_insn "*call_value_local32"
10443 [(set (match_operand 0 "" "")
10444 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10445 (match_operand 2 "" "g,g")))
10446 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10447 (clobber (match_scratch:SI 4 "=l,l"))]
10448 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10451 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10452 output_asm_insn (\"crxor 6,6,6\", operands);
10454 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10455 output_asm_insn (\"creqv 6,6,6\", operands);
10457 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10459 [(set_attr "type" "branch")
10460 (set_attr "length" "4,8")])
10463 (define_insn "*call_value_local64"
10464 [(set (match_operand 0 "" "")
10465 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10466 (match_operand 2 "" "g,g")))
10467 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10468 (clobber (match_scratch:SI 4 "=l,l"))]
10469 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10472 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10473 output_asm_insn (\"crxor 6,6,6\", operands);
10475 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10476 output_asm_insn (\"creqv 6,6,6\", operands);
10478 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10480 [(set_attr "type" "branch")
10481 (set_attr "length" "4,8")])
10483 ;; Call to function which may be in another module. Restore the TOC
10484 ;; pointer (r2) after the call unless this is System V.
10485 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10486 ;; either the function was not prototyped, or it was prototyped as a
10487 ;; variable argument function. It is > 0 if FP registers were passed
10488 ;; and < 0 if they were not.
10490 (define_insn "*call_indirect_nonlocal_aix32"
10491 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10492 (match_operand 1 "" "g,g"))
10496 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10497 (clobber (match_scratch:SI 2 "=l,l"))]
10498 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10499 "b%T0l\;{l|lwz} 2,20(1)"
10500 [(set_attr "type" "jmpreg")
10501 (set_attr "length" "8")])
10503 (define_insn "*call_nonlocal_aix32"
10504 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10505 (match_operand 1 "" "g"))
10506 (use (match_operand:SI 2 "immediate_operand" "O"))
10507 (clobber (match_scratch:SI 3 "=l"))]
10509 && DEFAULT_ABI == ABI_AIX
10510 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10512 [(set_attr "type" "branch")
10513 (set_attr "length" "8")])
10515 (define_insn "*call_indirect_nonlocal_aix64"
10516 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10517 (match_operand 1 "" "g,g"))
10521 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10522 (clobber (match_scratch:SI 2 "=l,l"))]
10523 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10524 "b%T0l\;ld 2,40(1)"
10525 [(set_attr "type" "jmpreg")
10526 (set_attr "length" "8")])
10528 (define_insn "*call_nonlocal_aix64"
10529 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10530 (match_operand 1 "" "g"))
10531 (use (match_operand:SI 2 "immediate_operand" "O"))
10532 (clobber (match_scratch:SI 3 "=l"))]
10534 && DEFAULT_ABI == ABI_AIX
10535 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10537 [(set_attr "type" "branch")
10538 (set_attr "length" "8")])
10540 (define_insn "*call_value_indirect_nonlocal_aix32"
10541 [(set (match_operand 0 "" "")
10542 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10543 (match_operand 2 "" "g,g")))
10547 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10548 (clobber (match_scratch:SI 3 "=l,l"))]
10549 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10550 "b%T1l\;{l|lwz} 2,20(1)"
10551 [(set_attr "type" "jmpreg")
10552 (set_attr "length" "8")])
10554 (define_insn "*call_value_nonlocal_aix32"
10555 [(set (match_operand 0 "" "")
10556 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10557 (match_operand 2 "" "g")))
10558 (use (match_operand:SI 3 "immediate_operand" "O"))
10559 (clobber (match_scratch:SI 4 "=l"))]
10561 && DEFAULT_ABI == ABI_AIX
10562 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10564 [(set_attr "type" "branch")
10565 (set_attr "length" "8")])
10567 (define_insn "*call_value_indirect_nonlocal_aix64"
10568 [(set (match_operand 0 "" "")
10569 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10570 (match_operand 2 "" "g,g")))
10574 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10575 (clobber (match_scratch:SI 3 "=l,l"))]
10576 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10577 "b%T1l\;ld 2,40(1)"
10578 [(set_attr "type" "jmpreg")
10579 (set_attr "length" "8")])
10581 (define_insn "*call_value_nonlocal_aix64"
10582 [(set (match_operand 0 "" "")
10583 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10584 (match_operand 2 "" "g")))
10585 (use (match_operand:SI 3 "immediate_operand" "O"))
10586 (clobber (match_scratch:SI 4 "=l"))]
10588 && DEFAULT_ABI == ABI_AIX
10589 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10591 [(set_attr "type" "branch")
10592 (set_attr "length" "8")])
10594 ;; A function pointer under System V is just a normal pointer
10595 ;; operands[0] is the function pointer
10596 ;; operands[1] is the stack size to clean up
10597 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10598 ;; which indicates how to set cr1
10600 (define_insn "*call_indirect_nonlocal_sysv"
10601 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
10602 (match_operand 1 "" "g,g,g,g"))
10603 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10604 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10605 "DEFAULT_ABI == ABI_V4
10606 || DEFAULT_ABI == ABI_DARWIN"
10608 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10609 output_asm_insn ("crxor 6,6,6", operands);
10611 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10612 output_asm_insn ("creqv 6,6,6", operands);
10616 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10617 (set_attr "length" "4,4,8,8")])
10619 (define_insn "*call_nonlocal_sysv"
10620 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10621 (match_operand 1 "" "g,g"))
10622 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10623 (clobber (match_scratch:SI 3 "=l,l"))]
10624 "(DEFAULT_ABI == ABI_DARWIN
10625 || (DEFAULT_ABI == ABI_V4
10626 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10628 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10629 output_asm_insn ("crxor 6,6,6", operands);
10631 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10632 output_asm_insn ("creqv 6,6,6", operands);
10635 return output_call(insn, operands, 0, 2);
10637 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10640 [(set_attr "type" "branch,branch")
10641 (set_attr "length" "4,8")])
10643 (define_insn "*call_value_indirect_nonlocal_sysv"
10644 [(set (match_operand 0 "" "")
10645 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
10646 (match_operand 2 "" "g,g,g,g")))
10647 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10648 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10649 "DEFAULT_ABI == ABI_V4
10650 || DEFAULT_ABI == ABI_DARWIN"
10652 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10653 output_asm_insn ("crxor 6,6,6", operands);
10655 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10656 output_asm_insn ("creqv 6,6,6", operands);
10660 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10661 (set_attr "length" "4,4,8,8")])
10663 (define_insn "*call_value_nonlocal_sysv"
10664 [(set (match_operand 0 "" "")
10665 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10666 (match_operand 2 "" "g,g")))
10667 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10668 (clobber (match_scratch:SI 4 "=l,l"))]
10669 "(DEFAULT_ABI == ABI_DARWIN
10670 || (DEFAULT_ABI == ABI_V4
10671 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10673 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10674 output_asm_insn ("crxor 6,6,6", operands);
10676 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10677 output_asm_insn ("creqv 6,6,6", operands);
10680 return output_call(insn, operands, 1, 3);
10682 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10685 [(set_attr "type" "branch,branch")
10686 (set_attr "length" "4,8")])
10688 ;; Call subroutine returning any type.
10689 (define_expand "untyped_call"
10690 [(parallel [(call (match_operand 0 "" "")
10692 (match_operand 1 "" "")
10693 (match_operand 2 "" "")])]
10699 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10701 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10703 rtx set = XVECEXP (operands[2], 0, i);
10704 emit_move_insn (SET_DEST (set), SET_SRC (set));
10707 /* The optimizer does not know that the call sets the function value
10708 registers we stored in the result block. We avoid problems by
10709 claiming that all hard registers are used and clobbered at this
10711 emit_insn (gen_blockage ());
10716 ;; sibling call patterns
10717 (define_expand "sibcall"
10718 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10719 (match_operand 1 "" ""))
10720 (use (match_operand 2 "" ""))
10721 (use (match_operand 3 "" ""))
10727 if (MACHOPIC_INDIRECT)
10728 operands[0] = machopic_indirect_call_target (operands[0]);
10731 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10734 operands[0] = XEXP (operands[0], 0);
10735 operands[3] = gen_reg_rtx (SImode);
10739 ;; this and similar patterns must be marked as using LR, otherwise
10740 ;; dataflow will try to delete the store into it. This is true
10741 ;; even when the actual reg to jump to is in CTR, when LR was
10742 ;; saved and restored around the PIC-setting BCL.
10743 (define_insn "*sibcall_local32"
10744 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10745 (match_operand 1 "" "g,g"))
10746 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10747 (use (match_operand:SI 3 "register_operand" "l,l"))
10749 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10752 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10753 output_asm_insn (\"crxor 6,6,6\", operands);
10755 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10756 output_asm_insn (\"creqv 6,6,6\", operands);
10758 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10760 [(set_attr "type" "branch")
10761 (set_attr "length" "4,8")])
10763 (define_insn "*sibcall_local64"
10764 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10765 (match_operand 1 "" "g,g"))
10766 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10767 (use (match_operand:SI 3 "register_operand" "l,l"))
10769 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10772 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10773 output_asm_insn (\"crxor 6,6,6\", operands);
10775 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10776 output_asm_insn (\"creqv 6,6,6\", operands);
10778 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10780 [(set_attr "type" "branch")
10781 (set_attr "length" "4,8")])
10783 (define_insn "*sibcall_value_local32"
10784 [(set (match_operand 0 "" "")
10785 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10786 (match_operand 2 "" "g,g")))
10787 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10788 (use (match_operand:SI 4 "register_operand" "l,l"))
10790 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10793 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10794 output_asm_insn (\"crxor 6,6,6\", operands);
10796 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10797 output_asm_insn (\"creqv 6,6,6\", operands);
10799 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10801 [(set_attr "type" "branch")
10802 (set_attr "length" "4,8")])
10805 (define_insn "*sibcall_value_local64"
10806 [(set (match_operand 0 "" "")
10807 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10808 (match_operand 2 "" "g,g")))
10809 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10810 (use (match_operand:SI 4 "register_operand" "l,l"))
10812 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10815 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10816 output_asm_insn (\"crxor 6,6,6\", operands);
10818 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10819 output_asm_insn (\"creqv 6,6,6\", operands);
10821 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10823 [(set_attr "type" "branch")
10824 (set_attr "length" "4,8")])
10826 (define_insn "*sibcall_nonlocal_aix32"
10827 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10828 (match_operand 1 "" "g"))
10829 (use (match_operand:SI 2 "immediate_operand" "O"))
10830 (use (match_operand:SI 3 "register_operand" "l"))
10833 && DEFAULT_ABI == ABI_AIX
10834 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10836 [(set_attr "type" "branch")
10837 (set_attr "length" "4")])
10839 (define_insn "*sibcall_nonlocal_aix64"
10840 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10841 (match_operand 1 "" "g"))
10842 (use (match_operand:SI 2 "immediate_operand" "O"))
10843 (use (match_operand:SI 3 "register_operand" "l"))
10846 && DEFAULT_ABI == ABI_AIX
10847 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10849 [(set_attr "type" "branch")
10850 (set_attr "length" "4")])
10852 (define_insn "*sibcall_value_nonlocal_aix32"
10853 [(set (match_operand 0 "" "")
10854 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10855 (match_operand 2 "" "g")))
10856 (use (match_operand:SI 3 "immediate_operand" "O"))
10857 (use (match_operand:SI 4 "register_operand" "l"))
10860 && DEFAULT_ABI == ABI_AIX
10861 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10863 [(set_attr "type" "branch")
10864 (set_attr "length" "4")])
10866 (define_insn "*sibcall_value_nonlocal_aix64"
10867 [(set (match_operand 0 "" "")
10868 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10869 (match_operand 2 "" "g")))
10870 (use (match_operand:SI 3 "immediate_operand" "O"))
10871 (use (match_operand:SI 4 "register_operand" "l"))
10874 && DEFAULT_ABI == ABI_AIX
10875 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10877 [(set_attr "type" "branch")
10878 (set_attr "length" "4")])
10880 (define_insn "*sibcall_nonlocal_sysv"
10881 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10882 (match_operand 1 "" ""))
10883 (use (match_operand 2 "immediate_operand" "O,n"))
10884 (use (match_operand:SI 3 "register_operand" "l,l"))
10886 "(DEFAULT_ABI == ABI_DARWIN
10887 || DEFAULT_ABI == ABI_V4)
10888 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10891 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10892 output_asm_insn (\"crxor 6,6,6\", operands);
10894 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10895 output_asm_insn (\"creqv 6,6,6\", operands);
10897 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
10899 [(set_attr "type" "branch,branch")
10900 (set_attr "length" "4,8")])
10902 (define_expand "sibcall_value"
10903 [(parallel [(set (match_operand 0 "register_operand" "")
10904 (call (mem:SI (match_operand 1 "address_operand" ""))
10905 (match_operand 2 "" "")))
10906 (use (match_operand 3 "" ""))
10907 (use (match_operand 4 "" ""))
10913 if (MACHOPIC_INDIRECT)
10914 operands[1] = machopic_indirect_call_target (operands[1]);
10917 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10920 operands[1] = XEXP (operands[1], 0);
10921 operands[4] = gen_reg_rtx (SImode);
10925 (define_insn "*sibcall_value_nonlocal_sysv"
10926 [(set (match_operand 0 "" "")
10927 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10928 (match_operand 2 "" "")))
10929 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10930 (use (match_operand:SI 4 "register_operand" "l,l"))
10932 "(DEFAULT_ABI == ABI_DARWIN
10933 || DEFAULT_ABI == ABI_V4)
10934 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10937 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10938 output_asm_insn (\"crxor 6,6,6\", operands);
10940 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10941 output_asm_insn (\"creqv 6,6,6\", operands);
10943 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
10945 [(set_attr "type" "branch,branch")
10946 (set_attr "length" "4,8")])
10948 (define_expand "sibcall_epilogue"
10949 [(use (const_int 0))]
10950 "TARGET_SCHED_PROLOG"
10953 rs6000_emit_epilogue (TRUE);
10957 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10958 ;; all of memory. This blocks insns from being moved across this point.
10960 (define_insn "blockage"
10961 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10965 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10966 ;; signed & unsigned, and one type of branch.
10968 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10969 ;; insns, and branches. We store the operands of compares until we see
10971 (define_expand "cmpsi"
10973 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10974 (match_operand:SI 1 "reg_or_short_operand" "")))]
10978 /* Take care of the possibility that operands[1] might be negative but
10979 this might be a logical operation. That insn doesn't exist. */
10980 if (GET_CODE (operands[1]) == CONST_INT
10981 && INTVAL (operands[1]) < 0)
10982 operands[1] = force_reg (SImode, operands[1]);
10984 rs6000_compare_op0 = operands[0];
10985 rs6000_compare_op1 = operands[1];
10986 rs6000_compare_fp_p = 0;
10990 (define_expand "cmpdi"
10992 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10993 (match_operand:DI 1 "reg_or_short_operand" "")))]
10997 /* Take care of the possibility that operands[1] might be negative but
10998 this might be a logical operation. That insn doesn't exist. */
10999 if (GET_CODE (operands[1]) == CONST_INT
11000 && INTVAL (operands[1]) < 0)
11001 operands[1] = force_reg (DImode, operands[1]);
11003 rs6000_compare_op0 = operands[0];
11004 rs6000_compare_op1 = operands[1];
11005 rs6000_compare_fp_p = 0;
11009 (define_expand "cmpsf"
11010 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
11011 (match_operand:SF 1 "gpc_reg_operand" "")))]
11012 "TARGET_HARD_FLOAT"
11015 rs6000_compare_op0 = operands[0];
11016 rs6000_compare_op1 = operands[1];
11017 rs6000_compare_fp_p = 1;
11021 (define_expand "cmpdf"
11022 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
11023 (match_operand:DF 1 "gpc_reg_operand" "")))]
11024 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
11027 rs6000_compare_op0 = operands[0];
11028 rs6000_compare_op1 = operands[1];
11029 rs6000_compare_fp_p = 1;
11033 (define_expand "cmptf"
11034 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
11035 (match_operand:TF 1 "gpc_reg_operand" "")))]
11036 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
11037 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11040 rs6000_compare_op0 = operands[0];
11041 rs6000_compare_op1 = operands[1];
11042 rs6000_compare_fp_p = 1;
11046 (define_expand "beq"
11047 [(use (match_operand 0 "" ""))]
11049 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11051 (define_expand "bne"
11052 [(use (match_operand 0 "" ""))]
11054 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11056 (define_expand "bge"
11057 [(use (match_operand 0 "" ""))]
11059 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11061 (define_expand "bgt"
11062 [(use (match_operand 0 "" ""))]
11064 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11066 (define_expand "ble"
11067 [(use (match_operand 0 "" ""))]
11069 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11071 (define_expand "blt"
11072 [(use (match_operand 0 "" ""))]
11074 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11076 (define_expand "bgeu"
11077 [(use (match_operand 0 "" ""))]
11079 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11081 (define_expand "bgtu"
11082 [(use (match_operand 0 "" ""))]
11084 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11086 (define_expand "bleu"
11087 [(use (match_operand 0 "" ""))]
11089 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11091 (define_expand "bltu"
11092 [(use (match_operand 0 "" ""))]
11094 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11096 (define_expand "bunordered"
11097 [(use (match_operand 0 "" ""))]
11098 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11099 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11101 (define_expand "bordered"
11102 [(use (match_operand 0 "" ""))]
11103 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11104 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11106 (define_expand "buneq"
11107 [(use (match_operand 0 "" ""))]
11109 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11111 (define_expand "bunge"
11112 [(use (match_operand 0 "" ""))]
11114 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11116 (define_expand "bungt"
11117 [(use (match_operand 0 "" ""))]
11119 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11121 (define_expand "bunle"
11122 [(use (match_operand 0 "" ""))]
11124 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11126 (define_expand "bunlt"
11127 [(use (match_operand 0 "" ""))]
11129 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11131 (define_expand "bltgt"
11132 [(use (match_operand 0 "" ""))]
11134 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11136 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11137 ;; For SEQ, likewise, except that comparisons with zero should be done
11138 ;; with an scc insns. However, due to the order that combine see the
11139 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11140 ;; the cases we don't want to handle.
11141 (define_expand "seq"
11142 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11144 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11146 (define_expand "sne"
11147 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11151 if (! rs6000_compare_fp_p)
11154 rs6000_emit_sCOND (NE, operands[0]);
11158 ;; A >= 0 is best done the portable way for A an integer.
11159 (define_expand "sge"
11160 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11164 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11167 rs6000_emit_sCOND (GE, operands[0]);
11171 ;; A > 0 is best done using the portable sequence, so fail in that case.
11172 (define_expand "sgt"
11173 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11177 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11180 rs6000_emit_sCOND (GT, operands[0]);
11184 ;; A <= 0 is best done the portable way for A an integer.
11185 (define_expand "sle"
11186 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11190 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11193 rs6000_emit_sCOND (LE, operands[0]);
11197 ;; A < 0 is best done in the portable way for A an integer.
11198 (define_expand "slt"
11199 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11203 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11206 rs6000_emit_sCOND (LT, operands[0]);
11210 (define_expand "sgeu"
11211 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11213 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11215 (define_expand "sgtu"
11216 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11218 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11220 (define_expand "sleu"
11221 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11223 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11225 (define_expand "sltu"
11226 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11228 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11230 (define_expand "sunordered"
11231 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11232 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11233 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11235 (define_expand "sordered"
11236 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11237 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11238 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11240 (define_expand "suneq"
11241 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11243 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11245 (define_expand "sunge"
11246 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11248 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11250 (define_expand "sungt"
11251 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11253 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11255 (define_expand "sunle"
11256 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11258 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11260 (define_expand "sunlt"
11261 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11263 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11265 (define_expand "sltgt"
11266 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11268 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11271 ;; Here are the actual compare insns.
11272 (define_insn "*cmpsi_internal1"
11273 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11274 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11275 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11277 "{cmp%I2|cmpw%I2} %0,%1,%2"
11278 [(set_attr "type" "cmp")])
11280 (define_insn "*cmpdi_internal1"
11281 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11282 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11283 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11286 [(set_attr "type" "cmp")])
11288 ;; If we are comparing a register for equality with a large constant,
11289 ;; we can do this with an XOR followed by a compare. But we need a scratch
11290 ;; register for the result of the XOR.
11293 [(set (match_operand:CC 0 "cc_reg_operand" "")
11294 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11295 (match_operand:SI 2 "non_short_cint_operand" "")))
11296 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11297 "find_single_use (operands[0], insn, 0)
11298 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11299 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11300 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11301 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11304 /* Get the constant we are comparing against, C, and see what it looks like
11305 sign-extended to 16 bits. Then see what constant could be XOR'ed
11306 with C to get the sign-extended value. */
11308 HOST_WIDE_INT c = INTVAL (operands[2]);
11309 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11310 HOST_WIDE_INT xorv = c ^ sextc;
11312 operands[4] = GEN_INT (xorv);
11313 operands[5] = GEN_INT (sextc);
11316 (define_insn "*cmpsi_internal2"
11317 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11318 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11319 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11321 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11322 [(set_attr "type" "cmp")])
11324 (define_insn "*cmpdi_internal2"
11325 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11326 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11327 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11329 "cmpld%I2 %0,%1,%b2"
11330 [(set_attr "type" "cmp")])
11332 ;; The following two insns don't exist as single insns, but if we provide
11333 ;; them, we can swap an add and compare, which will enable us to overlap more
11334 ;; of the required delay between a compare and branch. We generate code for
11335 ;; them by splitting.
11338 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11339 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11340 (match_operand:SI 2 "short_cint_operand" "i")))
11341 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11342 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11345 [(set_attr "length" "8")])
11348 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11349 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11350 (match_operand:SI 2 "u_short_cint_operand" "i")))
11351 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11352 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11355 [(set_attr "length" "8")])
11358 [(set (match_operand:CC 3 "cc_reg_operand" "")
11359 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11360 (match_operand:SI 2 "short_cint_operand" "")))
11361 (set (match_operand:SI 0 "gpc_reg_operand" "")
11362 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11364 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11365 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11368 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11369 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11370 (match_operand:SI 2 "u_short_cint_operand" "")))
11371 (set (match_operand:SI 0 "gpc_reg_operand" "")
11372 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11374 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11375 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11377 (define_insn "*cmpsf_internal1"
11378 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11379 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11380 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11381 "TARGET_HARD_FLOAT && TARGET_FPRS"
11383 [(set_attr "type" "fpcompare")])
11385 (define_insn "*cmpdf_internal1"
11386 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11387 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11388 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11389 "TARGET_HARD_FLOAT && TARGET_FPRS"
11391 [(set_attr "type" "fpcompare")])
11393 ;; Only need to compare second words if first words equal
11394 (define_insn "*cmptf_internal1"
11395 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11396 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11397 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11398 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
11399 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11400 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11401 [(set_attr "type" "fpcompare")
11402 (set_attr "length" "12")])
11404 (define_insn_and_split "*cmptf_internal2"
11405 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11406 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11407 (match_operand:TF 2 "gpc_reg_operand" "f")))
11408 (clobber (match_scratch:DF 3 "=f"))
11409 (clobber (match_scratch:DF 4 "=f"))
11410 (clobber (match_scratch:DF 5 "=f"))
11411 (clobber (match_scratch:DF 6 "=f"))
11412 (clobber (match_scratch:DF 7 "=f"))
11413 (clobber (match_scratch:DF 8 "=f"))
11414 (clobber (match_scratch:DF 9 "=f"))
11415 (clobber (match_scratch:DF 10 "=f"))]
11416 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
11417 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11419 "&& reload_completed"
11420 [(set (match_dup 3) (match_dup 13))
11421 (set (match_dup 4) (match_dup 14))
11422 (set (match_dup 9) (abs:DF (match_dup 5)))
11423 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11424 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11425 (label_ref (match_dup 11))
11427 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11428 (set (pc) (label_ref (match_dup 12)))
11430 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11431 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11432 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11433 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11436 REAL_VALUE_TYPE rv;
11437 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11438 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11440 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11441 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11442 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11443 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11444 operands[11] = gen_label_rtx ();
11445 operands[12] = gen_label_rtx ();
11447 operands[13] = force_const_mem (DFmode,
11448 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11449 operands[14] = force_const_mem (DFmode,
11450 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11454 operands[13] = gen_const_mem (DFmode,
11455 create_TOC_reference (XEXP (operands[13], 0)));
11456 operands[14] = gen_const_mem (DFmode,
11457 create_TOC_reference (XEXP (operands[14], 0)));
11458 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11459 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11463 ;; Now we have the scc insns. We can do some combinations because of the
11464 ;; way the machine works.
11466 ;; Note that this is probably faster if we can put an insn between the
11467 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11468 ;; cases the insns below which don't use an intermediate CR field will
11469 ;; be used instead.
11471 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11472 (match_operator:SI 1 "scc_comparison_operator"
11473 [(match_operand 2 "cc_reg_operand" "y")
11476 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11477 [(set (attr "type")
11478 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11479 (const_string "mfcrf")
11481 (const_string "mfcr")))
11482 (set_attr "length" "8")])
11484 ;; Same as above, but get the GT bit.
11485 (define_insn "move_from_CR_gt_bit"
11486 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11487 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11489 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11490 [(set_attr "type" "mfcr")
11491 (set_attr "length" "8")])
11493 ;; Same as above, but get the OV/ORDERED bit.
11494 (define_insn "move_from_CR_ov_bit"
11495 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11496 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11498 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11499 [(set_attr "type" "mfcr")
11500 (set_attr "length" "8")])
11503 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11504 (match_operator:DI 1 "scc_comparison_operator"
11505 [(match_operand 2 "cc_reg_operand" "y")
11508 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11509 [(set (attr "type")
11510 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11511 (const_string "mfcrf")
11513 (const_string "mfcr")))
11514 (set_attr "length" "8")])
11517 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11518 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11519 [(match_operand 2 "cc_reg_operand" "y,y")
11522 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11523 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11526 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11528 [(set_attr "type" "delayed_compare")
11529 (set_attr "length" "8,16")])
11532 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11533 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11534 [(match_operand 2 "cc_reg_operand" "")
11537 (set (match_operand:SI 3 "gpc_reg_operand" "")
11538 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11539 "TARGET_32BIT && reload_completed"
11540 [(set (match_dup 3)
11541 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11543 (compare:CC (match_dup 3)
11548 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11549 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11550 [(match_operand 2 "cc_reg_operand" "y")
11552 (match_operand:SI 3 "const_int_operand" "n")))]
11556 int is_bit = ccr_bit (operands[1], 1);
11557 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11560 if (is_bit >= put_bit)
11561 count = is_bit - put_bit;
11563 count = 32 - (put_bit - is_bit);
11565 operands[4] = GEN_INT (count);
11566 operands[5] = GEN_INT (put_bit);
11568 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11570 [(set (attr "type")
11571 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11572 (const_string "mfcrf")
11574 (const_string "mfcr")))
11575 (set_attr "length" "8")])
11578 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11580 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11581 [(match_operand 2 "cc_reg_operand" "y,y")
11583 (match_operand:SI 3 "const_int_operand" "n,n"))
11585 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11586 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11591 int is_bit = ccr_bit (operands[1], 1);
11592 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11595 /* Force split for non-cc0 compare. */
11596 if (which_alternative == 1)
11599 if (is_bit >= put_bit)
11600 count = is_bit - put_bit;
11602 count = 32 - (put_bit - is_bit);
11604 operands[5] = GEN_INT (count);
11605 operands[6] = GEN_INT (put_bit);
11607 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11609 [(set_attr "type" "delayed_compare")
11610 (set_attr "length" "8,16")])
11613 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11615 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11616 [(match_operand 2 "cc_reg_operand" "")
11618 (match_operand:SI 3 "const_int_operand" ""))
11620 (set (match_operand:SI 4 "gpc_reg_operand" "")
11621 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11624 [(set (match_dup 4)
11625 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11628 (compare:CC (match_dup 4)
11632 ;; There is a 3 cycle delay between consecutive mfcr instructions
11633 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11636 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11637 (match_operator:SI 1 "scc_comparison_operator"
11638 [(match_operand 2 "cc_reg_operand" "y")
11640 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11641 (match_operator:SI 4 "scc_comparison_operator"
11642 [(match_operand 5 "cc_reg_operand" "y")
11644 "REGNO (operands[2]) != REGNO (operands[5])"
11645 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11646 [(set_attr "type" "mfcr")
11647 (set_attr "length" "12")])
11650 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11651 (match_operator:DI 1 "scc_comparison_operator"
11652 [(match_operand 2 "cc_reg_operand" "y")
11654 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11655 (match_operator:DI 4 "scc_comparison_operator"
11656 [(match_operand 5 "cc_reg_operand" "y")
11658 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11659 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11660 [(set_attr "type" "mfcr")
11661 (set_attr "length" "12")])
11663 ;; There are some scc insns that can be done directly, without a compare.
11664 ;; These are faster because they don't involve the communications between
11665 ;; the FXU and branch units. In fact, we will be replacing all of the
11666 ;; integer scc insns here or in the portable methods in emit_store_flag.
11668 ;; Also support (neg (scc ..)) since that construct is used to replace
11669 ;; branches, (plus (scc ..) ..) since that construct is common and
11670 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11671 ;; cases where it is no more expensive than (neg (scc ..)).
11673 ;; Have reload force a constant into a register for the simple insns that
11674 ;; otherwise won't accept constants. We do this because it is faster than
11675 ;; the cmp/mfcr sequence we would otherwise generate.
11678 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11679 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11680 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11681 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11684 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11685 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11686 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11687 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11688 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11689 [(set_attr "type" "three,two,three,three,three")
11690 (set_attr "length" "12,8,12,12,12")])
11693 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11694 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11695 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11696 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11699 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11700 subfic %3,%1,0\;adde %0,%3,%1
11701 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11702 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11703 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11704 [(set_attr "type" "three,two,three,three,three")
11705 (set_attr "length" "12,8,12,12,12")])
11708 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11710 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11711 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11713 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11714 (eq:SI (match_dup 1) (match_dup 2)))
11715 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11718 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11719 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11720 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11721 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11722 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11728 [(set_attr "type" "compare")
11729 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11732 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11734 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11735 (match_operand:SI 2 "reg_or_cint_operand" ""))
11737 (set (match_operand:SI 0 "gpc_reg_operand" "")
11738 (eq:SI (match_dup 1) (match_dup 2)))
11739 (clobber (match_scratch:SI 3 ""))]
11740 "TARGET_32BIT && reload_completed"
11741 [(parallel [(set (match_dup 0)
11742 (eq:SI (match_dup 1) (match_dup 2)))
11743 (clobber (match_dup 3))])
11745 (compare:CC (match_dup 0)
11750 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11752 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11753 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11755 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11756 (eq:DI (match_dup 1) (match_dup 2)))
11757 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11760 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11761 subfic %3,%1,0\;adde. %0,%3,%1
11762 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11763 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11764 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11770 [(set_attr "type" "compare")
11771 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11774 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11776 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11777 (match_operand:DI 2 "reg_or_cint_operand" ""))
11779 (set (match_operand:DI 0 "gpc_reg_operand" "")
11780 (eq:DI (match_dup 1) (match_dup 2)))
11781 (clobber (match_scratch:DI 3 ""))]
11782 "TARGET_64BIT && reload_completed"
11783 [(parallel [(set (match_dup 0)
11784 (eq:DI (match_dup 1) (match_dup 2)))
11785 (clobber (match_dup 3))])
11787 (compare:CC (match_dup 0)
11791 ;; We have insns of the form shown by the first define_insn below. If
11792 ;; there is something inside the comparison operation, we must split it.
11794 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11795 (plus:SI (match_operator 1 "comparison_operator"
11796 [(match_operand:SI 2 "" "")
11797 (match_operand:SI 3
11798 "reg_or_cint_operand" "")])
11799 (match_operand:SI 4 "gpc_reg_operand" "")))
11800 (clobber (match_operand:SI 5 "register_operand" ""))]
11801 "! gpc_reg_operand (operands[2], SImode)"
11802 [(set (match_dup 5) (match_dup 2))
11803 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11807 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11808 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11809 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11810 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11813 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11814 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11815 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11816 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11817 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11818 [(set_attr "type" "three,two,three,three,three")
11819 (set_attr "length" "12,8,12,12,12")])
11822 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11825 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11826 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11827 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11829 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11832 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11833 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11834 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11835 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11836 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11842 [(set_attr "type" "compare")
11843 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11846 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11849 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11850 (match_operand:SI 2 "reg_or_cint_operand" ""))
11851 (match_operand:SI 3 "gpc_reg_operand" ""))
11853 (clobber (match_scratch:SI 4 ""))]
11854 "TARGET_32BIT && reload_completed"
11855 [(set (match_dup 4)
11856 (plus:SI (eq:SI (match_dup 1)
11860 (compare:CC (match_dup 4)
11865 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11868 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11869 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11870 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11872 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11873 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11876 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11877 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11878 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11879 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11880 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11886 [(set_attr "type" "compare")
11887 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11890 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11893 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11894 (match_operand:SI 2 "reg_or_cint_operand" ""))
11895 (match_operand:SI 3 "gpc_reg_operand" ""))
11897 (set (match_operand:SI 0 "gpc_reg_operand" "")
11898 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11899 "TARGET_32BIT && reload_completed"
11900 [(set (match_dup 0)
11901 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11903 (compare:CC (match_dup 0)
11908 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11909 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11910 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11913 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11914 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11915 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11916 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11917 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11918 [(set_attr "type" "three,two,three,three,three")
11919 (set_attr "length" "12,8,12,12,12")])
11921 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11922 ;; since it nabs/sr is just as fast.
11923 (define_insn "*ne0"
11924 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11925 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11927 (clobber (match_scratch:SI 2 "=&r"))]
11928 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11929 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11930 [(set_attr "type" "two")
11931 (set_attr "length" "8")])
11934 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11935 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11937 (clobber (match_scratch:DI 2 "=&r"))]
11939 "addic %2,%1,-1\;subfe %0,%2,%1"
11940 [(set_attr "type" "two")
11941 (set_attr "length" "8")])
11943 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11946 (plus:SI (lshiftrt:SI
11947 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11949 (match_operand:SI 2 "gpc_reg_operand" "r")))
11950 (clobber (match_scratch:SI 3 "=&r"))]
11952 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11953 [(set_attr "type" "two")
11954 (set_attr "length" "8")])
11957 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11958 (plus:DI (lshiftrt:DI
11959 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11961 (match_operand:DI 2 "gpc_reg_operand" "r")))
11962 (clobber (match_scratch:DI 3 "=&r"))]
11964 "addic %3,%1,-1\;addze %0,%2"
11965 [(set_attr "type" "two")
11966 (set_attr "length" "8")])
11969 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11971 (plus:SI (lshiftrt:SI
11972 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11974 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11976 (clobber (match_scratch:SI 3 "=&r,&r"))
11977 (clobber (match_scratch:SI 4 "=X,&r"))]
11980 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11982 [(set_attr "type" "compare")
11983 (set_attr "length" "8,12")])
11986 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11988 (plus:SI (lshiftrt:SI
11989 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11991 (match_operand:SI 2 "gpc_reg_operand" ""))
11993 (clobber (match_scratch:SI 3 ""))
11994 (clobber (match_scratch:SI 4 ""))]
11995 "TARGET_32BIT && reload_completed"
11996 [(parallel [(set (match_dup 3)
11997 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12000 (clobber (match_dup 4))])
12002 (compare:CC (match_dup 3)
12007 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12009 (plus:DI (lshiftrt:DI
12010 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12012 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12014 (clobber (match_scratch:DI 3 "=&r,&r"))]
12017 addic %3,%1,-1\;addze. %3,%2
12019 [(set_attr "type" "compare")
12020 (set_attr "length" "8,12")])
12023 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12025 (plus:DI (lshiftrt:DI
12026 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12028 (match_operand:DI 2 "gpc_reg_operand" ""))
12030 (clobber (match_scratch:DI 3 ""))]
12031 "TARGET_64BIT && reload_completed"
12032 [(set (match_dup 3)
12033 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12037 (compare:CC (match_dup 3)
12042 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12044 (plus:SI (lshiftrt:SI
12045 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12047 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12049 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12050 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12052 (clobber (match_scratch:SI 3 "=&r,&r"))]
12055 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12057 [(set_attr "type" "compare")
12058 (set_attr "length" "8,12")])
12061 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12063 (plus:SI (lshiftrt:SI
12064 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12066 (match_operand:SI 2 "gpc_reg_operand" ""))
12068 (set (match_operand:SI 0 "gpc_reg_operand" "")
12069 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12071 (clobber (match_scratch:SI 3 ""))]
12072 "TARGET_32BIT && reload_completed"
12073 [(parallel [(set (match_dup 0)
12074 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12076 (clobber (match_dup 3))])
12078 (compare:CC (match_dup 0)
12083 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12085 (plus:DI (lshiftrt:DI
12086 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12088 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12090 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12091 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12093 (clobber (match_scratch:DI 3 "=&r,&r"))]
12096 addic %3,%1,-1\;addze. %0,%2
12098 [(set_attr "type" "compare")
12099 (set_attr "length" "8,12")])
12102 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12104 (plus:DI (lshiftrt:DI
12105 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12107 (match_operand:DI 2 "gpc_reg_operand" ""))
12109 (set (match_operand:DI 0 "gpc_reg_operand" "")
12110 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12112 (clobber (match_scratch:DI 3 ""))]
12113 "TARGET_64BIT && reload_completed"
12114 [(parallel [(set (match_dup 0)
12115 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12117 (clobber (match_dup 3))])
12119 (compare:CC (match_dup 0)
12124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12125 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12126 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12127 (clobber (match_scratch:SI 3 "=r,X"))]
12130 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12131 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12132 [(set_attr "length" "12")])
12135 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12137 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12138 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12140 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12141 (le:SI (match_dup 1) (match_dup 2)))
12142 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12145 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12146 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12149 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12150 (set_attr "length" "12,12,16,16")])
12153 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12155 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12156 (match_operand:SI 2 "reg_or_short_operand" ""))
12158 (set (match_operand:SI 0 "gpc_reg_operand" "")
12159 (le:SI (match_dup 1) (match_dup 2)))
12160 (clobber (match_scratch:SI 3 ""))]
12161 "TARGET_POWER && reload_completed"
12162 [(parallel [(set (match_dup 0)
12163 (le:SI (match_dup 1) (match_dup 2)))
12164 (clobber (match_dup 3))])
12166 (compare:CC (match_dup 0)
12171 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12172 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12173 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12174 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12177 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12178 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12179 [(set_attr "length" "12")])
12182 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12184 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12185 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12186 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12188 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12191 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12192 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12195 [(set_attr "type" "compare")
12196 (set_attr "length" "12,12,16,16")])
12199 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12201 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12202 (match_operand:SI 2 "reg_or_short_operand" ""))
12203 (match_operand:SI 3 "gpc_reg_operand" ""))
12205 (clobber (match_scratch:SI 4 ""))]
12206 "TARGET_POWER && reload_completed"
12207 [(set (match_dup 4)
12208 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12211 (compare:CC (match_dup 4)
12216 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12218 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12219 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12220 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12222 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12223 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12226 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12227 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12230 [(set_attr "type" "compare")
12231 (set_attr "length" "12,12,16,16")])
12234 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12236 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12237 (match_operand:SI 2 "reg_or_short_operand" ""))
12238 (match_operand:SI 3 "gpc_reg_operand" ""))
12240 (set (match_operand:SI 0 "gpc_reg_operand" "")
12241 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12242 "TARGET_POWER && reload_completed"
12243 [(set (match_dup 0)
12244 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12246 (compare:CC (match_dup 0)
12251 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12252 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12253 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12256 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12257 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12258 [(set_attr "length" "12")])
12261 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12262 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12263 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12265 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12266 [(set_attr "type" "three")
12267 (set_attr "length" "12")])
12270 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12271 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12272 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12274 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12275 [(set_attr "type" "three")
12276 (set_attr "length" "12")])
12279 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12281 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12282 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12284 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12285 (leu:DI (match_dup 1) (match_dup 2)))]
12288 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12290 [(set_attr "type" "compare")
12291 (set_attr "length" "12,16")])
12294 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12296 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12297 (match_operand:DI 2 "reg_or_short_operand" ""))
12299 (set (match_operand:DI 0 "gpc_reg_operand" "")
12300 (leu:DI (match_dup 1) (match_dup 2)))]
12301 "TARGET_64BIT && reload_completed"
12302 [(set (match_dup 0)
12303 (leu:DI (match_dup 1) (match_dup 2)))
12305 (compare:CC (match_dup 0)
12310 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12312 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12313 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12315 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12316 (leu:SI (match_dup 1) (match_dup 2)))]
12319 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12321 [(set_attr "type" "compare")
12322 (set_attr "length" "12,16")])
12325 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12327 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12328 (match_operand:SI 2 "reg_or_short_operand" ""))
12330 (set (match_operand:SI 0 "gpc_reg_operand" "")
12331 (leu:SI (match_dup 1) (match_dup 2)))]
12332 "TARGET_32BIT && reload_completed"
12333 [(set (match_dup 0)
12334 (leu:SI (match_dup 1) (match_dup 2)))
12336 (compare:CC (match_dup 0)
12341 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12342 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12343 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12344 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12346 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12347 [(set_attr "type" "two")
12348 (set_attr "length" "8")])
12351 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12353 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12354 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12355 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12357 (clobber (match_scratch:SI 4 "=&r,&r"))]
12360 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12362 [(set_attr "type" "compare")
12363 (set_attr "length" "8,12")])
12366 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12368 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12369 (match_operand:SI 2 "reg_or_short_operand" ""))
12370 (match_operand:SI 3 "gpc_reg_operand" ""))
12372 (clobber (match_scratch:SI 4 ""))]
12373 "TARGET_32BIT && reload_completed"
12374 [(set (match_dup 4)
12375 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12378 (compare:CC (match_dup 4)
12383 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12385 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12386 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12387 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12389 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12390 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12393 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12395 [(set_attr "type" "compare")
12396 (set_attr "length" "8,12")])
12399 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12401 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12402 (match_operand:SI 2 "reg_or_short_operand" ""))
12403 (match_operand:SI 3 "gpc_reg_operand" ""))
12405 (set (match_operand:SI 0 "gpc_reg_operand" "")
12406 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12407 "TARGET_32BIT && reload_completed"
12408 [(set (match_dup 0)
12409 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12411 (compare:CC (match_dup 0)
12416 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12417 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12418 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12420 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12421 [(set_attr "type" "three")
12422 (set_attr "length" "12")])
12425 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12427 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12428 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12429 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12431 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12432 [(set_attr "type" "three")
12433 (set_attr "length" "12")])
12436 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12439 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12440 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12441 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12443 (clobber (match_scratch:SI 4 "=&r,&r"))]
12446 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12448 [(set_attr "type" "compare")
12449 (set_attr "length" "12,16")])
12452 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12455 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12456 (match_operand:SI 2 "reg_or_short_operand" "")))
12457 (match_operand:SI 3 "gpc_reg_operand" ""))
12459 (clobber (match_scratch:SI 4 ""))]
12460 "TARGET_32BIT && reload_completed"
12461 [(set (match_dup 4)
12462 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12465 (compare:CC (match_dup 4)
12470 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12473 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12474 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12475 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12477 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12478 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12481 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12483 [(set_attr "type" "compare")
12484 (set_attr "length" "12,16")])
12487 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12490 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12491 (match_operand:SI 2 "reg_or_short_operand" "")))
12492 (match_operand:SI 3 "gpc_reg_operand" ""))
12494 (set (match_operand:SI 0 "gpc_reg_operand" "")
12495 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12496 "TARGET_32BIT && reload_completed"
12497 [(set (match_dup 0)
12498 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12501 (compare:CC (match_dup 0)
12506 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12507 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12508 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12510 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12511 [(set_attr "length" "12")])
12514 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12516 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12517 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12519 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12520 (lt:SI (match_dup 1) (match_dup 2)))]
12523 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12525 [(set_attr "type" "delayed_compare")
12526 (set_attr "length" "12,16")])
12529 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12531 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12532 (match_operand:SI 2 "reg_or_short_operand" ""))
12534 (set (match_operand:SI 0 "gpc_reg_operand" "")
12535 (lt:SI (match_dup 1) (match_dup 2)))]
12536 "TARGET_POWER && reload_completed"
12537 [(set (match_dup 0)
12538 (lt:SI (match_dup 1) (match_dup 2)))
12540 (compare:CC (match_dup 0)
12545 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12546 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12547 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12548 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12550 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12551 [(set_attr "length" "12")])
12554 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12556 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12557 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12558 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12560 (clobber (match_scratch:SI 4 "=&r,&r"))]
12563 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12565 [(set_attr "type" "compare")
12566 (set_attr "length" "12,16")])
12569 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12571 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12572 (match_operand:SI 2 "reg_or_short_operand" ""))
12573 (match_operand:SI 3 "gpc_reg_operand" ""))
12575 (clobber (match_scratch:SI 4 ""))]
12576 "TARGET_POWER && reload_completed"
12577 [(set (match_dup 4)
12578 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12581 (compare:CC (match_dup 4)
12586 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12588 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12589 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12590 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12592 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12593 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12596 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12598 [(set_attr "type" "compare")
12599 (set_attr "length" "12,16")])
12602 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12604 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12605 (match_operand:SI 2 "reg_or_short_operand" ""))
12606 (match_operand:SI 3 "gpc_reg_operand" ""))
12608 (set (match_operand:SI 0 "gpc_reg_operand" "")
12609 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12610 "TARGET_POWER && reload_completed"
12611 [(set (match_dup 0)
12612 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12614 (compare:CC (match_dup 0)
12619 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12620 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12621 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12623 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12624 [(set_attr "length" "12")])
12626 (define_insn_and_split ""
12627 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12628 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12629 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12633 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12634 (set (match_dup 0) (neg:SI (match_dup 0)))]
12637 (define_insn_and_split ""
12638 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12639 (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12640 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12644 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12645 (set (match_dup 0) (neg:DI (match_dup 0)))]
12649 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12651 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12652 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12654 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12655 (ltu:SI (match_dup 1) (match_dup 2)))]
12658 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12659 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12662 [(set_attr "type" "compare")
12663 (set_attr "length" "12,12,16,16")])
12666 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12668 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12669 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12671 (set (match_operand:SI 0 "gpc_reg_operand" "")
12672 (ltu:SI (match_dup 1) (match_dup 2)))]
12673 "TARGET_32BIT && reload_completed"
12674 [(set (match_dup 0)
12675 (ltu:SI (match_dup 1) (match_dup 2)))
12677 (compare:CC (match_dup 0)
12681 (define_insn_and_split ""
12682 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
12683 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12684 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12685 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12688 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12689 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12690 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
12693 (define_insn_and_split ""
12694 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
12695 (plus:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12696 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))
12697 (match_operand:DI 3 "reg_or_short_operand" "rI,rI")))]
12700 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12701 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12702 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
12706 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12708 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12709 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12710 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12712 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12715 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12716 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12719 [(set_attr "type" "compare")
12720 (set_attr "length" "12,12,16,16")])
12723 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12725 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12726 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12727 (match_operand:SI 3 "gpc_reg_operand" ""))
12729 (clobber (match_scratch:SI 4 ""))]
12730 "TARGET_32BIT && reload_completed"
12731 [(set (match_dup 4)
12732 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12735 (compare:CC (match_dup 4)
12740 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12742 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12743 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12744 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12746 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12747 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12750 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12751 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12754 [(set_attr "type" "compare")
12755 (set_attr "length" "12,12,16,16")])
12758 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12760 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12761 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12762 (match_operand:SI 3 "gpc_reg_operand" ""))
12764 (set (match_operand:SI 0 "gpc_reg_operand" "")
12765 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12766 "TARGET_32BIT && reload_completed"
12767 [(set (match_dup 0)
12768 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12770 (compare:CC (match_dup 0)
12775 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12776 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12777 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12780 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12781 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12782 [(set_attr "type" "two")
12783 (set_attr "length" "8")])
12786 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12787 (neg:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12788 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))))]
12791 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12792 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12793 [(set_attr "type" "two")
12794 (set_attr "length" "8")])
12797 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12798 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12799 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12800 (clobber (match_scratch:SI 3 "=r"))]
12802 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12803 [(set_attr "length" "12")])
12806 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12808 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12809 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12811 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12812 (ge:SI (match_dup 1) (match_dup 2)))
12813 (clobber (match_scratch:SI 3 "=r,r"))]
12816 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12818 [(set_attr "type" "compare")
12819 (set_attr "length" "12,16")])
12822 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12824 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12825 (match_operand:SI 2 "reg_or_short_operand" ""))
12827 (set (match_operand:SI 0 "gpc_reg_operand" "")
12828 (ge:SI (match_dup 1) (match_dup 2)))
12829 (clobber (match_scratch:SI 3 ""))]
12830 "TARGET_POWER && reload_completed"
12831 [(parallel [(set (match_dup 0)
12832 (ge:SI (match_dup 1) (match_dup 2)))
12833 (clobber (match_dup 3))])
12835 (compare:CC (match_dup 0)
12840 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12841 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12842 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12843 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12845 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12846 [(set_attr "length" "12")])
12849 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12851 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12852 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12853 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12855 (clobber (match_scratch:SI 4 "=&r,&r"))]
12858 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12860 [(set_attr "type" "compare")
12861 (set_attr "length" "12,16")])
12864 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12866 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12867 (match_operand:SI 2 "reg_or_short_operand" ""))
12868 (match_operand:SI 3 "gpc_reg_operand" ""))
12870 (clobber (match_scratch:SI 4 ""))]
12871 "TARGET_POWER && reload_completed"
12872 [(set (match_dup 4)
12873 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12876 (compare:CC (match_dup 4)
12881 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12883 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12884 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12885 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12887 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12888 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12891 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12893 [(set_attr "type" "compare")
12894 (set_attr "length" "12,16")])
12897 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12899 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12900 (match_operand:SI 2 "reg_or_short_operand" ""))
12901 (match_operand:SI 3 "gpc_reg_operand" ""))
12903 (set (match_operand:SI 0 "gpc_reg_operand" "")
12904 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12905 "TARGET_POWER && reload_completed"
12906 [(set (match_dup 0)
12907 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12909 (compare:CC (match_dup 0)
12914 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12915 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12916 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12918 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12919 [(set_attr "length" "12")])
12922 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12923 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12924 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12927 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12928 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12929 [(set_attr "type" "three")
12930 (set_attr "length" "12")])
12933 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12934 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12935 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12938 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12939 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12940 [(set_attr "type" "three")
12941 (set_attr "length" "12")])
12944 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12946 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12947 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12949 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12950 (geu:SI (match_dup 1) (match_dup 2)))]
12953 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12954 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12957 [(set_attr "type" "compare")
12958 (set_attr "length" "12,12,16,16")])
12961 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12963 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12964 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12966 (set (match_operand:SI 0 "gpc_reg_operand" "")
12967 (geu:SI (match_dup 1) (match_dup 2)))]
12968 "TARGET_32BIT && reload_completed"
12969 [(set (match_dup 0)
12970 (geu:SI (match_dup 1) (match_dup 2)))
12972 (compare:CC (match_dup 0)
12977 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12979 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12980 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12982 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12983 (geu:DI (match_dup 1) (match_dup 2)))]
12986 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12987 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12990 [(set_attr "type" "compare")
12991 (set_attr "length" "12,12,16,16")])
12994 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12996 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12997 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12999 (set (match_operand:DI 0 "gpc_reg_operand" "")
13000 (geu:DI (match_dup 1) (match_dup 2)))]
13001 "TARGET_64BIT && reload_completed"
13002 [(set (match_dup 0)
13003 (geu:DI (match_dup 1) (match_dup 2)))
13005 (compare:CC (match_dup 0)
13010 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13011 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13012 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
13013 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13016 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13017 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13018 [(set_attr "type" "two")
13019 (set_attr "length" "8")])
13022 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13024 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13025 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13026 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13028 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13031 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13032 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13035 [(set_attr "type" "compare")
13036 (set_attr "length" "8,8,12,12")])
13039 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13041 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13042 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13043 (match_operand:SI 3 "gpc_reg_operand" ""))
13045 (clobber (match_scratch:SI 4 ""))]
13046 "TARGET_32BIT && reload_completed"
13047 [(set (match_dup 4)
13048 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13051 (compare:CC (match_dup 4)
13056 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13058 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13059 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13060 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13062 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13063 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13066 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13067 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13070 [(set_attr "type" "compare")
13071 (set_attr "length" "8,8,12,12")])
13074 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13076 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13077 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13078 (match_operand:SI 3 "gpc_reg_operand" ""))
13080 (set (match_operand:SI 0 "gpc_reg_operand" "")
13081 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13082 "TARGET_32BIT && reload_completed"
13083 [(set (match_dup 0)
13084 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13086 (compare:CC (match_dup 0)
13091 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13092 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13093 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
13096 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13097 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13098 [(set_attr "type" "three")
13099 (set_attr "length" "12")])
13102 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13104 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13105 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
13106 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13109 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13110 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13111 [(set_attr "type" "three")
13112 (set_attr "length" "12")])
13115 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13118 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13119 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13120 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13122 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13125 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13126 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13129 [(set_attr "type" "compare")
13130 (set_attr "length" "12,12,16,16")])
13133 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13136 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13137 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13138 (match_operand:SI 3 "gpc_reg_operand" ""))
13140 (clobber (match_scratch:SI 4 ""))]
13141 "TARGET_32BIT && reload_completed"
13142 [(set (match_dup 4)
13143 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13146 (compare:CC (match_dup 4)
13151 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13154 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13155 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13156 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13158 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13159 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13162 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13163 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13166 [(set_attr "type" "compare")
13167 (set_attr "length" "12,12,16,16")])
13170 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13173 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13174 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13175 (match_operand:SI 3 "gpc_reg_operand" ""))
13177 (set (match_operand:SI 0 "gpc_reg_operand" "")
13178 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13179 "TARGET_32BIT && reload_completed"
13180 [(set (match_dup 0)
13181 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13183 (compare:CC (match_dup 0)
13188 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13189 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13192 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
13193 [(set_attr "type" "three")
13194 (set_attr "length" "12")])
13197 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13198 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13201 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
13202 [(set_attr "type" "three")
13203 (set_attr "length" "12")])
13206 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13208 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13211 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13212 (gt:SI (match_dup 1) (const_int 0)))]
13215 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
13217 [(set_attr "type" "delayed_compare")
13218 (set_attr "length" "12,16")])
13221 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13223 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13226 (set (match_operand:SI 0 "gpc_reg_operand" "")
13227 (gt:SI (match_dup 1) (const_int 0)))]
13228 "TARGET_32BIT && reload_completed"
13229 [(set (match_dup 0)
13230 (gt:SI (match_dup 1) (const_int 0)))
13232 (compare:CC (match_dup 0)
13237 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13239 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13242 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13243 (gt:DI (match_dup 1) (const_int 0)))]
13246 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
13248 [(set_attr "type" "delayed_compare")
13249 (set_attr "length" "12,16")])
13252 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13254 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13257 (set (match_operand:DI 0 "gpc_reg_operand" "")
13258 (gt:DI (match_dup 1) (const_int 0)))]
13259 "TARGET_64BIT && reload_completed"
13260 [(set (match_dup 0)
13261 (gt:DI (match_dup 1) (const_int 0)))
13263 (compare:CC (match_dup 0)
13268 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13269 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13270 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13272 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13273 [(set_attr "length" "12")])
13276 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13278 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13279 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13281 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13282 (gt:SI (match_dup 1) (match_dup 2)))]
13285 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13287 [(set_attr "type" "delayed_compare")
13288 (set_attr "length" "12,16")])
13291 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13293 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13294 (match_operand:SI 2 "reg_or_short_operand" ""))
13296 (set (match_operand:SI 0 "gpc_reg_operand" "")
13297 (gt:SI (match_dup 1) (match_dup 2)))]
13298 "TARGET_POWER && reload_completed"
13299 [(set (match_dup 0)
13300 (gt:SI (match_dup 1) (match_dup 2)))
13302 (compare:CC (match_dup 0)
13307 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13308 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13310 (match_operand:SI 2 "gpc_reg_operand" "r")))]
13312 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13313 [(set_attr "type" "three")
13314 (set_attr "length" "12")])
13317 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13318 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13320 (match_operand:DI 2 "gpc_reg_operand" "r")))]
13322 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13323 [(set_attr "type" "three")
13324 (set_attr "length" "12")])
13327 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13329 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13331 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13333 (clobber (match_scratch:SI 3 "=&r,&r"))]
13336 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13338 [(set_attr "type" "compare")
13339 (set_attr "length" "12,16")])
13342 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13344 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13346 (match_operand:SI 2 "gpc_reg_operand" ""))
13348 (clobber (match_scratch:SI 3 ""))]
13349 "TARGET_32BIT && reload_completed"
13350 [(set (match_dup 3)
13351 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13354 (compare:CC (match_dup 3)
13359 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13361 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13363 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13365 (clobber (match_scratch:DI 3 "=&r,&r"))]
13368 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13370 [(set_attr "type" "compare")
13371 (set_attr "length" "12,16")])
13374 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13376 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13378 (match_operand:DI 2 "gpc_reg_operand" ""))
13380 (clobber (match_scratch:DI 3 ""))]
13381 "TARGET_64BIT && reload_completed"
13382 [(set (match_dup 3)
13383 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13386 (compare:CC (match_dup 3)
13391 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13393 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13395 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13397 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13398 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13401 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13403 [(set_attr "type" "compare")
13404 (set_attr "length" "12,16")])
13407 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13409 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13411 (match_operand:SI 2 "gpc_reg_operand" ""))
13413 (set (match_operand:SI 0 "gpc_reg_operand" "")
13414 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13415 "TARGET_32BIT && reload_completed"
13416 [(set (match_dup 0)
13417 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13419 (compare:CC (match_dup 0)
13424 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13426 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13428 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13430 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13431 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13434 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13436 [(set_attr "type" "compare")
13437 (set_attr "length" "12,16")])
13440 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13442 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13444 (match_operand:DI 2 "gpc_reg_operand" ""))
13446 (set (match_operand:DI 0 "gpc_reg_operand" "")
13447 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13448 "TARGET_64BIT && reload_completed"
13449 [(set (match_dup 0)
13450 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13452 (compare:CC (match_dup 0)
13457 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13458 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13459 (match_operand:SI 2 "reg_or_short_operand" "r"))
13460 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13462 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13463 [(set_attr "length" "12")])
13466 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13468 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13469 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13470 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13472 (clobber (match_scratch:SI 4 "=&r,&r"))]
13475 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13477 [(set_attr "type" "compare")
13478 (set_attr "length" "12,16")])
13481 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13483 (plus:SI (gt: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 (clobber (match_scratch:SI 4 ""))]
13488 "TARGET_POWER && reload_completed"
13489 [(set (match_dup 4)
13490 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13492 (compare:CC (match_dup 4)
13497 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13499 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13500 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13501 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13503 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13504 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13507 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13509 [(set_attr "type" "compare")
13510 (set_attr "length" "12,16")])
13513 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13515 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13516 (match_operand:SI 2 "reg_or_short_operand" ""))
13517 (match_operand:SI 3 "gpc_reg_operand" ""))
13519 (set (match_operand:SI 0 "gpc_reg_operand" "")
13520 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13521 "TARGET_POWER && reload_completed"
13522 [(set (match_dup 0)
13523 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13525 (compare:CC (match_dup 0)
13530 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13531 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13534 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13535 [(set_attr "type" "three")
13536 (set_attr "length" "12")])
13539 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13540 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13543 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13544 [(set_attr "type" "three")
13545 (set_attr "length" "12")])
13548 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13549 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13550 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13552 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13553 [(set_attr "length" "12")])
13555 (define_insn_and_split ""
13556 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13557 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13558 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13562 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13563 (set (match_dup 0) (neg:SI (match_dup 0)))]
13566 (define_insn_and_split ""
13567 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13568 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13569 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13573 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13574 (set (match_dup 0) (neg:DI (match_dup 0)))]
13578 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13580 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13581 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13583 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13584 (gtu:SI (match_dup 1) (match_dup 2)))]
13587 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13589 [(set_attr "type" "compare")
13590 (set_attr "length" "12,16")])
13593 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13595 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13596 (match_operand:SI 2 "reg_or_short_operand" ""))
13598 (set (match_operand:SI 0 "gpc_reg_operand" "")
13599 (gtu:SI (match_dup 1) (match_dup 2)))]
13600 "TARGET_32BIT && reload_completed"
13601 [(set (match_dup 0)
13602 (gtu:SI (match_dup 1) (match_dup 2)))
13604 (compare:CC (match_dup 0)
13609 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13611 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13612 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13614 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13615 (gtu:DI (match_dup 1) (match_dup 2)))]
13618 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13620 [(set_attr "type" "compare")
13621 (set_attr "length" "12,16")])
13624 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13626 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13627 (match_operand:DI 2 "reg_or_short_operand" ""))
13629 (set (match_operand:DI 0 "gpc_reg_operand" "")
13630 (gtu:DI (match_dup 1) (match_dup 2)))]
13631 "TARGET_64BIT && reload_completed"
13632 [(set (match_dup 0)
13633 (gtu:DI (match_dup 1) (match_dup 2)))
13635 (compare:CC (match_dup 0)
13639 (define_insn_and_split ""
13640 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13641 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13642 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13643 (match_operand:SI 3 "reg_or_short_operand" "rI")))]
13646 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13647 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13648 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
13651 (define_insn_and_split ""
13652 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13653 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13654 (match_operand:DI 2 "reg_or_short_operand" "rI"))
13655 (match_operand:DI 3 "reg_or_short_operand" "rI")))]
13658 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13659 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13660 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
13664 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13666 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13667 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13668 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13670 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13673 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13674 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
13677 [(set_attr "type" "compare")
13678 (set_attr "length" "8,12,12,16")])
13681 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13683 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13684 (match_operand:SI 2 "reg_or_short_operand" ""))
13685 (match_operand:SI 3 "gpc_reg_operand" ""))
13687 (clobber (match_scratch:SI 4 ""))]
13688 "TARGET_32BIT && reload_completed"
13689 [(set (match_dup 4)
13690 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13693 (compare:CC (match_dup 4)
13698 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13700 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13701 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13702 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13704 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13707 addic %4,%1,%k2\;addze. %4,%3
13708 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subf. %4,%4,%3
13711 [(set_attr "type" "compare")
13712 (set_attr "length" "8,12,12,16")])
13715 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13717 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13718 (match_operand:DI 2 "reg_or_short_operand" ""))
13719 (match_operand:DI 3 "gpc_reg_operand" ""))
13721 (clobber (match_scratch:DI 4 ""))]
13722 "TARGET_64BIT && reload_completed"
13723 [(set (match_dup 4)
13724 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13727 (compare:CC (match_dup 4)
13732 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13734 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13735 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13736 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13738 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13739 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13742 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13743 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
13746 [(set_attr "type" "compare")
13747 (set_attr "length" "8,12,12,16")])
13750 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13752 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13753 (match_operand:SI 2 "reg_or_short_operand" ""))
13754 (match_operand:SI 3 "gpc_reg_operand" ""))
13756 (set (match_operand:SI 0 "gpc_reg_operand" "")
13757 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13758 "TARGET_32BIT && reload_completed"
13759 [(set (match_dup 0)
13760 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13762 (compare:CC (match_dup 0)
13767 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13769 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13770 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13771 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13773 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13774 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13777 addic %0,%1,%k2\;addze. %0,%3
13778 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf. %0,%0,%3
13781 [(set_attr "type" "compare")
13782 (set_attr "length" "8,12,12,16")])
13785 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13787 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13788 (match_operand:DI 2 "reg_or_short_operand" ""))
13789 (match_operand:DI 3 "gpc_reg_operand" ""))
13791 (set (match_operand:DI 0 "gpc_reg_operand" "")
13792 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13793 "TARGET_64BIT && reload_completed"
13794 [(set (match_dup 0)
13795 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13797 (compare:CC (match_dup 0)
13802 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13803 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13804 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13806 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13807 [(set_attr "type" "two")
13808 (set_attr "length" "8")])
13811 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13812 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13813 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13815 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13816 [(set_attr "type" "two")
13817 (set_attr "length" "8")])
13819 ;; Define both directions of branch and return. If we need a reload
13820 ;; register, we'd rather use CR0 since it is much easier to copy a
13821 ;; register CC value to there.
13825 (if_then_else (match_operator 1 "branch_comparison_operator"
13827 "cc_reg_operand" "y")
13829 (label_ref (match_operand 0 "" ""))
13834 return output_cbranch (operands[1], \"%l0\", 0, insn);
13836 [(set_attr "type" "branch")])
13840 (if_then_else (match_operator 0 "branch_comparison_operator"
13842 "cc_reg_operand" "y")
13849 return output_cbranch (operands[0], NULL, 0, insn);
13851 [(set_attr "type" "branch")
13852 (set_attr "length" "4")])
13856 (if_then_else (match_operator 1 "branch_comparison_operator"
13858 "cc_reg_operand" "y")
13861 (label_ref (match_operand 0 "" ""))))]
13865 return output_cbranch (operands[1], \"%l0\", 1, insn);
13867 [(set_attr "type" "branch")])
13871 (if_then_else (match_operator 0 "branch_comparison_operator"
13873 "cc_reg_operand" "y")
13880 return output_cbranch (operands[0], NULL, 1, insn);
13882 [(set_attr "type" "branch")
13883 (set_attr "length" "4")])
13885 ;; Logic on condition register values.
13887 ; This pattern matches things like
13888 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13889 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13891 ; which are generated by the branch logic.
13892 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13894 (define_insn "*cceq_ior_compare"
13895 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13896 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13897 [(match_operator:SI 2
13898 "branch_positive_comparison_operator"
13900 "cc_reg_operand" "y,y")
13902 (match_operator:SI 4
13903 "branch_positive_comparison_operator"
13905 "cc_reg_operand" "0,y")
13909 "cr%q1 %E0,%j2,%j4"
13910 [(set_attr "type" "cr_logical,delayed_cr")])
13912 ; Why is the constant -1 here, but 1 in the previous pattern?
13913 ; Because ~1 has all but the low bit set.
13915 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13916 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13917 [(not:SI (match_operator:SI 2
13918 "branch_positive_comparison_operator"
13920 "cc_reg_operand" "y,y")
13922 (match_operator:SI 4
13923 "branch_positive_comparison_operator"
13925 "cc_reg_operand" "0,y")
13929 "cr%q1 %E0,%j2,%j4"
13930 [(set_attr "type" "cr_logical,delayed_cr")])
13932 (define_insn "*cceq_rev_compare"
13933 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13934 (compare:CCEQ (match_operator:SI 1
13935 "branch_positive_comparison_operator"
13937 "cc_reg_operand" "0,y")
13941 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13942 [(set_attr "type" "cr_logical,delayed_cr")])
13944 ;; If we are comparing the result of two comparisons, this can be done
13945 ;; using creqv or crxor.
13947 (define_insn_and_split ""
13948 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13949 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13950 [(match_operand 2 "cc_reg_operand" "y")
13952 (match_operator 3 "branch_comparison_operator"
13953 [(match_operand 4 "cc_reg_operand" "y")
13958 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13962 int positive_1, positive_2;
13964 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13965 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13968 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13969 GET_CODE (operands[1])),
13971 operands[2], const0_rtx);
13972 else if (GET_MODE (operands[1]) != SImode)
13973 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13974 operands[2], const0_rtx);
13977 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13978 GET_CODE (operands[3])),
13980 operands[4], const0_rtx);
13981 else if (GET_MODE (operands[3]) != SImode)
13982 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13983 operands[4], const0_rtx);
13985 if (positive_1 == positive_2)
13987 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13988 operands[5] = constm1_rtx;
13992 operands[5] = const1_rtx;
13996 ;; Unconditional branch and return.
13998 (define_insn "jump"
14000 (label_ref (match_operand 0 "" "")))]
14003 [(set_attr "type" "branch")])
14005 (define_insn "return"
14009 [(set_attr "type" "jmpreg")])
14011 (define_expand "indirect_jump"
14012 [(set (pc) (match_operand 0 "register_operand" ""))]
14017 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
14019 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
14023 (define_insn "indirect_jumpsi"
14024 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
14029 [(set_attr "type" "jmpreg")])
14031 (define_insn "indirect_jumpdi"
14032 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
14037 [(set_attr "type" "jmpreg")])
14039 ;; Table jump for switch statements:
14040 (define_expand "tablejump"
14041 [(use (match_operand 0 "" ""))
14042 (use (label_ref (match_operand 1 "" "")))]
14047 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14049 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14053 (define_expand "tablejumpsi"
14054 [(set (match_dup 3)
14055 (plus:SI (match_operand:SI 0 "" "")
14057 (parallel [(set (pc) (match_dup 3))
14058 (use (label_ref (match_operand 1 "" "")))])]
14061 { operands[0] = force_reg (SImode, operands[0]);
14062 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14063 operands[3] = gen_reg_rtx (SImode);
14066 (define_expand "tablejumpdi"
14067 [(set (match_dup 4)
14068 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
14070 (plus:DI (match_dup 4)
14072 (parallel [(set (pc) (match_dup 3))
14073 (use (label_ref (match_operand 1 "" "")))])]
14076 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14077 operands[3] = gen_reg_rtx (DImode);
14078 operands[4] = gen_reg_rtx (DImode);
14083 (match_operand:SI 0 "register_operand" "c,*l"))
14084 (use (label_ref (match_operand 1 "" "")))]
14089 [(set_attr "type" "jmpreg")])
14093 (match_operand:DI 0 "register_operand" "c,*l"))
14094 (use (label_ref (match_operand 1 "" "")))]
14099 [(set_attr "type" "jmpreg")])
14104 "{cror 0,0,0|nop}")
14106 ;; Define the subtract-one-and-jump insns, starting with the template
14107 ;; so loop.c knows what to generate.
14109 (define_expand "doloop_end"
14110 [(use (match_operand 0 "" "")) ; loop pseudo
14111 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14112 (use (match_operand 2 "" "")) ; max iterations
14113 (use (match_operand 3 "" "")) ; loop level
14114 (use (match_operand 4 "" ""))] ; label
14118 /* Only use this on innermost loops. */
14119 if (INTVAL (operands[3]) > 1)
14123 if (GET_MODE (operands[0]) != DImode)
14125 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14129 if (GET_MODE (operands[0]) != SImode)
14131 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14136 (define_expand "ctrsi"
14137 [(parallel [(set (pc)
14138 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
14140 (label_ref (match_operand 1 "" ""))
14143 (plus:SI (match_dup 0)
14145 (clobber (match_scratch:CC 2 ""))
14146 (clobber (match_scratch:SI 3 ""))])]
14150 (define_expand "ctrdi"
14151 [(parallel [(set (pc)
14152 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
14154 (label_ref (match_operand 1 "" ""))
14157 (plus:DI (match_dup 0)
14159 (clobber (match_scratch:CC 2 ""))
14160 (clobber (match_scratch:DI 3 ""))])]
14164 ;; We need to be able to do this for any operand, including MEM, or we
14165 ;; will cause reload to blow up since we don't allow output reloads on
14167 ;; For the length attribute to be calculated correctly, the
14168 ;; label MUST be operand 0.
14170 (define_insn "*ctrsi_internal1"
14172 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14174 (label_ref (match_operand 0 "" ""))
14176 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14177 (plus:SI (match_dup 1)
14179 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14180 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14184 if (which_alternative != 0)
14186 else if (get_attr_length (insn) == 4)
14187 return \"{bdn|bdnz} %l0\";
14189 return \"bdz $+8\;b %l0\";
14191 [(set_attr "type" "branch")
14192 (set_attr "length" "*,12,16,16")])
14194 (define_insn "*ctrsi_internal2"
14196 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14199 (label_ref (match_operand 0 "" ""))))
14200 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14201 (plus:SI (match_dup 1)
14203 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14204 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14208 if (which_alternative != 0)
14210 else if (get_attr_length (insn) == 4)
14211 return \"bdz %l0\";
14213 return \"{bdn|bdnz} $+8\;b %l0\";
14215 [(set_attr "type" "branch")
14216 (set_attr "length" "*,12,16,16")])
14218 (define_insn "*ctrdi_internal1"
14220 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14222 (label_ref (match_operand 0 "" ""))
14224 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14225 (plus:DI (match_dup 1)
14227 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14228 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14232 if (which_alternative != 0)
14234 else if (get_attr_length (insn) == 4)
14235 return \"{bdn|bdnz} %l0\";
14237 return \"bdz $+8\;b %l0\";
14239 [(set_attr "type" "branch")
14240 (set_attr "length" "*,12,16,16")])
14242 (define_insn "*ctrdi_internal2"
14244 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14247 (label_ref (match_operand 0 "" ""))))
14248 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14249 (plus:DI (match_dup 1)
14251 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14252 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14256 if (which_alternative != 0)
14258 else if (get_attr_length (insn) == 4)
14259 return \"bdz %l0\";
14261 return \"{bdn|bdnz} $+8\;b %l0\";
14263 [(set_attr "type" "branch")
14264 (set_attr "length" "*,12,16,16")])
14266 ;; Similar but use EQ
14268 (define_insn "*ctrsi_internal5"
14270 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14272 (label_ref (match_operand 0 "" ""))
14274 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14275 (plus:SI (match_dup 1)
14277 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14278 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14282 if (which_alternative != 0)
14284 else if (get_attr_length (insn) == 4)
14285 return \"bdz %l0\";
14287 return \"{bdn|bdnz} $+8\;b %l0\";
14289 [(set_attr "type" "branch")
14290 (set_attr "length" "*,12,16,16")])
14292 (define_insn "*ctrsi_internal6"
14294 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14297 (label_ref (match_operand 0 "" ""))))
14298 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14299 (plus:SI (match_dup 1)
14301 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14302 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14306 if (which_alternative != 0)
14308 else if (get_attr_length (insn) == 4)
14309 return \"{bdn|bdnz} %l0\";
14311 return \"bdz $+8\;b %l0\";
14313 [(set_attr "type" "branch")
14314 (set_attr "length" "*,12,16,16")])
14316 (define_insn "*ctrdi_internal5"
14318 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14320 (label_ref (match_operand 0 "" ""))
14322 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14323 (plus:DI (match_dup 1)
14325 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14326 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14330 if (which_alternative != 0)
14332 else if (get_attr_length (insn) == 4)
14333 return \"bdz %l0\";
14335 return \"{bdn|bdnz} $+8\;b %l0\";
14337 [(set_attr "type" "branch")
14338 (set_attr "length" "*,12,16,16")])
14340 (define_insn "*ctrdi_internal6"
14342 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14345 (label_ref (match_operand 0 "" ""))))
14346 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14347 (plus:DI (match_dup 1)
14349 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14350 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14354 if (which_alternative != 0)
14356 else if (get_attr_length (insn) == 4)
14357 return \"{bdn|bdnz} %l0\";
14359 return \"bdz $+8\;b %l0\";
14361 [(set_attr "type" "branch")
14362 (set_attr "length" "*,12,16,16")])
14364 ;; Now the splitters if we could not allocate the CTR register
14368 (if_then_else (match_operator 2 "comparison_operator"
14369 [(match_operand:SI 1 "gpc_reg_operand" "")
14371 (match_operand 5 "" "")
14372 (match_operand 6 "" "")))
14373 (set (match_operand:SI 0 "gpc_reg_operand" "")
14374 (plus:SI (match_dup 1)
14376 (clobber (match_scratch:CC 3 ""))
14377 (clobber (match_scratch:SI 4 ""))]
14378 "TARGET_32BIT && reload_completed"
14379 [(parallel [(set (match_dup 3)
14380 (compare:CC (plus:SI (match_dup 1)
14384 (plus:SI (match_dup 1)
14386 (set (pc) (if_then_else (match_dup 7)
14390 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14391 operands[3], const0_rtx); }")
14395 (if_then_else (match_operator 2 "comparison_operator"
14396 [(match_operand:SI 1 "gpc_reg_operand" "")
14398 (match_operand 5 "" "")
14399 (match_operand 6 "" "")))
14400 (set (match_operand:SI 0 "nonimmediate_operand" "")
14401 (plus:SI (match_dup 1) (const_int -1)))
14402 (clobber (match_scratch:CC 3 ""))
14403 (clobber (match_scratch:SI 4 ""))]
14404 "TARGET_32BIT && reload_completed
14405 && ! gpc_reg_operand (operands[0], SImode)"
14406 [(parallel [(set (match_dup 3)
14407 (compare:CC (plus:SI (match_dup 1)
14411 (plus:SI (match_dup 1)
14415 (set (pc) (if_then_else (match_dup 7)
14419 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14420 operands[3], const0_rtx); }")
14423 (if_then_else (match_operator 2 "comparison_operator"
14424 [(match_operand:DI 1 "gpc_reg_operand" "")
14426 (match_operand 5 "" "")
14427 (match_operand 6 "" "")))
14428 (set (match_operand:DI 0 "gpc_reg_operand" "")
14429 (plus:DI (match_dup 1)
14431 (clobber (match_scratch:CC 3 ""))
14432 (clobber (match_scratch:DI 4 ""))]
14433 "TARGET_64BIT && reload_completed"
14434 [(parallel [(set (match_dup 3)
14435 (compare:CC (plus:DI (match_dup 1)
14439 (plus:DI (match_dup 1)
14441 (set (pc) (if_then_else (match_dup 7)
14445 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14446 operands[3], const0_rtx); }")
14450 (if_then_else (match_operator 2 "comparison_operator"
14451 [(match_operand:DI 1 "gpc_reg_operand" "")
14453 (match_operand 5 "" "")
14454 (match_operand 6 "" "")))
14455 (set (match_operand:DI 0 "nonimmediate_operand" "")
14456 (plus:DI (match_dup 1) (const_int -1)))
14457 (clobber (match_scratch:CC 3 ""))
14458 (clobber (match_scratch:DI 4 ""))]
14459 "TARGET_64BIT && reload_completed
14460 && ! gpc_reg_operand (operands[0], DImode)"
14461 [(parallel [(set (match_dup 3)
14462 (compare:CC (plus:DI (match_dup 1)
14466 (plus:DI (match_dup 1)
14470 (set (pc) (if_then_else (match_dup 7)
14474 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14475 operands[3], const0_rtx); }")
14477 (define_insn "trap"
14478 [(trap_if (const_int 1) (const_int 0))]
14482 (define_expand "conditional_trap"
14483 [(trap_if (match_operator 0 "trap_comparison_operator"
14484 [(match_dup 2) (match_dup 3)])
14485 (match_operand 1 "const_int_operand" ""))]
14487 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14488 operands[2] = rs6000_compare_op0;
14489 operands[3] = rs6000_compare_op1;")
14492 [(trap_if (match_operator 0 "trap_comparison_operator"
14493 [(match_operand:SI 1 "register_operand" "r")
14494 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14497 "{t|tw}%V0%I2 %1,%2")
14500 [(trap_if (match_operator 0 "trap_comparison_operator"
14501 [(match_operand:DI 1 "register_operand" "r")
14502 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14507 ;; Insns related to generating the function prologue and epilogue.
14509 (define_expand "prologue"
14510 [(use (const_int 0))]
14511 "TARGET_SCHED_PROLOG"
14514 rs6000_emit_prologue ();
14518 (define_insn "*movesi_from_cr_one"
14519 [(match_parallel 0 "mfcr_operation"
14520 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14521 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14522 (match_operand 3 "immediate_operand" "n")]
14523 UNSPEC_MOVESI_FROM_CR))])]
14529 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14531 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14532 operands[4] = GEN_INT (mask);
14533 output_asm_insn (\"mfcr %1,%4\", operands);
14537 [(set_attr "type" "mfcrf")])
14539 (define_insn "movesi_from_cr"
14540 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14541 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14542 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14543 UNSPEC_MOVESI_FROM_CR))]
14546 [(set_attr "type" "mfcr")])
14548 (define_insn "*stmw"
14549 [(match_parallel 0 "stmw_operation"
14550 [(set (match_operand:SI 1 "memory_operand" "=m")
14551 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14553 "{stm|stmw} %2,%1")
14555 (define_insn "*save_fpregs_si"
14556 [(match_parallel 0 "any_parallel_operand"
14557 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14558 (use (match_operand:SI 2 "call_operand" "s"))
14559 (set (match_operand:DF 3 "memory_operand" "=m")
14560 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14563 [(set_attr "type" "branch")
14564 (set_attr "length" "4")])
14566 (define_insn "*save_fpregs_di"
14567 [(match_parallel 0 "any_parallel_operand"
14568 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14569 (use (match_operand:DI 2 "call_operand" "s"))
14570 (set (match_operand:DF 3 "memory_operand" "=m")
14571 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14574 [(set_attr "type" "branch")
14575 (set_attr "length" "4")])
14577 ; These are to explain that changes to the stack pointer should
14578 ; not be moved over stores to stack memory.
14579 (define_insn "stack_tie"
14580 [(set (match_operand:BLK 0 "memory_operand" "+m")
14581 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14584 [(set_attr "length" "0")])
14587 (define_expand "epilogue"
14588 [(use (const_int 0))]
14589 "TARGET_SCHED_PROLOG"
14592 rs6000_emit_epilogue (FALSE);
14596 ; On some processors, doing the mtcrf one CC register at a time is
14597 ; faster (like on the 604e). On others, doing them all at once is
14598 ; faster; for instance, on the 601 and 750.
14600 (define_expand "movsi_to_cr_one"
14601 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14602 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14603 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14605 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14607 (define_insn "*movsi_to_cr"
14608 [(match_parallel 0 "mtcrf_operation"
14609 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14610 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14611 (match_operand 3 "immediate_operand" "n")]
14612 UNSPEC_MOVESI_TO_CR))])]
14618 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14619 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14620 operands[4] = GEN_INT (mask);
14621 return \"mtcrf %4,%2\";
14623 [(set_attr "type" "mtcr")])
14625 (define_insn "*mtcrfsi"
14626 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14627 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14628 (match_operand 2 "immediate_operand" "n")]
14629 UNSPEC_MOVESI_TO_CR))]
14630 "GET_CODE (operands[0]) == REG
14631 && CR_REGNO_P (REGNO (operands[0]))
14632 && GET_CODE (operands[2]) == CONST_INT
14633 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14635 [(set_attr "type" "mtcr")])
14637 ; The load-multiple instructions have similar properties.
14638 ; Note that "load_multiple" is a name known to the machine-independent
14639 ; code that actually corresponds to the powerpc load-string.
14641 (define_insn "*lmw"
14642 [(match_parallel 0 "lmw_operation"
14643 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14644 (match_operand:SI 2 "memory_operand" "m"))])]
14648 (define_insn "*return_internal_si"
14650 (use (match_operand:SI 0 "register_operand" "lc"))]
14653 [(set_attr "type" "jmpreg")])
14655 (define_insn "*return_internal_di"
14657 (use (match_operand:DI 0 "register_operand" "lc"))]
14660 [(set_attr "type" "jmpreg")])
14662 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14663 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14665 (define_insn "*return_and_restore_fpregs_si"
14666 [(match_parallel 0 "any_parallel_operand"
14668 (use (match_operand:SI 1 "register_operand" "l"))
14669 (use (match_operand:SI 2 "call_operand" "s"))
14670 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14671 (match_operand:DF 4 "memory_operand" "m"))])]
14675 (define_insn "*return_and_restore_fpregs_di"
14676 [(match_parallel 0 "any_parallel_operand"
14678 (use (match_operand:DI 1 "register_operand" "l"))
14679 (use (match_operand:DI 2 "call_operand" "s"))
14680 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14681 (match_operand:DF 4 "memory_operand" "m"))])]
14685 ; This is used in compiling the unwind routines.
14686 (define_expand "eh_return"
14687 [(use (match_operand 0 "general_operand" ""))]
14692 emit_insn (gen_eh_set_lr_si (operands[0]));
14694 emit_insn (gen_eh_set_lr_di (operands[0]));
14698 ; We can't expand this before we know where the link register is stored.
14699 (define_insn "eh_set_lr_si"
14700 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")]
14702 (clobber (match_scratch:SI 1 "=&b"))]
14706 (define_insn "eh_set_lr_di"
14707 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
14709 (clobber (match_scratch:DI 1 "=&b"))]
14714 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14715 (clobber (match_scratch 1 ""))]
14720 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14724 (define_insn "prefetch"
14725 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14726 (match_operand:SI 1 "const_int_operand" "n")
14727 (match_operand:SI 2 "const_int_operand" "n"))]
14731 if (GET_CODE (operands[0]) == REG)
14732 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14733 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14735 [(set_attr "type" "load")])
14737 (include "altivec.md")