1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 2, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 ;; MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 [(UNSPEC_FRSP 0) ; frsp for POWER machines
31 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
32 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
33 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
35 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
37 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
38 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
41 (UNSPEC_MOVESI_FROM_CR 19)
42 (UNSPEC_MOVESI_TO_CR 20)
44 (UNSPEC_TLSDTPRELHA 22)
45 (UNSPEC_TLSDTPRELLO 23)
46 (UNSPEC_TLSGOTDTPREL 24)
48 (UNSPEC_TLSTPRELHA 26)
49 (UNSPEC_TLSTPRELLO 27)
50 (UNSPEC_TLSGOTTPREL 28)
52 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
53 (UNSPEC_MV_CR_EQ 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_insn_and_split "*andsi3_internal7"
2415 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2416 (compare:CC (and:SI (match_operand:SI 0 "gpc_reg_operand" "r,r")
2417 (match_operand:SI 1 "mask_operand_wrap" "i,i"))
2419 (clobber (match_scratch:SI 3 "=r,r"))]
2423 [(parallel [(set (match_dup 2)
2424 (compare:CC (and:SI (rotate:SI (match_dup 0) (match_dup 4))
2427 (clobber (match_dup 3))])]
2430 int mb = extract_MB (operands[1]);
2431 int me = extract_ME (operands[1]);
2432 operands[4] = GEN_INT (me + 1);
2433 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2435 [(set_attr "type" "delayed_compare,compare")
2436 (set_attr "length" "4,8")])
2438 (define_insn_and_split "*andsi3_internal8"
2439 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2440 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2441 (match_operand:SI 2 "mask_operand_wrap" "i,i"))
2443 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2444 (and:SI (match_dup 1)
2450 (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2452 (parallel [(set (match_dup 3)
2453 (compare:CC (rotate:SI (match_dup 0) (match_dup 6))
2456 (rotate:SI (match_dup 0) (match_dup 6)))])]
2459 int mb = extract_MB (operands[2]);
2460 int me = extract_ME (operands[2]);
2461 operands[4] = GEN_INT (me + 1);
2462 operands[6] = GEN_INT (32 - (me + 1));
2463 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2465 [(set_attr "type" "delayed_compare,compare")
2466 (set_attr "length" "8,12")])
2468 (define_expand "iorsi3"
2469 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2470 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2471 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2475 if (GET_CODE (operands[2]) == CONST_INT
2476 && ! logical_operand (operands[2], SImode))
2478 HOST_WIDE_INT value = INTVAL (operands[2]);
2479 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2480 ? operands[0] : gen_reg_rtx (SImode));
2482 emit_insn (gen_iorsi3 (tmp, operands[1],
2483 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2484 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2489 (define_expand "xorsi3"
2490 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2491 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2492 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2496 if (GET_CODE (operands[2]) == CONST_INT
2497 && ! logical_operand (operands[2], SImode))
2499 HOST_WIDE_INT value = INTVAL (operands[2]);
2500 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2501 ? operands[0] : gen_reg_rtx (SImode));
2503 emit_insn (gen_xorsi3 (tmp, operands[1],
2504 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2505 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2510 (define_insn "*boolsi3_internal1"
2511 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2512 (match_operator:SI 3 "boolean_or_operator"
2513 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2514 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2518 {%q3il|%q3i} %0,%1,%b2
2519 {%q3iu|%q3is} %0,%1,%u2")
2521 (define_insn "*boolsi3_internal2"
2522 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2523 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2524 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2525 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2527 (clobber (match_scratch:SI 3 "=r,r"))]
2532 [(set_attr "type" "compare")
2533 (set_attr "length" "4,8")])
2536 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2537 (compare:CC (match_operator:SI 4 "boolean_operator"
2538 [(match_operand:SI 1 "gpc_reg_operand" "")
2539 (match_operand:SI 2 "gpc_reg_operand" "")])
2541 (clobber (match_scratch:SI 3 ""))]
2542 "TARGET_32BIT && reload_completed"
2543 [(set (match_dup 3) (match_dup 4))
2545 (compare:CC (match_dup 3)
2549 (define_insn "*boolsi3_internal3"
2550 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2551 (compare:CC (match_operator:SI 4 "boolean_operator"
2552 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2553 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2555 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2561 [(set_attr "type" "compare")
2562 (set_attr "length" "4,8")])
2565 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2566 (compare:CC (match_operator:SI 4 "boolean_operator"
2567 [(match_operand:SI 1 "gpc_reg_operand" "")
2568 (match_operand:SI 2 "gpc_reg_operand" "")])
2570 (set (match_operand:SI 0 "gpc_reg_operand" "")
2572 "TARGET_32BIT && reload_completed"
2573 [(set (match_dup 0) (match_dup 4))
2575 (compare:CC (match_dup 0)
2579 ;; Split a logical operation that we can't do in one insn into two insns,
2580 ;; each of which does one 16-bit part. This is used by combine.
2583 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2584 (match_operator:SI 3 "boolean_or_operator"
2585 [(match_operand:SI 1 "gpc_reg_operand" "")
2586 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2588 [(set (match_dup 0) (match_dup 4))
2589 (set (match_dup 0) (match_dup 5))]
2593 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2594 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2596 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2597 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2601 (define_insn "*boolcsi3_internal1"
2602 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2603 (match_operator:SI 3 "boolean_operator"
2604 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2605 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2609 (define_insn "*boolcsi3_internal2"
2610 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2611 (compare:CC (match_operator:SI 4 "boolean_operator"
2612 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2613 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2615 (clobber (match_scratch:SI 3 "=r,r"))]
2620 [(set_attr "type" "compare")
2621 (set_attr "length" "4,8")])
2624 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2625 (compare:CC (match_operator:SI 4 "boolean_operator"
2626 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2627 (match_operand:SI 2 "gpc_reg_operand" "")])
2629 (clobber (match_scratch:SI 3 ""))]
2630 "TARGET_32BIT && reload_completed"
2631 [(set (match_dup 3) (match_dup 4))
2633 (compare:CC (match_dup 3)
2637 (define_insn "*boolcsi3_internal3"
2638 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2639 (compare:CC (match_operator:SI 4 "boolean_operator"
2640 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2641 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2643 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2649 [(set_attr "type" "compare")
2650 (set_attr "length" "4,8")])
2653 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2654 (compare:CC (match_operator:SI 4 "boolean_operator"
2655 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2656 (match_operand:SI 2 "gpc_reg_operand" "")])
2658 (set (match_operand:SI 0 "gpc_reg_operand" "")
2660 "TARGET_32BIT && reload_completed"
2661 [(set (match_dup 0) (match_dup 4))
2663 (compare:CC (match_dup 0)
2667 (define_insn "*boolccsi3_internal1"
2668 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2669 (match_operator:SI 3 "boolean_operator"
2670 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2671 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2675 (define_insn "*boolccsi3_internal2"
2676 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2677 (compare:CC (match_operator:SI 4 "boolean_operator"
2678 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2679 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2681 (clobber (match_scratch:SI 3 "=r,r"))]
2686 [(set_attr "type" "compare")
2687 (set_attr "length" "4,8")])
2690 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2691 (compare:CC (match_operator:SI 4 "boolean_operator"
2692 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2693 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2695 (clobber (match_scratch:SI 3 ""))]
2696 "TARGET_32BIT && reload_completed"
2697 [(set (match_dup 3) (match_dup 4))
2699 (compare:CC (match_dup 3)
2703 (define_insn "*boolccsi3_internal3"
2704 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2705 (compare:CC (match_operator:SI 4 "boolean_operator"
2706 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2707 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2709 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2715 [(set_attr "type" "compare")
2716 (set_attr "length" "4,8")])
2719 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2720 (compare:CC (match_operator:SI 4 "boolean_operator"
2721 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2722 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2724 (set (match_operand:SI 0 "gpc_reg_operand" "")
2726 "TARGET_32BIT && reload_completed"
2727 [(set (match_dup 0) (match_dup 4))
2729 (compare:CC (match_dup 0)
2733 ;; maskir insn. We need four forms because things might be in arbitrary
2734 ;; orders. Don't define forms that only set CR fields because these
2735 ;; would modify an input register.
2737 (define_insn "*maskir_internal1"
2738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2739 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2740 (match_operand:SI 1 "gpc_reg_operand" "0"))
2741 (and:SI (match_dup 2)
2742 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2746 (define_insn "*maskir_internal2"
2747 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2748 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2749 (match_operand:SI 1 "gpc_reg_operand" "0"))
2750 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2755 (define_insn "*maskir_internal3"
2756 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2757 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2758 (match_operand:SI 3 "gpc_reg_operand" "r"))
2759 (and:SI (not:SI (match_dup 2))
2760 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2764 (define_insn "*maskir_internal4"
2765 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2766 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2767 (match_operand:SI 2 "gpc_reg_operand" "r"))
2768 (and:SI (not:SI (match_dup 2))
2769 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2773 (define_insn "*maskir_internal5"
2774 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2776 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2777 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2778 (and:SI (match_dup 2)
2779 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2781 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2782 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2783 (and:SI (match_dup 2) (match_dup 3))))]
2788 [(set_attr "type" "compare")
2789 (set_attr "length" "4,8")])
2792 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2794 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2795 (match_operand:SI 1 "gpc_reg_operand" ""))
2796 (and:SI (match_dup 2)
2797 (match_operand:SI 3 "gpc_reg_operand" "")))
2799 (set (match_operand:SI 0 "gpc_reg_operand" "")
2800 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2801 (and:SI (match_dup 2) (match_dup 3))))]
2802 "TARGET_POWER && reload_completed"
2804 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2805 (and:SI (match_dup 2) (match_dup 3))))
2807 (compare:CC (match_dup 0)
2811 (define_insn "*maskir_internal6"
2812 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2814 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2815 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2816 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2819 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2820 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2821 (and:SI (match_dup 3) (match_dup 2))))]
2826 [(set_attr "type" "compare")
2827 (set_attr "length" "4,8")])
2830 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2832 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2833 (match_operand:SI 1 "gpc_reg_operand" ""))
2834 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2837 (set (match_operand:SI 0 "gpc_reg_operand" "")
2838 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2839 (and:SI (match_dup 3) (match_dup 2))))]
2840 "TARGET_POWER && reload_completed"
2842 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2843 (and:SI (match_dup 3) (match_dup 2))))
2845 (compare:CC (match_dup 0)
2849 (define_insn "*maskir_internal7"
2850 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2852 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2853 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2854 (and:SI (not:SI (match_dup 2))
2855 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2857 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2858 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2859 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2864 [(set_attr "type" "compare")
2865 (set_attr "length" "4,8")])
2868 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2870 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2871 (match_operand:SI 3 "gpc_reg_operand" ""))
2872 (and:SI (not:SI (match_dup 2))
2873 (match_operand:SI 1 "gpc_reg_operand" "")))
2875 (set (match_operand:SI 0 "gpc_reg_operand" "")
2876 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2877 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2878 "TARGET_POWER && reload_completed"
2880 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2881 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2883 (compare:CC (match_dup 0)
2887 (define_insn "*maskir_internal8"
2888 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2890 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2891 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2892 (and:SI (not:SI (match_dup 2))
2893 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2895 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2896 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2897 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2902 [(set_attr "type" "compare")
2903 (set_attr "length" "4,8")])
2906 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2908 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2909 (match_operand:SI 2 "gpc_reg_operand" ""))
2910 (and:SI (not:SI (match_dup 2))
2911 (match_operand:SI 1 "gpc_reg_operand" "")))
2913 (set (match_operand:SI 0 "gpc_reg_operand" "")
2914 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2915 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2916 "TARGET_POWER && reload_completed"
2918 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2919 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2921 (compare:CC (match_dup 0)
2925 ;; Rotate and shift insns, in all their variants. These support shifts,
2926 ;; field inserts and extracts, and various combinations thereof.
2927 (define_expand "insv"
2928 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2929 (match_operand:SI 1 "const_int_operand" "")
2930 (match_operand:SI 2 "const_int_operand" ""))
2931 (match_operand 3 "gpc_reg_operand" ""))]
2935 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2936 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2937 compiler if the address of the structure is taken later. */
2938 if (GET_CODE (operands[0]) == SUBREG
2939 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2942 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2943 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2945 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2949 (define_insn "insvsi"
2950 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2951 (match_operand:SI 1 "const_int_operand" "i")
2952 (match_operand:SI 2 "const_int_operand" "i"))
2953 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2957 int start = INTVAL (operands[2]) & 31;
2958 int size = INTVAL (operands[1]) & 31;
2960 operands[4] = GEN_INT (32 - start - size);
2961 operands[1] = GEN_INT (start + size - 1);
2962 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2964 [(set_attr "type" "insert_word")])
2966 (define_insn "*insvsi_internal1"
2967 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2968 (match_operand:SI 1 "const_int_operand" "i")
2969 (match_operand:SI 2 "const_int_operand" "i"))
2970 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2971 (match_operand:SI 4 "const_int_operand" "i")))]
2972 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2975 int shift = INTVAL (operands[4]) & 31;
2976 int start = INTVAL (operands[2]) & 31;
2977 int size = INTVAL (operands[1]) & 31;
2979 operands[4] = GEN_INT (shift - start - size);
2980 operands[1] = GEN_INT (start + size - 1);
2981 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2983 [(set_attr "type" "insert_word")])
2985 (define_insn "*insvsi_internal2"
2986 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2987 (match_operand:SI 1 "const_int_operand" "i")
2988 (match_operand:SI 2 "const_int_operand" "i"))
2989 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2990 (match_operand:SI 4 "const_int_operand" "i")))]
2991 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2994 int shift = INTVAL (operands[4]) & 31;
2995 int start = INTVAL (operands[2]) & 31;
2996 int size = INTVAL (operands[1]) & 31;
2998 operands[4] = GEN_INT (32 - shift - start - size);
2999 operands[1] = GEN_INT (start + size - 1);
3000 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3002 [(set_attr "type" "insert_word")])
3004 (define_insn "*insvsi_internal3"
3005 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3006 (match_operand:SI 1 "const_int_operand" "i")
3007 (match_operand:SI 2 "const_int_operand" "i"))
3008 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3009 (match_operand:SI 4 "const_int_operand" "i")))]
3010 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3013 int shift = INTVAL (operands[4]) & 31;
3014 int start = INTVAL (operands[2]) & 31;
3015 int size = INTVAL (operands[1]) & 31;
3017 operands[4] = GEN_INT (32 - shift - start - size);
3018 operands[1] = GEN_INT (start + size - 1);
3019 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3021 [(set_attr "type" "insert_word")])
3023 (define_insn "*insvsi_internal4"
3024 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3025 (match_operand:SI 1 "const_int_operand" "i")
3026 (match_operand:SI 2 "const_int_operand" "i"))
3027 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3028 (match_operand:SI 4 "const_int_operand" "i")
3029 (match_operand:SI 5 "const_int_operand" "i")))]
3030 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3033 int extract_start = INTVAL (operands[5]) & 31;
3034 int extract_size = INTVAL (operands[4]) & 31;
3035 int insert_start = INTVAL (operands[2]) & 31;
3036 int insert_size = INTVAL (operands[1]) & 31;
3038 /* Align extract field with insert field */
3039 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3040 operands[1] = GEN_INT (insert_start + insert_size - 1);
3041 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3043 [(set_attr "type" "insert_word")])
3045 ;; combine patterns for rlwimi
3046 (define_insn "*insvsi_internal5"
3047 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3048 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3049 (match_operand:SI 1 "mask_operand" "i"))
3050 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3051 (match_operand:SI 2 "const_int_operand" "i"))
3052 (match_operand:SI 5 "mask_operand" "i"))))]
3053 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3056 int me = extract_ME(operands[5]);
3057 int mb = extract_MB(operands[5]);
3058 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3059 operands[2] = GEN_INT(mb);
3060 operands[1] = GEN_INT(me);
3061 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3063 [(set_attr "type" "insert_word")])
3065 (define_insn "*insvsi_internal6"
3066 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3067 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3068 (match_operand:SI 2 "const_int_operand" "i"))
3069 (match_operand:SI 5 "mask_operand" "i"))
3070 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3071 (match_operand:SI 1 "mask_operand" "i"))))]
3072 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3075 int me = extract_ME(operands[5]);
3076 int mb = extract_MB(operands[5]);
3077 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3078 operands[2] = GEN_INT(mb);
3079 operands[1] = GEN_INT(me);
3080 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3082 [(set_attr "type" "insert_word")])
3084 (define_insn "insvdi"
3085 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3086 (match_operand:SI 1 "const_int_operand" "i")
3087 (match_operand:SI 2 "const_int_operand" "i"))
3088 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3092 int start = INTVAL (operands[2]) & 63;
3093 int size = INTVAL (operands[1]) & 63;
3095 operands[1] = GEN_INT (64 - start - size);
3096 return \"rldimi %0,%3,%H1,%H2\";
3099 (define_insn "*insvdi_internal2"
3100 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3101 (match_operand:SI 1 "const_int_operand" "i")
3102 (match_operand:SI 2 "const_int_operand" "i"))
3103 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3104 (match_operand:SI 4 "const_int_operand" "i")))]
3106 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3109 int shift = INTVAL (operands[4]) & 63;
3110 int start = (INTVAL (operands[2]) & 63) - 32;
3111 int size = INTVAL (operands[1]) & 63;
3113 operands[4] = GEN_INT (64 - shift - start - size);
3114 operands[2] = GEN_INT (start);
3115 operands[1] = GEN_INT (start + size - 1);
3116 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3119 (define_insn "*insvdi_internal3"
3120 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3121 (match_operand:SI 1 "const_int_operand" "i")
3122 (match_operand:SI 2 "const_int_operand" "i"))
3123 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3124 (match_operand:SI 4 "const_int_operand" "i")))]
3126 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3129 int shift = INTVAL (operands[4]) & 63;
3130 int start = (INTVAL (operands[2]) & 63) - 32;
3131 int size = INTVAL (operands[1]) & 63;
3133 operands[4] = GEN_INT (64 - shift - start - size);
3134 operands[2] = GEN_INT (start);
3135 operands[1] = GEN_INT (start + size - 1);
3136 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3139 (define_expand "extzv"
3140 [(set (match_operand 0 "gpc_reg_operand" "")
3141 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3142 (match_operand:SI 2 "const_int_operand" "")
3143 (match_operand:SI 3 "const_int_operand" "")))]
3147 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3148 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3149 compiler if the address of the structure is taken later. */
3150 if (GET_CODE (operands[0]) == SUBREG
3151 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3154 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3155 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3157 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3161 (define_insn "extzvsi"
3162 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3163 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3164 (match_operand:SI 2 "const_int_operand" "i")
3165 (match_operand:SI 3 "const_int_operand" "i")))]
3169 int start = INTVAL (operands[3]) & 31;
3170 int size = INTVAL (operands[2]) & 31;
3172 if (start + size >= 32)
3173 operands[3] = const0_rtx;
3175 operands[3] = GEN_INT (start + size);
3176 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3179 (define_insn "*extzvsi_internal1"
3180 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3181 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3182 (match_operand:SI 2 "const_int_operand" "i,i")
3183 (match_operand:SI 3 "const_int_operand" "i,i"))
3185 (clobber (match_scratch:SI 4 "=r,r"))]
3189 int start = INTVAL (operands[3]) & 31;
3190 int size = INTVAL (operands[2]) & 31;
3192 /* Force split for non-cc0 compare. */
3193 if (which_alternative == 1)
3196 /* If the bit-field being tested fits in the upper or lower half of a
3197 word, it is possible to use andiu. or andil. to test it. This is
3198 useful because the condition register set-use delay is smaller for
3199 andi[ul]. than for rlinm. This doesn't work when the starting bit
3200 position is 0 because the LT and GT bits may be set wrong. */
3202 if ((start > 0 && start + size <= 16) || start >= 16)
3204 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3205 - (1 << (16 - (start & 15) - size))));
3207 return \"{andiu.|andis.} %4,%1,%3\";
3209 return \"{andil.|andi.} %4,%1,%3\";
3212 if (start + size >= 32)
3213 operands[3] = const0_rtx;
3215 operands[3] = GEN_INT (start + size);
3216 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3218 [(set_attr "type" "compare")
3219 (set_attr "length" "4,8")])
3222 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3223 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3224 (match_operand:SI 2 "const_int_operand" "")
3225 (match_operand:SI 3 "const_int_operand" ""))
3227 (clobber (match_scratch:SI 4 ""))]
3230 (zero_extract:SI (match_dup 1) (match_dup 2)
3233 (compare:CC (match_dup 4)
3237 (define_insn "*extzvsi_internal2"
3238 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3239 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3240 (match_operand:SI 2 "const_int_operand" "i,i")
3241 (match_operand:SI 3 "const_int_operand" "i,i"))
3243 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3244 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3248 int start = INTVAL (operands[3]) & 31;
3249 int size = INTVAL (operands[2]) & 31;
3251 /* Force split for non-cc0 compare. */
3252 if (which_alternative == 1)
3255 /* Since we are using the output value, we can't ignore any need for
3256 a shift. The bit-field must end at the LSB. */
3257 if (start >= 16 && start + size == 32)
3259 operands[3] = GEN_INT ((1 << size) - 1);
3260 return \"{andil.|andi.} %0,%1,%3\";
3263 if (start + size >= 32)
3264 operands[3] = const0_rtx;
3266 operands[3] = GEN_INT (start + size);
3267 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3269 [(set_attr "type" "compare")
3270 (set_attr "length" "4,8")])
3273 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3274 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3275 (match_operand:SI 2 "const_int_operand" "")
3276 (match_operand:SI 3 "const_int_operand" ""))
3278 (set (match_operand:SI 0 "gpc_reg_operand" "")
3279 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3282 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3284 (compare:CC (match_dup 0)
3288 (define_insn "extzvdi"
3289 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3290 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3291 (match_operand:SI 2 "const_int_operand" "i")
3292 (match_operand:SI 3 "const_int_operand" "i")))]
3296 int start = INTVAL (operands[3]) & 63;
3297 int size = INTVAL (operands[2]) & 63;
3299 if (start + size >= 64)
3300 operands[3] = const0_rtx;
3302 operands[3] = GEN_INT (start + size);
3303 operands[2] = GEN_INT (64 - size);
3304 return \"rldicl %0,%1,%3,%2\";
3307 (define_insn "*extzvdi_internal1"
3308 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3309 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3310 (match_operand:SI 2 "const_int_operand" "i")
3311 (match_operand:SI 3 "const_int_operand" "i"))
3313 (clobber (match_scratch:DI 4 "=r"))]
3317 int start = INTVAL (operands[3]) & 63;
3318 int size = INTVAL (operands[2]) & 63;
3320 if (start + size >= 64)
3321 operands[3] = const0_rtx;
3323 operands[3] = GEN_INT (start + size);
3324 operands[2] = GEN_INT (64 - size);
3325 return \"rldicl. %4,%1,%3,%2\";
3327 [(set_attr "type" "compare")])
3329 (define_insn "*extzvdi_internal2"
3330 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3331 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3332 (match_operand:SI 2 "const_int_operand" "i")
3333 (match_operand:SI 3 "const_int_operand" "i"))
3335 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3336 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3340 int start = INTVAL (operands[3]) & 63;
3341 int size = INTVAL (operands[2]) & 63;
3343 if (start + size >= 64)
3344 operands[3] = const0_rtx;
3346 operands[3] = GEN_INT (start + size);
3347 operands[2] = GEN_INT (64 - size);
3348 return \"rldicl. %0,%1,%3,%2\";
3350 [(set_attr "type" "compare")])
3352 (define_insn "rotlsi3"
3353 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3354 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3355 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3357 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3359 (define_insn "*rotlsi3_internal2"
3360 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3361 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3362 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3364 (clobber (match_scratch:SI 3 "=r,r"))]
3367 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3369 [(set_attr "type" "delayed_compare")
3370 (set_attr "length" "4,8")])
3373 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3374 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3375 (match_operand:SI 2 "reg_or_cint_operand" ""))
3377 (clobber (match_scratch:SI 3 ""))]
3380 (rotate:SI (match_dup 1) (match_dup 2)))
3382 (compare:CC (match_dup 3)
3386 (define_insn "*rotlsi3_internal3"
3387 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3388 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3389 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3391 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3392 (rotate:SI (match_dup 1) (match_dup 2)))]
3395 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3397 [(set_attr "type" "delayed_compare")
3398 (set_attr "length" "4,8")])
3401 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3402 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3403 (match_operand:SI 2 "reg_or_cint_operand" ""))
3405 (set (match_operand:SI 0 "gpc_reg_operand" "")
3406 (rotate:SI (match_dup 1) (match_dup 2)))]
3409 (rotate:SI (match_dup 1) (match_dup 2)))
3411 (compare:CC (match_dup 0)
3415 (define_insn "*rotlsi3_internal4"
3416 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3417 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3418 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3419 (match_operand:SI 3 "mask_operand" "n")))]
3421 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3423 (define_insn "*rotlsi3_internal5"
3424 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3426 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3427 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3428 (match_operand:SI 3 "mask_operand" "n,n"))
3430 (clobber (match_scratch:SI 4 "=r,r"))]
3433 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3435 [(set_attr "type" "delayed_compare")
3436 (set_attr "length" "4,8")])
3439 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3441 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3442 (match_operand:SI 2 "reg_or_cint_operand" ""))
3443 (match_operand:SI 3 "mask_operand" ""))
3445 (clobber (match_scratch:SI 4 ""))]
3448 (and:SI (rotate:SI (match_dup 1)
3452 (compare:CC (match_dup 4)
3456 (define_insn "*rotlsi3_internal6"
3457 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3459 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3460 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3461 (match_operand:SI 3 "mask_operand" "n,n"))
3463 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3464 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3467 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3469 [(set_attr "type" "delayed_compare")
3470 (set_attr "length" "4,8")])
3473 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3475 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3476 (match_operand:SI 2 "reg_or_cint_operand" ""))
3477 (match_operand:SI 3 "mask_operand" ""))
3479 (set (match_operand:SI 0 "gpc_reg_operand" "")
3480 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3483 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3485 (compare:CC (match_dup 0)
3489 (define_insn "*rotlsi3_internal7"
3490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3493 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3494 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3496 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3498 (define_insn "*rotlsi3_internal8"
3499 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3500 (compare:CC (zero_extend:SI
3502 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3503 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3505 (clobber (match_scratch:SI 3 "=r,r"))]
3508 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3510 [(set_attr "type" "delayed_compare")
3511 (set_attr "length" "4,8")])
3514 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3515 (compare:CC (zero_extend:SI
3517 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3518 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3520 (clobber (match_scratch:SI 3 ""))]
3523 (zero_extend:SI (subreg:QI
3524 (rotate:SI (match_dup 1)
3527 (compare:CC (match_dup 3)
3531 (define_insn "*rotlsi3_internal9"
3532 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3533 (compare:CC (zero_extend:SI
3535 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3536 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3538 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3539 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3542 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3544 [(set_attr "type" "delayed_compare")
3545 (set_attr "length" "4,8")])
3548 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3549 (compare:CC (zero_extend:SI
3551 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3552 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3554 (set (match_operand:SI 0 "gpc_reg_operand" "")
3555 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3558 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3560 (compare:CC (match_dup 0)
3564 (define_insn "*rotlsi3_internal10"
3565 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3568 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3569 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3571 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3573 (define_insn "*rotlsi3_internal11"
3574 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3575 (compare:CC (zero_extend:SI
3577 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3578 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3580 (clobber (match_scratch:SI 3 "=r,r"))]
3583 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3585 [(set_attr "type" "delayed_compare")
3586 (set_attr "length" "4,8")])
3589 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3590 (compare:CC (zero_extend:SI
3592 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3593 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3595 (clobber (match_scratch:SI 3 ""))]
3598 (zero_extend:SI (subreg:HI
3599 (rotate:SI (match_dup 1)
3602 (compare:CC (match_dup 3)
3606 (define_insn "*rotlsi3_internal12"
3607 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3608 (compare:CC (zero_extend:SI
3610 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3611 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3613 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3614 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3617 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3619 [(set_attr "type" "delayed_compare")
3620 (set_attr "length" "4,8")])
3623 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3624 (compare:CC (zero_extend:SI
3626 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3627 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3629 (set (match_operand:SI 0 "gpc_reg_operand" "")
3630 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3633 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3635 (compare:CC (match_dup 0)
3639 ;; Note that we use "sle." instead of "sl." so that we can set
3640 ;; SHIFT_COUNT_TRUNCATED.
3642 (define_expand "ashlsi3"
3643 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3644 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3645 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3650 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3652 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3656 (define_insn "ashlsi3_power"
3657 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3658 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3659 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3660 (clobber (match_scratch:SI 3 "=q,X"))]
3664 {sli|slwi} %0,%1,%h2")
3666 (define_insn "ashlsi3_no_power"
3667 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3668 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3669 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3671 "{sl|slw}%I2 %0,%1,%h2")
3674 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3675 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3676 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3678 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3679 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3683 {sli.|slwi.} %3,%1,%h2
3686 [(set_attr "type" "delayed_compare")
3687 (set_attr "length" "4,4,8,8")])
3690 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3691 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3692 (match_operand:SI 2 "reg_or_cint_operand" ""))
3694 (clobber (match_scratch:SI 3 ""))
3695 (clobber (match_scratch:SI 4 ""))]
3696 "TARGET_POWER && reload_completed"
3697 [(parallel [(set (match_dup 3)
3698 (ashift:SI (match_dup 1) (match_dup 2)))
3699 (clobber (match_dup 4))])
3701 (compare:CC (match_dup 3)
3706 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3707 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3708 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3710 (clobber (match_scratch:SI 3 "=r,r"))]
3711 "! TARGET_POWER && TARGET_32BIT"
3713 {sl|slw}%I2. %3,%1,%h2
3715 [(set_attr "type" "delayed_compare")
3716 (set_attr "length" "4,8")])
3719 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3720 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3721 (match_operand:SI 2 "reg_or_cint_operand" ""))
3723 (clobber (match_scratch:SI 3 ""))]
3724 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3726 (ashift:SI (match_dup 1) (match_dup 2)))
3728 (compare:CC (match_dup 3)
3733 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3734 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3735 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3737 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3738 (ashift:SI (match_dup 1) (match_dup 2)))
3739 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3743 {sli.|slwi.} %0,%1,%h2
3746 [(set_attr "type" "delayed_compare")
3747 (set_attr "length" "4,4,8,8")])
3750 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3751 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3752 (match_operand:SI 2 "reg_or_cint_operand" ""))
3754 (set (match_operand:SI 0 "gpc_reg_operand" "")
3755 (ashift:SI (match_dup 1) (match_dup 2)))
3756 (clobber (match_scratch:SI 4 ""))]
3757 "TARGET_POWER && reload_completed"
3758 [(parallel [(set (match_dup 0)
3759 (ashift:SI (match_dup 1) (match_dup 2)))
3760 (clobber (match_dup 4))])
3762 (compare:CC (match_dup 0)
3767 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3768 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3769 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3771 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3772 (ashift:SI (match_dup 1) (match_dup 2)))]
3773 "! TARGET_POWER && TARGET_32BIT"
3775 {sl|slw}%I2. %0,%1,%h2
3777 [(set_attr "type" "delayed_compare")
3778 (set_attr "length" "4,8")])
3781 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3782 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3783 (match_operand:SI 2 "reg_or_cint_operand" ""))
3785 (set (match_operand:SI 0 "gpc_reg_operand" "")
3786 (ashift:SI (match_dup 1) (match_dup 2)))]
3787 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3789 (ashift:SI (match_dup 1) (match_dup 2)))
3791 (compare:CC (match_dup 0)
3796 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3797 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3798 (match_operand:SI 2 "const_int_operand" "i"))
3799 (match_operand:SI 3 "mask_operand" "n")))]
3800 "includes_lshift_p (operands[2], operands[3])"
3801 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3804 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3806 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3807 (match_operand:SI 2 "const_int_operand" "i,i"))
3808 (match_operand:SI 3 "mask_operand" "n,n"))
3810 (clobber (match_scratch:SI 4 "=r,r"))]
3811 "includes_lshift_p (operands[2], operands[3])"
3813 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3815 [(set_attr "type" "delayed_compare")
3816 (set_attr "length" "4,8")])
3819 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3821 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3822 (match_operand:SI 2 "const_int_operand" ""))
3823 (match_operand:SI 3 "mask_operand" ""))
3825 (clobber (match_scratch:SI 4 ""))]
3826 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3828 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3831 (compare:CC (match_dup 4)
3836 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3838 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3839 (match_operand:SI 2 "const_int_operand" "i,i"))
3840 (match_operand:SI 3 "mask_operand" "n,n"))
3842 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3843 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3844 "includes_lshift_p (operands[2], operands[3])"
3846 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3848 [(set_attr "type" "delayed_compare")
3849 (set_attr "length" "4,8")])
3852 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3854 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3855 (match_operand:SI 2 "const_int_operand" ""))
3856 (match_operand:SI 3 "mask_operand" ""))
3858 (set (match_operand:SI 0 "gpc_reg_operand" "")
3859 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3860 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3862 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3864 (compare:CC (match_dup 0)
3868 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3870 (define_expand "lshrsi3"
3871 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3872 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3873 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3878 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3880 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3884 (define_insn "lshrsi3_power"
3885 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3886 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3887 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3888 (clobber (match_scratch:SI 3 "=q,X,X"))]
3893 {s%A2i|s%A2wi} %0,%1,%h2")
3895 (define_insn "lshrsi3_no_power"
3896 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3897 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3898 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3902 {sr|srw}%I2 %0,%1,%h2")
3905 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3906 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3907 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3909 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3910 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3915 {s%A2i.|s%A2wi.} %3,%1,%h2
3919 [(set_attr "type" "delayed_compare")
3920 (set_attr "length" "4,4,4,8,8,8")])
3923 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3924 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3925 (match_operand:SI 2 "reg_or_cint_operand" ""))
3927 (clobber (match_scratch:SI 3 ""))
3928 (clobber (match_scratch:SI 4 ""))]
3929 "TARGET_POWER && reload_completed"
3930 [(parallel [(set (match_dup 3)
3931 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3932 (clobber (match_dup 4))])
3934 (compare:CC (match_dup 3)
3939 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3940 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3941 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3943 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3944 "! TARGET_POWER && TARGET_32BIT"
3947 {sr|srw}%I2. %3,%1,%h2
3950 [(set_attr "type" "delayed_compare")
3951 (set_attr "length" "4,4,8,8")])
3954 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3955 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3956 (match_operand:SI 2 "reg_or_cint_operand" ""))
3958 (clobber (match_scratch:SI 3 ""))]
3959 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3961 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3963 (compare:CC (match_dup 3)
3968 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3969 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3970 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3972 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3973 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3974 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3979 {s%A2i.|s%A2wi.} %0,%1,%h2
3983 [(set_attr "type" "delayed_compare")
3984 (set_attr "length" "4,4,4,8,8,8")])
3987 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3988 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3989 (match_operand:SI 2 "reg_or_cint_operand" ""))
3991 (set (match_operand:SI 0 "gpc_reg_operand" "")
3992 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3993 (clobber (match_scratch:SI 4 ""))]
3994 "TARGET_POWER && reload_completed"
3995 [(parallel [(set (match_dup 0)
3996 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3997 (clobber (match_dup 4))])
3999 (compare:CC (match_dup 0)
4004 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4005 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4006 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4008 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4009 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4010 "! TARGET_POWER && TARGET_32BIT"
4013 {sr|srw}%I2. %0,%1,%h2
4016 [(set_attr "type" "delayed_compare")
4017 (set_attr "length" "4,4,8,8")])
4020 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4021 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4022 (match_operand:SI 2 "reg_or_cint_operand" ""))
4024 (set (match_operand:SI 0 "gpc_reg_operand" "")
4025 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4026 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4028 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4030 (compare:CC (match_dup 0)
4035 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4036 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4037 (match_operand:SI 2 "const_int_operand" "i"))
4038 (match_operand:SI 3 "mask_operand" "n")))]
4039 "includes_rshift_p (operands[2], operands[3])"
4040 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4043 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4045 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4046 (match_operand:SI 2 "const_int_operand" "i,i"))
4047 (match_operand:SI 3 "mask_operand" "n,n"))
4049 (clobber (match_scratch:SI 4 "=r,r"))]
4050 "includes_rshift_p (operands[2], operands[3])"
4052 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4054 [(set_attr "type" "delayed_compare")
4055 (set_attr "length" "4,8")])
4058 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4060 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4061 (match_operand:SI 2 "const_int_operand" ""))
4062 (match_operand:SI 3 "mask_operand" ""))
4064 (clobber (match_scratch:SI 4 ""))]
4065 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4067 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4070 (compare:CC (match_dup 4)
4075 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4077 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4078 (match_operand:SI 2 "const_int_operand" "i,i"))
4079 (match_operand:SI 3 "mask_operand" "n,n"))
4081 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4082 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4083 "includes_rshift_p (operands[2], operands[3])"
4085 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4087 [(set_attr "type" "delayed_compare")
4088 (set_attr "length" "4,8")])
4091 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4093 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4094 (match_operand:SI 2 "const_int_operand" ""))
4095 (match_operand:SI 3 "mask_operand" ""))
4097 (set (match_operand:SI 0 "gpc_reg_operand" "")
4098 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4099 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4101 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4103 (compare:CC (match_dup 0)
4108 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4111 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4112 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4113 "includes_rshift_p (operands[2], GEN_INT (255))"
4114 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4117 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4121 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4122 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4124 (clobber (match_scratch:SI 3 "=r,r"))]
4125 "includes_rshift_p (operands[2], GEN_INT (255))"
4127 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4129 [(set_attr "type" "delayed_compare")
4130 (set_attr "length" "4,8")])
4133 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4137 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4138 (match_operand:SI 2 "const_int_operand" "")) 0))
4140 (clobber (match_scratch:SI 3 ""))]
4141 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4143 (zero_extend:SI (subreg:QI
4144 (lshiftrt:SI (match_dup 1)
4147 (compare:CC (match_dup 3)
4152 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4156 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4157 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4159 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4160 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4161 "includes_rshift_p (operands[2], GEN_INT (255))"
4163 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4165 [(set_attr "type" "delayed_compare")
4166 (set_attr "length" "4,8")])
4169 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4173 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4174 (match_operand:SI 2 "const_int_operand" "")) 0))
4176 (set (match_operand:SI 0 "gpc_reg_operand" "")
4177 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4178 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4180 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4182 (compare:CC (match_dup 0)
4187 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4190 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4191 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4192 "includes_rshift_p (operands[2], GEN_INT (65535))"
4193 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4196 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4200 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4201 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4203 (clobber (match_scratch:SI 3 "=r,r"))]
4204 "includes_rshift_p (operands[2], GEN_INT (65535))"
4206 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4208 [(set_attr "type" "delayed_compare")
4209 (set_attr "length" "4,8")])
4212 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4216 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4217 (match_operand:SI 2 "const_int_operand" "")) 0))
4219 (clobber (match_scratch:SI 3 ""))]
4220 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4222 (zero_extend:SI (subreg:HI
4223 (lshiftrt:SI (match_dup 1)
4226 (compare:CC (match_dup 3)
4231 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4235 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4236 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4238 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4239 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4240 "includes_rshift_p (operands[2], GEN_INT (65535))"
4242 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4244 [(set_attr "type" "delayed_compare")
4245 (set_attr "length" "4,8")])
4248 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4252 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4253 (match_operand:SI 2 "const_int_operand" "")) 0))
4255 (set (match_operand:SI 0 "gpc_reg_operand" "")
4256 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4257 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4259 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4261 (compare:CC (match_dup 0)
4266 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4268 (match_operand:SI 1 "gpc_reg_operand" "r"))
4269 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4275 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4277 (match_operand:SI 1 "gpc_reg_operand" "r"))
4278 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4284 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4286 (match_operand:SI 1 "gpc_reg_operand" "r"))
4287 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4293 (define_expand "ashrsi3"
4294 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4295 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4296 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4301 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4303 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4307 (define_insn "ashrsi3_power"
4308 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4309 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4310 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4311 (clobber (match_scratch:SI 3 "=q,X"))]
4315 {srai|srawi} %0,%1,%h2")
4317 (define_insn "ashrsi3_no_power"
4318 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4319 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4320 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4322 "{sra|sraw}%I2 %0,%1,%h2")
4325 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4326 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4327 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4329 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4330 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4334 {srai.|srawi.} %3,%1,%h2
4337 [(set_attr "type" "delayed_compare")
4338 (set_attr "length" "4,4,8,8")])
4341 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4342 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4343 (match_operand:SI 2 "reg_or_cint_operand" ""))
4345 (clobber (match_scratch:SI 3 ""))
4346 (clobber (match_scratch:SI 4 ""))]
4347 "TARGET_POWER && reload_completed"
4348 [(parallel [(set (match_dup 3)
4349 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4350 (clobber (match_dup 4))])
4352 (compare:CC (match_dup 3)
4357 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4358 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4359 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4361 (clobber (match_scratch:SI 3 "=r,r"))]
4364 {sra|sraw}%I2. %3,%1,%h2
4366 [(set_attr "type" "delayed_compare")
4367 (set_attr "length" "4,8")])
4370 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4371 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4372 (match_operand:SI 2 "reg_or_cint_operand" ""))
4374 (clobber (match_scratch:SI 3 ""))]
4375 "! TARGET_POWER && reload_completed"
4377 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4379 (compare:CC (match_dup 3)
4384 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4385 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4386 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4388 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4389 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4390 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4394 {srai.|srawi.} %0,%1,%h2
4397 [(set_attr "type" "delayed_compare")
4398 (set_attr "length" "4,4,8,8")])
4401 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4402 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4403 (match_operand:SI 2 "reg_or_cint_operand" ""))
4405 (set (match_operand:SI 0 "gpc_reg_operand" "")
4406 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4407 (clobber (match_scratch:SI 4 ""))]
4408 "TARGET_POWER && reload_completed"
4409 [(parallel [(set (match_dup 0)
4410 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4411 (clobber (match_dup 4))])
4413 (compare:CC (match_dup 0)
4418 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4419 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4420 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4422 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4423 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4426 {sra|sraw}%I2. %0,%1,%h2
4428 [(set_attr "type" "delayed_compare")
4429 (set_attr "length" "4,8")])
4432 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4433 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4434 (match_operand:SI 2 "reg_or_cint_operand" ""))
4436 (set (match_operand:SI 0 "gpc_reg_operand" "")
4437 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4438 "! TARGET_POWER && reload_completed"
4440 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4442 (compare:CC (match_dup 0)
4446 ;; Floating-point insns, excluding normal data motion.
4448 ;; PowerPC has a full set of single-precision floating point instructions.
4450 ;; For the POWER architecture, we pretend that we have both SFmode and
4451 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4452 ;; The only conversions we will do will be when storing to memory. In that
4453 ;; case, we will use the "frsp" instruction before storing.
4455 ;; Note that when we store into a single-precision memory location, we need to
4456 ;; use the frsp insn first. If the register being stored isn't dead, we
4457 ;; need a scratch register for the frsp. But this is difficult when the store
4458 ;; is done by reload. It is not incorrect to do the frsp on the register in
4459 ;; this case, we just lose precision that we would have otherwise gotten but
4460 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4462 (define_expand "extendsfdf2"
4463 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4464 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "")))]
4465 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4468 (define_insn_and_split "*extendsfdf2_fpr"
4469 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
4470 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "0,f")))]
4471 "TARGET_HARD_FLOAT && TARGET_FPRS"
4475 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
4478 emit_note (NOTE_INSN_DELETED);
4481 [(set_attr "type" "fp")])
4483 (define_expand "truncdfsf2"
4484 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4485 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4486 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4489 (define_insn "*truncdfsf2_fpr"
4490 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4491 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4492 "TARGET_HARD_FLOAT && TARGET_FPRS"
4494 [(set_attr "type" "fp")])
4496 (define_insn "aux_truncdfsf2"
4497 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4498 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4499 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4501 [(set_attr "type" "fp")])
4503 (define_expand "negsf2"
4504 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4505 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4509 (define_insn "*negsf2"
4510 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4511 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4512 "TARGET_HARD_FLOAT && TARGET_FPRS"
4514 [(set_attr "type" "fp")])
4516 (define_expand "abssf2"
4517 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4518 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4522 (define_insn "*abssf2"
4523 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4524 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4525 "TARGET_HARD_FLOAT && TARGET_FPRS"
4527 [(set_attr "type" "fp")])
4530 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4531 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4532 "TARGET_HARD_FLOAT && TARGET_FPRS"
4534 [(set_attr "type" "fp")])
4536 (define_expand "addsf3"
4537 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4538 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4539 (match_operand:SF 2 "gpc_reg_operand" "")))]
4544 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4545 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4546 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4547 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4549 [(set_attr "type" "fp")])
4552 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4553 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4554 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4555 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4556 "{fa|fadd} %0,%1,%2"
4557 [(set_attr "type" "fp")])
4559 (define_expand "subsf3"
4560 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4561 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4562 (match_operand:SF 2 "gpc_reg_operand" "")))]
4567 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4568 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4569 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4570 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4572 [(set_attr "type" "fp")])
4575 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4576 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4577 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4578 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4579 "{fs|fsub} %0,%1,%2"
4580 [(set_attr "type" "fp")])
4582 (define_expand "mulsf3"
4583 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4584 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4585 (match_operand:SF 2 "gpc_reg_operand" "")))]
4590 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4591 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4592 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4593 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4595 [(set_attr "type" "fp")])
4598 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4599 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4600 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4601 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4602 "{fm|fmul} %0,%1,%2"
4603 [(set_attr "type" "dmul")])
4605 (define_expand "divsf3"
4606 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4607 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4608 (match_operand:SF 2 "gpc_reg_operand" "")))]
4613 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4614 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4615 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4616 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4618 [(set_attr "type" "sdiv")])
4621 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4622 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4623 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4624 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4625 "{fd|fdiv} %0,%1,%2"
4626 [(set_attr "type" "ddiv")])
4629 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4630 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4631 (match_operand:SF 2 "gpc_reg_operand" "f"))
4632 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4633 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4634 "fmadds %0,%1,%2,%3"
4635 [(set_attr "type" "fp")])
4638 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4639 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4640 (match_operand:SF 2 "gpc_reg_operand" "f"))
4641 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4642 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4643 "{fma|fmadd} %0,%1,%2,%3"
4644 [(set_attr "type" "dmul")])
4647 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4648 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4649 (match_operand:SF 2 "gpc_reg_operand" "f"))
4650 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4651 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4652 "fmsubs %0,%1,%2,%3"
4653 [(set_attr "type" "fp")])
4656 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4657 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4658 (match_operand:SF 2 "gpc_reg_operand" "f"))
4659 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4660 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4661 "{fms|fmsub} %0,%1,%2,%3"
4662 [(set_attr "type" "dmul")])
4665 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4666 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4667 (match_operand:SF 2 "gpc_reg_operand" "f"))
4668 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4669 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4670 && HONOR_SIGNED_ZEROS (SFmode)"
4671 "fnmadds %0,%1,%2,%3"
4672 [(set_attr "type" "fp")])
4675 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4676 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4677 (match_operand:SF 2 "gpc_reg_operand" "f"))
4678 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4679 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4680 && ! HONOR_SIGNED_ZEROS (SFmode)"
4681 "fnmadds %0,%1,%2,%3"
4682 [(set_attr "type" "fp")])
4685 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4686 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4687 (match_operand:SF 2 "gpc_reg_operand" "f"))
4688 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4689 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4690 "{fnma|fnmadd} %0,%1,%2,%3"
4691 [(set_attr "type" "dmul")])
4694 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4695 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4696 (match_operand:SF 2 "gpc_reg_operand" "f"))
4697 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4698 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4699 && ! HONOR_SIGNED_ZEROS (SFmode)"
4700 "{fnma|fnmadd} %0,%1,%2,%3"
4701 [(set_attr "type" "dmul")])
4704 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4705 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4706 (match_operand:SF 2 "gpc_reg_operand" "f"))
4707 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4708 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4709 && HONOR_SIGNED_ZEROS (SFmode)"
4710 "fnmsubs %0,%1,%2,%3"
4711 [(set_attr "type" "fp")])
4714 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4715 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4716 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4717 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4718 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4719 && ! HONOR_SIGNED_ZEROS (SFmode)"
4720 "fnmsubs %0,%1,%2,%3"
4721 [(set_attr "type" "fp")])
4724 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4725 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4726 (match_operand:SF 2 "gpc_reg_operand" "f"))
4727 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4728 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4729 "{fnms|fnmsub} %0,%1,%2,%3"
4730 [(set_attr "type" "dmul")])
4733 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4734 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4735 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4736 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4737 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4738 && ! HONOR_SIGNED_ZEROS (SFmode)"
4739 "{fnms|fnmsub} %0,%1,%2,%3"
4740 [(set_attr "type" "fp")])
4742 (define_expand "sqrtsf2"
4743 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4744 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4745 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4749 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4750 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4751 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4753 [(set_attr "type" "ssqrt")])
4756 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4757 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4758 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4760 [(set_attr "type" "dsqrt")])
4762 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4763 ;; fsel instruction and some auxiliary computations. Then we just have a
4764 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4766 (define_expand "maxsf3"
4767 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4768 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4769 (match_operand:SF 2 "gpc_reg_operand" ""))
4772 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4773 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4775 (define_expand "minsf3"
4776 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4777 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4778 (match_operand:SF 2 "gpc_reg_operand" ""))
4781 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4782 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4785 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4786 (match_operator:SF 3 "min_max_operator"
4787 [(match_operand:SF 1 "gpc_reg_operand" "")
4788 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4789 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4792 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4793 operands[1], operands[2]);
4797 (define_expand "movsicc"
4798 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4799 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4800 (match_operand:SI 2 "gpc_reg_operand" "")
4801 (match_operand:SI 3 "gpc_reg_operand" "")))]
4805 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4811 ;; We use the BASE_REGS for the isel input operands because, if rA is
4812 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4813 ;; because we may switch the operands and rB may end up being rA.
4815 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4816 ;; leave out the mode in operand 4 and use one pattern, but reload can
4817 ;; change the mode underneath our feet and then gets confused trying
4818 ;; to reload the value.
4819 (define_insn "isel_signed"
4820 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4822 (match_operator 1 "comparison_operator"
4823 [(match_operand:CC 4 "cc_reg_operand" "y")
4825 (match_operand:SI 2 "gpc_reg_operand" "b")
4826 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4829 { return output_isel (operands); }"
4830 [(set_attr "length" "4")])
4832 (define_insn "isel_unsigned"
4833 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4835 (match_operator 1 "comparison_operator"
4836 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4838 (match_operand:SI 2 "gpc_reg_operand" "b")
4839 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4842 { return output_isel (operands); }"
4843 [(set_attr "length" "4")])
4845 (define_expand "movsfcc"
4846 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4847 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4848 (match_operand:SF 2 "gpc_reg_operand" "")
4849 (match_operand:SF 3 "gpc_reg_operand" "")))]
4850 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4853 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4859 (define_insn "*fselsfsf4"
4860 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4861 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4862 (match_operand:SF 4 "zero_fp_constant" "F"))
4863 (match_operand:SF 2 "gpc_reg_operand" "f")
4864 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4865 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4867 [(set_attr "type" "fp")])
4869 (define_insn "*fseldfsf4"
4870 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4871 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4872 (match_operand:DF 4 "zero_fp_constant" "F"))
4873 (match_operand:SF 2 "gpc_reg_operand" "f")
4874 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4875 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4877 [(set_attr "type" "fp")])
4879 (define_expand "negdf2"
4880 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4881 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4882 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4885 (define_insn "*negdf2_fpr"
4886 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4887 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4888 "TARGET_HARD_FLOAT && TARGET_FPRS"
4890 [(set_attr "type" "fp")])
4892 (define_expand "absdf2"
4893 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4894 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4895 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4898 (define_insn "*absdf2_fpr"
4899 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4900 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4901 "TARGET_HARD_FLOAT && TARGET_FPRS"
4903 [(set_attr "type" "fp")])
4905 (define_insn "*nabsdf2_fpr"
4906 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4907 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4908 "TARGET_HARD_FLOAT && TARGET_FPRS"
4910 [(set_attr "type" "fp")])
4912 (define_expand "adddf3"
4913 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4914 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4915 (match_operand:DF 2 "gpc_reg_operand" "")))]
4916 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4919 (define_insn "*adddf3_fpr"
4920 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4921 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4922 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4923 "TARGET_HARD_FLOAT && TARGET_FPRS"
4924 "{fa|fadd} %0,%1,%2"
4925 [(set_attr "type" "fp")])
4927 (define_expand "subdf3"
4928 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4929 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4930 (match_operand:DF 2 "gpc_reg_operand" "")))]
4931 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4934 (define_insn "*subdf3_fpr"
4935 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4936 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4937 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4938 "TARGET_HARD_FLOAT && TARGET_FPRS"
4939 "{fs|fsub} %0,%1,%2"
4940 [(set_attr "type" "fp")])
4942 (define_expand "muldf3"
4943 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4944 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
4945 (match_operand:DF 2 "gpc_reg_operand" "")))]
4946 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4949 (define_insn "*muldf3_fpr"
4950 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4951 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4952 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4953 "TARGET_HARD_FLOAT && TARGET_FPRS"
4954 "{fm|fmul} %0,%1,%2"
4955 [(set_attr "type" "dmul")])
4957 (define_expand "divdf3"
4958 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4959 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
4960 (match_operand:DF 2 "gpc_reg_operand" "")))]
4961 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4964 (define_insn "*divdf3_fpr"
4965 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4966 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4967 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4968 "TARGET_HARD_FLOAT && TARGET_FPRS"
4969 "{fd|fdiv} %0,%1,%2"
4970 [(set_attr "type" "ddiv")])
4973 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4974 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4975 (match_operand:DF 2 "gpc_reg_operand" "f"))
4976 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4977 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4978 "{fma|fmadd} %0,%1,%2,%3"
4979 [(set_attr "type" "dmul")])
4982 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4983 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4984 (match_operand:DF 2 "gpc_reg_operand" "f"))
4985 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4986 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4987 "{fms|fmsub} %0,%1,%2,%3"
4988 [(set_attr "type" "dmul")])
4991 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4992 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4993 (match_operand:DF 2 "gpc_reg_operand" "f"))
4994 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4995 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4996 && HONOR_SIGNED_ZEROS (DFmode)"
4997 "{fnma|fnmadd} %0,%1,%2,%3"
4998 [(set_attr "type" "dmul")])
5001 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5002 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5003 (match_operand:DF 2 "gpc_reg_operand" "f"))
5004 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5005 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5006 && ! HONOR_SIGNED_ZEROS (DFmode)"
5007 "{fnma|fnmadd} %0,%1,%2,%3"
5008 [(set_attr "type" "dmul")])
5011 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5012 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5013 (match_operand:DF 2 "gpc_reg_operand" "f"))
5014 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5015 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5016 && HONOR_SIGNED_ZEROS (DFmode)"
5017 "{fnms|fnmsub} %0,%1,%2,%3"
5018 [(set_attr "type" "dmul")])
5021 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5022 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5023 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5024 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5025 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5026 && ! HONOR_SIGNED_ZEROS (DFmode)"
5027 "{fnms|fnmsub} %0,%1,%2,%3"
5028 [(set_attr "type" "dmul")])
5030 (define_insn "sqrtdf2"
5031 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5032 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5033 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5035 [(set_attr "type" "dsqrt")])
5037 ;; The conditional move instructions allow us to perform max and min
5038 ;; operations even when
5040 (define_expand "maxdf3"
5041 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5042 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5043 (match_operand:DF 2 "gpc_reg_operand" ""))
5046 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5047 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5049 (define_expand "mindf3"
5050 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5051 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5052 (match_operand:DF 2 "gpc_reg_operand" ""))
5055 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5056 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5059 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5060 (match_operator:DF 3 "min_max_operator"
5061 [(match_operand:DF 1 "gpc_reg_operand" "")
5062 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5063 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5066 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5067 operands[1], operands[2]);
5071 (define_expand "movdfcc"
5072 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5073 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5074 (match_operand:DF 2 "gpc_reg_operand" "")
5075 (match_operand:DF 3 "gpc_reg_operand" "")))]
5076 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5079 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5085 (define_insn "*fseldfdf4"
5086 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5087 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5088 (match_operand:DF 4 "zero_fp_constant" "F"))
5089 (match_operand:DF 2 "gpc_reg_operand" "f")
5090 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5091 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5093 [(set_attr "type" "fp")])
5095 (define_insn "*fselsfdf4"
5096 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5097 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5098 (match_operand:SF 4 "zero_fp_constant" "F"))
5099 (match_operand:DF 2 "gpc_reg_operand" "f")
5100 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5103 [(set_attr "type" "fp")])
5105 ;; Conversions to and from floating-point.
5107 (define_expand "fixuns_truncsfsi2"
5108 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5109 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5110 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5113 (define_expand "fix_truncsfsi2"
5114 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5115 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5116 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5119 ; For each of these conversions, there is a define_expand, a define_insn
5120 ; with a '#' template, and a define_split (with C code). The idea is
5121 ; to allow constant folding with the template of the define_insn,
5122 ; then to have the insns split later (between sched1 and final).
5124 (define_expand "floatsidf2"
5125 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5126 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5129 (clobber (match_dup 4))
5130 (clobber (match_dup 5))
5131 (clobber (match_dup 6))])]
5132 "TARGET_HARD_FLOAT && TARGET_FPRS"
5135 if (TARGET_E500_DOUBLE)
5137 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5140 if (TARGET_POWERPC64)
5142 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5143 rtx t1 = gen_reg_rtx (DImode);
5144 rtx t2 = gen_reg_rtx (DImode);
5145 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5149 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5150 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5151 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5152 operands[5] = gen_reg_rtx (DFmode);
5153 operands[6] = gen_reg_rtx (SImode);
5156 (define_insn "*floatsidf2_internal"
5157 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5158 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5159 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5160 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5161 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5162 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5163 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5164 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5166 [(set_attr "length" "24")])
5169 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5170 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5171 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5172 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5173 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5174 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5175 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5176 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5177 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5178 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5179 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5180 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5181 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5182 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5183 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5186 rtx lowword, highword;
5187 if (GET_CODE (operands[4]) != MEM)
5189 highword = XEXP (operands[4], 0);
5190 lowword = plus_constant (highword, 4);
5191 if (! WORDS_BIG_ENDIAN)
5194 tmp = highword; highword = lowword; lowword = tmp;
5197 emit_insn (gen_xorsi3 (operands[6], operands[1],
5198 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5199 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5200 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5201 emit_move_insn (operands[5], operands[4]);
5202 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5206 (define_expand "floatunssisf2"
5207 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5208 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5209 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5212 (define_expand "floatunssidf2"
5213 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5214 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5217 (clobber (match_dup 4))
5218 (clobber (match_dup 5))])]
5219 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5222 if (TARGET_E500_DOUBLE)
5224 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5227 if (TARGET_POWERPC64)
5229 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5230 rtx t1 = gen_reg_rtx (DImode);
5231 rtx t2 = gen_reg_rtx (DImode);
5232 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5237 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5238 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5239 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5240 operands[5] = gen_reg_rtx (DFmode);
5243 (define_insn "*floatunssidf2_internal"
5244 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5245 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5246 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5247 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5248 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5249 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5250 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5252 [(set_attr "length" "20")])
5255 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5256 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5257 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5258 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5259 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5260 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5261 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5262 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5263 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5264 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5265 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5266 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5267 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5270 rtx lowword, highword;
5271 if (GET_CODE (operands[4]) != MEM)
5273 highword = XEXP (operands[4], 0);
5274 lowword = plus_constant (highword, 4);
5275 if (! WORDS_BIG_ENDIAN)
5278 tmp = highword; highword = lowword; lowword = tmp;
5281 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5282 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5283 emit_move_insn (operands[5], operands[4]);
5284 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5288 (define_expand "fix_truncdfsi2"
5289 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5290 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5291 (clobber (match_dup 2))
5292 (clobber (match_dup 3))])]
5293 "(TARGET_POWER2 || TARGET_POWERPC)
5294 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5297 if (TARGET_E500_DOUBLE)
5299 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5302 operands[2] = gen_reg_rtx (DImode);
5303 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5306 (define_insn "*fix_truncdfsi2_internal"
5307 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5308 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5309 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5310 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5311 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5313 [(set_attr "length" "16")])
5316 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5317 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5318 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5319 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5320 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5321 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5322 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5323 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5324 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5328 if (GET_CODE (operands[3]) != MEM)
5330 lowword = XEXP (operands[3], 0);
5331 if (WORDS_BIG_ENDIAN)
5332 lowword = plus_constant (lowword, 4);
5334 emit_insn (gen_fctiwz (operands[2], operands[1]));
5335 emit_move_insn (operands[3], operands[2]);
5336 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5340 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5341 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5342 ; because the first makes it clear that operand 0 is not live
5343 ; before the instruction.
5344 (define_insn "fctiwz"
5345 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5346 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5348 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5349 "{fcirz|fctiwz} %0,%1"
5350 [(set_attr "type" "fp")])
5352 (define_expand "floatsisf2"
5353 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5354 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5355 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5358 (define_insn "floatdidf2"
5359 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5360 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5361 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5363 [(set_attr "type" "fp")])
5365 (define_insn_and_split "floatsidf_ppc64"
5366 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5367 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5368 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5369 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5370 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5371 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5374 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5375 (set (match_dup 2) (match_dup 3))
5376 (set (match_dup 4) (match_dup 2))
5377 (set (match_dup 0) (float:DF (match_dup 4)))]
5380 (define_insn_and_split "floatunssidf_ppc64"
5381 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5382 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5383 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5384 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5385 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5386 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5389 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5390 (set (match_dup 2) (match_dup 3))
5391 (set (match_dup 4) (match_dup 2))
5392 (set (match_dup 0) (float:DF (match_dup 4)))]
5395 (define_insn "fix_truncdfdi2"
5396 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5397 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5398 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5400 [(set_attr "type" "fp")])
5402 (define_expand "floatdisf2"
5403 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5404 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5405 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5408 rtx val = operands[1];
5409 if (!flag_unsafe_math_optimizations)
5411 rtx label = gen_label_rtx ();
5412 val = gen_reg_rtx (DImode);
5413 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5416 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5420 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5421 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5422 ;; from double rounding.
5423 (define_insn_and_split "floatdisf2_internal1"
5424 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5425 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5426 (clobber (match_scratch:DF 2 "=f"))]
5427 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5429 "&& reload_completed"
5431 (float:DF (match_dup 1)))
5433 (float_truncate:SF (match_dup 2)))]
5436 ;; Twiddles bits to avoid double rounding.
5437 ;; Bits that might be truncated when converting to DFmode are replaced
5438 ;; by a bit that won't be lost at that stage, but is below the SFmode
5439 ;; rounding position.
5440 (define_expand "floatdisf2_internal2"
5441 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
5443 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
5445 (clobber (scratch:CC))])
5446 (set (match_dup 3) (plus:DI (match_dup 3)
5448 (set (match_dup 0) (plus:DI (match_dup 0)
5450 (set (match_dup 4) (compare:CCUNS (match_dup 3)
5452 (set (match_dup 0) (ior:DI (match_dup 0)
5454 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
5456 (clobber (scratch:CC))])
5457 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
5458 (label_ref (match_operand:DI 2 "" ""))
5460 (set (match_dup 0) (match_dup 1))]
5461 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5464 operands[3] = gen_reg_rtx (DImode);
5465 operands[4] = gen_reg_rtx (CCUNSmode);
5468 ;; Define the DImode operations that can be done in a small number
5469 ;; of instructions. The & constraints are to prevent the register
5470 ;; allocator from allocating registers that overlap with the inputs
5471 ;; (for example, having an input in 7,8 and an output in 6,7). We
5472 ;; also allow for the output being the same as one of the inputs.
5474 (define_insn "*adddi3_noppc64"
5475 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5476 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5477 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5478 "! TARGET_POWERPC64"
5481 if (WORDS_BIG_ENDIAN)
5482 return (GET_CODE (operands[2])) != CONST_INT
5483 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5484 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5486 return (GET_CODE (operands[2])) != CONST_INT
5487 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5488 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5490 [(set_attr "type" "two")
5491 (set_attr "length" "8")])
5493 (define_insn "*subdi3_noppc64"
5494 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5495 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5496 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5497 "! TARGET_POWERPC64"
5500 if (WORDS_BIG_ENDIAN)
5501 return (GET_CODE (operands[1]) != CONST_INT)
5502 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5503 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5505 return (GET_CODE (operands[1]) != CONST_INT)
5506 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5507 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5509 [(set_attr "type" "two")
5510 (set_attr "length" "8")])
5512 (define_insn "*negdi2_noppc64"
5513 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5514 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5515 "! TARGET_POWERPC64"
5518 return (WORDS_BIG_ENDIAN)
5519 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5520 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5522 [(set_attr "type" "two")
5523 (set_attr "length" "8")])
5525 (define_expand "mulsidi3"
5526 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5527 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5528 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5529 "! TARGET_POWERPC64"
5532 if (! TARGET_POWER && ! TARGET_POWERPC)
5534 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5535 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5536 emit_insn (gen_mull_call ());
5537 if (WORDS_BIG_ENDIAN)
5538 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5541 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5542 gen_rtx_REG (SImode, 3));
5543 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5544 gen_rtx_REG (SImode, 4));
5548 else if (TARGET_POWER)
5550 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5555 (define_insn "mulsidi3_mq"
5556 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5557 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5558 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5559 (clobber (match_scratch:SI 3 "=q"))]
5561 "mul %0,%1,%2\;mfmq %L0"
5562 [(set_attr "type" "imul")
5563 (set_attr "length" "8")])
5565 (define_insn "*mulsidi3_no_mq"
5566 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5567 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5568 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5569 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5572 return (WORDS_BIG_ENDIAN)
5573 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5574 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5576 [(set_attr "type" "imul")
5577 (set_attr "length" "8")])
5580 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5581 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5582 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5583 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5586 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5587 (sign_extend:DI (match_dup 2)))
5590 (mult:SI (match_dup 1)
5594 int endian = (WORDS_BIG_ENDIAN == 0);
5595 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5596 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5599 (define_expand "umulsidi3"
5600 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5601 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5602 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5603 "TARGET_POWERPC && ! TARGET_POWERPC64"
5608 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5613 (define_insn "umulsidi3_mq"
5614 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5615 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5616 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5617 (clobber (match_scratch:SI 3 "=q"))]
5618 "TARGET_POWERPC && TARGET_POWER"
5621 return (WORDS_BIG_ENDIAN)
5622 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5623 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5625 [(set_attr "type" "imul")
5626 (set_attr "length" "8")])
5628 (define_insn "*umulsidi3_no_mq"
5629 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5630 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5631 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5632 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5635 return (WORDS_BIG_ENDIAN)
5636 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5637 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5639 [(set_attr "type" "imul")
5640 (set_attr "length" "8")])
5643 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5644 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5645 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5646 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5649 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5650 (zero_extend:DI (match_dup 2)))
5653 (mult:SI (match_dup 1)
5657 int endian = (WORDS_BIG_ENDIAN == 0);
5658 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5659 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5662 (define_expand "smulsi3_highpart"
5663 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5665 (lshiftrt:DI (mult:DI (sign_extend:DI
5666 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5668 (match_operand:SI 2 "gpc_reg_operand" "r")))
5673 if (! TARGET_POWER && ! TARGET_POWERPC)
5675 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5676 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5677 emit_insn (gen_mulh_call ());
5678 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5681 else if (TARGET_POWER)
5683 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5688 (define_insn "smulsi3_highpart_mq"
5689 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5691 (lshiftrt:DI (mult:DI (sign_extend:DI
5692 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5694 (match_operand:SI 2 "gpc_reg_operand" "r")))
5696 (clobber (match_scratch:SI 3 "=q"))]
5699 [(set_attr "type" "imul")])
5701 (define_insn "*smulsi3_highpart_no_mq"
5702 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5704 (lshiftrt:DI (mult:DI (sign_extend:DI
5705 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5707 (match_operand:SI 2 "gpc_reg_operand" "r")))
5709 "TARGET_POWERPC && ! TARGET_POWER"
5711 [(set_attr "type" "imul")])
5713 (define_expand "umulsi3_highpart"
5714 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5716 (lshiftrt:DI (mult:DI (zero_extend:DI
5717 (match_operand:SI 1 "gpc_reg_operand" ""))
5719 (match_operand:SI 2 "gpc_reg_operand" "")))
5726 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5731 (define_insn "umulsi3_highpart_mq"
5732 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5734 (lshiftrt:DI (mult:DI (zero_extend:DI
5735 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5737 (match_operand:SI 2 "gpc_reg_operand" "r")))
5739 (clobber (match_scratch:SI 3 "=q"))]
5740 "TARGET_POWERPC && TARGET_POWER"
5742 [(set_attr "type" "imul")])
5744 (define_insn "*umulsi3_highpart_no_mq"
5745 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5747 (lshiftrt:DI (mult:DI (zero_extend:DI
5748 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5750 (match_operand:SI 2 "gpc_reg_operand" "r")))
5752 "TARGET_POWERPC && ! TARGET_POWER"
5754 [(set_attr "type" "imul")])
5756 ;; If operands 0 and 2 are in the same register, we have a problem. But
5757 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5758 ;; why we have the strange constraints below.
5759 (define_insn "ashldi3_power"
5760 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5761 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5762 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5763 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5766 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5767 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5768 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5769 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5770 [(set_attr "length" "8")])
5772 (define_insn "lshrdi3_power"
5773 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5774 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5775 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5776 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5779 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5780 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5781 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5782 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5783 [(set_attr "length" "8")])
5785 ;; Shift by a variable amount is too complex to be worth open-coding. We
5786 ;; just handle shifts by constants.
5787 (define_insn "ashrdi3_power"
5788 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5789 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5790 (match_operand:SI 2 "const_int_operand" "M,i")))
5791 (clobber (match_scratch:SI 3 "=X,q"))]
5794 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5795 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5796 [(set_attr "length" "8")])
5798 (define_insn "ashrdi3_no_power"
5799 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5800 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5801 (match_operand:SI 2 "const_int_operand" "M,i")))]
5802 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5804 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5805 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5806 [(set_attr "type" "two,three")
5807 (set_attr "length" "8,12")])
5809 (define_insn "*ashrdisi3_noppc64"
5810 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5811 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5812 (const_int 32)) 4))]
5813 "TARGET_32BIT && !TARGET_POWERPC64"
5816 if (REGNO (operands[0]) == REGNO (operands[1]))
5819 return \"mr %0,%1\";
5821 [(set_attr "length" "4")])
5824 ;; PowerPC64 DImode operations.
5826 (define_expand "adddi3"
5827 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5828 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5829 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5833 if (! TARGET_POWERPC64)
5835 if (non_short_cint_operand (operands[2], DImode))
5839 if (GET_CODE (operands[2]) == CONST_INT
5840 && ! add_operand (operands[2], DImode))
5842 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5843 ? operands[0] : gen_reg_rtx (DImode));
5845 HOST_WIDE_INT val = INTVAL (operands[2]);
5846 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5847 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5849 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5852 /* The ordering here is important for the prolog expander.
5853 When space is allocated from the stack, adding 'low' first may
5854 produce a temporary deallocation (which would be bad). */
5855 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5856 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5861 ;; Discourage ai/addic because of carry but provide it in an alternative
5862 ;; allowing register zero as source.
5864 (define_insn "*adddi3_internal1"
5865 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5866 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5867 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5875 (define_insn "*adddi3_internal2"
5876 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5877 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5878 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5880 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5887 [(set_attr "type" "fast_compare,compare,compare,compare")
5888 (set_attr "length" "4,4,8,8")])
5891 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5892 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5893 (match_operand:DI 2 "reg_or_short_operand" ""))
5895 (clobber (match_scratch:DI 3 ""))]
5896 "TARGET_POWERPC64 && reload_completed"
5898 (plus:DI (match_dup 1) (match_dup 2)))
5900 (compare:CC (match_dup 3)
5904 (define_insn "*adddi3_internal3"
5905 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5906 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5907 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5909 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5910 (plus:DI (match_dup 1) (match_dup 2)))]
5917 [(set_attr "type" "fast_compare,compare,compare,compare")
5918 (set_attr "length" "4,4,8,8")])
5921 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5922 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5923 (match_operand:DI 2 "reg_or_short_operand" ""))
5925 (set (match_operand:DI 0 "gpc_reg_operand" "")
5926 (plus:DI (match_dup 1) (match_dup 2)))]
5927 "TARGET_POWERPC64 && reload_completed"
5929 (plus:DI (match_dup 1) (match_dup 2)))
5931 (compare:CC (match_dup 0)
5935 ;; Split an add that we can't do in one insn into two insns, each of which
5936 ;; does one 16-bit part. This is used by combine. Note that the low-order
5937 ;; add should be last in case the result gets used in an address.
5940 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5941 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5942 (match_operand:DI 2 "non_add_cint_operand" "")))]
5944 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5945 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5948 HOST_WIDE_INT val = INTVAL (operands[2]);
5949 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5950 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5952 operands[4] = GEN_INT (low);
5953 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5954 operands[3] = GEN_INT (rest);
5955 else if (! no_new_pseudos)
5957 operands[3] = gen_reg_rtx (DImode);
5958 emit_move_insn (operands[3], operands[2]);
5959 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5966 (define_insn "one_cmpldi2"
5967 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5968 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5973 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5974 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5976 (clobber (match_scratch:DI 2 "=r,r"))]
5981 [(set_attr "type" "compare")
5982 (set_attr "length" "4,8")])
5985 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5986 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5988 (clobber (match_scratch:DI 2 ""))]
5989 "TARGET_POWERPC64 && reload_completed"
5991 (not:DI (match_dup 1)))
5993 (compare:CC (match_dup 2)
5998 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5999 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6001 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6002 (not:DI (match_dup 1)))]
6007 [(set_attr "type" "compare")
6008 (set_attr "length" "4,8")])
6011 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6012 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6014 (set (match_operand:DI 0 "gpc_reg_operand" "")
6015 (not:DI (match_dup 1)))]
6016 "TARGET_POWERPC64 && reload_completed"
6018 (not:DI (match_dup 1)))
6020 (compare:CC (match_dup 0)
6025 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6026 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
6027 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
6034 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6035 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6036 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6038 (clobber (match_scratch:DI 3 "=r,r"))]
6043 [(set_attr "type" "fast_compare")
6044 (set_attr "length" "4,8")])
6047 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6048 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6049 (match_operand:DI 2 "gpc_reg_operand" ""))
6051 (clobber (match_scratch:DI 3 ""))]
6052 "TARGET_POWERPC64 && reload_completed"
6054 (minus:DI (match_dup 1) (match_dup 2)))
6056 (compare:CC (match_dup 3)
6061 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6062 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6063 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6065 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6066 (minus:DI (match_dup 1) (match_dup 2)))]
6071 [(set_attr "type" "fast_compare")
6072 (set_attr "length" "4,8")])
6075 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6076 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6077 (match_operand:DI 2 "gpc_reg_operand" ""))
6079 (set (match_operand:DI 0 "gpc_reg_operand" "")
6080 (minus:DI (match_dup 1) (match_dup 2)))]
6081 "TARGET_POWERPC64 && reload_completed"
6083 (minus:DI (match_dup 1) (match_dup 2)))
6085 (compare:CC (match_dup 0)
6089 (define_expand "subdi3"
6090 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6091 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
6092 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
6096 if (GET_CODE (operands[2]) == CONST_INT)
6098 emit_insn (gen_adddi3 (operands[0], operands[1],
6099 negate_rtx (DImode, operands[2])));
6104 (define_insn_and_split "absdi2"
6105 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6106 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6107 (clobber (match_scratch:DI 2 "=&r,&r"))]
6110 "&& reload_completed"
6111 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6112 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6113 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6116 (define_insn_and_split "*nabsdi2"
6117 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6118 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6119 (clobber (match_scratch:DI 2 "=&r,&r"))]
6122 "&& reload_completed"
6123 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6124 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6125 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6128 (define_expand "negdi2"
6129 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6130 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
6135 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6136 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6141 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6142 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6144 (clobber (match_scratch:DI 2 "=r,r"))]
6149 [(set_attr "type" "fast_compare")
6150 (set_attr "length" "4,8")])
6153 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6154 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6156 (clobber (match_scratch:DI 2 ""))]
6157 "TARGET_POWERPC64 && reload_completed"
6159 (neg:DI (match_dup 1)))
6161 (compare:CC (match_dup 2)
6166 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6167 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6169 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6170 (neg:DI (match_dup 1)))]
6175 [(set_attr "type" "fast_compare")
6176 (set_attr "length" "4,8")])
6179 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6180 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6182 (set (match_operand:DI 0 "gpc_reg_operand" "")
6183 (neg:DI (match_dup 1)))]
6184 "TARGET_POWERPC64 && reload_completed"
6186 (neg:DI (match_dup 1)))
6188 (compare:CC (match_dup 0)
6192 (define_insn "clzdi2"
6193 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6194 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6198 (define_expand "ctzdi2"
6200 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6201 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6203 (clobber (scratch:CC))])
6204 (set (match_dup 4) (clz:DI (match_dup 3)))
6205 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6206 (minus:DI (const_int 63) (match_dup 4)))]
6209 operands[2] = gen_reg_rtx (DImode);
6210 operands[3] = gen_reg_rtx (DImode);
6211 operands[4] = gen_reg_rtx (DImode);
6214 (define_expand "ffsdi2"
6216 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6217 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6219 (clobber (scratch:CC))])
6220 (set (match_dup 4) (clz:DI (match_dup 3)))
6221 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6222 (minus:DI (const_int 64) (match_dup 4)))]
6225 operands[2] = gen_reg_rtx (DImode);
6226 operands[3] = gen_reg_rtx (DImode);
6227 operands[4] = gen_reg_rtx (DImode);
6230 (define_insn "muldi3"
6231 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6232 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6233 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6236 [(set_attr "type" "lmul")])
6238 (define_insn "*muldi3_internal1"
6239 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6240 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6241 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6243 (clobber (match_scratch:DI 3 "=r,r"))]
6248 [(set_attr "type" "lmul_compare")
6249 (set_attr "length" "4,8")])
6252 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6253 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6254 (match_operand:DI 2 "gpc_reg_operand" ""))
6256 (clobber (match_scratch:DI 3 ""))]
6257 "TARGET_POWERPC64 && reload_completed"
6259 (mult:DI (match_dup 1) (match_dup 2)))
6261 (compare:CC (match_dup 3)
6265 (define_insn "*muldi3_internal2"
6266 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6267 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6268 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6270 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6271 (mult:DI (match_dup 1) (match_dup 2)))]
6276 [(set_attr "type" "lmul_compare")
6277 (set_attr "length" "4,8")])
6280 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6281 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6282 (match_operand:DI 2 "gpc_reg_operand" ""))
6284 (set (match_operand:DI 0 "gpc_reg_operand" "")
6285 (mult:DI (match_dup 1) (match_dup 2)))]
6286 "TARGET_POWERPC64 && reload_completed"
6288 (mult:DI (match_dup 1) (match_dup 2)))
6290 (compare:CC (match_dup 0)
6294 (define_insn "smuldi3_highpart"
6295 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6297 (lshiftrt:TI (mult:TI (sign_extend:TI
6298 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6300 (match_operand:DI 2 "gpc_reg_operand" "r")))
6304 [(set_attr "type" "lmul")])
6306 (define_insn "umuldi3_highpart"
6307 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6309 (lshiftrt:TI (mult:TI (zero_extend:TI
6310 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6312 (match_operand:DI 2 "gpc_reg_operand" "r")))
6316 [(set_attr "type" "lmul")])
6318 (define_expand "divdi3"
6319 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6320 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6321 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6325 if (GET_CODE (operands[2]) == CONST_INT
6326 && INTVAL (operands[2]) > 0
6327 && exact_log2 (INTVAL (operands[2])) >= 0)
6330 operands[2] = force_reg (DImode, operands[2]);
6333 (define_expand "moddi3"
6334 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6335 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6336 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6344 if (GET_CODE (operands[2]) != CONST_INT
6345 || INTVAL (operands[2]) <= 0
6346 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6349 temp1 = gen_reg_rtx (DImode);
6350 temp2 = gen_reg_rtx (DImode);
6352 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6353 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6354 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6359 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6360 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6361 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6363 "sradi %0,%1,%p2\;addze %0,%0"
6364 [(set_attr "type" "two")
6365 (set_attr "length" "8")])
6368 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6369 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6370 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6372 (clobber (match_scratch:DI 3 "=r,r"))]
6375 sradi %3,%1,%p2\;addze. %3,%3
6377 [(set_attr "type" "compare")
6378 (set_attr "length" "8,12")])
6381 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6382 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6383 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6385 (clobber (match_scratch:DI 3 ""))]
6386 "TARGET_POWERPC64 && reload_completed"
6388 (div:DI (match_dup 1) (match_dup 2)))
6390 (compare:CC (match_dup 3)
6395 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6396 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6397 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6399 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6400 (div:DI (match_dup 1) (match_dup 2)))]
6403 sradi %0,%1,%p2\;addze. %0,%0
6405 [(set_attr "type" "compare")
6406 (set_attr "length" "8,12")])
6409 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6410 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6411 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6413 (set (match_operand:DI 0 "gpc_reg_operand" "")
6414 (div:DI (match_dup 1) (match_dup 2)))]
6415 "TARGET_POWERPC64 && reload_completed"
6417 (div:DI (match_dup 1) (match_dup 2)))
6419 (compare:CC (match_dup 0)
6424 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6425 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6426 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6429 [(set_attr "type" "ldiv")])
6431 (define_insn "udivdi3"
6432 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6433 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6434 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6437 [(set_attr "type" "ldiv")])
6439 (define_insn "rotldi3"
6440 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6441 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6442 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6444 "rld%I2cl %0,%1,%H2,0")
6446 (define_insn "*rotldi3_internal2"
6447 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6448 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6449 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6451 (clobber (match_scratch:DI 3 "=r,r"))]
6454 rld%I2cl. %3,%1,%H2,0
6456 [(set_attr "type" "delayed_compare")
6457 (set_attr "length" "4,8")])
6460 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6461 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6462 (match_operand:DI 2 "reg_or_cint_operand" ""))
6464 (clobber (match_scratch:DI 3 ""))]
6465 "TARGET_POWERPC64 && reload_completed"
6467 (rotate:DI (match_dup 1) (match_dup 2)))
6469 (compare:CC (match_dup 3)
6473 (define_insn "*rotldi3_internal3"
6474 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6475 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6476 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6478 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6479 (rotate:DI (match_dup 1) (match_dup 2)))]
6482 rld%I2cl. %0,%1,%H2,0
6484 [(set_attr "type" "delayed_compare")
6485 (set_attr "length" "4,8")])
6488 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6489 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6490 (match_operand:DI 2 "reg_or_cint_operand" ""))
6492 (set (match_operand:DI 0 "gpc_reg_operand" "")
6493 (rotate:DI (match_dup 1) (match_dup 2)))]
6494 "TARGET_POWERPC64 && reload_completed"
6496 (rotate:DI (match_dup 1) (match_dup 2)))
6498 (compare:CC (match_dup 0)
6502 (define_insn "*rotldi3_internal4"
6503 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6504 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6505 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6506 (match_operand:DI 3 "mask64_operand" "n")))]
6508 "rld%I2c%B3 %0,%1,%H2,%S3")
6510 (define_insn "*rotldi3_internal5"
6511 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6513 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6514 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6515 (match_operand:DI 3 "mask64_operand" "n,n"))
6517 (clobber (match_scratch:DI 4 "=r,r"))]
6520 rld%I2c%B3. %4,%1,%H2,%S3
6522 [(set_attr "type" "delayed_compare")
6523 (set_attr "length" "4,8")])
6526 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6528 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6529 (match_operand:DI 2 "reg_or_cint_operand" ""))
6530 (match_operand:DI 3 "mask64_operand" ""))
6532 (clobber (match_scratch:DI 4 ""))]
6533 "TARGET_POWERPC64 && reload_completed"
6535 (and:DI (rotate:DI (match_dup 1)
6539 (compare:CC (match_dup 4)
6543 (define_insn "*rotldi3_internal6"
6544 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6546 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6547 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6548 (match_operand:DI 3 "mask64_operand" "n,n"))
6550 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6551 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6554 rld%I2c%B3. %0,%1,%H2,%S3
6556 [(set_attr "type" "delayed_compare")
6557 (set_attr "length" "4,8")])
6560 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6562 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6563 (match_operand:DI 2 "reg_or_cint_operand" ""))
6564 (match_operand:DI 3 "mask64_operand" ""))
6566 (set (match_operand:DI 0 "gpc_reg_operand" "")
6567 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6568 "TARGET_POWERPC64 && reload_completed"
6570 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6572 (compare:CC (match_dup 0)
6576 (define_insn "*rotldi3_internal7"
6577 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6580 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6581 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6583 "rld%I2cl %0,%1,%H2,56")
6585 (define_insn "*rotldi3_internal8"
6586 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6587 (compare:CC (zero_extend:DI
6589 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6590 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6592 (clobber (match_scratch:DI 3 "=r,r"))]
6595 rld%I2cl. %3,%1,%H2,56
6597 [(set_attr "type" "delayed_compare")
6598 (set_attr "length" "4,8")])
6601 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6602 (compare:CC (zero_extend:DI
6604 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6605 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6607 (clobber (match_scratch:DI 3 ""))]
6608 "TARGET_POWERPC64 && reload_completed"
6610 (zero_extend:DI (subreg:QI
6611 (rotate:DI (match_dup 1)
6614 (compare:CC (match_dup 3)
6618 (define_insn "*rotldi3_internal9"
6619 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6620 (compare:CC (zero_extend:DI
6622 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6623 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6625 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6626 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6629 rld%I2cl. %0,%1,%H2,56
6631 [(set_attr "type" "delayed_compare")
6632 (set_attr "length" "4,8")])
6635 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6636 (compare:CC (zero_extend:DI
6638 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6639 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6641 (set (match_operand:DI 0 "gpc_reg_operand" "")
6642 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6643 "TARGET_POWERPC64 && reload_completed"
6645 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6647 (compare:CC (match_dup 0)
6651 (define_insn "*rotldi3_internal10"
6652 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6655 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6656 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6658 "rld%I2cl %0,%1,%H2,48")
6660 (define_insn "*rotldi3_internal11"
6661 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6662 (compare:CC (zero_extend:DI
6664 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6665 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6667 (clobber (match_scratch:DI 3 "=r,r"))]
6670 rld%I2cl. %3,%1,%H2,48
6672 [(set_attr "type" "delayed_compare")
6673 (set_attr "length" "4,8")])
6676 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6677 (compare:CC (zero_extend:DI
6679 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6680 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6682 (clobber (match_scratch:DI 3 ""))]
6683 "TARGET_POWERPC64 && reload_completed"
6685 (zero_extend:DI (subreg:HI
6686 (rotate:DI (match_dup 1)
6689 (compare:CC (match_dup 3)
6693 (define_insn "*rotldi3_internal12"
6694 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6695 (compare:CC (zero_extend:DI
6697 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6698 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6700 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6701 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6704 rld%I2cl. %0,%1,%H2,48
6706 [(set_attr "type" "delayed_compare")
6707 (set_attr "length" "4,8")])
6710 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6711 (compare:CC (zero_extend:DI
6713 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6714 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6716 (set (match_operand:DI 0 "gpc_reg_operand" "")
6717 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6718 "TARGET_POWERPC64 && reload_completed"
6720 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6722 (compare:CC (match_dup 0)
6726 (define_insn "*rotldi3_internal13"
6727 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6730 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6731 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6733 "rld%I2cl %0,%1,%H2,32")
6735 (define_insn "*rotldi3_internal14"
6736 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6737 (compare:CC (zero_extend:DI
6739 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6740 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6742 (clobber (match_scratch:DI 3 "=r,r"))]
6745 rld%I2cl. %3,%1,%H2,32
6747 [(set_attr "type" "delayed_compare")
6748 (set_attr "length" "4,8")])
6751 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6752 (compare:CC (zero_extend:DI
6754 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6755 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6757 (clobber (match_scratch:DI 3 ""))]
6758 "TARGET_POWERPC64 && reload_completed"
6760 (zero_extend:DI (subreg:SI
6761 (rotate:DI (match_dup 1)
6764 (compare:CC (match_dup 3)
6768 (define_insn "*rotldi3_internal15"
6769 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6770 (compare:CC (zero_extend:DI
6772 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6773 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6775 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6776 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6779 rld%I2cl. %0,%1,%H2,32
6781 [(set_attr "type" "delayed_compare")
6782 (set_attr "length" "4,8")])
6785 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6786 (compare:CC (zero_extend:DI
6788 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6789 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6791 (set (match_operand:DI 0 "gpc_reg_operand" "")
6792 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6793 "TARGET_POWERPC64 && reload_completed"
6795 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6797 (compare:CC (match_dup 0)
6801 (define_expand "ashldi3"
6802 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6803 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6804 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6805 "TARGET_POWERPC64 || TARGET_POWER"
6808 if (TARGET_POWERPC64)
6810 else if (TARGET_POWER)
6812 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6819 (define_insn "*ashldi3_internal1"
6820 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6821 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6822 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6826 (define_insn "*ashldi3_internal2"
6827 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6828 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6829 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6831 (clobber (match_scratch:DI 3 "=r,r"))]
6836 [(set_attr "type" "delayed_compare")
6837 (set_attr "length" "4,8")])
6840 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6841 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6842 (match_operand:SI 2 "reg_or_cint_operand" ""))
6844 (clobber (match_scratch:DI 3 ""))]
6845 "TARGET_POWERPC64 && reload_completed"
6847 (ashift:DI (match_dup 1) (match_dup 2)))
6849 (compare:CC (match_dup 3)
6853 (define_insn "*ashldi3_internal3"
6854 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6855 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6856 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6858 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6859 (ashift:DI (match_dup 1) (match_dup 2)))]
6864 [(set_attr "type" "delayed_compare")
6865 (set_attr "length" "4,8")])
6868 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6869 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6870 (match_operand:SI 2 "reg_or_cint_operand" ""))
6872 (set (match_operand:DI 0 "gpc_reg_operand" "")
6873 (ashift:DI (match_dup 1) (match_dup 2)))]
6874 "TARGET_POWERPC64 && reload_completed"
6876 (ashift:DI (match_dup 1) (match_dup 2)))
6878 (compare:CC (match_dup 0)
6882 (define_insn "*ashldi3_internal4"
6883 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6884 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6885 (match_operand:SI 2 "const_int_operand" "i"))
6886 (match_operand:DI 3 "const_int_operand" "n")))]
6887 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6888 "rldic %0,%1,%H2,%W3")
6890 (define_insn "ashldi3_internal5"
6891 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6893 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6894 (match_operand:SI 2 "const_int_operand" "i,i"))
6895 (match_operand:DI 3 "const_int_operand" "n,n"))
6897 (clobber (match_scratch:DI 4 "=r,r"))]
6898 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6900 rldic. %4,%1,%H2,%W3
6902 [(set_attr "type" "delayed_compare")
6903 (set_attr "length" "4,8")])
6906 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6908 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6909 (match_operand:SI 2 "const_int_operand" ""))
6910 (match_operand:DI 3 "const_int_operand" ""))
6912 (clobber (match_scratch:DI 4 ""))]
6913 "TARGET_POWERPC64 && reload_completed
6914 && includes_rldic_lshift_p (operands[2], operands[3])"
6916 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6919 (compare:CC (match_dup 4)
6923 (define_insn "*ashldi3_internal6"
6924 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6926 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6927 (match_operand:SI 2 "const_int_operand" "i,i"))
6928 (match_operand:DI 3 "const_int_operand" "n,n"))
6930 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6931 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6932 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6934 rldic. %0,%1,%H2,%W3
6936 [(set_attr "type" "delayed_compare")
6937 (set_attr "length" "4,8")])
6940 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6942 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6943 (match_operand:SI 2 "const_int_operand" ""))
6944 (match_operand:DI 3 "const_int_operand" ""))
6946 (set (match_operand:DI 0 "gpc_reg_operand" "")
6947 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6948 "TARGET_POWERPC64 && reload_completed
6949 && includes_rldic_lshift_p (operands[2], operands[3])"
6951 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6954 (compare:CC (match_dup 0)
6958 (define_insn "*ashldi3_internal7"
6959 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6960 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6961 (match_operand:SI 2 "const_int_operand" "i"))
6962 (match_operand:DI 3 "mask64_operand" "n")))]
6963 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6964 "rldicr %0,%1,%H2,%S3")
6966 (define_insn "ashldi3_internal8"
6967 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6969 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6970 (match_operand:SI 2 "const_int_operand" "i,i"))
6971 (match_operand:DI 3 "mask64_operand" "n,n"))
6973 (clobber (match_scratch:DI 4 "=r,r"))]
6974 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6976 rldicr. %4,%1,%H2,%S3
6978 [(set_attr "type" "delayed_compare")
6979 (set_attr "length" "4,8")])
6982 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6984 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6985 (match_operand:SI 2 "const_int_operand" ""))
6986 (match_operand:DI 3 "mask64_operand" ""))
6988 (clobber (match_scratch:DI 4 ""))]
6989 "TARGET_POWERPC64 && reload_completed
6990 && includes_rldicr_lshift_p (operands[2], operands[3])"
6992 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6995 (compare:CC (match_dup 4)
6999 (define_insn "*ashldi3_internal9"
7000 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7002 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7003 (match_operand:SI 2 "const_int_operand" "i,i"))
7004 (match_operand:DI 3 "mask64_operand" "n,n"))
7006 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7007 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7008 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7010 rldicr. %0,%1,%H2,%S3
7012 [(set_attr "type" "delayed_compare")
7013 (set_attr "length" "4,8")])
7016 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7018 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7019 (match_operand:SI 2 "const_int_operand" ""))
7020 (match_operand:DI 3 "mask64_operand" ""))
7022 (set (match_operand:DI 0 "gpc_reg_operand" "")
7023 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7024 "TARGET_POWERPC64 && reload_completed
7025 && includes_rldicr_lshift_p (operands[2], operands[3])"
7027 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7030 (compare:CC (match_dup 0)
7034 (define_expand "lshrdi3"
7035 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7036 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7037 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7038 "TARGET_POWERPC64 || TARGET_POWER"
7041 if (TARGET_POWERPC64)
7043 else if (TARGET_POWER)
7045 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7052 (define_insn "*lshrdi3_internal1"
7053 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7054 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7055 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7059 (define_insn "*lshrdi3_internal2"
7060 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7061 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7062 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7064 (clobber (match_scratch:DI 3 "=r,r"))]
7069 [(set_attr "type" "delayed_compare")
7070 (set_attr "length" "4,8")])
7073 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7074 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7075 (match_operand:SI 2 "reg_or_cint_operand" ""))
7077 (clobber (match_scratch:DI 3 ""))]
7078 "TARGET_POWERPC64 && reload_completed"
7080 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7082 (compare:CC (match_dup 3)
7086 (define_insn "*lshrdi3_internal3"
7087 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7088 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7089 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7091 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7092 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7097 [(set_attr "type" "delayed_compare")
7098 (set_attr "length" "4,8")])
7101 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7102 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7103 (match_operand:SI 2 "reg_or_cint_operand" ""))
7105 (set (match_operand:DI 0 "gpc_reg_operand" "")
7106 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7107 "TARGET_POWERPC64 && reload_completed"
7109 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7111 (compare:CC (match_dup 0)
7115 (define_expand "ashrdi3"
7116 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7117 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7118 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7122 if (TARGET_POWERPC64)
7124 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7126 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7129 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7130 && WORDS_BIG_ENDIAN)
7132 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7139 (define_insn "*ashrdi3_internal1"
7140 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7141 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7142 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7144 "srad%I2 %0,%1,%H2")
7146 (define_insn "*ashrdi3_internal2"
7147 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7148 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7149 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7151 (clobber (match_scratch:DI 3 "=r,r"))]
7156 [(set_attr "type" "delayed_compare")
7157 (set_attr "length" "4,8")])
7160 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7161 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7162 (match_operand:SI 2 "reg_or_cint_operand" ""))
7164 (clobber (match_scratch:DI 3 ""))]
7165 "TARGET_POWERPC64 && reload_completed"
7167 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7169 (compare:CC (match_dup 3)
7173 (define_insn "*ashrdi3_internal3"
7174 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7175 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7176 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7178 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7179 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7184 [(set_attr "type" "delayed_compare")
7185 (set_attr "length" "4,8")])
7188 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7189 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7190 (match_operand:SI 2 "reg_or_cint_operand" ""))
7192 (set (match_operand:DI 0 "gpc_reg_operand" "")
7193 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7194 "TARGET_POWERPC64 && reload_completed"
7196 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7198 (compare:CC (match_dup 0)
7202 (define_insn "anddi3"
7203 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7204 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7205 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7206 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7210 rldic%B2 %0,%1,0,%S2
7211 rlwinm %0,%1,0,%m2,%M2
7215 [(set_attr "type" "*,*,*,compare,compare,*")
7216 (set_attr "length" "4,4,4,4,4,8")])
7219 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7220 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7221 (match_operand:DI 2 "mask64_2_operand" "")))
7222 (clobber (match_scratch:CC 3 ""))]
7224 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7225 && !mask64_operand (operands[2], DImode)"
7227 (and:DI (rotate:DI (match_dup 1)
7231 (and:DI (rotate:DI (match_dup 0)
7235 build_mask64_2_operands (operands[2], &operands[4]);
7238 (define_insn "*anddi3_internal2"
7239 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7240 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7241 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7243 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7244 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7248 rldic%B2. %3,%1,0,%S2
7257 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7258 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7261 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7262 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7263 (match_operand:DI 2 "and64_operand" ""))
7265 (clobber (match_scratch:DI 3 ""))
7266 (clobber (match_scratch:CC 4 ""))]
7267 "TARGET_POWERPC64 && reload_completed"
7268 [(parallel [(set (match_dup 3)
7269 (and:DI (match_dup 1)
7271 (clobber (match_dup 4))])
7273 (compare:CC (match_dup 3)
7278 [(set (match_operand:CC 0 "cc_reg_operand" "")
7279 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7280 (match_operand:DI 2 "mask64_2_operand" ""))
7282 (clobber (match_scratch:DI 3 ""))
7283 (clobber (match_scratch:CC 4 ""))]
7284 "TARGET_POWERPC64 && reload_completed
7285 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7286 && !mask64_operand (operands[2], DImode)"
7288 (and:DI (rotate:DI (match_dup 1)
7291 (parallel [(set (match_dup 0)
7292 (compare:CC (and:DI (rotate:DI (match_dup 3)
7296 (clobber (match_dup 3))])]
7299 build_mask64_2_operands (operands[2], &operands[5]);
7302 (define_insn "*anddi3_internal3"
7303 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7304 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7305 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7307 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7308 (and:DI (match_dup 1) (match_dup 2)))
7309 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7313 rldic%B2. %0,%1,0,%S2
7322 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7323 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7326 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7327 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7328 (match_operand:DI 2 "and64_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 [(parallel [(set (match_dup 0)
7335 (and:DI (match_dup 1) (match_dup 2)))
7336 (clobber (match_dup 4))])
7338 (compare:CC (match_dup 0)
7343 [(set (match_operand:CC 3 "cc_reg_operand" "")
7344 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7345 (match_operand:DI 2 "mask64_2_operand" ""))
7347 (set (match_operand:DI 0 "gpc_reg_operand" "")
7348 (and:DI (match_dup 1) (match_dup 2)))
7349 (clobber (match_scratch:CC 4 ""))]
7350 "TARGET_POWERPC64 && reload_completed
7351 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7352 && !mask64_operand (operands[2], DImode)"
7354 (and:DI (rotate:DI (match_dup 1)
7357 (parallel [(set (match_dup 3)
7358 (compare:CC (and:DI (rotate:DI (match_dup 0)
7363 (and:DI (rotate:DI (match_dup 0)
7368 build_mask64_2_operands (operands[2], &operands[5]);
7371 (define_expand "iordi3"
7372 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7373 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7374 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7378 if (non_logical_cint_operand (operands[2], DImode))
7380 HOST_WIDE_INT value;
7381 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7382 ? operands[0] : gen_reg_rtx (DImode));
7384 if (GET_CODE (operands[2]) == CONST_INT)
7386 value = INTVAL (operands[2]);
7387 emit_insn (gen_iordi3 (tmp, operands[1],
7388 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7392 value = CONST_DOUBLE_LOW (operands[2]);
7393 emit_insn (gen_iordi3 (tmp, operands[1],
7394 immed_double_const (value
7395 & (~ (HOST_WIDE_INT) 0xffff),
7399 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7404 (define_expand "xordi3"
7405 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7406 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7407 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7411 if (non_logical_cint_operand (operands[2], DImode))
7413 HOST_WIDE_INT value;
7414 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7415 ? operands[0] : gen_reg_rtx (DImode));
7417 if (GET_CODE (operands[2]) == CONST_INT)
7419 value = INTVAL (operands[2]);
7420 emit_insn (gen_xordi3 (tmp, operands[1],
7421 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7425 value = CONST_DOUBLE_LOW (operands[2]);
7426 emit_insn (gen_xordi3 (tmp, operands[1],
7427 immed_double_const (value
7428 & (~ (HOST_WIDE_INT) 0xffff),
7432 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7437 (define_insn "*booldi3_internal1"
7438 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7439 (match_operator:DI 3 "boolean_or_operator"
7440 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7441 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7448 (define_insn "*booldi3_internal2"
7449 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7450 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7451 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7452 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7454 (clobber (match_scratch:DI 3 "=r,r"))]
7459 [(set_attr "type" "compare")
7460 (set_attr "length" "4,8")])
7463 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7464 (compare:CC (match_operator:DI 4 "boolean_operator"
7465 [(match_operand:DI 1 "gpc_reg_operand" "")
7466 (match_operand:DI 2 "gpc_reg_operand" "")])
7468 (clobber (match_scratch:DI 3 ""))]
7469 "TARGET_POWERPC64 && reload_completed"
7470 [(set (match_dup 3) (match_dup 4))
7472 (compare:CC (match_dup 3)
7476 (define_insn "*booldi3_internal3"
7477 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7478 (compare:CC (match_operator:DI 4 "boolean_operator"
7479 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7480 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7482 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7488 [(set_attr "type" "compare")
7489 (set_attr "length" "4,8")])
7492 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7493 (compare:CC (match_operator:DI 4 "boolean_operator"
7494 [(match_operand:DI 1 "gpc_reg_operand" "")
7495 (match_operand:DI 2 "gpc_reg_operand" "")])
7497 (set (match_operand:DI 0 "gpc_reg_operand" "")
7499 "TARGET_POWERPC64 && reload_completed"
7500 [(set (match_dup 0) (match_dup 4))
7502 (compare:CC (match_dup 0)
7506 ;; Split a logical operation that we can't do in one insn into two insns,
7507 ;; each of which does one 16-bit part. This is used by combine.
7510 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7511 (match_operator:DI 3 "boolean_or_operator"
7512 [(match_operand:DI 1 "gpc_reg_operand" "")
7513 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7515 [(set (match_dup 0) (match_dup 4))
7516 (set (match_dup 0) (match_dup 5))]
7521 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7523 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7524 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7526 i4 = GEN_INT (value & 0xffff);
7530 i3 = GEN_INT (INTVAL (operands[2])
7531 & (~ (HOST_WIDE_INT) 0xffff));
7532 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7534 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7536 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7540 (define_insn "*boolcdi3_internal1"
7541 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7542 (match_operator:DI 3 "boolean_operator"
7543 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7544 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7548 (define_insn "*boolcdi3_internal2"
7549 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7550 (compare:CC (match_operator:DI 4 "boolean_operator"
7551 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7552 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7554 (clobber (match_scratch:DI 3 "=r,r"))]
7559 [(set_attr "type" "compare")
7560 (set_attr "length" "4,8")])
7563 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7564 (compare:CC (match_operator:DI 4 "boolean_operator"
7565 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7566 (match_operand:DI 2 "gpc_reg_operand" "")])
7568 (clobber (match_scratch:DI 3 ""))]
7569 "TARGET_POWERPC64 && reload_completed"
7570 [(set (match_dup 3) (match_dup 4))
7572 (compare:CC (match_dup 3)
7576 (define_insn "*boolcdi3_internal3"
7577 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7578 (compare:CC (match_operator:DI 4 "boolean_operator"
7579 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7580 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7582 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7588 [(set_attr "type" "compare")
7589 (set_attr "length" "4,8")])
7592 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7593 (compare:CC (match_operator:DI 4 "boolean_operator"
7594 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7595 (match_operand:DI 2 "gpc_reg_operand" "")])
7597 (set (match_operand:DI 0 "gpc_reg_operand" "")
7599 "TARGET_POWERPC64 && reload_completed"
7600 [(set (match_dup 0) (match_dup 4))
7602 (compare:CC (match_dup 0)
7606 (define_insn "*boolccdi3_internal1"
7607 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7608 (match_operator:DI 3 "boolean_operator"
7609 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7610 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7614 (define_insn "*boolccdi3_internal2"
7615 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7616 (compare:CC (match_operator:DI 4 "boolean_operator"
7617 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7618 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7620 (clobber (match_scratch:DI 3 "=r,r"))]
7625 [(set_attr "type" "compare")
7626 (set_attr "length" "4,8")])
7629 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7630 (compare:CC (match_operator:DI 4 "boolean_operator"
7631 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7632 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7634 (clobber (match_scratch:DI 3 ""))]
7635 "TARGET_POWERPC64 && reload_completed"
7636 [(set (match_dup 3) (match_dup 4))
7638 (compare:CC (match_dup 3)
7642 (define_insn "*boolccdi3_internal3"
7643 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7644 (compare:CC (match_operator:DI 4 "boolean_operator"
7645 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7646 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7648 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7654 [(set_attr "type" "compare")
7655 (set_attr "length" "4,8")])
7658 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7659 (compare:CC (match_operator:DI 4 "boolean_operator"
7660 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7661 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7663 (set (match_operand:DI 0 "gpc_reg_operand" "")
7665 "TARGET_POWERPC64 && reload_completed"
7666 [(set (match_dup 0) (match_dup 4))
7668 (compare:CC (match_dup 0)
7672 ;; Now define ways of moving data around.
7674 ;; Elf specific ways of loading addresses for non-PIC code.
7675 ;; The output of this could be r0, but we make a very strong
7676 ;; preference for a base register because it will usually
7678 (define_insn "elf_high"
7679 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7680 (high:SI (match_operand 1 "" "")))]
7681 "TARGET_ELF && ! TARGET_64BIT"
7682 "{liu|lis} %0,%1@ha")
7684 (define_insn "elf_low"
7685 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7686 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7687 (match_operand 2 "" "")))]
7688 "TARGET_ELF && ! TARGET_64BIT"
7690 {cal|la} %0,%2@l(%1)
7691 {ai|addic} %0,%1,%K2")
7694 ;; Set up a register with a value from the GOT table
7696 (define_expand "movsi_got"
7697 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7698 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7699 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7700 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7703 if (GET_CODE (operands[1]) == CONST)
7705 rtx offset = const0_rtx;
7706 HOST_WIDE_INT value;
7708 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7709 value = INTVAL (offset);
7712 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7713 emit_insn (gen_movsi_got (tmp, operands[1]));
7714 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7719 operands[2] = rs6000_got_register (operands[1]);
7722 (define_insn "*movsi_got_internal"
7723 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7724 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7725 (match_operand:SI 2 "gpc_reg_operand" "b")]
7727 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7728 "{l|lwz} %0,%a1@got(%2)"
7729 [(set_attr "type" "load")])
7731 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7732 ;; didn't get allocated to a hard register.
7734 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7735 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7736 (match_operand:SI 2 "memory_operand" "")]
7738 "DEFAULT_ABI == ABI_V4
7740 && (reload_in_progress || reload_completed)"
7741 [(set (match_dup 0) (match_dup 2))
7742 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7746 ;; For SI, we special-case integers that can't be loaded in one insn. We
7747 ;; do the load 16-bits at a time. We could do this by loading from memory,
7748 ;; and this is even supposed to be faster, but it is simpler not to get
7749 ;; integers in the TOC.
7750 (define_expand "movsi"
7751 [(set (match_operand:SI 0 "general_operand" "")
7752 (match_operand:SI 1 "any_operand" ""))]
7754 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7756 (define_insn "movsi_low"
7757 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7758 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7759 (match_operand 2 "" ""))))]
7760 "TARGET_MACHO && ! TARGET_64BIT"
7761 "{l|lwz} %0,lo16(%2)(%1)"
7762 [(set_attr "type" "load")
7763 (set_attr "length" "4")])
7765 (define_insn "*movsi_internal1"
7766 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7767 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7768 "gpc_reg_operand (operands[0], SImode)
7769 || gpc_reg_operand (operands[1], SImode)"
7773 {l%U1%X1|lwz%U1%X1} %0,%1
7774 {st%U0%X0|stw%U0%X0} %1,%0
7784 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7785 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7787 ;; Split a load of a large constant into the appropriate two-insn
7791 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7792 (match_operand:SI 1 "const_int_operand" ""))]
7793 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7794 && (INTVAL (operands[1]) & 0xffff) != 0"
7798 (ior:SI (match_dup 0)
7801 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7803 if (tem == operands[0])
7809 (define_insn "*movsi_internal2"
7810 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7811 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "0,r,r")
7813 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7816 {cmpi|cmpwi} %2,%0,0
7819 [(set_attr "type" "cmp,compare,cmp")
7820 (set_attr "length" "4,4,8")])
7823 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7824 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7826 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7827 "TARGET_32BIT && reload_completed"
7828 [(set (match_dup 0) (match_dup 1))
7830 (compare:CC (match_dup 0)
7834 (define_expand "movhi"
7835 [(set (match_operand:HI 0 "general_operand" "")
7836 (match_operand:HI 1 "any_operand" ""))]
7838 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7840 (define_insn "*movhi_internal"
7841 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7842 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7843 "gpc_reg_operand (operands[0], HImode)
7844 || gpc_reg_operand (operands[1], HImode)"
7854 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7856 (define_expand "movqi"
7857 [(set (match_operand:QI 0 "general_operand" "")
7858 (match_operand:QI 1 "any_operand" ""))]
7860 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7862 (define_insn "*movqi_internal"
7863 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7864 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7865 "gpc_reg_operand (operands[0], QImode)
7866 || gpc_reg_operand (operands[1], QImode)"
7876 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7878 ;; Here is how to move condition codes around. When we store CC data in
7879 ;; an integer register or memory, we store just the high-order 4 bits.
7880 ;; This lets us not shift in the most common case of CR0.
7881 (define_expand "movcc"
7882 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7883 (match_operand:CC 1 "nonimmediate_operand" ""))]
7887 (define_insn "*movcc_internal1"
7888 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7889 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7890 "register_operand (operands[0], CCmode)
7891 || register_operand (operands[1], CCmode)"
7895 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7897 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7902 {l%U1%X1|lwz%U1%X1} %0,%1
7903 {st%U0%U1|stw%U0%U1} %1,%0"
7905 (cond [(eq_attr "alternative" "0")
7906 (const_string "cr_logical")
7907 (eq_attr "alternative" "1,2")
7908 (const_string "mtcr")
7909 (eq_attr "alternative" "5,7")
7910 (const_string "integer")
7911 (eq_attr "alternative" "6")
7912 (const_string "mfjmpr")
7913 (eq_attr "alternative" "8")
7914 (const_string "mtjmpr")
7915 (eq_attr "alternative" "9")
7916 (const_string "load")
7917 (eq_attr "alternative" "10")
7918 (const_string "store")
7919 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7920 (const_string "mfcrf")
7922 (const_string "mfcr")))
7923 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7925 ;; For floating-point, we normally deal with the floating-point registers
7926 ;; unless -msoft-float is used. The sole exception is that parameter passing
7927 ;; can produce floating-point values in fixed-point registers. Unless the
7928 ;; value is a simple constant or already in memory, we deal with this by
7929 ;; allocating memory and copying the value explicitly via that memory location.
7930 (define_expand "movsf"
7931 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7932 (match_operand:SF 1 "any_operand" ""))]
7934 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7937 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7938 (match_operand:SF 1 "const_double_operand" ""))]
7940 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7941 || (GET_CODE (operands[0]) == SUBREG
7942 && GET_CODE (SUBREG_REG (operands[0])) == REG
7943 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7944 [(set (match_dup 2) (match_dup 3))]
7950 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7951 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7953 if (! TARGET_POWERPC64)
7954 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7956 operands[2] = gen_lowpart (SImode, operands[0]);
7958 operands[3] = gen_int_mode (l, SImode);
7961 (define_insn "*movsf_hardfloat"
7962 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7963 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7964 "(gpc_reg_operand (operands[0], SFmode)
7965 || gpc_reg_operand (operands[1], SFmode))
7966 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7969 {l%U1%X1|lwz%U1%X1} %0,%1
7970 {st%U0%X0|stw%U0%X0} %1,%0
7980 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7981 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7983 (define_insn "*movsf_softfloat"
7984 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7985 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7986 "(gpc_reg_operand (operands[0], SFmode)
7987 || gpc_reg_operand (operands[1], SFmode))
7988 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7994 {l%U1%X1|lwz%U1%X1} %0,%1
7995 {st%U0%X0|stw%U0%X0} %1,%0
8002 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
8003 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8006 (define_expand "movdf"
8007 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8008 (match_operand:DF 1 "any_operand" ""))]
8010 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8013 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8014 (match_operand:DF 1 "const_int_operand" ""))]
8015 "! TARGET_POWERPC64 && reload_completed
8016 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8017 || (GET_CODE (operands[0]) == SUBREG
8018 && GET_CODE (SUBREG_REG (operands[0])) == REG
8019 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8020 [(set (match_dup 2) (match_dup 4))
8021 (set (match_dup 3) (match_dup 1))]
8024 int endian = (WORDS_BIG_ENDIAN == 0);
8025 HOST_WIDE_INT value = INTVAL (operands[1]);
8027 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8028 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8029 #if HOST_BITS_PER_WIDE_INT == 32
8030 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8032 operands[4] = GEN_INT (value >> 32);
8033 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8038 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8039 (match_operand:DF 1 "const_double_operand" ""))]
8040 "! TARGET_POWERPC64 && reload_completed
8041 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8042 || (GET_CODE (operands[0]) == SUBREG
8043 && GET_CODE (SUBREG_REG (operands[0])) == REG
8044 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8045 [(set (match_dup 2) (match_dup 4))
8046 (set (match_dup 3) (match_dup 5))]
8049 int endian = (WORDS_BIG_ENDIAN == 0);
8053 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8054 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8056 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8057 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8058 operands[4] = gen_int_mode (l[endian], SImode);
8059 operands[5] = gen_int_mode (l[1 - endian], SImode);
8063 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8064 (match_operand:DF 1 "easy_fp_constant" ""))]
8065 "TARGET_POWERPC64 && reload_completed
8066 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8067 || (GET_CODE (operands[0]) == SUBREG
8068 && GET_CODE (SUBREG_REG (operands[0])) == REG
8069 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8070 [(set (match_dup 2) (match_dup 3))]
8073 int endian = (WORDS_BIG_ENDIAN == 0);
8076 #if HOST_BITS_PER_WIDE_INT >= 64
8080 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8081 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8083 operands[2] = gen_lowpart (DImode, operands[0]);
8084 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8085 #if HOST_BITS_PER_WIDE_INT >= 64
8086 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8087 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8089 operands[3] = gen_int_mode (val, DImode);
8091 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8095 ;; Don't have reload use general registers to load a constant. First,
8096 ;; it might not work if the output operand is the equivalent of
8097 ;; a non-offsettable memref, but also it is less efficient than loading
8098 ;; the constant into an FP register, since it will probably be used there.
8099 ;; The "??" is a kludge until we can figure out a more reasonable way
8100 ;; of handling these non-offsettable values.
8101 (define_insn "*movdf_hardfloat32"
8102 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8103 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8104 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8105 && (gpc_reg_operand (operands[0], DFmode)
8106 || gpc_reg_operand (operands[1], DFmode))"
8109 switch (which_alternative)
8114 /* We normally copy the low-numbered register first. However, if
8115 the first register operand 0 is the same as the second register
8116 of operand 1, we must copy in the opposite order. */
8117 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8118 return \"mr %L0,%L1\;mr %0,%1\";
8120 return \"mr %0,%1\;mr %L0,%L1\";
8122 if (GET_CODE (operands[1]) == MEM
8123 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[1], 0),
8124 reload_completed || reload_in_progress)
8125 || GET_CODE (XEXP (operands[1], 0)) == REG
8126 || GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8127 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8128 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC))
8130 /* If the low-address word is used in the address, we must load
8131 it last. Otherwise, load it first. Note that we cannot have
8132 auto-increment in that case since the address register is
8133 known to be dead. */
8134 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8136 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8138 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8144 addreg = find_addr_reg (XEXP (operands[1], 0));
8145 if (refers_to_regno_p (REGNO (operands[0]),
8146 REGNO (operands[0]) + 1,
8149 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8150 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8151 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8152 return \"{lx|lwzx} %0,%1\";
8156 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8157 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8158 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8159 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8164 if (GET_CODE (operands[0]) == MEM
8165 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[0], 0),
8166 reload_completed || reload_in_progress)
8167 || GET_CODE (XEXP (operands[0], 0)) == REG
8168 || GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8169 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8170 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))
8171 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8176 addreg = find_addr_reg (XEXP (operands[0], 0));
8177 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8178 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8179 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8180 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8184 return \"fmr %0,%1\";
8186 return \"lfd%U1%X1 %0,%1\";
8188 return \"stfd%U0%X0 %1,%0\";
8195 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8196 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8198 (define_insn "*movdf_softfloat32"
8199 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8200 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8201 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8202 && (gpc_reg_operand (operands[0], DFmode)
8203 || gpc_reg_operand (operands[1], DFmode))"
8206 switch (which_alternative)
8211 /* We normally copy the low-numbered register first. However, if
8212 the first register operand 0 is the same as the second register of
8213 operand 1, we must copy in the opposite order. */
8214 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8215 return \"mr %L0,%L1\;mr %0,%1\";
8217 return \"mr %0,%1\;mr %L0,%L1\";
8219 /* If the low-address word is used in the address, we must load
8220 it last. Otherwise, load it first. Note that we cannot have
8221 auto-increment in that case since the address register is
8222 known to be dead. */
8223 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8225 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8227 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8229 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8236 [(set_attr "type" "two,load,store,*,*,*")
8237 (set_attr "length" "8,8,8,8,12,16")])
8239 ; ld/std require word-aligned displacements -> 'Y' constraint.
8240 ; List Y->r and r->Y before r->r for reload.
8241 (define_insn "*movdf_hardfloat64"
8242 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
8243 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8244 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8245 && (gpc_reg_operand (operands[0], DFmode)
8246 || gpc_reg_operand (operands[1], DFmode))"
8260 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
8261 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8263 (define_insn "*movdf_softfloat64"
8264 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8265 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8266 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8267 && (gpc_reg_operand (operands[0], DFmode)
8268 || gpc_reg_operand (operands[1], DFmode))"
8279 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
8280 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8282 (define_expand "movtf"
8283 [(set (match_operand:TF 0 "general_operand" "")
8284 (match_operand:TF 1 "any_operand" ""))]
8285 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8286 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8287 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8289 ; It's important to list the o->f and f->o moves before f->f because
8290 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8291 ; which doesn't make progress. Likewise r->o<> must be before r->r.
8292 (define_insn_and_split "*movtf_internal"
8293 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,o<>,r")
8294 (match_operand:TF 1 "input_operand" "f,o,f,mGHF,r,r"))]
8295 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8296 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8297 && (gpc_reg_operand (operands[0], TFmode)
8298 || gpc_reg_operand (operands[1], TFmode))"
8300 "&& reload_completed"
8302 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8303 [(set_attr "length" "8,8,8,20,20,16")])
8305 (define_expand "extenddftf2"
8306 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8307 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8308 (use (match_dup 2))])]
8309 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8310 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8312 operands[2] = CONST0_RTX (DFmode);
8315 (define_insn_and_split "*extenddftf2_internal"
8316 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8317 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8318 (use (match_operand:DF 2 "input_operand" "rf,m,f,n"))]
8319 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8320 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8322 "&& reload_completed"
8325 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8326 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8327 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8329 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8334 (define_expand "extendsftf2"
8335 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8336 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8337 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8338 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8340 rtx tmp = gen_reg_rtx (DFmode);
8341 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8342 emit_insn (gen_extenddftf2 (operands[0], tmp));
8346 (define_insn "trunctfdf2"
8347 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8348 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8349 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8350 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8352 [(set_attr "type" "fp")
8353 (set_attr "length" "4")])
8355 (define_insn_and_split "trunctfsf2"
8356 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8357 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8358 (clobber (match_scratch:DF 2 "=f"))]
8359 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8360 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8362 "&& reload_completed"
8364 (float_truncate:DF (match_dup 1)))
8366 (float_truncate:SF (match_dup 2)))]
8369 (define_expand "floatsitf2"
8370 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8371 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8372 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8373 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8375 rtx tmp = gen_reg_rtx (DFmode);
8376 expand_float (tmp, operands[1], false);
8377 emit_insn (gen_extenddftf2 (operands[0], tmp));
8381 ; fadd, but rounding towards zero.
8382 ; This is probably not the optimal code sequence.
8383 (define_insn "fix_trunc_helper"
8384 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8385 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8386 UNSPEC_FIX_TRUNC_TF))
8387 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8388 "TARGET_HARD_FLOAT && TARGET_FPRS"
8389 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8390 [(set_attr "type" "fp")
8391 (set_attr "length" "20")])
8393 (define_expand "fix_trunctfsi2"
8394 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8395 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8396 (clobber (match_dup 2))
8397 (clobber (match_dup 3))
8398 (clobber (match_dup 4))
8399 (clobber (match_dup 5))])]
8400 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8401 && (TARGET_POWER2 || TARGET_POWERPC)
8402 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8404 operands[2] = gen_reg_rtx (DFmode);
8405 operands[3] = gen_reg_rtx (DFmode);
8406 operands[4] = gen_reg_rtx (DImode);
8407 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8410 (define_insn_and_split "*fix_trunctfsi2_internal"
8411 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8412 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8413 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8414 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8415 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8416 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8417 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8418 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8420 "&& reload_completed"
8424 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8426 if (GET_CODE (operands[5]) != MEM)
8428 lowword = XEXP (operands[5], 0);
8429 if (WORDS_BIG_ENDIAN)
8430 lowword = plus_constant (lowword, 4);
8432 emit_insn (gen_fctiwz (operands[4], operands[2]));
8433 emit_move_insn (operands[5], operands[4]);
8434 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
8438 (define_insn "negtf2"
8439 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8440 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8441 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8442 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8445 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8446 return \"fneg %L0,%L1\;fneg %0,%1\";
8448 return \"fneg %0,%1\;fneg %L0,%L1\";
8450 [(set_attr "type" "fp")
8451 (set_attr "length" "8")])
8453 (define_expand "abstf2"
8454 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8455 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8456 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8457 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8460 rtx label = gen_label_rtx ();
8461 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8466 (define_expand "abstf2_internal"
8467 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8468 (match_operand:TF 1 "gpc_reg_operand" "f"))
8469 (set (match_dup 3) (match_dup 5))
8470 (set (match_dup 5) (abs:DF (match_dup 5)))
8471 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8472 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8473 (label_ref (match_operand 2 "" ""))
8475 (set (match_dup 6) (neg:DF (match_dup 6)))]
8476 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8477 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8480 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8481 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8482 operands[3] = gen_reg_rtx (DFmode);
8483 operands[4] = gen_reg_rtx (CCFPmode);
8484 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8485 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8488 ;; Next come the multi-word integer load and store and the load and store
8490 (define_expand "movdi"
8491 [(set (match_operand:DI 0 "general_operand" "")
8492 (match_operand:DI 1 "any_operand" ""))]
8494 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8496 ; List r->r after r->"o<>", otherwise reload will try to reload a
8497 ; non-offsettable address by using r->r which won't make progress.
8498 (define_insn "*movdi_internal32"
8499 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,f,f,m,r")
8500 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8502 && (gpc_reg_operand (operands[0], DImode)
8503 || gpc_reg_operand (operands[1], DImode))"
8512 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8515 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8516 (match_operand:DI 1 "const_int_operand" ""))]
8517 "! TARGET_POWERPC64 && reload_completed"
8518 [(set (match_dup 2) (match_dup 4))
8519 (set (match_dup 3) (match_dup 1))]
8522 HOST_WIDE_INT value = INTVAL (operands[1]);
8523 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8525 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8527 #if HOST_BITS_PER_WIDE_INT == 32
8528 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8530 operands[4] = GEN_INT (value >> 32);
8531 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8536 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8537 (match_operand:DI 1 "input_operand" ""))]
8538 "reload_completed && !TARGET_POWERPC64
8539 && gpr_or_gpr_p (operands[0], operands[1])"
8541 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8544 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8545 (match_operand:TI 1 "const_double_operand" ""))]
8547 [(set (match_dup 2) (match_dup 4))
8548 (set (match_dup 3) (match_dup 5))]
8551 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8553 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8555 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8557 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8558 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8560 else if (GET_CODE (operands[1]) == CONST_INT)
8562 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8563 operands[5] = operands[1];
8569 (define_insn "*movdi_internal64"
8570 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,??f,f,m,r,*h,*h")
8571 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8573 && (gpc_reg_operand (operands[0], DImode)
8574 || gpc_reg_operand (operands[1], DImode))"
8589 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8590 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8592 ;; immediate value valid for a single instruction hiding in a const_double
8594 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8595 (match_operand:DI 1 "const_double_operand" "F"))]
8596 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8597 && GET_CODE (operands[1]) == CONST_DOUBLE
8598 && num_insns_constant (operands[1], DImode) == 1"
8601 return ((unsigned HOST_WIDE_INT)
8602 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8603 ? \"li %0,%1\" : \"lis %0,%v1\";
8606 ;; Generate all one-bits and clear left or right.
8607 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8609 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8610 (match_operand:DI 1 "mask64_operand" ""))]
8611 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8612 [(set (match_dup 0) (const_int -1))
8614 (and:DI (rotate:DI (match_dup 0)
8619 ;; Split a load of a large constant into the appropriate five-instruction
8620 ;; sequence. Handle anything in a constant number of insns.
8621 ;; When non-easy constants can go in the TOC, this should use
8622 ;; easy_fp_constant predicate.
8624 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8625 (match_operand:DI 1 "const_int_operand" ""))]
8626 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8627 [(set (match_dup 0) (match_dup 2))
8628 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8630 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8632 if (tem == operands[0])
8639 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8640 (match_operand:DI 1 "const_double_operand" ""))]
8641 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8642 [(set (match_dup 0) (match_dup 2))
8643 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8645 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8647 if (tem == operands[0])
8653 (define_insn "*movdi_internal2"
8654 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8655 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "0,r,r")
8657 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8663 [(set_attr "type" "cmp,compare,cmp")
8664 (set_attr "length" "4,4,8")])
8667 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8668 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8670 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8671 "TARGET_POWERPC64 && reload_completed"
8672 [(set (match_dup 0) (match_dup 1))
8674 (compare:CC (match_dup 0)
8678 ;; TImode is similar, except that we usually want to compute the address into
8679 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8680 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8681 (define_expand "movti"
8682 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8683 (match_operand:TI 1 "general_operand" ""))
8684 (clobber (scratch:SI))])]
8686 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8688 ;; We say that MQ is clobbered in the last alternative because the first
8689 ;; alternative would never get used otherwise since it would need a reload
8690 ;; while the 2nd alternative would not. We put memory cases first so they
8691 ;; are preferred. Otherwise, we'd try to reload the output instead of
8692 ;; giving the SCRATCH mq.
8694 (define_insn "*movti_power"
8695 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8696 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
8697 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
8698 "TARGET_POWER && ! TARGET_POWERPC64
8699 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8702 switch (which_alternative)
8709 return \"{stsi|stswi} %1,%P0,16\";
8714 /* If the address is not used in the output, we can use lsi. Otherwise,
8715 fall through to generating four loads. */
8717 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8718 return \"{lsi|lswi} %0,%P1,16\";
8719 /* ... fall through ... */
8724 [(set_attr "type" "store,store,*,load,load")])
8726 (define_insn "*movti_string"
8727 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r")
8728 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))]
8729 "! TARGET_POWER && ! TARGET_POWERPC64
8730 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8733 switch (which_alternative)
8739 return \"{stsi|stswi} %1,%P0,16\";
8744 /* If the address is not used in the output, we can use lsi. Otherwise,
8745 fall through to generating four loads. */
8747 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8748 return \"{lsi|lswi} %0,%P1,16\";
8749 /* ... fall through ... */
8754 [(set_attr "type" "store,store,*,load,load")])
8756 (define_insn "*movti_ppc64"
8757 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8758 (match_operand:TI 1 "input_operand" "r,r,m"))]
8759 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8760 || gpc_reg_operand (operands[1], TImode))"
8762 [(set_attr "type" "*,load,store")])
8765 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8766 (match_operand:TI 1 "input_operand" ""))]
8768 && gpr_or_gpr_p (operands[0], operands[1])"
8770 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8772 (define_expand "load_multiple"
8773 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8774 (match_operand:SI 1 "" ""))
8775 (use (match_operand:SI 2 "" ""))])]
8776 "TARGET_STRING && !TARGET_POWERPC64"
8784 /* Support only loading a constant number of fixed-point registers from
8785 memory and only bother with this if more than two; the machine
8786 doesn't support more than eight. */
8787 if (GET_CODE (operands[2]) != CONST_INT
8788 || INTVAL (operands[2]) <= 2
8789 || INTVAL (operands[2]) > 8
8790 || GET_CODE (operands[1]) != MEM
8791 || GET_CODE (operands[0]) != REG
8792 || REGNO (operands[0]) >= 32)
8795 count = INTVAL (operands[2]);
8796 regno = REGNO (operands[0]);
8798 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8799 op1 = replace_equiv_address (operands[1],
8800 force_reg (SImode, XEXP (operands[1], 0)));
8802 for (i = 0; i < count; i++)
8803 XVECEXP (operands[3], 0, i)
8804 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8805 adjust_address_nv (op1, SImode, i * 4));
8808 (define_insn "*ldmsi8"
8809 [(match_parallel 0 "load_multiple_operation"
8810 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8811 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8812 (set (match_operand:SI 3 "gpc_reg_operand" "")
8813 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8814 (set (match_operand:SI 4 "gpc_reg_operand" "")
8815 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8816 (set (match_operand:SI 5 "gpc_reg_operand" "")
8817 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8818 (set (match_operand:SI 6 "gpc_reg_operand" "")
8819 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8820 (set (match_operand:SI 7 "gpc_reg_operand" "")
8821 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8822 (set (match_operand:SI 8 "gpc_reg_operand" "")
8823 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8824 (set (match_operand:SI 9 "gpc_reg_operand" "")
8825 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8826 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8828 { return rs6000_output_load_multiple (operands); }"
8829 [(set_attr "type" "load")
8830 (set_attr "length" "32")])
8832 (define_insn "*ldmsi7"
8833 [(match_parallel 0 "load_multiple_operation"
8834 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8835 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8836 (set (match_operand:SI 3 "gpc_reg_operand" "")
8837 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8838 (set (match_operand:SI 4 "gpc_reg_operand" "")
8839 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8840 (set (match_operand:SI 5 "gpc_reg_operand" "")
8841 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8842 (set (match_operand:SI 6 "gpc_reg_operand" "")
8843 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8844 (set (match_operand:SI 7 "gpc_reg_operand" "")
8845 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8846 (set (match_operand:SI 8 "gpc_reg_operand" "")
8847 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8848 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8850 { return rs6000_output_load_multiple (operands); }"
8851 [(set_attr "type" "load")
8852 (set_attr "length" "32")])
8854 (define_insn "*ldmsi6"
8855 [(match_parallel 0 "load_multiple_operation"
8856 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8857 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8858 (set (match_operand:SI 3 "gpc_reg_operand" "")
8859 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8860 (set (match_operand:SI 4 "gpc_reg_operand" "")
8861 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8862 (set (match_operand:SI 5 "gpc_reg_operand" "")
8863 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8864 (set (match_operand:SI 6 "gpc_reg_operand" "")
8865 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8866 (set (match_operand:SI 7 "gpc_reg_operand" "")
8867 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8868 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8870 { return rs6000_output_load_multiple (operands); }"
8871 [(set_attr "type" "load")
8872 (set_attr "length" "32")])
8874 (define_insn "*ldmsi5"
8875 [(match_parallel 0 "load_multiple_operation"
8876 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8877 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8878 (set (match_operand:SI 3 "gpc_reg_operand" "")
8879 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8880 (set (match_operand:SI 4 "gpc_reg_operand" "")
8881 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8882 (set (match_operand:SI 5 "gpc_reg_operand" "")
8883 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8884 (set (match_operand:SI 6 "gpc_reg_operand" "")
8885 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8886 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8888 { return rs6000_output_load_multiple (operands); }"
8889 [(set_attr "type" "load")
8890 (set_attr "length" "32")])
8892 (define_insn "*ldmsi4"
8893 [(match_parallel 0 "load_multiple_operation"
8894 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8895 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8896 (set (match_operand:SI 3 "gpc_reg_operand" "")
8897 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8898 (set (match_operand:SI 4 "gpc_reg_operand" "")
8899 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8900 (set (match_operand:SI 5 "gpc_reg_operand" "")
8901 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8902 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8904 { return rs6000_output_load_multiple (operands); }"
8905 [(set_attr "type" "load")
8906 (set_attr "length" "32")])
8908 (define_insn "*ldmsi3"
8909 [(match_parallel 0 "load_multiple_operation"
8910 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8911 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8912 (set (match_operand:SI 3 "gpc_reg_operand" "")
8913 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8914 (set (match_operand:SI 4 "gpc_reg_operand" "")
8915 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8916 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8918 { return rs6000_output_load_multiple (operands); }"
8919 [(set_attr "type" "load")
8920 (set_attr "length" "32")])
8922 (define_expand "store_multiple"
8923 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8924 (match_operand:SI 1 "" ""))
8925 (clobber (scratch:SI))
8926 (use (match_operand:SI 2 "" ""))])]
8927 "TARGET_STRING && !TARGET_POWERPC64"
8936 /* Support only storing a constant number of fixed-point registers to
8937 memory and only bother with this if more than two; the machine
8938 doesn't support more than eight. */
8939 if (GET_CODE (operands[2]) != CONST_INT
8940 || INTVAL (operands[2]) <= 2
8941 || INTVAL (operands[2]) > 8
8942 || GET_CODE (operands[0]) != MEM
8943 || GET_CODE (operands[1]) != REG
8944 || REGNO (operands[1]) >= 32)
8947 count = INTVAL (operands[2]);
8948 regno = REGNO (operands[1]);
8950 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8951 to = force_reg (SImode, XEXP (operands[0], 0));
8952 op0 = replace_equiv_address (operands[0], to);
8954 XVECEXP (operands[3], 0, 0)
8955 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8956 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8957 gen_rtx_SCRATCH (SImode));
8959 for (i = 1; i < count; i++)
8960 XVECEXP (operands[3], 0, i + 1)
8961 = gen_rtx_SET (VOIDmode,
8962 adjust_address_nv (op0, SImode, i * 4),
8963 gen_rtx_REG (SImode, regno + i));
8966 (define_insn "*store_multiple_power"
8967 [(match_parallel 0 "store_multiple_operation"
8968 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8969 (match_operand:SI 2 "gpc_reg_operand" "r"))
8970 (clobber (match_scratch:SI 3 "=q"))])]
8971 "TARGET_STRING && TARGET_POWER"
8972 "{stsi|stswi} %2,%P1,%O0"
8973 [(set_attr "type" "store")])
8975 (define_insn "*stmsi8"
8976 [(match_parallel 0 "store_multiple_operation"
8977 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8978 (match_operand:SI 2 "gpc_reg_operand" "r"))
8979 (clobber (match_scratch:SI 3 "X"))
8980 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8981 (match_operand:SI 4 "gpc_reg_operand" "r"))
8982 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8983 (match_operand:SI 5 "gpc_reg_operand" "r"))
8984 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8985 (match_operand:SI 6 "gpc_reg_operand" "r"))
8986 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8987 (match_operand:SI 7 "gpc_reg_operand" "r"))
8988 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8989 (match_operand:SI 8 "gpc_reg_operand" "r"))
8990 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8991 (match_operand:SI 9 "gpc_reg_operand" "r"))
8992 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8993 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8994 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8995 "{stsi|stswi} %2,%1,%O0"
8996 [(set_attr "type" "store")])
8998 (define_insn "*stmsi7"
8999 [(match_parallel 0 "store_multiple_operation"
9000 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9001 (match_operand:SI 2 "gpc_reg_operand" "r"))
9002 (clobber (match_scratch:SI 3 "X"))
9003 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9004 (match_operand:SI 4 "gpc_reg_operand" "r"))
9005 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9006 (match_operand:SI 5 "gpc_reg_operand" "r"))
9007 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9008 (match_operand:SI 6 "gpc_reg_operand" "r"))
9009 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9010 (match_operand:SI 7 "gpc_reg_operand" "r"))
9011 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9012 (match_operand:SI 8 "gpc_reg_operand" "r"))
9013 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9014 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9015 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9016 "{stsi|stswi} %2,%1,%O0"
9017 [(set_attr "type" "store")])
9019 (define_insn "*stmsi6"
9020 [(match_parallel 0 "store_multiple_operation"
9021 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9022 (match_operand:SI 2 "gpc_reg_operand" "r"))
9023 (clobber (match_scratch:SI 3 "X"))
9024 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9025 (match_operand:SI 4 "gpc_reg_operand" "r"))
9026 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9027 (match_operand:SI 5 "gpc_reg_operand" "r"))
9028 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9029 (match_operand:SI 6 "gpc_reg_operand" "r"))
9030 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9031 (match_operand:SI 7 "gpc_reg_operand" "r"))
9032 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9033 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9034 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9035 "{stsi|stswi} %2,%1,%O0"
9036 [(set_attr "type" "store")])
9038 (define_insn "*stmsi5"
9039 [(match_parallel 0 "store_multiple_operation"
9040 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9041 (match_operand:SI 2 "gpc_reg_operand" "r"))
9042 (clobber (match_scratch:SI 3 "X"))
9043 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9044 (match_operand:SI 4 "gpc_reg_operand" "r"))
9045 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9046 (match_operand:SI 5 "gpc_reg_operand" "r"))
9047 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9048 (match_operand:SI 6 "gpc_reg_operand" "r"))
9049 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9050 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9051 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9052 "{stsi|stswi} %2,%1,%O0"
9053 [(set_attr "type" "store")])
9055 (define_insn "*stmsi4"
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 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9067 "{stsi|stswi} %2,%1,%O0"
9068 [(set_attr "type" "store")])
9070 (define_insn "*stmsi3"
9071 [(match_parallel 0 "store_multiple_operation"
9072 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9073 (match_operand:SI 2 "gpc_reg_operand" "r"))
9074 (clobber (match_scratch:SI 3 "X"))
9075 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9076 (match_operand:SI 4 "gpc_reg_operand" "r"))
9077 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9078 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9079 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9080 "{stsi|stswi} %2,%1,%O0"
9081 [(set_attr "type" "store")])
9083 (define_expand "clrmemsi"
9084 [(parallel [(set (match_operand:BLK 0 "" "")
9086 (use (match_operand:SI 1 "" ""))
9087 (use (match_operand:SI 2 "" ""))])]
9091 if (expand_block_clear (operands))
9097 ;; String/block move insn.
9098 ;; Argument 0 is the destination
9099 ;; Argument 1 is the source
9100 ;; Argument 2 is the length
9101 ;; Argument 3 is the alignment
9103 (define_expand "movmemsi"
9104 [(parallel [(set (match_operand:BLK 0 "" "")
9105 (match_operand:BLK 1 "" ""))
9106 (use (match_operand:SI 2 "" ""))
9107 (use (match_operand:SI 3 "" ""))])]
9111 if (expand_block_move (operands))
9117 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9118 ;; register allocator doesn't have a clue about allocating 8 word registers.
9119 ;; rD/rS = r5 is preferred, efficient form.
9120 (define_expand "movmemsi_8reg"
9121 [(parallel [(set (match_operand 0 "" "")
9122 (match_operand 1 "" ""))
9123 (use (match_operand 2 "" ""))
9124 (use (match_operand 3 "" ""))
9125 (clobber (reg:SI 5))
9126 (clobber (reg:SI 6))
9127 (clobber (reg:SI 7))
9128 (clobber (reg:SI 8))
9129 (clobber (reg:SI 9))
9130 (clobber (reg:SI 10))
9131 (clobber (reg:SI 11))
9132 (clobber (reg:SI 12))
9133 (clobber (match_scratch:SI 4 ""))])]
9138 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9139 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9140 (use (match_operand:SI 2 "immediate_operand" "i"))
9141 (use (match_operand:SI 3 "immediate_operand" "i"))
9142 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9143 (clobber (reg:SI 6))
9144 (clobber (reg:SI 7))
9145 (clobber (reg:SI 8))
9146 (clobber (reg:SI 9))
9147 (clobber (reg:SI 10))
9148 (clobber (reg:SI 11))
9149 (clobber (reg:SI 12))
9150 (clobber (match_scratch:SI 5 "=q"))]
9151 "TARGET_STRING && TARGET_POWER
9152 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9153 || INTVAL (operands[2]) == 0)
9154 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9155 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9156 && REGNO (operands[4]) == 5"
9157 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9158 [(set_attr "type" "load")
9159 (set_attr "length" "8")])
9162 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9163 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9164 (use (match_operand:SI 2 "immediate_operand" "i"))
9165 (use (match_operand:SI 3 "immediate_operand" "i"))
9166 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9167 (clobber (reg:SI 6))
9168 (clobber (reg:SI 7))
9169 (clobber (reg:SI 8))
9170 (clobber (reg:SI 9))
9171 (clobber (reg:SI 10))
9172 (clobber (reg:SI 11))
9173 (clobber (reg:SI 12))
9174 (clobber (match_scratch:SI 5 "X"))]
9175 "TARGET_STRING && ! TARGET_POWER
9176 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9177 || INTVAL (operands[2]) == 0)
9178 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9179 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9180 && REGNO (operands[4]) == 5"
9181 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9182 [(set_attr "type" "load")
9183 (set_attr "length" "8")])
9186 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9187 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9188 (use (match_operand:SI 2 "immediate_operand" "i"))
9189 (use (match_operand:SI 3 "immediate_operand" "i"))
9190 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9191 (clobber (reg:SI 6))
9192 (clobber (reg:SI 7))
9193 (clobber (reg:SI 8))
9194 (clobber (reg:SI 9))
9195 (clobber (reg:SI 10))
9196 (clobber (reg:SI 11))
9197 (clobber (reg:SI 12))
9198 (clobber (match_scratch:SI 5 "X"))]
9199 "TARGET_STRING && TARGET_POWERPC64
9200 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9201 || INTVAL (operands[2]) == 0)
9202 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9203 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9204 && REGNO (operands[4]) == 5"
9205 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9206 [(set_attr "type" "load")
9207 (set_attr "length" "8")])
9209 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9210 ;; register allocator doesn't have a clue about allocating 6 word registers.
9211 ;; rD/rS = r5 is preferred, efficient form.
9212 (define_expand "movmemsi_6reg"
9213 [(parallel [(set (match_operand 0 "" "")
9214 (match_operand 1 "" ""))
9215 (use (match_operand 2 "" ""))
9216 (use (match_operand 3 "" ""))
9217 (clobber (reg:SI 5))
9218 (clobber (reg:SI 6))
9219 (clobber (reg:SI 7))
9220 (clobber (reg:SI 8))
9221 (clobber (reg:SI 9))
9222 (clobber (reg:SI 10))
9223 (clobber (match_scratch:SI 4 ""))])]
9228 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9229 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9230 (use (match_operand:SI 2 "immediate_operand" "i"))
9231 (use (match_operand:SI 3 "immediate_operand" "i"))
9232 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9233 (clobber (reg:SI 6))
9234 (clobber (reg:SI 7))
9235 (clobber (reg:SI 8))
9236 (clobber (reg:SI 9))
9237 (clobber (reg:SI 10))
9238 (clobber (match_scratch:SI 5 "=q"))]
9239 "TARGET_STRING && TARGET_POWER
9240 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9241 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9242 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9243 && REGNO (operands[4]) == 5"
9244 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9245 [(set_attr "type" "load")
9246 (set_attr "length" "8")])
9249 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9250 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9251 (use (match_operand:SI 2 "immediate_operand" "i"))
9252 (use (match_operand:SI 3 "immediate_operand" "i"))
9253 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
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 5 "X"))]
9260 "TARGET_STRING && ! TARGET_POWER
9261 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9262 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9263 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9264 && REGNO (operands[4]) == 5"
9265 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9266 [(set_attr "type" "load")
9267 (set_attr "length" "8")])
9270 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9271 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9272 (use (match_operand:SI 2 "immediate_operand" "i"))
9273 (use (match_operand:SI 3 "immediate_operand" "i"))
9274 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9275 (clobber (reg:SI 6))
9276 (clobber (reg:SI 7))
9277 (clobber (reg:SI 8))
9278 (clobber (reg:SI 9))
9279 (clobber (reg:SI 10))
9280 (clobber (match_scratch:SI 5 "X"))]
9281 "TARGET_STRING && TARGET_POWERPC64
9282 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9283 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9284 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9285 && REGNO (operands[4]) == 5"
9286 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9287 [(set_attr "type" "load")
9288 (set_attr "length" "8")])
9290 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9291 ;; problems with TImode.
9292 ;; rD/rS = r5 is preferred, efficient form.
9293 (define_expand "movmemsi_4reg"
9294 [(parallel [(set (match_operand 0 "" "")
9295 (match_operand 1 "" ""))
9296 (use (match_operand 2 "" ""))
9297 (use (match_operand 3 "" ""))
9298 (clobber (reg:SI 5))
9299 (clobber (reg:SI 6))
9300 (clobber (reg:SI 7))
9301 (clobber (reg:SI 8))
9302 (clobber (match_scratch:SI 4 ""))])]
9307 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9308 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9309 (use (match_operand:SI 2 "immediate_operand" "i"))
9310 (use (match_operand:SI 3 "immediate_operand" "i"))
9311 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9312 (clobber (reg:SI 6))
9313 (clobber (reg:SI 7))
9314 (clobber (reg:SI 8))
9315 (clobber (match_scratch:SI 5 "=q"))]
9316 "TARGET_STRING && TARGET_POWER
9317 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9318 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9319 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9320 && REGNO (operands[4]) == 5"
9321 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9322 [(set_attr "type" "load")
9323 (set_attr "length" "8")])
9326 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9327 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9328 (use (match_operand:SI 2 "immediate_operand" "i"))
9329 (use (match_operand:SI 3 "immediate_operand" "i"))
9330 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9331 (clobber (reg:SI 6))
9332 (clobber (reg:SI 7))
9333 (clobber (reg:SI 8))
9334 (clobber (match_scratch:SI 5 "X"))]
9335 "TARGET_STRING && ! TARGET_POWER
9336 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9337 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9338 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9339 && REGNO (operands[4]) == 5"
9340 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9341 [(set_attr "type" "load")
9342 (set_attr "length" "8")])
9345 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9346 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9347 (use (match_operand:SI 2 "immediate_operand" "i"))
9348 (use (match_operand:SI 3 "immediate_operand" "i"))
9349 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9350 (clobber (reg:SI 6))
9351 (clobber (reg:SI 7))
9352 (clobber (reg:SI 8))
9353 (clobber (match_scratch:SI 5 "X"))]
9354 "TARGET_STRING && TARGET_POWERPC64
9355 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9356 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9357 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9358 && REGNO (operands[4]) == 5"
9359 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9360 [(set_attr "type" "load")
9361 (set_attr "length" "8")])
9363 ;; Move up to 8 bytes at a time.
9364 (define_expand "movmemsi_2reg"
9365 [(parallel [(set (match_operand 0 "" "")
9366 (match_operand 1 "" ""))
9367 (use (match_operand 2 "" ""))
9368 (use (match_operand 3 "" ""))
9369 (clobber (match_scratch:DI 4 ""))
9370 (clobber (match_scratch:SI 5 ""))])]
9371 "TARGET_STRING && ! TARGET_POWERPC64"
9375 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9376 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9377 (use (match_operand:SI 2 "immediate_operand" "i"))
9378 (use (match_operand:SI 3 "immediate_operand" "i"))
9379 (clobber (match_scratch:DI 4 "=&r"))
9380 (clobber (match_scratch:SI 5 "=q"))]
9381 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9382 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9383 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9384 [(set_attr "type" "load")
9385 (set_attr "length" "8")])
9388 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9389 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9390 (use (match_operand:SI 2 "immediate_operand" "i"))
9391 (use (match_operand:SI 3 "immediate_operand" "i"))
9392 (clobber (match_scratch:DI 4 "=&r"))
9393 (clobber (match_scratch:SI 5 "X"))]
9394 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9395 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9396 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9397 [(set_attr "type" "load")
9398 (set_attr "length" "8")])
9400 ;; Move up to 4 bytes at a time.
9401 (define_expand "movmemsi_1reg"
9402 [(parallel [(set (match_operand 0 "" "")
9403 (match_operand 1 "" ""))
9404 (use (match_operand 2 "" ""))
9405 (use (match_operand 3 "" ""))
9406 (clobber (match_scratch:SI 4 ""))
9407 (clobber (match_scratch:SI 5 ""))])]
9412 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9413 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9414 (use (match_operand:SI 2 "immediate_operand" "i"))
9415 (use (match_operand:SI 3 "immediate_operand" "i"))
9416 (clobber (match_scratch:SI 4 "=&r"))
9417 (clobber (match_scratch:SI 5 "=q"))]
9418 "TARGET_STRING && TARGET_POWER
9419 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9420 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9421 [(set_attr "type" "load")
9422 (set_attr "length" "8")])
9425 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9426 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9427 (use (match_operand:SI 2 "immediate_operand" "i"))
9428 (use (match_operand:SI 3 "immediate_operand" "i"))
9429 (clobber (match_scratch:SI 4 "=&r"))
9430 (clobber (match_scratch:SI 5 "X"))]
9431 "TARGET_STRING && ! TARGET_POWER
9432 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9433 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9434 [(set_attr "type" "load")
9435 (set_attr "length" "8")])
9438 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9439 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9440 (use (match_operand:SI 2 "immediate_operand" "i"))
9441 (use (match_operand:SI 3 "immediate_operand" "i"))
9442 (clobber (match_scratch:SI 4 "=&r"))
9443 (clobber (match_scratch:SI 5 "X"))]
9444 "TARGET_STRING && TARGET_POWERPC64
9445 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9446 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9447 [(set_attr "type" "load")
9448 (set_attr "length" "8")])
9451 ;; Define insns that do load or store with update. Some of these we can
9452 ;; get by using pre-decrement or pre-increment, but the hardware can also
9453 ;; do cases where the increment is not the size of the object.
9455 ;; In all these cases, we use operands 0 and 1 for the register being
9456 ;; incremented because those are the operands that local-alloc will
9457 ;; tie and these are the pair most likely to be tieable (and the ones
9458 ;; that will benefit the most).
9460 (define_insn "*movdi_update1"
9461 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9462 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9463 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9464 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9465 (plus:DI (match_dup 1) (match_dup 2)))]
9466 "TARGET_POWERPC64 && TARGET_UPDATE"
9470 [(set_attr "type" "load_ux,load_u")])
9472 (define_insn "movdi_<mode>_update"
9473 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9474 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9475 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9476 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9477 (plus:P (match_dup 1) (match_dup 2)))]
9478 "TARGET_POWERPC64 && TARGET_UPDATE"
9482 [(set_attr "type" "store_ux,store_u")])
9484 (define_insn "*movsi_update1"
9485 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9486 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9487 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9488 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9489 (plus:SI (match_dup 1) (match_dup 2)))]
9492 {lux|lwzux} %3,%0,%2
9493 {lu|lwzu} %3,%2(%0)"
9494 [(set_attr "type" "load_ux,load_u")])
9496 (define_insn "*movsi_update2"
9497 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9499 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9500 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9501 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9502 (plus:DI (match_dup 1) (match_dup 2)))]
9505 [(set_attr "type" "load_ext_ux")])
9507 (define_insn "movsi_update"
9508 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9509 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9510 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9511 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9512 (plus:SI (match_dup 1) (match_dup 2)))]
9515 {stux|stwux} %3,%0,%2
9516 {stu|stwu} %3,%2(%0)"
9517 [(set_attr "type" "store_ux,store_u")])
9519 (define_insn "*movhi_update1"
9520 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9521 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9522 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9523 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9524 (plus:SI (match_dup 1) (match_dup 2)))]
9529 [(set_attr "type" "load_ux,load_u")])
9531 (define_insn "*movhi_update2"
9532 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9534 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9535 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9536 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9537 (plus:SI (match_dup 1) (match_dup 2)))]
9542 [(set_attr "type" "load_ux,load_u")])
9544 (define_insn "*movhi_update3"
9545 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9547 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9548 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9549 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9550 (plus:SI (match_dup 1) (match_dup 2)))]
9555 [(set_attr "type" "load_ext_ux,load_ext_u")])
9557 (define_insn "*movhi_update4"
9558 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9559 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9560 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9561 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9562 (plus:SI (match_dup 1) (match_dup 2)))]
9567 [(set_attr "type" "store_ux,store_u")])
9569 (define_insn "*movqi_update1"
9570 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9571 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9572 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9573 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9574 (plus:SI (match_dup 1) (match_dup 2)))]
9579 [(set_attr "type" "load_ux,load_u")])
9581 (define_insn "*movqi_update2"
9582 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9584 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9585 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9586 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9587 (plus:SI (match_dup 1) (match_dup 2)))]
9592 [(set_attr "type" "load_ux,load_u")])
9594 (define_insn "*movqi_update3"
9595 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9596 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9597 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9598 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9599 (plus:SI (match_dup 1) (match_dup 2)))]
9604 [(set_attr "type" "store_ux,store_u")])
9606 (define_insn "*movsf_update1"
9607 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9608 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9609 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9610 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9611 (plus:SI (match_dup 1) (match_dup 2)))]
9612 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9616 [(set_attr "type" "fpload_ux,fpload_u")])
9618 (define_insn "*movsf_update2"
9619 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9620 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9621 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9622 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9623 (plus:SI (match_dup 1) (match_dup 2)))]
9624 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9628 [(set_attr "type" "fpstore_ux,fpstore_u")])
9630 (define_insn "*movsf_update3"
9631 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9632 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9633 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9634 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9635 (plus:SI (match_dup 1) (match_dup 2)))]
9636 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9638 {lux|lwzux} %3,%0,%2
9639 {lu|lwzu} %3,%2(%0)"
9640 [(set_attr "type" "load_ux,load_u")])
9642 (define_insn "*movsf_update4"
9643 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9644 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9645 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9646 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9647 (plus:SI (match_dup 1) (match_dup 2)))]
9648 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9650 {stux|stwux} %3,%0,%2
9651 {stu|stwu} %3,%2(%0)"
9652 [(set_attr "type" "store_ux,store_u")])
9654 (define_insn "*movdf_update1"
9655 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9656 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9657 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
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" "fpload_ux,fpload_u")])
9666 (define_insn "*movdf_update2"
9667 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9668 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9669 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9670 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9671 (plus:SI (match_dup 1) (match_dup 2)))]
9672 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9676 [(set_attr "type" "fpstore_ux,fpstore_u")])
9678 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9680 (define_insn "*lfq_power2"
9681 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9682 (match_operand:TF 1 "memory_operand" ""))]
9684 && TARGET_HARD_FLOAT && TARGET_FPRS"
9688 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9689 (match_operand:DF 1 "memory_operand" ""))
9690 (set (match_operand:DF 2 "gpc_reg_operand" "")
9691 (match_operand:DF 3 "memory_operand" ""))]
9693 && TARGET_HARD_FLOAT && TARGET_FPRS
9694 && registers_ok_for_quad_peep (operands[0], operands[2])
9695 && mems_ok_for_quad_peep (operands[1], operands[3])"
9698 "operands[1] = widen_memory_access (operands[1], TFmode, 0);
9699 operands[0] = gen_rtx_REG (TFmode, REGNO (operands[0]));")
9701 (define_insn "*stfq_power2"
9702 [(set (match_operand:TF 0 "memory_operand" "")
9703 (match_operand:TF 1 "gpc_reg_operand" "f"))]
9705 && TARGET_HARD_FLOAT && TARGET_FPRS"
9710 [(set (match_operand:DF 0 "memory_operand" "")
9711 (match_operand:DF 1 "gpc_reg_operand" ""))
9712 (set (match_operand:DF 2 "memory_operand" "")
9713 (match_operand:DF 3 "gpc_reg_operand" ""))]
9715 && TARGET_HARD_FLOAT && TARGET_FPRS
9716 && registers_ok_for_quad_peep (operands[1], operands[3])
9717 && mems_ok_for_quad_peep (operands[0], operands[2])"
9720 "operands[0] = widen_memory_access (operands[0], TFmode, 0);
9721 operands[1] = gen_rtx_REG (TFmode, REGNO (operands[1]));")
9723 ;; after inserting conditional returns we can sometimes have
9724 ;; unnecessary register moves. Unfortunately we cannot have a
9725 ;; modeless peephole here, because some single SImode sets have early
9726 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9727 ;; sequences, using get_attr_length here will smash the operands
9728 ;; array. Neither is there an early_cobbler_p predicate.
9730 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9731 (match_operand:DF 1 "any_operand" ""))
9732 (set (match_operand:DF 2 "gpc_reg_operand" "")
9734 "peep2_reg_dead_p (2, operands[0])"
9735 [(set (match_dup 2) (match_dup 1))])
9738 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9739 (match_operand:SF 1 "any_operand" ""))
9740 (set (match_operand:SF 2 "gpc_reg_operand" "")
9742 "peep2_reg_dead_p (2, operands[0])"
9743 [(set (match_dup 2) (match_dup 1))])
9748 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9749 (define_insn "tls_gd_32"
9750 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9751 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9752 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9754 "HAVE_AS_TLS && !TARGET_64BIT"
9755 "addi %0,%1,%2@got@tlsgd")
9757 (define_insn "tls_gd_64"
9758 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9759 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9760 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9762 "HAVE_AS_TLS && TARGET_64BIT"
9763 "addi %0,%1,%2@got@tlsgd")
9765 (define_insn "tls_ld_32"
9766 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9767 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9769 "HAVE_AS_TLS && !TARGET_64BIT"
9770 "addi %0,%1,%&@got@tlsld")
9772 (define_insn "tls_ld_64"
9773 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9774 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9776 "HAVE_AS_TLS && TARGET_64BIT"
9777 "addi %0,%1,%&@got@tlsld")
9779 (define_insn "tls_dtprel_32"
9780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9781 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9782 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9784 "HAVE_AS_TLS && !TARGET_64BIT"
9785 "addi %0,%1,%2@dtprel")
9787 (define_insn "tls_dtprel_64"
9788 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9789 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9790 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9792 "HAVE_AS_TLS && TARGET_64BIT"
9793 "addi %0,%1,%2@dtprel")
9795 (define_insn "tls_dtprel_ha_32"
9796 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9797 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9798 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9799 UNSPEC_TLSDTPRELHA))]
9800 "HAVE_AS_TLS && !TARGET_64BIT"
9801 "addis %0,%1,%2@dtprel@ha")
9803 (define_insn "tls_dtprel_ha_64"
9804 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9805 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9806 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9807 UNSPEC_TLSDTPRELHA))]
9808 "HAVE_AS_TLS && TARGET_64BIT"
9809 "addis %0,%1,%2@dtprel@ha")
9811 (define_insn "tls_dtprel_lo_32"
9812 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9813 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9814 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9815 UNSPEC_TLSDTPRELLO))]
9816 "HAVE_AS_TLS && !TARGET_64BIT"
9817 "addi %0,%1,%2@dtprel@l")
9819 (define_insn "tls_dtprel_lo_64"
9820 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9821 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9822 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9823 UNSPEC_TLSDTPRELLO))]
9824 "HAVE_AS_TLS && TARGET_64BIT"
9825 "addi %0,%1,%2@dtprel@l")
9827 (define_insn "tls_got_dtprel_32"
9828 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9829 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9830 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9831 UNSPEC_TLSGOTDTPREL))]
9832 "HAVE_AS_TLS && !TARGET_64BIT"
9833 "lwz %0,%2@got@dtprel(%1)")
9835 (define_insn "tls_got_dtprel_64"
9836 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9837 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9838 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9839 UNSPEC_TLSGOTDTPREL))]
9840 "HAVE_AS_TLS && TARGET_64BIT"
9841 "ld %0,%2@got@dtprel(%1)")
9843 (define_insn "tls_tprel_32"
9844 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9845 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9846 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9848 "HAVE_AS_TLS && !TARGET_64BIT"
9849 "addi %0,%1,%2@tprel")
9851 (define_insn "tls_tprel_64"
9852 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9853 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9854 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9856 "HAVE_AS_TLS && TARGET_64BIT"
9857 "addi %0,%1,%2@tprel")
9859 (define_insn "tls_tprel_ha_32"
9860 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9861 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9862 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9863 UNSPEC_TLSTPRELHA))]
9864 "HAVE_AS_TLS && !TARGET_64BIT"
9865 "addis %0,%1,%2@tprel@ha")
9867 (define_insn "tls_tprel_ha_64"
9868 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9869 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9870 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9871 UNSPEC_TLSTPRELHA))]
9872 "HAVE_AS_TLS && TARGET_64BIT"
9873 "addis %0,%1,%2@tprel@ha")
9875 (define_insn "tls_tprel_lo_32"
9876 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9877 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9878 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9879 UNSPEC_TLSTPRELLO))]
9880 "HAVE_AS_TLS && !TARGET_64BIT"
9881 "addi %0,%1,%2@tprel@l")
9883 (define_insn "tls_tprel_lo_64"
9884 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9885 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9886 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9887 UNSPEC_TLSTPRELLO))]
9888 "HAVE_AS_TLS && TARGET_64BIT"
9889 "addi %0,%1,%2@tprel@l")
9891 ;; "b" output constraint here and on tls_tls input to support linker tls
9892 ;; optimization. The linker may edit the instructions emitted by a
9893 ;; tls_got_tprel/tls_tls pair to addis,addi.
9894 (define_insn "tls_got_tprel_32"
9895 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9896 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9897 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9898 UNSPEC_TLSGOTTPREL))]
9899 "HAVE_AS_TLS && !TARGET_64BIT"
9900 "lwz %0,%2@got@tprel(%1)")
9902 (define_insn "tls_got_tprel_64"
9903 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9904 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9905 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9906 UNSPEC_TLSGOTTPREL))]
9907 "HAVE_AS_TLS && TARGET_64BIT"
9908 "ld %0,%2@got@tprel(%1)")
9910 (define_insn "tls_tls_32"
9911 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9912 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9913 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9915 "HAVE_AS_TLS && !TARGET_64BIT"
9918 (define_insn "tls_tls_64"
9919 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9920 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9921 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9923 "HAVE_AS_TLS && TARGET_64BIT"
9926 ;; Next come insns related to the calling sequence.
9928 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9929 ;; We move the back-chain and decrement the stack pointer.
9931 (define_expand "allocate_stack"
9932 [(set (match_operand 0 "gpc_reg_operand" "=r")
9933 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9935 (minus (reg 1) (match_dup 1)))]
9938 { rtx chain = gen_reg_rtx (Pmode);
9939 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9942 emit_move_insn (chain, stack_bot);
9944 /* Check stack bounds if necessary. */
9945 if (current_function_limit_stack)
9948 available = expand_binop (Pmode, sub_optab,
9949 stack_pointer_rtx, stack_limit_rtx,
9950 NULL_RTX, 1, OPTAB_WIDEN);
9951 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9954 if (GET_CODE (operands[1]) != CONST_INT
9955 || INTVAL (operands[1]) < -32767
9956 || INTVAL (operands[1]) > 32768)
9958 neg_op0 = gen_reg_rtx (Pmode);
9960 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9962 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9965 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9968 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
9969 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9973 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9974 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9975 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9978 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9982 ;; These patterns say how to save and restore the stack pointer. We need not
9983 ;; save the stack pointer at function level since we are careful to
9984 ;; preserve the backchain. At block level, we have to restore the backchain
9985 ;; when we restore the stack pointer.
9987 ;; For nonlocal gotos, we must save both the stack pointer and its
9988 ;; backchain and restore both. Note that in the nonlocal case, the
9989 ;; save area is a memory location.
9991 (define_expand "save_stack_function"
9992 [(match_operand 0 "any_operand" "")
9993 (match_operand 1 "any_operand" "")]
9997 (define_expand "restore_stack_function"
9998 [(match_operand 0 "any_operand" "")
9999 (match_operand 1 "any_operand" "")]
10003 (define_expand "restore_stack_block"
10004 [(use (match_operand 0 "register_operand" ""))
10005 (set (match_dup 2) (match_dup 3))
10006 (set (match_dup 0) (match_operand 1 "register_operand" ""))
10007 (set (match_dup 3) (match_dup 2))]
10011 operands[2] = gen_reg_rtx (Pmode);
10012 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
10015 (define_expand "save_stack_nonlocal"
10016 [(match_operand 0 "memory_operand" "")
10017 (match_operand 1 "register_operand" "")]
10021 rtx temp = gen_reg_rtx (Pmode);
10022 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10024 /* Copy the backchain to the first word, sp to the second. */
10025 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
10026 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
10027 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
10032 (define_expand "restore_stack_nonlocal"
10033 [(match_operand 0 "register_operand" "")
10034 (match_operand 1 "memory_operand" "")]
10038 rtx temp = gen_reg_rtx (Pmode);
10039 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10041 /* Restore the backchain from the first word, sp from the second. */
10042 emit_move_insn (temp,
10043 adjust_address_nv (operands[1], Pmode, 0));
10044 emit_move_insn (operands[0],
10045 adjust_address_nv (operands[1], Pmode, units_per_word));
10046 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
10050 ;; TOC register handling.
10052 ;; Code to initialize the TOC register...
10054 (define_insn "load_toc_aix_si"
10055 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10056 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10057 (use (reg:SI 2))])]
10058 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10062 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10063 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10064 operands[2] = gen_rtx_REG (Pmode, 2);
10065 return \"{l|lwz} %0,%1(%2)\";
10067 [(set_attr "type" "load")])
10069 (define_insn "load_toc_aix_di"
10070 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10071 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10072 (use (reg:DI 2))])]
10073 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10077 #ifdef TARGET_RELOCATABLE
10078 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10079 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10081 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10084 strcat (buf, \"@toc\");
10085 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10086 operands[2] = gen_rtx_REG (Pmode, 2);
10087 return \"ld %0,%1(%2)\";
10089 [(set_attr "type" "load")])
10091 (define_insn "load_toc_v4_pic_si"
10092 [(set (match_operand:SI 0 "register_operand" "=l")
10093 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10094 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10095 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10096 [(set_attr "type" "branch")
10097 (set_attr "length" "4")])
10099 (define_insn "load_toc_v4_PIC_1"
10100 [(set (match_operand:SI 0 "register_operand" "=l")
10101 (match_operand:SI 1 "immediate_operand" "s"))
10102 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
10103 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10104 "bcl 20,31,%1\\n%1:"
10105 [(set_attr "type" "branch")
10106 (set_attr "length" "4")])
10108 (define_insn "load_toc_v4_PIC_1b"
10109 [(set (match_operand:SI 0 "register_operand" "=l")
10110 (match_operand:SI 1 "immediate_operand" "s"))
10111 (use (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")]
10113 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10114 "bcl 20,31,%1+4\\n%1:\\n\\t.long %2-%1"
10115 [(set_attr "type" "branch")
10116 (set_attr "length" "8")])
10118 (define_insn "load_toc_v4_PIC_2"
10119 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10120 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10121 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10122 (match_operand:SI 3 "immediate_operand" "s")))))]
10123 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10124 "{l|lwz} %0,%2-%3(%1)"
10125 [(set_attr "type" "load")])
10128 ;; If the TOC is shared over a translation unit, as happens with all
10129 ;; the kinds of PIC that we support, we need to restore the TOC
10130 ;; pointer only when jumping over units of translation.
10131 ;; On Darwin, we need to reload the picbase.
10133 (define_expand "builtin_setjmp_receiver"
10134 [(use (label_ref (match_operand 0 "" "")))]
10135 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10136 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10137 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10141 if (DEFAULT_ABI == ABI_DARWIN)
10143 const char *picbase = machopic_function_base_name ();
10144 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10145 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10149 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10150 CODE_LABEL_NUMBER (operands[0]));
10151 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10153 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10154 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10158 rs6000_emit_load_toc_table (FALSE);
10162 ;; A function pointer under AIX is a pointer to a data area whose first word
10163 ;; contains the actual address of the function, whose second word contains a
10164 ;; pointer to its TOC, and whose third word contains a value to place in the
10165 ;; static chain register (r11). Note that if we load the static chain, our
10166 ;; "trampoline" need not have any executable code.
10168 (define_expand "call_indirect_aix32"
10169 [(set (match_dup 2)
10170 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10171 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10174 (mem:SI (plus:SI (match_dup 0)
10177 (mem:SI (plus:SI (match_dup 0)
10179 (parallel [(call (mem:SI (match_dup 2))
10180 (match_operand 1 "" ""))
10184 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10185 (clobber (scratch:SI))])]
10188 { operands[2] = gen_reg_rtx (SImode); }")
10190 (define_expand "call_indirect_aix64"
10191 [(set (match_dup 2)
10192 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10193 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10196 (mem:DI (plus:DI (match_dup 0)
10199 (mem:DI (plus:DI (match_dup 0)
10201 (parallel [(call (mem:SI (match_dup 2))
10202 (match_operand 1 "" ""))
10206 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10207 (clobber (scratch:SI))])]
10210 { operands[2] = gen_reg_rtx (DImode); }")
10212 (define_expand "call_value_indirect_aix32"
10213 [(set (match_dup 3)
10214 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10215 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10218 (mem:SI (plus:SI (match_dup 1)
10221 (mem:SI (plus:SI (match_dup 1)
10223 (parallel [(set (match_operand 0 "" "")
10224 (call (mem:SI (match_dup 3))
10225 (match_operand 2 "" "")))
10229 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10230 (clobber (scratch:SI))])]
10233 { operands[3] = gen_reg_rtx (SImode); }")
10235 (define_expand "call_value_indirect_aix64"
10236 [(set (match_dup 3)
10237 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10238 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10241 (mem:DI (plus:DI (match_dup 1)
10244 (mem:DI (plus:DI (match_dup 1)
10246 (parallel [(set (match_operand 0 "" "")
10247 (call (mem:SI (match_dup 3))
10248 (match_operand 2 "" "")))
10252 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10253 (clobber (scratch:SI))])]
10256 { operands[3] = gen_reg_rtx (DImode); }")
10258 ;; Now the definitions for the call and call_value insns
10259 (define_expand "call"
10260 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10261 (match_operand 1 "" ""))
10262 (use (match_operand 2 "" ""))
10263 (clobber (scratch:SI))])]
10268 if (MACHOPIC_INDIRECT)
10269 operands[0] = machopic_indirect_call_target (operands[0]);
10272 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10275 operands[0] = XEXP (operands[0], 0);
10277 if (GET_CODE (operands[0]) != SYMBOL_REF
10278 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10279 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10281 if (INTVAL (operands[2]) & CALL_LONG)
10282 operands[0] = rs6000_longcall_ref (operands[0]);
10284 if (DEFAULT_ABI == ABI_V4
10285 || DEFAULT_ABI == ABI_DARWIN)
10286 operands[0] = force_reg (Pmode, operands[0]);
10288 else if (DEFAULT_ABI == ABI_AIX)
10290 /* AIX function pointers are really pointers to a three word
10292 emit_call_insn (TARGET_32BIT
10293 ? gen_call_indirect_aix32 (force_reg (SImode,
10296 : gen_call_indirect_aix64 (force_reg (DImode,
10306 (define_expand "call_value"
10307 [(parallel [(set (match_operand 0 "" "")
10308 (call (mem:SI (match_operand 1 "address_operand" ""))
10309 (match_operand 2 "" "")))
10310 (use (match_operand 3 "" ""))
10311 (clobber (scratch:SI))])]
10316 if (MACHOPIC_INDIRECT)
10317 operands[1] = machopic_indirect_call_target (operands[1]);
10320 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10323 operands[1] = XEXP (operands[1], 0);
10325 if (GET_CODE (operands[1]) != SYMBOL_REF
10326 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10327 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10329 if (INTVAL (operands[3]) & CALL_LONG)
10330 operands[1] = rs6000_longcall_ref (operands[1]);
10332 if (DEFAULT_ABI == ABI_V4
10333 || DEFAULT_ABI == ABI_DARWIN)
10334 operands[1] = force_reg (Pmode, operands[1]);
10336 else if (DEFAULT_ABI == ABI_AIX)
10338 /* AIX function pointers are really pointers to a three word
10340 emit_call_insn (TARGET_32BIT
10341 ? gen_call_value_indirect_aix32 (operands[0],
10345 : gen_call_value_indirect_aix64 (operands[0],
10356 ;; Call to function in current module. No TOC pointer reload needed.
10357 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10358 ;; either the function was not prototyped, or it was prototyped as a
10359 ;; variable argument function. It is > 0 if FP registers were passed
10360 ;; and < 0 if they were not.
10362 (define_insn "*call_local32"
10363 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10364 (match_operand 1 "" "g,g"))
10365 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10366 (clobber (match_scratch:SI 3 "=l,l"))]
10367 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10370 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10371 output_asm_insn (\"crxor 6,6,6\", operands);
10373 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10374 output_asm_insn (\"creqv 6,6,6\", operands);
10376 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10378 [(set_attr "type" "branch")
10379 (set_attr "length" "4,8")])
10381 (define_insn "*call_local64"
10382 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10383 (match_operand 1 "" "g,g"))
10384 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10385 (clobber (match_scratch:SI 3 "=l,l"))]
10386 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10389 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10390 output_asm_insn (\"crxor 6,6,6\", operands);
10392 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10393 output_asm_insn (\"creqv 6,6,6\", operands);
10395 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10397 [(set_attr "type" "branch")
10398 (set_attr "length" "4,8")])
10400 (define_insn "*call_value_local32"
10401 [(set (match_operand 0 "" "")
10402 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10403 (match_operand 2 "" "g,g")))
10404 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10405 (clobber (match_scratch:SI 4 "=l,l"))]
10406 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10409 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10410 output_asm_insn (\"crxor 6,6,6\", operands);
10412 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10413 output_asm_insn (\"creqv 6,6,6\", operands);
10415 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10417 [(set_attr "type" "branch")
10418 (set_attr "length" "4,8")])
10421 (define_insn "*call_value_local64"
10422 [(set (match_operand 0 "" "")
10423 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10424 (match_operand 2 "" "g,g")))
10425 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10426 (clobber (match_scratch:SI 4 "=l,l"))]
10427 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10430 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10431 output_asm_insn (\"crxor 6,6,6\", operands);
10433 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10434 output_asm_insn (\"creqv 6,6,6\", operands);
10436 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10438 [(set_attr "type" "branch")
10439 (set_attr "length" "4,8")])
10441 ;; Call to function which may be in another module. Restore the TOC
10442 ;; pointer (r2) after the call unless this is System V.
10443 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10444 ;; either the function was not prototyped, or it was prototyped as a
10445 ;; variable argument function. It is > 0 if FP registers were passed
10446 ;; and < 0 if they were not.
10448 (define_insn "*call_indirect_nonlocal_aix32"
10449 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10450 (match_operand 1 "" "g"))
10454 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10455 (clobber (match_scratch:SI 2 "=l"))]
10456 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10457 "b%T0l\;{l|lwz} 2,20(1)"
10458 [(set_attr "type" "jmpreg")
10459 (set_attr "length" "8")])
10461 (define_insn "*call_nonlocal_aix32"
10462 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10463 (match_operand 1 "" "g"))
10464 (use (match_operand:SI 2 "immediate_operand" "O"))
10465 (clobber (match_scratch:SI 3 "=l"))]
10467 && DEFAULT_ABI == ABI_AIX
10468 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10470 [(set_attr "type" "branch")
10471 (set_attr "length" "8")])
10473 (define_insn "*call_indirect_nonlocal_aix64"
10474 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10475 (match_operand 1 "" "g"))
10479 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10480 (clobber (match_scratch:SI 2 "=l"))]
10481 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10482 "b%T0l\;ld 2,40(1)"
10483 [(set_attr "type" "jmpreg")
10484 (set_attr "length" "8")])
10486 (define_insn "*call_nonlocal_aix64"
10487 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10488 (match_operand 1 "" "g"))
10489 (use (match_operand:SI 2 "immediate_operand" "O"))
10490 (clobber (match_scratch:SI 3 "=l"))]
10492 && DEFAULT_ABI == ABI_AIX
10493 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10495 [(set_attr "type" "branch")
10496 (set_attr "length" "8")])
10498 (define_insn "*call_value_indirect_nonlocal_aix32"
10499 [(set (match_operand 0 "" "")
10500 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10501 (match_operand 2 "" "g")))
10505 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10506 (clobber (match_scratch:SI 3 "=l"))]
10507 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10508 "b%T1l\;{l|lwz} 2,20(1)"
10509 [(set_attr "type" "jmpreg")
10510 (set_attr "length" "8")])
10512 (define_insn "*call_value_nonlocal_aix32"
10513 [(set (match_operand 0 "" "")
10514 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10515 (match_operand 2 "" "g")))
10516 (use (match_operand:SI 3 "immediate_operand" "O"))
10517 (clobber (match_scratch:SI 4 "=l"))]
10519 && DEFAULT_ABI == ABI_AIX
10520 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10522 [(set_attr "type" "branch")
10523 (set_attr "length" "8")])
10525 (define_insn "*call_value_indirect_nonlocal_aix64"
10526 [(set (match_operand 0 "" "")
10527 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10528 (match_operand 2 "" "g")))
10532 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10533 (clobber (match_scratch:SI 3 "=l"))]
10534 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10535 "b%T1l\;ld 2,40(1)"
10536 [(set_attr "type" "jmpreg")
10537 (set_attr "length" "8")])
10539 (define_insn "*call_value_nonlocal_aix64"
10540 [(set (match_operand 0 "" "")
10541 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10542 (match_operand 2 "" "g")))
10543 (use (match_operand:SI 3 "immediate_operand" "O"))
10544 (clobber (match_scratch:SI 4 "=l"))]
10546 && DEFAULT_ABI == ABI_AIX
10547 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10549 [(set_attr "type" "branch")
10550 (set_attr "length" "8")])
10552 ;; A function pointer under System V is just a normal pointer
10553 ;; operands[0] is the function pointer
10554 ;; operands[1] is the stack size to clean up
10555 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10556 ;; which indicates how to set cr1
10558 (define_insn "*call_indirect_nonlocal_sysv"
10559 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10560 (match_operand 1 "" "g,g"))
10561 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10562 (clobber (match_scratch:SI 3 "=l,l"))]
10563 "DEFAULT_ABI == ABI_V4
10564 || DEFAULT_ABI == ABI_DARWIN"
10566 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10567 output_asm_insn ("crxor 6,6,6", operands);
10569 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10570 output_asm_insn ("creqv 6,6,6", operands);
10574 [(set_attr "type" "jmpreg,jmpreg")
10575 (set_attr "length" "4,8")])
10577 (define_insn "*call_nonlocal_sysv"
10578 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10579 (match_operand 1 "" "g,g"))
10580 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10581 (clobber (match_scratch:SI 3 "=l,l"))]
10582 "(DEFAULT_ABI == ABI_DARWIN
10583 || (DEFAULT_ABI == ABI_V4
10584 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10586 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10587 output_asm_insn ("crxor 6,6,6", operands);
10589 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10590 output_asm_insn ("creqv 6,6,6", operands);
10593 return output_call(insn, operands, 0, 2);
10595 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10598 [(set_attr "type" "branch,branch")
10599 (set_attr "length" "4,8")])
10601 (define_insn "*call_value_indirect_nonlocal_sysv"
10602 [(set (match_operand 0 "" "")
10603 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10604 (match_operand 2 "" "g,g")))
10605 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10606 (clobber (match_scratch:SI 4 "=l,l"))]
10607 "DEFAULT_ABI == ABI_V4
10608 || DEFAULT_ABI == ABI_DARWIN"
10610 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10611 output_asm_insn ("crxor 6,6,6", operands);
10613 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10614 output_asm_insn ("creqv 6,6,6", operands);
10618 [(set_attr "type" "jmpreg,jmpreg")
10619 (set_attr "length" "4,8")])
10621 (define_insn "*call_value_nonlocal_sysv"
10622 [(set (match_operand 0 "" "")
10623 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10624 (match_operand 2 "" "g,g")))
10625 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10626 (clobber (match_scratch:SI 4 "=l,l"))]
10627 "(DEFAULT_ABI == ABI_DARWIN
10628 || (DEFAULT_ABI == ABI_V4
10629 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10631 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10632 output_asm_insn ("crxor 6,6,6", operands);
10634 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10635 output_asm_insn ("creqv 6,6,6", operands);
10638 return output_call(insn, operands, 1, 3);
10640 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10643 [(set_attr "type" "branch,branch")
10644 (set_attr "length" "4,8")])
10646 ;; Call subroutine returning any type.
10647 (define_expand "untyped_call"
10648 [(parallel [(call (match_operand 0 "" "")
10650 (match_operand 1 "" "")
10651 (match_operand 2 "" "")])]
10657 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10659 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10661 rtx set = XVECEXP (operands[2], 0, i);
10662 emit_move_insn (SET_DEST (set), SET_SRC (set));
10665 /* The optimizer does not know that the call sets the function value
10666 registers we stored in the result block. We avoid problems by
10667 claiming that all hard registers are used and clobbered at this
10669 emit_insn (gen_blockage ());
10674 ;; sibling call patterns
10675 (define_expand "sibcall"
10676 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10677 (match_operand 1 "" ""))
10678 (use (match_operand 2 "" ""))
10679 (use (match_operand 3 "" ""))
10685 if (MACHOPIC_INDIRECT)
10686 operands[0] = machopic_indirect_call_target (operands[0]);
10689 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10692 operands[0] = XEXP (operands[0], 0);
10693 operands[3] = gen_reg_rtx (SImode);
10697 ;; this and similar patterns must be marked as using LR, otherwise
10698 ;; dataflow will try to delete the store into it. This is true
10699 ;; even when the actual reg to jump to is in CTR, when LR was
10700 ;; saved and restored around the PIC-setting BCL.
10701 (define_insn "*sibcall_local32"
10702 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10703 (match_operand 1 "" "g,g"))
10704 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10705 (use (match_operand:SI 3 "register_operand" "l,l"))
10707 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10710 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10711 output_asm_insn (\"crxor 6,6,6\", operands);
10713 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10714 output_asm_insn (\"creqv 6,6,6\", operands);
10716 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10718 [(set_attr "type" "branch")
10719 (set_attr "length" "4,8")])
10721 (define_insn "*sibcall_local64"
10722 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10723 (match_operand 1 "" "g,g"))
10724 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10725 (use (match_operand:SI 3 "register_operand" "l,l"))
10727 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10730 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10731 output_asm_insn (\"crxor 6,6,6\", operands);
10733 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10734 output_asm_insn (\"creqv 6,6,6\", operands);
10736 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10738 [(set_attr "type" "branch")
10739 (set_attr "length" "4,8")])
10741 (define_insn "*sibcall_value_local32"
10742 [(set (match_operand 0 "" "")
10743 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10744 (match_operand 2 "" "g,g")))
10745 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10746 (use (match_operand:SI 4 "register_operand" "l,l"))
10748 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10751 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10752 output_asm_insn (\"crxor 6,6,6\", operands);
10754 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10755 output_asm_insn (\"creqv 6,6,6\", operands);
10757 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10759 [(set_attr "type" "branch")
10760 (set_attr "length" "4,8")])
10763 (define_insn "*sibcall_value_local64"
10764 [(set (match_operand 0 "" "")
10765 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10766 (match_operand 2 "" "g,g")))
10767 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10768 (use (match_operand:SI 4 "register_operand" "l,l"))
10770 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10773 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10774 output_asm_insn (\"crxor 6,6,6\", operands);
10776 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10777 output_asm_insn (\"creqv 6,6,6\", operands);
10779 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10781 [(set_attr "type" "branch")
10782 (set_attr "length" "4,8")])
10784 (define_insn "*sibcall_nonlocal_aix32"
10785 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10786 (match_operand 1 "" "g"))
10787 (use (match_operand:SI 2 "immediate_operand" "O"))
10788 (use (match_operand:SI 3 "register_operand" "l"))
10791 && DEFAULT_ABI == ABI_AIX
10792 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10794 [(set_attr "type" "branch")
10795 (set_attr "length" "4")])
10797 (define_insn "*sibcall_nonlocal_aix64"
10798 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10799 (match_operand 1 "" "g"))
10800 (use (match_operand:SI 2 "immediate_operand" "O"))
10801 (use (match_operand:SI 3 "register_operand" "l"))
10804 && DEFAULT_ABI == ABI_AIX
10805 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10807 [(set_attr "type" "branch")
10808 (set_attr "length" "4")])
10810 (define_insn "*sibcall_value_nonlocal_aix32"
10811 [(set (match_operand 0 "" "")
10812 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10813 (match_operand 2 "" "g")))
10814 (use (match_operand:SI 3 "immediate_operand" "O"))
10815 (use (match_operand:SI 4 "register_operand" "l"))
10818 && DEFAULT_ABI == ABI_AIX
10819 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10821 [(set_attr "type" "branch")
10822 (set_attr "length" "4")])
10824 (define_insn "*sibcall_value_nonlocal_aix64"
10825 [(set (match_operand 0 "" "")
10826 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10827 (match_operand 2 "" "g")))
10828 (use (match_operand:SI 3 "immediate_operand" "O"))
10829 (use (match_operand:SI 4 "register_operand" "l"))
10832 && DEFAULT_ABI == ABI_AIX
10833 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10835 [(set_attr "type" "branch")
10836 (set_attr "length" "4")])
10838 (define_insn "*sibcall_nonlocal_sysv"
10839 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10840 (match_operand 1 "" ""))
10841 (use (match_operand 2 "immediate_operand" "O,n"))
10842 (use (match_operand:SI 3 "register_operand" "l,l"))
10844 "(DEFAULT_ABI == ABI_DARWIN
10845 || DEFAULT_ABI == ABI_V4)
10846 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10849 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10850 output_asm_insn (\"crxor 6,6,6\", operands);
10852 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10853 output_asm_insn (\"creqv 6,6,6\", operands);
10855 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
10857 [(set_attr "type" "branch,branch")
10858 (set_attr "length" "4,8")])
10860 (define_expand "sibcall_value"
10861 [(parallel [(set (match_operand 0 "register_operand" "")
10862 (call (mem:SI (match_operand 1 "address_operand" ""))
10863 (match_operand 2 "" "")))
10864 (use (match_operand 3 "" ""))
10865 (use (match_operand 4 "" ""))
10871 if (MACHOPIC_INDIRECT)
10872 operands[1] = machopic_indirect_call_target (operands[1]);
10875 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10878 operands[1] = XEXP (operands[1], 0);
10879 operands[4] = gen_reg_rtx (SImode);
10883 (define_insn "*sibcall_value_nonlocal_sysv"
10884 [(set (match_operand 0 "" "")
10885 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10886 (match_operand 2 "" "")))
10887 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10888 (use (match_operand:SI 4 "register_operand" "l,l"))
10890 "(DEFAULT_ABI == ABI_DARWIN
10891 || DEFAULT_ABI == ABI_V4)
10892 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10895 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10896 output_asm_insn (\"crxor 6,6,6\", operands);
10898 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10899 output_asm_insn (\"creqv 6,6,6\", operands);
10901 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
10903 [(set_attr "type" "branch,branch")
10904 (set_attr "length" "4,8")])
10906 (define_expand "sibcall_epilogue"
10907 [(use (const_int 0))]
10908 "TARGET_SCHED_PROLOG"
10911 rs6000_emit_epilogue (TRUE);
10915 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10916 ;; all of memory. This blocks insns from being moved across this point.
10918 (define_insn "blockage"
10919 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10923 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10924 ;; signed & unsigned, and one type of branch.
10926 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10927 ;; insns, and branches. We store the operands of compares until we see
10929 (define_expand "cmpsi"
10931 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10932 (match_operand:SI 1 "reg_or_short_operand" "")))]
10936 /* Take care of the possibility that operands[1] might be negative but
10937 this might be a logical operation. That insn doesn't exist. */
10938 if (GET_CODE (operands[1]) == CONST_INT
10939 && INTVAL (operands[1]) < 0)
10940 operands[1] = force_reg (SImode, operands[1]);
10942 rs6000_compare_op0 = operands[0];
10943 rs6000_compare_op1 = operands[1];
10944 rs6000_compare_fp_p = 0;
10948 (define_expand "cmpdi"
10950 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10951 (match_operand:DI 1 "reg_or_short_operand" "")))]
10955 /* Take care of the possibility that operands[1] might be negative but
10956 this might be a logical operation. That insn doesn't exist. */
10957 if (GET_CODE (operands[1]) == CONST_INT
10958 && INTVAL (operands[1]) < 0)
10959 operands[1] = force_reg (DImode, operands[1]);
10961 rs6000_compare_op0 = operands[0];
10962 rs6000_compare_op1 = operands[1];
10963 rs6000_compare_fp_p = 0;
10967 (define_expand "cmpsf"
10968 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10969 (match_operand:SF 1 "gpc_reg_operand" "")))]
10970 "TARGET_HARD_FLOAT"
10973 rs6000_compare_op0 = operands[0];
10974 rs6000_compare_op1 = operands[1];
10975 rs6000_compare_fp_p = 1;
10979 (define_expand "cmpdf"
10980 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10981 (match_operand:DF 1 "gpc_reg_operand" "")))]
10982 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
10985 rs6000_compare_op0 = operands[0];
10986 rs6000_compare_op1 = operands[1];
10987 rs6000_compare_fp_p = 1;
10991 (define_expand "cmptf"
10992 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
10993 (match_operand:TF 1 "gpc_reg_operand" "")))]
10994 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
10995 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10998 rs6000_compare_op0 = operands[0];
10999 rs6000_compare_op1 = operands[1];
11000 rs6000_compare_fp_p = 1;
11004 (define_expand "beq"
11005 [(use (match_operand 0 "" ""))]
11007 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11009 (define_expand "bne"
11010 [(use (match_operand 0 "" ""))]
11012 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11014 (define_expand "bge"
11015 [(use (match_operand 0 "" ""))]
11017 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11019 (define_expand "bgt"
11020 [(use (match_operand 0 "" ""))]
11022 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11024 (define_expand "ble"
11025 [(use (match_operand 0 "" ""))]
11027 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11029 (define_expand "blt"
11030 [(use (match_operand 0 "" ""))]
11032 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11034 (define_expand "bgeu"
11035 [(use (match_operand 0 "" ""))]
11037 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11039 (define_expand "bgtu"
11040 [(use (match_operand 0 "" ""))]
11042 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11044 (define_expand "bleu"
11045 [(use (match_operand 0 "" ""))]
11047 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11049 (define_expand "bltu"
11050 [(use (match_operand 0 "" ""))]
11052 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11054 (define_expand "bunordered"
11055 [(use (match_operand 0 "" ""))]
11056 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11057 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11059 (define_expand "bordered"
11060 [(use (match_operand 0 "" ""))]
11061 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11062 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11064 (define_expand "buneq"
11065 [(use (match_operand 0 "" ""))]
11067 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11069 (define_expand "bunge"
11070 [(use (match_operand 0 "" ""))]
11072 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11074 (define_expand "bungt"
11075 [(use (match_operand 0 "" ""))]
11077 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11079 (define_expand "bunle"
11080 [(use (match_operand 0 "" ""))]
11082 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11084 (define_expand "bunlt"
11085 [(use (match_operand 0 "" ""))]
11087 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11089 (define_expand "bltgt"
11090 [(use (match_operand 0 "" ""))]
11092 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11094 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11095 ;; For SEQ, likewise, except that comparisons with zero should be done
11096 ;; with an scc insns. However, due to the order that combine see the
11097 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11098 ;; the cases we don't want to handle.
11099 (define_expand "seq"
11100 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11102 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11104 (define_expand "sne"
11105 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11109 if (! rs6000_compare_fp_p)
11112 rs6000_emit_sCOND (NE, operands[0]);
11116 ;; A >= 0 is best done the portable way for A an integer.
11117 (define_expand "sge"
11118 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11122 if (! rs6000_compare_fp_p
11123 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11126 rs6000_emit_sCOND (GE, operands[0]);
11130 ;; A > 0 is best done using the portable sequence, so fail in that case.
11131 (define_expand "sgt"
11132 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11136 if (! rs6000_compare_fp_p
11137 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11140 rs6000_emit_sCOND (GT, operands[0]);
11144 ;; A <= 0 is best done the portable way for A an integer.
11145 (define_expand "sle"
11146 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11150 if (! rs6000_compare_fp_p
11151 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11154 rs6000_emit_sCOND (LE, operands[0]);
11158 ;; A < 0 is best done in the portable way for A an integer.
11159 (define_expand "slt"
11160 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11164 if (! rs6000_compare_fp_p
11165 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11168 rs6000_emit_sCOND (LT, operands[0]);
11172 (define_expand "sgeu"
11173 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11175 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11177 (define_expand "sgtu"
11178 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11180 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11182 (define_expand "sleu"
11183 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11185 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11187 (define_expand "sltu"
11188 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11190 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11192 (define_expand "sunordered"
11193 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11195 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11197 (define_expand "sordered"
11198 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11200 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11202 (define_expand "suneq"
11203 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11205 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11207 (define_expand "sunge"
11208 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11210 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11212 (define_expand "sungt"
11213 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11215 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11217 (define_expand "sunle"
11218 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11220 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11222 (define_expand "sunlt"
11223 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11225 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11227 (define_expand "sltgt"
11228 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11230 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11233 ;; Here are the actual compare insns.
11234 (define_insn "*cmpsi_internal1"
11235 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11236 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11237 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11239 "{cmp%I2|cmpw%I2} %0,%1,%2"
11240 [(set_attr "type" "cmp")])
11242 (define_insn "*cmpdi_internal1"
11243 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11244 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11245 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11248 [(set_attr "type" "cmp")])
11250 ;; If we are comparing a register for equality with a large constant,
11251 ;; we can do this with an XOR followed by a compare. But we need a scratch
11252 ;; register for the result of the XOR.
11255 [(set (match_operand:CC 0 "cc_reg_operand" "")
11256 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11257 (match_operand:SI 2 "non_short_cint_operand" "")))
11258 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11259 "find_single_use (operands[0], insn, 0)
11260 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11261 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11262 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11263 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11266 /* Get the constant we are comparing against, C, and see what it looks like
11267 sign-extended to 16 bits. Then see what constant could be XOR'ed
11268 with C to get the sign-extended value. */
11270 HOST_WIDE_INT c = INTVAL (operands[2]);
11271 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11272 HOST_WIDE_INT xorv = c ^ sextc;
11274 operands[4] = GEN_INT (xorv);
11275 operands[5] = GEN_INT (sextc);
11278 (define_insn "*cmpsi_internal2"
11279 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11280 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11281 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11283 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11284 [(set_attr "type" "cmp")])
11286 (define_insn "*cmpdi_internal2"
11287 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11288 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11289 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11291 "cmpld%I2 %0,%1,%b2"
11292 [(set_attr "type" "cmp")])
11294 ;; The following two insns don't exist as single insns, but if we provide
11295 ;; them, we can swap an add and compare, which will enable us to overlap more
11296 ;; of the required delay between a compare and branch. We generate code for
11297 ;; them by splitting.
11300 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11301 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11302 (match_operand:SI 2 "short_cint_operand" "i")))
11303 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11304 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11307 [(set_attr "length" "8")])
11310 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11311 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11312 (match_operand:SI 2 "u_short_cint_operand" "i")))
11313 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11314 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11317 [(set_attr "length" "8")])
11320 [(set (match_operand:CC 3 "cc_reg_operand" "")
11321 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11322 (match_operand:SI 2 "short_cint_operand" "")))
11323 (set (match_operand:SI 0 "gpc_reg_operand" "")
11324 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11326 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11327 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11330 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11331 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11332 (match_operand:SI 2 "u_short_cint_operand" "")))
11333 (set (match_operand:SI 0 "gpc_reg_operand" "")
11334 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11336 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11337 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11339 (define_insn "*cmpsf_internal1"
11340 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11341 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11342 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11343 "TARGET_HARD_FLOAT && TARGET_FPRS"
11345 [(set_attr "type" "fpcompare")])
11347 (define_insn "*cmpdf_internal1"
11348 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11349 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11350 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11351 "TARGET_HARD_FLOAT && TARGET_FPRS"
11353 [(set_attr "type" "fpcompare")])
11355 ;; Only need to compare second words if first words equal
11356 (define_insn "*cmptf_internal1"
11357 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11358 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11359 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11360 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
11361 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11362 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11363 [(set_attr "type" "fpcompare")
11364 (set_attr "length" "12")])
11366 ;; Now we have the scc insns. We can do some combinations because of the
11367 ;; way the machine works.
11369 ;; Note that this is probably faster if we can put an insn between the
11370 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11371 ;; cases the insns below which don't use an intermediate CR field will
11372 ;; be used instead.
11374 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11375 (match_operator:SI 1 "scc_comparison_operator"
11376 [(match_operand 2 "cc_reg_operand" "y")
11379 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11380 [(set (attr "type")
11381 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11382 (const_string "mfcrf")
11384 (const_string "mfcr")))
11385 (set_attr "length" "8")])
11387 ;; Same as above, but get the GT bit.
11388 (define_insn "move_from_CR_eq_bit"
11389 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11390 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_EQ))]
11392 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,1"
11393 [(set_attr "type" "mfcr")
11394 (set_attr "length" "8")])
11396 ;; Same as above, but get the OV/ORDERED bit.
11397 (define_insn "move_from_CR_ov_bit"
11398 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11399 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11401 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11402 [(set_attr "type" "mfcr")
11403 (set_attr "length" "8")])
11406 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11407 (match_operator:DI 1 "scc_comparison_operator"
11408 [(match_operand 2 "cc_reg_operand" "y")
11411 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11412 [(set (attr "type")
11413 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11414 (const_string "mfcrf")
11416 (const_string "mfcr")))
11417 (set_attr "length" "8")])
11420 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11421 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11422 [(match_operand 2 "cc_reg_operand" "y,y")
11425 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11426 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11429 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11431 [(set_attr "type" "delayed_compare")
11432 (set_attr "length" "8,16")])
11435 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11436 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11437 [(match_operand 2 "cc_reg_operand" "")
11440 (set (match_operand:SI 3 "gpc_reg_operand" "")
11441 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11442 "TARGET_32BIT && reload_completed"
11443 [(set (match_dup 3)
11444 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11446 (compare:CC (match_dup 3)
11451 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11452 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11453 [(match_operand 2 "cc_reg_operand" "y")
11455 (match_operand:SI 3 "const_int_operand" "n")))]
11459 int is_bit = ccr_bit (operands[1], 1);
11460 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11463 if (is_bit >= put_bit)
11464 count = is_bit - put_bit;
11466 count = 32 - (put_bit - is_bit);
11468 operands[4] = GEN_INT (count);
11469 operands[5] = GEN_INT (put_bit);
11471 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11473 [(set (attr "type")
11474 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11475 (const_string "mfcrf")
11477 (const_string "mfcr")))
11478 (set_attr "length" "8")])
11481 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11483 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11484 [(match_operand 2 "cc_reg_operand" "y,y")
11486 (match_operand:SI 3 "const_int_operand" "n,n"))
11488 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11489 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11494 int is_bit = ccr_bit (operands[1], 1);
11495 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11498 /* Force split for non-cc0 compare. */
11499 if (which_alternative == 1)
11502 if (is_bit >= put_bit)
11503 count = is_bit - put_bit;
11505 count = 32 - (put_bit - is_bit);
11507 operands[5] = GEN_INT (count);
11508 operands[6] = GEN_INT (put_bit);
11510 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11512 [(set_attr "type" "delayed_compare")
11513 (set_attr "length" "8,16")])
11516 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11518 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11519 [(match_operand 2 "cc_reg_operand" "")
11521 (match_operand:SI 3 "const_int_operand" ""))
11523 (set (match_operand:SI 4 "gpc_reg_operand" "")
11524 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11527 [(set (match_dup 4)
11528 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11531 (compare:CC (match_dup 4)
11535 ;; There is a 3 cycle delay between consecutive mfcr instructions
11536 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11539 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11540 (match_operator:SI 1 "scc_comparison_operator"
11541 [(match_operand 2 "cc_reg_operand" "y")
11543 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11544 (match_operator:SI 4 "scc_comparison_operator"
11545 [(match_operand 5 "cc_reg_operand" "y")
11547 "REGNO (operands[2]) != REGNO (operands[5])"
11548 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11549 [(set_attr "type" "mfcr")
11550 (set_attr "length" "12")])
11553 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11554 (match_operator:DI 1 "scc_comparison_operator"
11555 [(match_operand 2 "cc_reg_operand" "y")
11557 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11558 (match_operator:DI 4 "scc_comparison_operator"
11559 [(match_operand 5 "cc_reg_operand" "y")
11561 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11562 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11563 [(set_attr "type" "mfcr")
11564 (set_attr "length" "12")])
11566 ;; There are some scc insns that can be done directly, without a compare.
11567 ;; These are faster because they don't involve the communications between
11568 ;; the FXU and branch units. In fact, we will be replacing all of the
11569 ;; integer scc insns here or in the portable methods in emit_store_flag.
11571 ;; Also support (neg (scc ..)) since that construct is used to replace
11572 ;; branches, (plus (scc ..) ..) since that construct is common and
11573 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11574 ;; cases where it is no more expensive than (neg (scc ..)).
11576 ;; Have reload force a constant into a register for the simple insns that
11577 ;; otherwise won't accept constants. We do this because it is faster than
11578 ;; the cmp/mfcr sequence we would otherwise generate.
11581 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11582 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11583 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11584 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11587 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11588 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11589 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11590 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11591 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11592 [(set_attr "type" "three,two,three,three,three")
11593 (set_attr "length" "12,8,12,12,12")])
11596 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11597 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11598 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11599 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11602 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11603 subfic %3,%1,0\;adde %0,%3,%1
11604 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11605 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11606 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11607 [(set_attr "type" "three,two,three,three,three")
11608 (set_attr "length" "12,8,12,12,12")])
11611 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11613 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11614 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11616 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11617 (eq:SI (match_dup 1) (match_dup 2)))
11618 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11621 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11622 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11623 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11624 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11625 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11631 [(set_attr "type" "compare")
11632 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11635 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11637 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11638 (match_operand:SI 2 "reg_or_cint_operand" ""))
11640 (set (match_operand:SI 0 "gpc_reg_operand" "")
11641 (eq:SI (match_dup 1) (match_dup 2)))
11642 (clobber (match_scratch:SI 3 ""))]
11643 "TARGET_32BIT && reload_completed"
11644 [(parallel [(set (match_dup 0)
11645 (eq:SI (match_dup 1) (match_dup 2)))
11646 (clobber (match_dup 3))])
11648 (compare:CC (match_dup 0)
11653 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11655 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11656 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11658 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11659 (eq:DI (match_dup 1) (match_dup 2)))
11660 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11663 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11664 subfic %3,%1,0\;adde. %0,%3,%1
11665 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11666 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11667 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11673 [(set_attr "type" "compare")
11674 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11677 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11679 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11680 (match_operand:DI 2 "reg_or_cint_operand" ""))
11682 (set (match_operand:DI 0 "gpc_reg_operand" "")
11683 (eq:DI (match_dup 1) (match_dup 2)))
11684 (clobber (match_scratch:DI 3 ""))]
11685 "TARGET_64BIT && reload_completed"
11686 [(parallel [(set (match_dup 0)
11687 (eq:DI (match_dup 1) (match_dup 2)))
11688 (clobber (match_dup 3))])
11690 (compare:CC (match_dup 0)
11694 ;; We have insns of the form shown by the first define_insn below. If
11695 ;; there is something inside the comparison operation, we must split it.
11697 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11698 (plus:SI (match_operator 1 "comparison_operator"
11699 [(match_operand:SI 2 "" "")
11700 (match_operand:SI 3
11701 "reg_or_cint_operand" "")])
11702 (match_operand:SI 4 "gpc_reg_operand" "")))
11703 (clobber (match_operand:SI 5 "register_operand" ""))]
11704 "! gpc_reg_operand (operands[2], SImode)"
11705 [(set (match_dup 5) (match_dup 2))
11706 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11710 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11711 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11712 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11713 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11716 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11717 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11718 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11719 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11720 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11721 [(set_attr "type" "three,two,three,three,three")
11722 (set_attr "length" "12,8,12,12,12")])
11725 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11728 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11729 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11730 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11732 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11735 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11736 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11737 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11738 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11739 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11745 [(set_attr "type" "compare")
11746 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11749 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11752 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11753 (match_operand:SI 2 "reg_or_cint_operand" ""))
11754 (match_operand:SI 3 "gpc_reg_operand" ""))
11756 (clobber (match_scratch:SI 4 ""))]
11757 "TARGET_32BIT && reload_completed"
11758 [(set (match_dup 4)
11759 (plus:SI (eq:SI (match_dup 1)
11763 (compare:CC (match_dup 4)
11768 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11771 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11772 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11773 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11775 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11776 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11779 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11780 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11781 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11782 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11783 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11789 [(set_attr "type" "compare")
11790 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11793 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11796 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11797 (match_operand:SI 2 "reg_or_cint_operand" ""))
11798 (match_operand:SI 3 "gpc_reg_operand" ""))
11800 (set (match_operand:SI 0 "gpc_reg_operand" "")
11801 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11802 "TARGET_32BIT && reload_completed"
11803 [(set (match_dup 0)
11804 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11806 (compare:CC (match_dup 0)
11811 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11812 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11813 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11816 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11817 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11818 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11819 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11820 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11821 [(set_attr "type" "three,two,three,three,three")
11822 (set_attr "length" "12,8,12,12,12")])
11824 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11825 ;; since it nabs/sr is just as fast.
11826 (define_insn "*ne0"
11827 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11828 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11830 (clobber (match_scratch:SI 2 "=&r"))]
11831 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11832 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11833 [(set_attr "type" "two")
11834 (set_attr "length" "8")])
11837 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11838 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11840 (clobber (match_scratch:DI 2 "=&r"))]
11842 "addic %2,%1,-1\;subfe %0,%2,%1"
11843 [(set_attr "type" "two")
11844 (set_attr "length" "8")])
11846 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11848 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11849 (plus:SI (lshiftrt:SI
11850 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11852 (match_operand:SI 2 "gpc_reg_operand" "r")))
11853 (clobber (match_scratch:SI 3 "=&r"))]
11855 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11856 [(set_attr "type" "two")
11857 (set_attr "length" "8")])
11860 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11861 (plus:DI (lshiftrt:DI
11862 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11864 (match_operand:DI 2 "gpc_reg_operand" "r")))
11865 (clobber (match_scratch:DI 3 "=&r"))]
11867 "addic %3,%1,-1\;addze %0,%2"
11868 [(set_attr "type" "two")
11869 (set_attr "length" "8")])
11872 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11874 (plus:SI (lshiftrt:SI
11875 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11877 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11879 (clobber (match_scratch:SI 3 "=&r,&r"))
11880 (clobber (match_scratch:SI 4 "=X,&r"))]
11883 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11885 [(set_attr "type" "compare")
11886 (set_attr "length" "8,12")])
11889 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11891 (plus:SI (lshiftrt:SI
11892 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11894 (match_operand:SI 2 "gpc_reg_operand" ""))
11896 (clobber (match_scratch:SI 3 ""))
11897 (clobber (match_scratch:SI 4 ""))]
11898 "TARGET_32BIT && reload_completed"
11899 [(parallel [(set (match_dup 3)
11900 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11903 (clobber (match_dup 4))])
11905 (compare:CC (match_dup 3)
11910 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11912 (plus:DI (lshiftrt:DI
11913 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11915 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11917 (clobber (match_scratch:DI 3 "=&r,&r"))]
11920 addic %3,%1,-1\;addze. %3,%2
11922 [(set_attr "type" "compare")
11923 (set_attr "length" "8,12")])
11926 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11928 (plus:DI (lshiftrt:DI
11929 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11931 (match_operand:DI 2 "gpc_reg_operand" ""))
11933 (clobber (match_scratch:DI 3 ""))]
11934 "TARGET_64BIT && reload_completed"
11935 [(set (match_dup 3)
11936 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11940 (compare:CC (match_dup 3)
11945 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11947 (plus:SI (lshiftrt:SI
11948 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11950 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11952 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11953 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11955 (clobber (match_scratch:SI 3 "=&r,&r"))]
11958 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11960 [(set_attr "type" "compare")
11961 (set_attr "length" "8,12")])
11964 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11966 (plus:SI (lshiftrt:SI
11967 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11969 (match_operand:SI 2 "gpc_reg_operand" ""))
11971 (set (match_operand:SI 0 "gpc_reg_operand" "")
11972 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11974 (clobber (match_scratch:SI 3 ""))]
11975 "TARGET_32BIT && reload_completed"
11976 [(parallel [(set (match_dup 0)
11977 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11979 (clobber (match_dup 3))])
11981 (compare:CC (match_dup 0)
11986 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11988 (plus:DI (lshiftrt:DI
11989 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11991 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11993 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11994 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11996 (clobber (match_scratch:DI 3 "=&r,&r"))]
11999 addic %3,%1,-1\;addze. %0,%2
12001 [(set_attr "type" "compare")
12002 (set_attr "length" "8,12")])
12005 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12007 (plus:DI (lshiftrt:DI
12008 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12010 (match_operand:DI 2 "gpc_reg_operand" ""))
12012 (set (match_operand:DI 0 "gpc_reg_operand" "")
12013 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12015 (clobber (match_scratch:DI 3 ""))]
12016 "TARGET_64BIT && reload_completed"
12017 [(parallel [(set (match_dup 0)
12018 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12020 (clobber (match_dup 3))])
12022 (compare:CC (match_dup 0)
12027 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12028 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12029 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12030 (clobber (match_scratch:SI 3 "=r,X"))]
12033 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12034 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12035 [(set_attr "length" "12")])
12038 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12040 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12041 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12043 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12044 (le:SI (match_dup 1) (match_dup 2)))
12045 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12048 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12049 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12052 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12053 (set_attr "length" "12,12,16,16")])
12056 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12058 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12059 (match_operand:SI 2 "reg_or_short_operand" ""))
12061 (set (match_operand:SI 0 "gpc_reg_operand" "")
12062 (le:SI (match_dup 1) (match_dup 2)))
12063 (clobber (match_scratch:SI 3 ""))]
12064 "TARGET_POWER && reload_completed"
12065 [(parallel [(set (match_dup 0)
12066 (le:SI (match_dup 1) (match_dup 2)))
12067 (clobber (match_dup 3))])
12069 (compare:CC (match_dup 0)
12074 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12075 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12076 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12077 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12080 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12081 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12082 [(set_attr "length" "12")])
12085 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12087 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12088 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12089 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12091 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12094 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12095 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12098 [(set_attr "type" "compare")
12099 (set_attr "length" "12,12,16,16")])
12102 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12104 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12105 (match_operand:SI 2 "reg_or_short_operand" ""))
12106 (match_operand:SI 3 "gpc_reg_operand" ""))
12108 (clobber (match_scratch:SI 4 ""))]
12109 "TARGET_POWER && reload_completed"
12110 [(set (match_dup 4)
12111 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12114 (compare:CC (match_dup 4)
12119 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12121 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12122 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12123 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12125 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12126 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12129 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12130 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12133 [(set_attr "type" "compare")
12134 (set_attr "length" "12,12,16,16")])
12137 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12139 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12140 (match_operand:SI 2 "reg_or_short_operand" ""))
12141 (match_operand:SI 3 "gpc_reg_operand" ""))
12143 (set (match_operand:SI 0 "gpc_reg_operand" "")
12144 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12145 "TARGET_POWER && reload_completed"
12146 [(set (match_dup 0)
12147 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12149 (compare:CC (match_dup 0)
12154 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12155 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12156 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12159 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12160 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12161 [(set_attr "length" "12")])
12164 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12165 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12166 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12168 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12169 [(set_attr "type" "three")
12170 (set_attr "length" "12")])
12173 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12174 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12175 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12177 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12178 [(set_attr "type" "three")
12179 (set_attr "length" "12")])
12182 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12184 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12185 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12187 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12188 (leu:DI (match_dup 1) (match_dup 2)))]
12191 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12193 [(set_attr "type" "compare")
12194 (set_attr "length" "12,16")])
12197 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12199 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12200 (match_operand:DI 2 "reg_or_short_operand" ""))
12202 (set (match_operand:DI 0 "gpc_reg_operand" "")
12203 (leu:DI (match_dup 1) (match_dup 2)))]
12204 "TARGET_64BIT && reload_completed"
12205 [(set (match_dup 0)
12206 (leu:DI (match_dup 1) (match_dup 2)))
12208 (compare:CC (match_dup 0)
12213 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12215 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12216 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12218 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12219 (leu:SI (match_dup 1) (match_dup 2)))]
12222 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12224 [(set_attr "type" "compare")
12225 (set_attr "length" "12,16")])
12228 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12230 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12231 (match_operand:SI 2 "reg_or_short_operand" ""))
12233 (set (match_operand:SI 0 "gpc_reg_operand" "")
12234 (leu:SI (match_dup 1) (match_dup 2)))]
12235 "TARGET_32BIT && reload_completed"
12236 [(set (match_dup 0)
12237 (leu:SI (match_dup 1) (match_dup 2)))
12239 (compare:CC (match_dup 0)
12244 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12245 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12246 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12247 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12249 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12250 [(set_attr "type" "two")
12251 (set_attr "length" "8")])
12254 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12256 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12257 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12258 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12260 (clobber (match_scratch:SI 4 "=&r,&r"))]
12263 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12265 [(set_attr "type" "compare")
12266 (set_attr "length" "8,12")])
12269 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12271 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12272 (match_operand:SI 2 "reg_or_short_operand" ""))
12273 (match_operand:SI 3 "gpc_reg_operand" ""))
12275 (clobber (match_scratch:SI 4 ""))]
12276 "TARGET_32BIT && reload_completed"
12277 [(set (match_dup 4)
12278 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12281 (compare:CC (match_dup 4)
12286 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12288 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12289 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12290 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12292 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12293 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12296 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12298 [(set_attr "type" "compare")
12299 (set_attr "length" "8,12")])
12302 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12304 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12305 (match_operand:SI 2 "reg_or_short_operand" ""))
12306 (match_operand:SI 3 "gpc_reg_operand" ""))
12308 (set (match_operand:SI 0 "gpc_reg_operand" "")
12309 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12310 "TARGET_32BIT && reload_completed"
12311 [(set (match_dup 0)
12312 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12314 (compare:CC (match_dup 0)
12319 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12320 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12321 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12323 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12324 [(set_attr "type" "three")
12325 (set_attr "length" "12")])
12328 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12330 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12331 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12332 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12334 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12335 [(set_attr "type" "three")
12336 (set_attr "length" "12")])
12339 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12342 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12343 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12344 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12346 (clobber (match_scratch:SI 4 "=&r,&r"))]
12349 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12351 [(set_attr "type" "compare")
12352 (set_attr "length" "12,16")])
12355 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12358 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12359 (match_operand:SI 2 "reg_or_short_operand" "")))
12360 (match_operand:SI 3 "gpc_reg_operand" ""))
12362 (clobber (match_scratch:SI 4 ""))]
12363 "TARGET_32BIT && reload_completed"
12364 [(set (match_dup 4)
12365 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12368 (compare:CC (match_dup 4)
12373 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12376 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12377 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12378 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12380 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12381 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12384 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12386 [(set_attr "type" "compare")
12387 (set_attr "length" "12,16")])
12390 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12393 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12394 (match_operand:SI 2 "reg_or_short_operand" "")))
12395 (match_operand:SI 3 "gpc_reg_operand" ""))
12397 (set (match_operand:SI 0 "gpc_reg_operand" "")
12398 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12399 "TARGET_32BIT && reload_completed"
12400 [(set (match_dup 0)
12401 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12404 (compare:CC (match_dup 0)
12409 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12410 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12411 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12413 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12414 [(set_attr "length" "12")])
12417 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12419 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12420 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12422 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12423 (lt:SI (match_dup 1) (match_dup 2)))]
12426 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12428 [(set_attr "type" "delayed_compare")
12429 (set_attr "length" "12,16")])
12432 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12434 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12435 (match_operand:SI 2 "reg_or_short_operand" ""))
12437 (set (match_operand:SI 0 "gpc_reg_operand" "")
12438 (lt:SI (match_dup 1) (match_dup 2)))]
12439 "TARGET_POWER && reload_completed"
12440 [(set (match_dup 0)
12441 (lt:SI (match_dup 1) (match_dup 2)))
12443 (compare:CC (match_dup 0)
12448 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12449 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12450 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12451 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12453 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12454 [(set_attr "length" "12")])
12457 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12459 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12460 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12461 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12463 (clobber (match_scratch:SI 4 "=&r,&r"))]
12466 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12468 [(set_attr "type" "compare")
12469 (set_attr "length" "12,16")])
12472 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12474 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12475 (match_operand:SI 2 "reg_or_short_operand" ""))
12476 (match_operand:SI 3 "gpc_reg_operand" ""))
12478 (clobber (match_scratch:SI 4 ""))]
12479 "TARGET_POWER && reload_completed"
12480 [(set (match_dup 4)
12481 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12484 (compare:CC (match_dup 4)
12489 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12491 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12492 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12493 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12495 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12496 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12499 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12501 [(set_attr "type" "compare")
12502 (set_attr "length" "12,16")])
12505 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12507 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12508 (match_operand:SI 2 "reg_or_short_operand" ""))
12509 (match_operand:SI 3 "gpc_reg_operand" ""))
12511 (set (match_operand:SI 0 "gpc_reg_operand" "")
12512 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12513 "TARGET_POWER && reload_completed"
12514 [(set (match_dup 0)
12515 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12517 (compare:CC (match_dup 0)
12522 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12523 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12524 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12526 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12527 [(set_attr "length" "12")])
12529 (define_insn_and_split ""
12530 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12531 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12532 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12536 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12537 (set (match_dup 0) (neg:SI (match_dup 0)))]
12540 (define_insn_and_split ""
12541 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12542 (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12543 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12547 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12548 (set (match_dup 0) (neg:DI (match_dup 0)))]
12552 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12554 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12555 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12557 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12558 (ltu:SI (match_dup 1) (match_dup 2)))]
12561 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12562 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12565 [(set_attr "type" "compare")
12566 (set_attr "length" "12,12,16,16")])
12569 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12571 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12572 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12574 (set (match_operand:SI 0 "gpc_reg_operand" "")
12575 (ltu:SI (match_dup 1) (match_dup 2)))]
12576 "TARGET_32BIT && reload_completed"
12577 [(set (match_dup 0)
12578 (ltu:SI (match_dup 1) (match_dup 2)))
12580 (compare:CC (match_dup 0)
12584 (define_insn_and_split ""
12585 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12586 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12587 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12588 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12592 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12593 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
12596 (define_insn_and_split ""
12597 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12598 (plus:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12599 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))
12600 (match_operand:DI 3 "reg_or_short_operand" "rI,rI")))]
12604 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12605 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
12609 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12611 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12612 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12613 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12615 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12618 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12619 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12622 [(set_attr "type" "compare")
12623 (set_attr "length" "12,12,16,16")])
12626 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12628 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12629 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12630 (match_operand:SI 3 "gpc_reg_operand" ""))
12632 (clobber (match_scratch:SI 4 ""))]
12633 "TARGET_32BIT && reload_completed"
12634 [(set (match_dup 4)
12635 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12638 (compare:CC (match_dup 4)
12643 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12645 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12646 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12647 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12649 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12650 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12653 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12654 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12657 [(set_attr "type" "compare")
12658 (set_attr "length" "12,12,16,16")])
12661 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12663 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12664 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12665 (match_operand:SI 3 "gpc_reg_operand" ""))
12667 (set (match_operand:SI 0 "gpc_reg_operand" "")
12668 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12669 "TARGET_32BIT && reload_completed"
12670 [(set (match_dup 0)
12671 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12673 (compare:CC (match_dup 0)
12678 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12679 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12680 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12683 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12684 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12685 [(set_attr "type" "two")
12686 (set_attr "length" "8")])
12689 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12690 (neg:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12691 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))))]
12694 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12695 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12696 [(set_attr "type" "two")
12697 (set_attr "length" "8")])
12700 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12701 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12702 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12703 (clobber (match_scratch:SI 3 "=r"))]
12705 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12706 [(set_attr "length" "12")])
12709 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12711 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12712 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12714 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12715 (ge:SI (match_dup 1) (match_dup 2)))
12716 (clobber (match_scratch:SI 3 "=r,r"))]
12719 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12721 [(set_attr "type" "compare")
12722 (set_attr "length" "12,16")])
12725 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12727 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12728 (match_operand:SI 2 "reg_or_short_operand" ""))
12730 (set (match_operand:SI 0 "gpc_reg_operand" "")
12731 (ge:SI (match_dup 1) (match_dup 2)))
12732 (clobber (match_scratch:SI 3 ""))]
12733 "TARGET_POWER && reload_completed"
12734 [(parallel [(set (match_dup 0)
12735 (ge:SI (match_dup 1) (match_dup 2)))
12736 (clobber (match_dup 3))])
12738 (compare:CC (match_dup 0)
12743 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12744 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12745 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12746 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12748 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12749 [(set_attr "length" "12")])
12752 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12754 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12755 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12756 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12758 (clobber (match_scratch:SI 4 "=&r,&r"))]
12761 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12763 [(set_attr "type" "compare")
12764 (set_attr "length" "12,16")])
12767 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12769 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12770 (match_operand:SI 2 "reg_or_short_operand" ""))
12771 (match_operand:SI 3 "gpc_reg_operand" ""))
12773 (clobber (match_scratch:SI 4 ""))]
12774 "TARGET_POWER && reload_completed"
12775 [(set (match_dup 4)
12776 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12779 (compare:CC (match_dup 4)
12784 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12786 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12787 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12788 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12790 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12791 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12794 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12796 [(set_attr "type" "compare")
12797 (set_attr "length" "12,16")])
12800 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12802 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12803 (match_operand:SI 2 "reg_or_short_operand" ""))
12804 (match_operand:SI 3 "gpc_reg_operand" ""))
12806 (set (match_operand:SI 0 "gpc_reg_operand" "")
12807 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12808 "TARGET_POWER && reload_completed"
12809 [(set (match_dup 0)
12810 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12812 (compare:CC (match_dup 0)
12817 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12818 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12819 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12821 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12822 [(set_attr "length" "12")])
12825 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12826 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12827 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12830 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12831 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12832 [(set_attr "type" "three")
12833 (set_attr "length" "12")])
12836 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12837 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12838 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12841 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12842 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12843 [(set_attr "type" "three")
12844 (set_attr "length" "12")])
12847 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12849 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12850 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12852 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12853 (geu:SI (match_dup 1) (match_dup 2)))]
12856 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12857 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12860 [(set_attr "type" "compare")
12861 (set_attr "length" "12,12,16,16")])
12864 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12866 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12867 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12869 (set (match_operand:SI 0 "gpc_reg_operand" "")
12870 (geu:SI (match_dup 1) (match_dup 2)))]
12871 "TARGET_32BIT && reload_completed"
12872 [(set (match_dup 0)
12873 (geu:SI (match_dup 1) (match_dup 2)))
12875 (compare:CC (match_dup 0)
12880 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12882 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12883 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12885 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12886 (geu:DI (match_dup 1) (match_dup 2)))]
12889 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12890 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12893 [(set_attr "type" "compare")
12894 (set_attr "length" "12,12,16,16")])
12897 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12899 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12900 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12902 (set (match_operand:DI 0 "gpc_reg_operand" "")
12903 (geu:DI (match_dup 1) (match_dup 2)))]
12904 "TARGET_64BIT && reload_completed"
12905 [(set (match_dup 0)
12906 (geu:DI (match_dup 1) (match_dup 2)))
12908 (compare:CC (match_dup 0)
12913 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12914 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12915 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12916 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12919 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12920 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12921 [(set_attr "type" "two")
12922 (set_attr "length" "8")])
12925 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12927 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12928 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12929 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12931 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12934 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12935 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12938 [(set_attr "type" "compare")
12939 (set_attr "length" "8,8,12,12")])
12942 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12944 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12945 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12946 (match_operand:SI 3 "gpc_reg_operand" ""))
12948 (clobber (match_scratch:SI 4 ""))]
12949 "TARGET_32BIT && reload_completed"
12950 [(set (match_dup 4)
12951 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12954 (compare:CC (match_dup 4)
12959 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12961 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12962 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12963 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12965 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12966 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12969 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12970 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12973 [(set_attr "type" "compare")
12974 (set_attr "length" "8,8,12,12")])
12977 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12979 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12980 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12981 (match_operand:SI 3 "gpc_reg_operand" ""))
12983 (set (match_operand:SI 0 "gpc_reg_operand" "")
12984 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12985 "TARGET_32BIT && reload_completed"
12986 [(set (match_dup 0)
12987 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12989 (compare:CC (match_dup 0)
12994 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12995 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12996 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12999 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13000 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13001 [(set_attr "type" "three")
13002 (set_attr "length" "12")])
13005 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13007 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13008 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
13009 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13012 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13013 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13014 [(set_attr "type" "three")
13015 (set_attr "length" "12")])
13018 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13021 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13022 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13023 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13025 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13028 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13029 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13032 [(set_attr "type" "compare")
13033 (set_attr "length" "12,12,16,16")])
13036 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13039 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13040 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13041 (match_operand:SI 3 "gpc_reg_operand" ""))
13043 (clobber (match_scratch:SI 4 ""))]
13044 "TARGET_32BIT && reload_completed"
13045 [(set (match_dup 4)
13046 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13049 (compare:CC (match_dup 4)
13054 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13057 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13058 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13059 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13061 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13062 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13065 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13066 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13069 [(set_attr "type" "compare")
13070 (set_attr "length" "12,12,16,16")])
13073 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13076 (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 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13082 "TARGET_32BIT && reload_completed"
13083 [(set (match_dup 0)
13084 (and:SI (neg: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")
13092 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13095 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
13096 [(set_attr "type" "three")
13097 (set_attr "length" "12")])
13100 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13101 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13104 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
13105 [(set_attr "type" "three")
13106 (set_attr "length" "12")])
13109 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13111 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13114 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13115 (gt:SI (match_dup 1) (const_int 0)))]
13118 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
13120 [(set_attr "type" "delayed_compare")
13121 (set_attr "length" "12,16")])
13124 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13126 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13129 (set (match_operand:SI 0 "gpc_reg_operand" "")
13130 (gt:SI (match_dup 1) (const_int 0)))]
13131 "TARGET_32BIT && reload_completed"
13132 [(set (match_dup 0)
13133 (gt:SI (match_dup 1) (const_int 0)))
13135 (compare:CC (match_dup 0)
13140 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13142 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13145 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13146 (gt:DI (match_dup 1) (const_int 0)))]
13149 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
13151 [(set_attr "type" "delayed_compare")
13152 (set_attr "length" "12,16")])
13155 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13157 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13160 (set (match_operand:DI 0 "gpc_reg_operand" "")
13161 (gt:DI (match_dup 1) (const_int 0)))]
13162 "TARGET_64BIT && reload_completed"
13163 [(set (match_dup 0)
13164 (gt:DI (match_dup 1) (const_int 0)))
13166 (compare:CC (match_dup 0)
13171 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13172 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13173 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13175 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13176 [(set_attr "length" "12")])
13179 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13181 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13182 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13184 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13185 (gt:SI (match_dup 1) (match_dup 2)))]
13188 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13190 [(set_attr "type" "delayed_compare")
13191 (set_attr "length" "12,16")])
13194 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13196 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13197 (match_operand:SI 2 "reg_or_short_operand" ""))
13199 (set (match_operand:SI 0 "gpc_reg_operand" "")
13200 (gt:SI (match_dup 1) (match_dup 2)))]
13201 "TARGET_POWER && reload_completed"
13202 [(set (match_dup 0)
13203 (gt:SI (match_dup 1) (match_dup 2)))
13205 (compare:CC (match_dup 0)
13210 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13211 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13213 (match_operand:SI 2 "gpc_reg_operand" "r")))]
13215 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13216 [(set_attr "type" "three")
13217 (set_attr "length" "12")])
13220 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13221 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13223 (match_operand:DI 2 "gpc_reg_operand" "r")))]
13225 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13226 [(set_attr "type" "three")
13227 (set_attr "length" "12")])
13230 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13232 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13234 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13236 (clobber (match_scratch:SI 3 "=&r,&r"))]
13239 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13241 [(set_attr "type" "compare")
13242 (set_attr "length" "12,16")])
13245 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13247 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13249 (match_operand:SI 2 "gpc_reg_operand" ""))
13251 (clobber (match_scratch:SI 3 ""))]
13252 "TARGET_32BIT && reload_completed"
13253 [(set (match_dup 3)
13254 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13257 (compare:CC (match_dup 3)
13262 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13264 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13266 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13268 (clobber (match_scratch:DI 3 "=&r,&r"))]
13271 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13273 [(set_attr "type" "compare")
13274 (set_attr "length" "12,16")])
13277 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13279 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13281 (match_operand:DI 2 "gpc_reg_operand" ""))
13283 (clobber (match_scratch:DI 3 ""))]
13284 "TARGET_64BIT && reload_completed"
13285 [(set (match_dup 3)
13286 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13289 (compare:CC (match_dup 3)
13294 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13296 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13298 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13300 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13301 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13304 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13306 [(set_attr "type" "compare")
13307 (set_attr "length" "12,16")])
13310 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13312 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13314 (match_operand:SI 2 "gpc_reg_operand" ""))
13316 (set (match_operand:SI 0 "gpc_reg_operand" "")
13317 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13318 "TARGET_32BIT && reload_completed"
13319 [(set (match_dup 0)
13320 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13322 (compare:CC (match_dup 0)
13327 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13329 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13331 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13333 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13334 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13337 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13339 [(set_attr "type" "compare")
13340 (set_attr "length" "12,16")])
13343 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13345 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13347 (match_operand:DI 2 "gpc_reg_operand" ""))
13349 (set (match_operand:DI 0 "gpc_reg_operand" "")
13350 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13351 "TARGET_64BIT && reload_completed"
13352 [(set (match_dup 0)
13353 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13355 (compare:CC (match_dup 0)
13360 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13361 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13362 (match_operand:SI 2 "reg_or_short_operand" "r"))
13363 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13365 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13366 [(set_attr "length" "12")])
13369 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13371 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13372 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13373 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13375 (clobber (match_scratch:SI 4 "=&r,&r"))]
13378 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13380 [(set_attr "type" "compare")
13381 (set_attr "length" "12,16")])
13384 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13386 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13387 (match_operand:SI 2 "reg_or_short_operand" ""))
13388 (match_operand:SI 3 "gpc_reg_operand" ""))
13390 (clobber (match_scratch:SI 4 ""))]
13391 "TARGET_POWER && reload_completed"
13392 [(set (match_dup 4)
13393 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13395 (compare:CC (match_dup 4)
13400 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13402 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13403 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13404 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13406 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13407 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13410 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13412 [(set_attr "type" "compare")
13413 (set_attr "length" "12,16")])
13416 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13418 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13419 (match_operand:SI 2 "reg_or_short_operand" ""))
13420 (match_operand:SI 3 "gpc_reg_operand" ""))
13422 (set (match_operand:SI 0 "gpc_reg_operand" "")
13423 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13424 "TARGET_POWER && reload_completed"
13425 [(set (match_dup 0)
13426 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13428 (compare:CC (match_dup 0)
13433 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13434 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13437 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13438 [(set_attr "type" "three")
13439 (set_attr "length" "12")])
13442 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13443 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13446 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13447 [(set_attr "type" "three")
13448 (set_attr "length" "12")])
13451 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13452 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13453 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13455 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13456 [(set_attr "length" "12")])
13458 (define_insn_and_split ""
13459 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13460 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13461 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13465 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13466 (set (match_dup 0) (neg:SI (match_dup 0)))]
13469 (define_insn_and_split ""
13470 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13471 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13472 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13476 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13477 (set (match_dup 0) (neg:DI (match_dup 0)))]
13481 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13483 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13484 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13486 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13487 (gtu:SI (match_dup 1) (match_dup 2)))]
13490 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13492 [(set_attr "type" "compare")
13493 (set_attr "length" "12,16")])
13496 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13498 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13499 (match_operand:SI 2 "reg_or_short_operand" ""))
13501 (set (match_operand:SI 0 "gpc_reg_operand" "")
13502 (gtu:SI (match_dup 1) (match_dup 2)))]
13503 "TARGET_32BIT && reload_completed"
13504 [(set (match_dup 0)
13505 (gtu:SI (match_dup 1) (match_dup 2)))
13507 (compare:CC (match_dup 0)
13512 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13514 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13515 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13517 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13518 (gtu:DI (match_dup 1) (match_dup 2)))]
13521 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13523 [(set_attr "type" "compare")
13524 (set_attr "length" "12,16")])
13527 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13529 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13530 (match_operand:DI 2 "reg_or_short_operand" ""))
13532 (set (match_operand:DI 0 "gpc_reg_operand" "")
13533 (gtu:DI (match_dup 1) (match_dup 2)))]
13534 "TARGET_64BIT && reload_completed"
13535 [(set (match_dup 0)
13536 (gtu:DI (match_dup 1) (match_dup 2)))
13538 (compare:CC (match_dup 0)
13542 (define_insn_and_split ""
13543 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13544 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13545 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13546 (match_operand:SI 3 "reg_or_short_operand" "rI")))]
13550 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13551 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
13554 (define_insn_and_split ""
13555 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13556 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13557 (match_operand:DI 2 "reg_or_short_operand" "rI"))
13558 (match_operand:DI 3 "reg_or_short_operand" "rI")))]
13562 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13563 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
13567 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13569 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13570 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13571 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13573 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13576 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13577 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
13580 [(set_attr "type" "compare")
13581 (set_attr "length" "8,12,12,16")])
13584 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13586 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13587 (match_operand:SI 2 "reg_or_short_operand" ""))
13588 (match_operand:SI 3 "gpc_reg_operand" ""))
13590 (clobber (match_scratch:SI 4 ""))]
13591 "TARGET_32BIT && reload_completed"
13592 [(set (match_dup 4)
13593 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13596 (compare:CC (match_dup 4)
13601 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13603 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13604 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13605 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13607 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13610 addic %4,%1,%k2\;addze. %4,%3
13611 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subf. %4,%4,%3
13614 [(set_attr "type" "compare")
13615 (set_attr "length" "8,12,12,16")])
13618 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13620 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13621 (match_operand:DI 2 "reg_or_short_operand" ""))
13622 (match_operand:DI 3 "gpc_reg_operand" ""))
13624 (clobber (match_scratch:DI 4 ""))]
13625 "TARGET_64BIT && reload_completed"
13626 [(set (match_dup 4)
13627 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13630 (compare:CC (match_dup 4)
13635 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13637 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13638 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13639 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13641 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13642 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13645 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13646 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
13649 [(set_attr "type" "compare")
13650 (set_attr "length" "8,12,12,16")])
13653 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13655 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13656 (match_operand:SI 2 "reg_or_short_operand" ""))
13657 (match_operand:SI 3 "gpc_reg_operand" ""))
13659 (set (match_operand:SI 0 "gpc_reg_operand" "")
13660 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13661 "TARGET_32BIT && reload_completed"
13662 [(set (match_dup 0)
13663 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13665 (compare:CC (match_dup 0)
13670 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13672 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13673 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13674 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13676 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13677 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13680 addic %0,%1,%k2\;addze. %0,%3
13681 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf. %0,%0,%3
13684 [(set_attr "type" "compare")
13685 (set_attr "length" "8,12,12,16")])
13688 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13690 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13691 (match_operand:DI 2 "reg_or_short_operand" ""))
13692 (match_operand:DI 3 "gpc_reg_operand" ""))
13694 (set (match_operand:DI 0 "gpc_reg_operand" "")
13695 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13696 "TARGET_64BIT && reload_completed"
13697 [(set (match_dup 0)
13698 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13700 (compare:CC (match_dup 0)
13705 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13706 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13707 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13709 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13710 [(set_attr "type" "two")
13711 (set_attr "length" "8")])
13714 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13715 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13716 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13718 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13719 [(set_attr "type" "two")
13720 (set_attr "length" "8")])
13722 ;; Define both directions of branch and return. If we need a reload
13723 ;; register, we'd rather use CR0 since it is much easier to copy a
13724 ;; register CC value to there.
13728 (if_then_else (match_operator 1 "branch_comparison_operator"
13730 "cc_reg_operand" "y")
13732 (label_ref (match_operand 0 "" ""))
13737 return output_cbranch (operands[1], \"%l0\", 0, insn);
13739 [(set_attr "type" "branch")])
13743 (if_then_else (match_operator 0 "branch_comparison_operator"
13745 "cc_reg_operand" "y")
13752 return output_cbranch (operands[0], NULL, 0, insn);
13754 [(set_attr "type" "branch")
13755 (set_attr "length" "4")])
13759 (if_then_else (match_operator 1 "branch_comparison_operator"
13761 "cc_reg_operand" "y")
13764 (label_ref (match_operand 0 "" ""))))]
13768 return output_cbranch (operands[1], \"%l0\", 1, insn);
13770 [(set_attr "type" "branch")])
13774 (if_then_else (match_operator 0 "branch_comparison_operator"
13776 "cc_reg_operand" "y")
13783 return output_cbranch (operands[0], NULL, 1, insn);
13785 [(set_attr "type" "branch")
13786 (set_attr "length" "4")])
13788 ;; Logic on condition register values.
13790 ; This pattern matches things like
13791 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13792 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13794 ; which are generated by the branch logic.
13795 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13797 (define_insn "*cceq_ior_compare"
13798 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13799 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13800 [(match_operator:SI 2
13801 "branch_positive_comparison_operator"
13803 "cc_reg_operand" "y,y")
13805 (match_operator:SI 4
13806 "branch_positive_comparison_operator"
13808 "cc_reg_operand" "0,y")
13812 "cr%q1 %E0,%j2,%j4"
13813 [(set_attr "type" "cr_logical,delayed_cr")])
13815 ; Why is the constant -1 here, but 1 in the previous pattern?
13816 ; Because ~1 has all but the low bit set.
13818 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13819 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13820 [(not:SI (match_operator:SI 2
13821 "branch_positive_comparison_operator"
13823 "cc_reg_operand" "y,y")
13825 (match_operator:SI 4
13826 "branch_positive_comparison_operator"
13828 "cc_reg_operand" "0,y")
13832 "cr%q1 %E0,%j2,%j4"
13833 [(set_attr "type" "cr_logical,delayed_cr")])
13835 (define_insn "*cceq_rev_compare"
13836 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13837 (compare:CCEQ (match_operator:SI 1
13838 "branch_positive_comparison_operator"
13840 "cc_reg_operand" "0,y")
13844 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13845 [(set_attr "type" "cr_logical,delayed_cr")])
13847 ;; If we are comparing the result of two comparisons, this can be done
13848 ;; using creqv or crxor.
13850 (define_insn_and_split ""
13851 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13852 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13853 [(match_operand 2 "cc_reg_operand" "y")
13855 (match_operator 3 "branch_comparison_operator"
13856 [(match_operand 4 "cc_reg_operand" "y")
13861 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13865 int positive_1, positive_2;
13867 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13868 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13871 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13872 GET_CODE (operands[1])),
13874 operands[2], const0_rtx);
13875 else if (GET_MODE (operands[1]) != SImode)
13876 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13877 operands[2], const0_rtx);
13880 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13881 GET_CODE (operands[3])),
13883 operands[4], const0_rtx);
13884 else if (GET_MODE (operands[3]) != SImode)
13885 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13886 operands[4], const0_rtx);
13888 if (positive_1 == positive_2)
13890 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13891 operands[5] = constm1_rtx;
13895 operands[5] = const1_rtx;
13899 ;; Unconditional branch and return.
13901 (define_insn "jump"
13903 (label_ref (match_operand 0 "" "")))]
13906 [(set_attr "type" "branch")])
13908 (define_insn "return"
13912 [(set_attr "type" "jmpreg")])
13914 (define_expand "indirect_jump"
13915 [(set (pc) (match_operand 0 "register_operand" ""))]
13920 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13922 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13926 (define_insn "indirect_jumpsi"
13927 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13932 [(set_attr "type" "jmpreg")])
13934 (define_insn "indirect_jumpdi"
13935 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13940 [(set_attr "type" "jmpreg")])
13942 ;; Table jump for switch statements:
13943 (define_expand "tablejump"
13944 [(use (match_operand 0 "" ""))
13945 (use (label_ref (match_operand 1 "" "")))]
13950 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13952 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13956 (define_expand "tablejumpsi"
13957 [(set (match_dup 3)
13958 (plus:SI (match_operand:SI 0 "" "")
13960 (parallel [(set (pc) (match_dup 3))
13961 (use (label_ref (match_operand 1 "" "")))])]
13964 { operands[0] = force_reg (SImode, operands[0]);
13965 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13966 operands[3] = gen_reg_rtx (SImode);
13969 (define_expand "tablejumpdi"
13970 [(set (match_dup 4)
13971 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13973 (plus:DI (match_dup 4)
13975 (parallel [(set (pc) (match_dup 3))
13976 (use (label_ref (match_operand 1 "" "")))])]
13979 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13980 operands[3] = gen_reg_rtx (DImode);
13981 operands[4] = gen_reg_rtx (DImode);
13986 (match_operand:SI 0 "register_operand" "c,*l"))
13987 (use (label_ref (match_operand 1 "" "")))]
13992 [(set_attr "type" "jmpreg")])
13996 (match_operand:DI 0 "register_operand" "c,*l"))
13997 (use (label_ref (match_operand 1 "" "")))]
14002 [(set_attr "type" "jmpreg")])
14007 "{cror 0,0,0|nop}")
14009 ;; Define the subtract-one-and-jump insns, starting with the template
14010 ;; so loop.c knows what to generate.
14012 (define_expand "doloop_end"
14013 [(use (match_operand 0 "" "")) ; loop pseudo
14014 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14015 (use (match_operand 2 "" "")) ; max iterations
14016 (use (match_operand 3 "" "")) ; loop level
14017 (use (match_operand 4 "" ""))] ; label
14021 /* Only use this on innermost loops. */
14022 if (INTVAL (operands[3]) > 1)
14026 if (GET_MODE (operands[0]) != DImode)
14028 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14032 if (GET_MODE (operands[0]) != SImode)
14034 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14039 (define_expand "ctrsi"
14040 [(parallel [(set (pc)
14041 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
14043 (label_ref (match_operand 1 "" ""))
14046 (plus:SI (match_dup 0)
14048 (clobber (match_scratch:CC 2 ""))
14049 (clobber (match_scratch:SI 3 ""))])]
14053 (define_expand "ctrdi"
14054 [(parallel [(set (pc)
14055 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
14057 (label_ref (match_operand 1 "" ""))
14060 (plus:DI (match_dup 0)
14062 (clobber (match_scratch:CC 2 ""))
14063 (clobber (match_scratch:DI 3 ""))])]
14067 ;; We need to be able to do this for any operand, including MEM, or we
14068 ;; will cause reload to blow up since we don't allow output reloads on
14070 ;; For the length attribute to be calculated correctly, the
14071 ;; label MUST be operand 0.
14073 (define_insn "*ctrsi_internal1"
14075 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14077 (label_ref (match_operand 0 "" ""))
14079 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14080 (plus:SI (match_dup 1)
14082 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14083 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14087 if (which_alternative != 0)
14089 else if (get_attr_length (insn) == 4)
14090 return \"{bdn|bdnz} %l0\";
14092 return \"bdz $+8\;b %l0\";
14094 [(set_attr "type" "branch")
14095 (set_attr "length" "*,12,16,16")])
14097 (define_insn "*ctrsi_internal2"
14099 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14102 (label_ref (match_operand 0 "" ""))))
14103 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14104 (plus:SI (match_dup 1)
14106 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14107 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14111 if (which_alternative != 0)
14113 else if (get_attr_length (insn) == 4)
14114 return \"bdz %l0\";
14116 return \"{bdn|bdnz} $+8\;b %l0\";
14118 [(set_attr "type" "branch")
14119 (set_attr "length" "*,12,16,16")])
14121 (define_insn "*ctrdi_internal1"
14123 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14125 (label_ref (match_operand 0 "" ""))
14127 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14128 (plus:DI (match_dup 1)
14130 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14131 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14135 if (which_alternative != 0)
14137 else if (get_attr_length (insn) == 4)
14138 return \"{bdn|bdnz} %l0\";
14140 return \"bdz $+8\;b %l0\";
14142 [(set_attr "type" "branch")
14143 (set_attr "length" "*,12,16,16")])
14145 (define_insn "*ctrdi_internal2"
14147 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14150 (label_ref (match_operand 0 "" ""))))
14151 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14152 (plus:DI (match_dup 1)
14154 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14155 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14159 if (which_alternative != 0)
14161 else if (get_attr_length (insn) == 4)
14162 return \"bdz %l0\";
14164 return \"{bdn|bdnz} $+8\;b %l0\";
14166 [(set_attr "type" "branch")
14167 (set_attr "length" "*,12,16,16")])
14169 ;; Similar but use EQ
14171 (define_insn "*ctrsi_internal5"
14173 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14175 (label_ref (match_operand 0 "" ""))
14177 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14178 (plus:SI (match_dup 1)
14180 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14181 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14185 if (which_alternative != 0)
14187 else if (get_attr_length (insn) == 4)
14188 return \"bdz %l0\";
14190 return \"{bdn|bdnz} $+8\;b %l0\";
14192 [(set_attr "type" "branch")
14193 (set_attr "length" "*,12,16,16")])
14195 (define_insn "*ctrsi_internal6"
14197 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14200 (label_ref (match_operand 0 "" ""))))
14201 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14202 (plus:SI (match_dup 1)
14204 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14205 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14209 if (which_alternative != 0)
14211 else if (get_attr_length (insn) == 4)
14212 return \"{bdn|bdnz} %l0\";
14214 return \"bdz $+8\;b %l0\";
14216 [(set_attr "type" "branch")
14217 (set_attr "length" "*,12,16,16")])
14219 (define_insn "*ctrdi_internal5"
14221 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14223 (label_ref (match_operand 0 "" ""))
14225 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14226 (plus:DI (match_dup 1)
14228 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14229 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14233 if (which_alternative != 0)
14235 else if (get_attr_length (insn) == 4)
14236 return \"bdz %l0\";
14238 return \"{bdn|bdnz} $+8\;b %l0\";
14240 [(set_attr "type" "branch")
14241 (set_attr "length" "*,12,16,16")])
14243 (define_insn "*ctrdi_internal6"
14245 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14248 (label_ref (match_operand 0 "" ""))))
14249 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14250 (plus:DI (match_dup 1)
14252 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14253 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14257 if (which_alternative != 0)
14259 else if (get_attr_length (insn) == 4)
14260 return \"{bdn|bdnz} %l0\";
14262 return \"bdz $+8\;b %l0\";
14264 [(set_attr "type" "branch")
14265 (set_attr "length" "*,12,16,16")])
14267 ;; Now the splitters if we could not allocate the CTR register
14271 (if_then_else (match_operator 2 "comparison_operator"
14272 [(match_operand:SI 1 "gpc_reg_operand" "")
14274 (match_operand 5 "" "")
14275 (match_operand 6 "" "")))
14276 (set (match_operand:SI 0 "gpc_reg_operand" "")
14277 (plus:SI (match_dup 1)
14279 (clobber (match_scratch:CC 3 ""))
14280 (clobber (match_scratch:SI 4 ""))]
14281 "TARGET_32BIT && reload_completed"
14282 [(parallel [(set (match_dup 3)
14283 (compare:CC (plus:SI (match_dup 1)
14287 (plus:SI (match_dup 1)
14289 (set (pc) (if_then_else (match_dup 7)
14293 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14294 operands[3], const0_rtx); }")
14298 (if_then_else (match_operator 2 "comparison_operator"
14299 [(match_operand:SI 1 "gpc_reg_operand" "")
14301 (match_operand 5 "" "")
14302 (match_operand 6 "" "")))
14303 (set (match_operand:SI 0 "nonimmediate_operand" "")
14304 (plus:SI (match_dup 1) (const_int -1)))
14305 (clobber (match_scratch:CC 3 ""))
14306 (clobber (match_scratch:SI 4 ""))]
14307 "TARGET_32BIT && reload_completed
14308 && ! gpc_reg_operand (operands[0], SImode)"
14309 [(parallel [(set (match_dup 3)
14310 (compare:CC (plus:SI (match_dup 1)
14314 (plus:SI (match_dup 1)
14318 (set (pc) (if_then_else (match_dup 7)
14322 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14323 operands[3], const0_rtx); }")
14326 (if_then_else (match_operator 2 "comparison_operator"
14327 [(match_operand:DI 1 "gpc_reg_operand" "")
14329 (match_operand 5 "" "")
14330 (match_operand 6 "" "")))
14331 (set (match_operand:DI 0 "gpc_reg_operand" "")
14332 (plus:DI (match_dup 1)
14334 (clobber (match_scratch:CC 3 ""))
14335 (clobber (match_scratch:DI 4 ""))]
14336 "TARGET_64BIT && reload_completed"
14337 [(parallel [(set (match_dup 3)
14338 (compare:CC (plus:DI (match_dup 1)
14342 (plus:DI (match_dup 1)
14344 (set (pc) (if_then_else (match_dup 7)
14348 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14349 operands[3], const0_rtx); }")
14353 (if_then_else (match_operator 2 "comparison_operator"
14354 [(match_operand:DI 1 "gpc_reg_operand" "")
14356 (match_operand 5 "" "")
14357 (match_operand 6 "" "")))
14358 (set (match_operand:DI 0 "nonimmediate_operand" "")
14359 (plus:DI (match_dup 1) (const_int -1)))
14360 (clobber (match_scratch:CC 3 ""))
14361 (clobber (match_scratch:DI 4 ""))]
14362 "TARGET_64BIT && reload_completed
14363 && ! gpc_reg_operand (operands[0], DImode)"
14364 [(parallel [(set (match_dup 3)
14365 (compare:CC (plus:DI (match_dup 1)
14369 (plus:DI (match_dup 1)
14373 (set (pc) (if_then_else (match_dup 7)
14377 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14378 operands[3], const0_rtx); }")
14380 (define_insn "trap"
14381 [(trap_if (const_int 1) (const_int 0))]
14385 (define_expand "conditional_trap"
14386 [(trap_if (match_operator 0 "trap_comparison_operator"
14387 [(match_dup 2) (match_dup 3)])
14388 (match_operand 1 "const_int_operand" ""))]
14390 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14391 operands[2] = rs6000_compare_op0;
14392 operands[3] = rs6000_compare_op1;")
14395 [(trap_if (match_operator 0 "trap_comparison_operator"
14396 [(match_operand:SI 1 "register_operand" "r")
14397 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14400 "{t|tw}%V0%I2 %1,%2")
14403 [(trap_if (match_operator 0 "trap_comparison_operator"
14404 [(match_operand:DI 1 "register_operand" "r")
14405 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14410 ;; Insns related to generating the function prologue and epilogue.
14412 (define_expand "prologue"
14413 [(use (const_int 0))]
14414 "TARGET_SCHED_PROLOG"
14417 rs6000_emit_prologue ();
14421 (define_insn "*movesi_from_cr_one"
14422 [(match_parallel 0 "mfcr_operation"
14423 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14424 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14425 (match_operand 3 "immediate_operand" "n")]
14426 UNSPEC_MOVESI_FROM_CR))])]
14432 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14434 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14435 operands[4] = GEN_INT (mask);
14436 output_asm_insn (\"mfcr %1,%4\", operands);
14440 [(set_attr "type" "mfcrf")])
14442 (define_insn "movesi_from_cr"
14443 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14444 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14445 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14446 UNSPEC_MOVESI_FROM_CR))]
14449 [(set_attr "type" "mfcr")])
14451 (define_insn "*stmw"
14452 [(match_parallel 0 "stmw_operation"
14453 [(set (match_operand:SI 1 "memory_operand" "=m")
14454 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14456 "{stm|stmw} %2,%1")
14458 (define_insn "*save_fpregs_si"
14459 [(match_parallel 0 "any_parallel_operand"
14460 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14461 (use (match_operand:SI 2 "call_operand" "s"))
14462 (set (match_operand:DF 3 "memory_operand" "=m")
14463 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14466 [(set_attr "type" "branch")
14467 (set_attr "length" "4")])
14469 (define_insn "*save_fpregs_di"
14470 [(match_parallel 0 "any_parallel_operand"
14471 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14472 (use (match_operand:DI 2 "call_operand" "s"))
14473 (set (match_operand:DF 3 "memory_operand" "=m")
14474 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14477 [(set_attr "type" "branch")
14478 (set_attr "length" "4")])
14480 ; These are to explain that changes to the stack pointer should
14481 ; not be moved over stores to stack memory.
14482 (define_insn "stack_tie"
14483 [(set (match_operand:BLK 0 "memory_operand" "+m")
14484 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14487 [(set_attr "length" "0")])
14490 (define_expand "epilogue"
14491 [(use (const_int 0))]
14492 "TARGET_SCHED_PROLOG"
14495 rs6000_emit_epilogue (FALSE);
14499 ; On some processors, doing the mtcrf one CC register at a time is
14500 ; faster (like on the 604e). On others, doing them all at once is
14501 ; faster; for instance, on the 601 and 750.
14503 (define_expand "movsi_to_cr_one"
14504 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14505 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14506 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14508 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14510 (define_insn "*movsi_to_cr"
14511 [(match_parallel 0 "mtcrf_operation"
14512 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14513 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14514 (match_operand 3 "immediate_operand" "n")]
14515 UNSPEC_MOVESI_TO_CR))])]
14521 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14522 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14523 operands[4] = GEN_INT (mask);
14524 return \"mtcrf %4,%2\";
14526 [(set_attr "type" "mtcr")])
14528 (define_insn "*mtcrfsi"
14529 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14530 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14531 (match_operand 2 "immediate_operand" "n")]
14532 UNSPEC_MOVESI_TO_CR))]
14533 "GET_CODE (operands[0]) == REG
14534 && CR_REGNO_P (REGNO (operands[0]))
14535 && GET_CODE (operands[2]) == CONST_INT
14536 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14538 [(set_attr "type" "mtcr")])
14540 ; The load-multiple instructions have similar properties.
14541 ; Note that "load_multiple" is a name known to the machine-independent
14542 ; code that actually corresponds to the powerpc load-string.
14544 (define_insn "*lmw"
14545 [(match_parallel 0 "lmw_operation"
14546 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14547 (match_operand:SI 2 "memory_operand" "m"))])]
14551 (define_insn "*return_internal_si"
14553 (use (match_operand:SI 0 "register_operand" "lc"))]
14556 [(set_attr "type" "jmpreg")])
14558 (define_insn "*return_internal_di"
14560 (use (match_operand:DI 0 "register_operand" "lc"))]
14563 [(set_attr "type" "jmpreg")])
14565 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14566 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14568 (define_insn "*return_and_restore_fpregs_si"
14569 [(match_parallel 0 "any_parallel_operand"
14571 (use (match_operand:SI 1 "register_operand" "l"))
14572 (use (match_operand:SI 2 "call_operand" "s"))
14573 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14574 (match_operand:DF 4 "memory_operand" "m"))])]
14578 (define_insn "*return_and_restore_fpregs_di"
14579 [(match_parallel 0 "any_parallel_operand"
14581 (use (match_operand:DI 1 "register_operand" "l"))
14582 (use (match_operand:DI 2 "call_operand" "s"))
14583 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14584 (match_operand:DF 4 "memory_operand" "m"))])]
14588 ; This is used in compiling the unwind routines.
14589 (define_expand "eh_return"
14590 [(use (match_operand 0 "general_operand" ""))]
14595 emit_insn (gen_eh_set_lr_si (operands[0]));
14597 emit_insn (gen_eh_set_lr_di (operands[0]));
14601 ; We can't expand this before we know where the link register is stored.
14602 (define_insn "eh_set_lr_si"
14603 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")]
14605 (clobber (match_scratch:SI 1 "=&b"))]
14609 (define_insn "eh_set_lr_di"
14610 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
14612 (clobber (match_scratch:DI 1 "=&b"))]
14617 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14618 (clobber (match_scratch 1 ""))]
14623 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14627 (define_insn "prefetch"
14628 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14629 (match_operand:SI 1 "const_int_operand" "n")
14630 (match_operand:SI 2 "const_int_operand" "n"))]
14634 if (GET_CODE (operands[0]) == REG)
14635 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14636 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14638 [(set_attr "type" "load")])
14640 (include "altivec.md")