1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 2, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 ;; MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 [(UNSPEC_FRSP 0) ; frsp for POWER machines
31 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
32 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
33 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
35 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
37 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
38 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
41 (UNSPEC_MOVESI_FROM_CR 19)
42 (UNSPEC_MOVESI_TO_CR 20)
44 (UNSPEC_TLSDTPRELHA 22)
45 (UNSPEC_TLSDTPRELLO 23)
46 (UNSPEC_TLSGOTDTPREL 24)
48 (UNSPEC_TLSTPRELHA 26)
49 (UNSPEC_TLSTPRELLO 27)
50 (UNSPEC_TLSGOTTPREL 28)
52 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
53 (UNSPEC_MV_CR_GT 31) ; move_from_CR_eq_bit
58 ;; UNSPEC_VOLATILE usage
63 (UNSPECV_EH_RR 9) ; eh_reg_restore
66 ;; Define an insn type attribute. This is used in function unit delay
68 (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"
69 (const_string "integer"))
72 ; '(pc)' in the following doesn't include the instruction itself; it is
73 ; calculated as if the instruction had zero size.
74 (define_attr "length" ""
75 (if_then_else (eq_attr "type" "branch")
76 (if_then_else (and (ge (minus (match_dup 0) (pc))
78 (lt (minus (match_dup 0) (pc))
84 ;; Processor type -- this attribute must exactly match the processor_type
85 ;; enumeration in rs6000.h.
87 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
88 (const (symbol_ref "rs6000_cpu_attr")))
90 (automata_option "ndfa")
103 (include "power4.md")
104 (include "power5.md")
106 (include "predicates.md")
108 (include "darwin.md")
111 ;; This mode macro allows :P to be used for patterns that operate on
112 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
113 (define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
115 ;; Start with fixed-point load and store insns. Here we put only the more
116 ;; complex forms. Basic data transfer is done later.
118 (define_expand "zero_extendqidi2"
119 [(set (match_operand:DI 0 "gpc_reg_operand" "")
120 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
125 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
126 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
131 [(set_attr "type" "load,*")])
134 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
135 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
137 (clobber (match_scratch:DI 2 "=r,r"))]
142 [(set_attr "type" "compare")
143 (set_attr "length" "4,8")])
146 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
147 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
149 (clobber (match_scratch:DI 2 ""))]
150 "TARGET_POWERPC64 && reload_completed"
152 (zero_extend:DI (match_dup 1)))
154 (compare:CC (match_dup 2)
159 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
160 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
162 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
163 (zero_extend:DI (match_dup 1)))]
168 [(set_attr "type" "compare")
169 (set_attr "length" "4,8")])
172 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
173 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
175 (set (match_operand:DI 0 "gpc_reg_operand" "")
176 (zero_extend:DI (match_dup 1)))]
177 "TARGET_POWERPC64 && reload_completed"
179 (zero_extend:DI (match_dup 1)))
181 (compare:CC (match_dup 0)
185 (define_insn "extendqidi2"
186 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
187 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
192 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
193 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
195 (clobber (match_scratch:DI 2 "=r,r"))]
200 [(set_attr "type" "compare")
201 (set_attr "length" "4,8")])
204 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
205 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
207 (clobber (match_scratch:DI 2 ""))]
208 "TARGET_POWERPC64 && reload_completed"
210 (sign_extend:DI (match_dup 1)))
212 (compare:CC (match_dup 2)
217 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
218 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
220 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
221 (sign_extend:DI (match_dup 1)))]
226 [(set_attr "type" "compare")
227 (set_attr "length" "4,8")])
230 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
231 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
233 (set (match_operand:DI 0 "gpc_reg_operand" "")
234 (sign_extend:DI (match_dup 1)))]
235 "TARGET_POWERPC64 && reload_completed"
237 (sign_extend:DI (match_dup 1)))
239 (compare:CC (match_dup 0)
243 (define_expand "zero_extendhidi2"
244 [(set (match_operand:DI 0 "gpc_reg_operand" "")
245 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
250 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
251 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
256 [(set_attr "type" "load,*")])
259 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
260 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
262 (clobber (match_scratch:DI 2 "=r,r"))]
267 [(set_attr "type" "compare")
268 (set_attr "length" "4,8")])
271 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
272 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
274 (clobber (match_scratch:DI 2 ""))]
275 "TARGET_POWERPC64 && reload_completed"
277 (zero_extend:DI (match_dup 1)))
279 (compare:CC (match_dup 2)
284 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
285 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
287 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
288 (zero_extend:DI (match_dup 1)))]
293 [(set_attr "type" "compare")
294 (set_attr "length" "4,8")])
297 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
298 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
300 (set (match_operand:DI 0 "gpc_reg_operand" "")
301 (zero_extend:DI (match_dup 1)))]
302 "TARGET_POWERPC64 && reload_completed"
304 (zero_extend:DI (match_dup 1)))
306 (compare:CC (match_dup 0)
310 (define_expand "extendhidi2"
311 [(set (match_operand:DI 0 "gpc_reg_operand" "")
312 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
317 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
318 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
323 [(set_attr "type" "load_ext,*")])
326 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
327 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
329 (clobber (match_scratch:DI 2 "=r,r"))]
334 [(set_attr "type" "compare")
335 (set_attr "length" "4,8")])
338 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
339 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
341 (clobber (match_scratch:DI 2 ""))]
342 "TARGET_POWERPC64 && reload_completed"
344 (sign_extend:DI (match_dup 1)))
346 (compare:CC (match_dup 2)
351 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
352 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
354 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
355 (sign_extend:DI (match_dup 1)))]
360 [(set_attr "type" "compare")
361 (set_attr "length" "4,8")])
364 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
365 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
367 (set (match_operand:DI 0 "gpc_reg_operand" "")
368 (sign_extend:DI (match_dup 1)))]
369 "TARGET_POWERPC64 && reload_completed"
371 (sign_extend:DI (match_dup 1)))
373 (compare:CC (match_dup 0)
377 (define_expand "zero_extendsidi2"
378 [(set (match_operand:DI 0 "gpc_reg_operand" "")
379 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
384 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
385 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
390 [(set_attr "type" "load,*")])
393 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
394 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
396 (clobber (match_scratch:DI 2 "=r,r"))]
401 [(set_attr "type" "compare")
402 (set_attr "length" "4,8")])
405 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
406 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
408 (clobber (match_scratch:DI 2 ""))]
409 "TARGET_POWERPC64 && reload_completed"
411 (zero_extend:DI (match_dup 1)))
413 (compare:CC (match_dup 2)
418 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
419 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
421 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
422 (zero_extend:DI (match_dup 1)))]
427 [(set_attr "type" "compare")
428 (set_attr "length" "4,8")])
431 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
432 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
434 (set (match_operand:DI 0 "gpc_reg_operand" "")
435 (zero_extend:DI (match_dup 1)))]
436 "TARGET_POWERPC64 && reload_completed"
438 (zero_extend:DI (match_dup 1)))
440 (compare:CC (match_dup 0)
444 (define_expand "extendsidi2"
445 [(set (match_operand:DI 0 "gpc_reg_operand" "")
446 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
451 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
452 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
457 [(set_attr "type" "load_ext,*")])
460 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
461 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
463 (clobber (match_scratch:DI 2 "=r,r"))]
468 [(set_attr "type" "compare")
469 (set_attr "length" "4,8")])
472 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
473 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
475 (clobber (match_scratch:DI 2 ""))]
476 "TARGET_POWERPC64 && reload_completed"
478 (sign_extend:DI (match_dup 1)))
480 (compare:CC (match_dup 2)
485 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
486 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
488 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
489 (sign_extend:DI (match_dup 1)))]
494 [(set_attr "type" "compare")
495 (set_attr "length" "4,8")])
498 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
499 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
501 (set (match_operand:DI 0 "gpc_reg_operand" "")
502 (sign_extend:DI (match_dup 1)))]
503 "TARGET_POWERPC64 && reload_completed"
505 (sign_extend:DI (match_dup 1)))
507 (compare:CC (match_dup 0)
511 (define_expand "zero_extendqisi2"
512 [(set (match_operand:SI 0 "gpc_reg_operand" "")
513 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
518 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
519 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
523 {rlinm|rlwinm} %0,%1,0,0xff"
524 [(set_attr "type" "load,*")])
527 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
528 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
530 (clobber (match_scratch:SI 2 "=r,r"))]
533 {andil.|andi.} %2,%1,0xff
535 [(set_attr "type" "compare")
536 (set_attr "length" "4,8")])
539 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
540 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
542 (clobber (match_scratch:SI 2 ""))]
545 (zero_extend:SI (match_dup 1)))
547 (compare:CC (match_dup 2)
552 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
553 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
555 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
556 (zero_extend:SI (match_dup 1)))]
559 {andil.|andi.} %0,%1,0xff
561 [(set_attr "type" "compare")
562 (set_attr "length" "4,8")])
565 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
566 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
568 (set (match_operand:SI 0 "gpc_reg_operand" "")
569 (zero_extend:SI (match_dup 1)))]
572 (zero_extend:SI (match_dup 1)))
574 (compare:CC (match_dup 0)
578 (define_expand "extendqisi2"
579 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
580 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
585 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
586 else if (TARGET_POWER)
587 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
589 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
593 (define_insn "extendqisi2_ppc"
594 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
595 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
600 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
601 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
603 (clobber (match_scratch:SI 2 "=r,r"))]
608 [(set_attr "type" "compare")
609 (set_attr "length" "4,8")])
612 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
613 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
615 (clobber (match_scratch:SI 2 ""))]
616 "TARGET_POWERPC && reload_completed"
618 (sign_extend:SI (match_dup 1)))
620 (compare:CC (match_dup 2)
625 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
626 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
628 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
629 (sign_extend:SI (match_dup 1)))]
634 [(set_attr "type" "compare")
635 (set_attr "length" "4,8")])
638 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
639 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
641 (set (match_operand:SI 0 "gpc_reg_operand" "")
642 (sign_extend:SI (match_dup 1)))]
643 "TARGET_POWERPC && reload_completed"
645 (sign_extend:SI (match_dup 1)))
647 (compare:CC (match_dup 0)
651 (define_expand "extendqisi2_power"
652 [(parallel [(set (match_dup 2)
653 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
655 (clobber (scratch:SI))])
656 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
657 (ashiftrt:SI (match_dup 2)
659 (clobber (scratch:SI))])]
662 { operands[1] = gen_lowpart (SImode, operands[1]);
663 operands[2] = gen_reg_rtx (SImode); }")
665 (define_expand "extendqisi2_no_power"
667 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
669 (set (match_operand:SI 0 "gpc_reg_operand" "")
670 (ashiftrt:SI (match_dup 2)
672 "! TARGET_POWER && ! TARGET_POWERPC"
674 { operands[1] = gen_lowpart (SImode, operands[1]);
675 operands[2] = gen_reg_rtx (SImode); }")
677 (define_expand "zero_extendqihi2"
678 [(set (match_operand:HI 0 "gpc_reg_operand" "")
679 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
684 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
685 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
689 {rlinm|rlwinm} %0,%1,0,0xff"
690 [(set_attr "type" "load,*")])
693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
694 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
696 (clobber (match_scratch:HI 2 "=r,r"))]
699 {andil.|andi.} %2,%1,0xff
701 [(set_attr "type" "compare")
702 (set_attr "length" "4,8")])
705 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
706 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
708 (clobber (match_scratch:HI 2 ""))]
711 (zero_extend:HI (match_dup 1)))
713 (compare:CC (match_dup 2)
718 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
719 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
721 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
722 (zero_extend:HI (match_dup 1)))]
725 {andil.|andi.} %0,%1,0xff
727 [(set_attr "type" "compare")
728 (set_attr "length" "4,8")])
731 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
732 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
734 (set (match_operand:HI 0 "gpc_reg_operand" "")
735 (zero_extend:HI (match_dup 1)))]
738 (zero_extend:HI (match_dup 1)))
740 (compare:CC (match_dup 0)
744 (define_expand "extendqihi2"
745 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
746 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
751 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
752 else if (TARGET_POWER)
753 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
755 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
759 (define_insn "extendqihi2_ppc"
760 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
761 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
766 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
767 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
769 (clobber (match_scratch:HI 2 "=r,r"))]
774 [(set_attr "type" "compare")
775 (set_attr "length" "4,8")])
778 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
779 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
781 (clobber (match_scratch:HI 2 ""))]
782 "TARGET_POWERPC && reload_completed"
784 (sign_extend:HI (match_dup 1)))
786 (compare:CC (match_dup 2)
791 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
792 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
794 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
795 (sign_extend:HI (match_dup 1)))]
800 [(set_attr "type" "compare")
801 (set_attr "length" "4,8")])
804 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
805 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
807 (set (match_operand:HI 0 "gpc_reg_operand" "")
808 (sign_extend:HI (match_dup 1)))]
809 "TARGET_POWERPC && reload_completed"
811 (sign_extend:HI (match_dup 1)))
813 (compare:CC (match_dup 0)
817 (define_expand "extendqihi2_power"
818 [(parallel [(set (match_dup 2)
819 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
821 (clobber (scratch:SI))])
822 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
823 (ashiftrt:SI (match_dup 2)
825 (clobber (scratch:SI))])]
828 { operands[0] = gen_lowpart (SImode, operands[0]);
829 operands[1] = gen_lowpart (SImode, operands[1]);
830 operands[2] = gen_reg_rtx (SImode); }")
832 (define_expand "extendqihi2_no_power"
834 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
836 (set (match_operand:HI 0 "gpc_reg_operand" "")
837 (ashiftrt:SI (match_dup 2)
839 "! TARGET_POWER && ! TARGET_POWERPC"
841 { operands[0] = gen_lowpart (SImode, operands[0]);
842 operands[1] = gen_lowpart (SImode, operands[1]);
843 operands[2] = gen_reg_rtx (SImode); }")
845 (define_expand "zero_extendhisi2"
846 [(set (match_operand:SI 0 "gpc_reg_operand" "")
847 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
852 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
853 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
857 {rlinm|rlwinm} %0,%1,0,0xffff"
858 [(set_attr "type" "load,*")])
861 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
862 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
864 (clobber (match_scratch:SI 2 "=r,r"))]
867 {andil.|andi.} %2,%1,0xffff
869 [(set_attr "type" "compare")
870 (set_attr "length" "4,8")])
873 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
874 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
876 (clobber (match_scratch:SI 2 ""))]
879 (zero_extend:SI (match_dup 1)))
881 (compare:CC (match_dup 2)
886 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
887 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
889 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
890 (zero_extend:SI (match_dup 1)))]
893 {andil.|andi.} %0,%1,0xffff
895 [(set_attr "type" "compare")
896 (set_attr "length" "4,8")])
899 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
900 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
902 (set (match_operand:SI 0 "gpc_reg_operand" "")
903 (zero_extend:SI (match_dup 1)))]
906 (zero_extend:SI (match_dup 1)))
908 (compare:CC (match_dup 0)
912 (define_expand "extendhisi2"
913 [(set (match_operand:SI 0 "gpc_reg_operand" "")
914 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
919 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
920 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
925 [(set_attr "type" "load_ext,*")])
928 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
929 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
931 (clobber (match_scratch:SI 2 "=r,r"))]
936 [(set_attr "type" "compare")
937 (set_attr "length" "4,8")])
940 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
941 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
943 (clobber (match_scratch:SI 2 ""))]
946 (sign_extend:SI (match_dup 1)))
948 (compare:CC (match_dup 2)
953 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
954 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
956 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
957 (sign_extend:SI (match_dup 1)))]
962 [(set_attr "type" "compare")
963 (set_attr "length" "4,8")])
966 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
967 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
969 (set (match_operand:SI 0 "gpc_reg_operand" "")
970 (sign_extend:SI (match_dup 1)))]
973 (sign_extend:SI (match_dup 1)))
975 (compare:CC (match_dup 0)
979 ;; Fixed-point arithmetic insns.
981 ;; Discourage ai/addic because of carry but provide it in an alternative
982 ;; allowing register zero as source.
983 (define_expand "addsi3"
984 [(set (match_operand:SI 0 "gpc_reg_operand" "")
985 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
986 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
990 if (GET_CODE (operands[2]) == CONST_INT
991 && ! add_operand (operands[2], SImode))
993 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
994 ? operands[0] : gen_reg_rtx (SImode));
996 HOST_WIDE_INT val = INTVAL (operands[2]);
997 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
998 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1000 /* The ordering here is important for the prolog expander.
1001 When space is allocated from the stack, adding 'low' first may
1002 produce a temporary deallocation (which would be bad). */
1003 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
1004 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
1009 (define_insn "*addsi3_internal1"
1010 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1011 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1012 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1016 {cal %0,%2(%1)|addi %0,%1,%2}
1018 {cau|addis} %0,%1,%v2"
1019 [(set_attr "length" "4,4,4,4")])
1021 (define_insn "addsi3_high"
1022 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1023 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1024 (high:SI (match_operand 2 "" ""))))]
1025 "TARGET_MACHO && !TARGET_64BIT"
1026 "{cau|addis} %0,%1,ha16(%2)"
1027 [(set_attr "length" "4")])
1029 (define_insn "*addsi3_internal2"
1030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1031 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1032 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1034 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1037 {cax.|add.} %3,%1,%2
1038 {ai.|addic.} %3,%1,%2
1041 [(set_attr "type" "fast_compare,compare,compare,compare")
1042 (set_attr "length" "4,4,8,8")])
1045 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1046 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1047 (match_operand:SI 2 "reg_or_short_operand" ""))
1049 (clobber (match_scratch:SI 3 ""))]
1050 "TARGET_32BIT && reload_completed"
1052 (plus:SI (match_dup 1)
1055 (compare:CC (match_dup 3)
1059 (define_insn "*addsi3_internal3"
1060 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1061 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1062 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1064 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1065 (plus:SI (match_dup 1)
1069 {cax.|add.} %0,%1,%2
1070 {ai.|addic.} %0,%1,%2
1073 [(set_attr "type" "fast_compare,compare,compare,compare")
1074 (set_attr "length" "4,4,8,8")])
1077 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1078 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1079 (match_operand:SI 2 "reg_or_short_operand" ""))
1081 (set (match_operand:SI 0 "gpc_reg_operand" "")
1082 (plus:SI (match_dup 1) (match_dup 2)))]
1083 "TARGET_32BIT && reload_completed"
1085 (plus:SI (match_dup 1)
1088 (compare:CC (match_dup 0)
1092 ;; Split an add that we can't do in one insn into two insns, each of which
1093 ;; does one 16-bit part. This is used by combine. Note that the low-order
1094 ;; add should be last in case the result gets used in an address.
1097 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1098 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1099 (match_operand:SI 2 "non_add_cint_operand" "")))]
1101 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1102 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1105 HOST_WIDE_INT val = INTVAL (operands[2]);
1106 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1107 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1109 operands[3] = GEN_INT (rest);
1110 operands[4] = GEN_INT (low);
1113 (define_insn "one_cmplsi2"
1114 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1115 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1120 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1121 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1123 (clobber (match_scratch:SI 2 "=r,r"))]
1128 [(set_attr "type" "compare")
1129 (set_attr "length" "4,8")])
1132 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1133 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1135 (clobber (match_scratch:SI 2 ""))]
1136 "TARGET_32BIT && reload_completed"
1138 (not:SI (match_dup 1)))
1140 (compare:CC (match_dup 2)
1145 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1146 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1148 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1149 (not:SI (match_dup 1)))]
1154 [(set_attr "type" "compare")
1155 (set_attr "length" "4,8")])
1158 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1159 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1161 (set (match_operand:SI 0 "gpc_reg_operand" "")
1162 (not:SI (match_dup 1)))]
1163 "TARGET_32BIT && reload_completed"
1165 (not:SI (match_dup 1)))
1167 (compare:CC (match_dup 0)
1172 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1173 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1174 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1176 "{sf%I1|subf%I1c} %0,%2,%1")
1179 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1180 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1181 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1188 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1189 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1190 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1192 (clobber (match_scratch:SI 3 "=r,r"))]
1195 {sf.|subfc.} %3,%2,%1
1197 [(set_attr "type" "compare")
1198 (set_attr "length" "4,8")])
1201 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1202 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1203 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1205 (clobber (match_scratch:SI 3 "=r,r"))]
1206 "TARGET_POWERPC && TARGET_32BIT"
1210 [(set_attr "type" "fast_compare")
1211 (set_attr "length" "4,8")])
1214 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1215 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1216 (match_operand:SI 2 "gpc_reg_operand" ""))
1218 (clobber (match_scratch:SI 3 ""))]
1219 "TARGET_32BIT && reload_completed"
1221 (minus:SI (match_dup 1)
1224 (compare:CC (match_dup 3)
1229 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1230 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1231 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1233 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1234 (minus:SI (match_dup 1) (match_dup 2)))]
1237 {sf.|subfc.} %0,%2,%1
1239 [(set_attr "type" "compare")
1240 (set_attr "length" "4,8")])
1243 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1244 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1245 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1247 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1248 (minus:SI (match_dup 1)
1250 "TARGET_POWERPC && TARGET_32BIT"
1254 [(set_attr "type" "fast_compare")
1255 (set_attr "length" "4,8")])
1258 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1259 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1260 (match_operand:SI 2 "gpc_reg_operand" ""))
1262 (set (match_operand:SI 0 "gpc_reg_operand" "")
1263 (minus:SI (match_dup 1)
1265 "TARGET_32BIT && reload_completed"
1267 (minus:SI (match_dup 1)
1270 (compare:CC (match_dup 0)
1274 (define_expand "subsi3"
1275 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1276 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1277 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1281 if (GET_CODE (operands[2]) == CONST_INT)
1283 emit_insn (gen_addsi3 (operands[0], operands[1],
1284 negate_rtx (SImode, operands[2])));
1289 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1290 ;; instruction and some auxiliary computations. Then we just have a single
1291 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1294 (define_expand "sminsi3"
1296 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1297 (match_operand:SI 2 "reg_or_short_operand" ""))
1299 (minus:SI (match_dup 2) (match_dup 1))))
1300 (set (match_operand:SI 0 "gpc_reg_operand" "")
1301 (minus:SI (match_dup 2) (match_dup 3)))]
1302 "TARGET_POWER || TARGET_ISEL"
1307 operands[2] = force_reg (SImode, operands[2]);
1308 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1312 operands[3] = gen_reg_rtx (SImode);
1316 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1317 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1318 (match_operand:SI 2 "reg_or_short_operand" "")))
1319 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1322 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1324 (minus:SI (match_dup 2) (match_dup 1))))
1325 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1328 (define_expand "smaxsi3"
1330 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1331 (match_operand:SI 2 "reg_or_short_operand" ""))
1333 (minus:SI (match_dup 2) (match_dup 1))))
1334 (set (match_operand:SI 0 "gpc_reg_operand" "")
1335 (plus:SI (match_dup 3) (match_dup 1)))]
1336 "TARGET_POWER || TARGET_ISEL"
1341 operands[2] = force_reg (SImode, operands[2]);
1342 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1345 operands[3] = gen_reg_rtx (SImode);
1349 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1350 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1351 (match_operand:SI 2 "reg_or_short_operand" "")))
1352 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1355 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1357 (minus:SI (match_dup 2) (match_dup 1))))
1358 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1361 (define_expand "uminsi3"
1362 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1364 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1366 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1368 (minus:SI (match_dup 4) (match_dup 3))))
1369 (set (match_operand:SI 0 "gpc_reg_operand" "")
1370 (minus:SI (match_dup 2) (match_dup 3)))]
1371 "TARGET_POWER || TARGET_ISEL"
1376 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1379 operands[3] = gen_reg_rtx (SImode);
1380 operands[4] = gen_reg_rtx (SImode);
1381 operands[5] = GEN_INT (-2147483647 - 1);
1384 (define_expand "umaxsi3"
1385 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1387 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1389 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1391 (minus:SI (match_dup 4) (match_dup 3))))
1392 (set (match_operand:SI 0 "gpc_reg_operand" "")
1393 (plus:SI (match_dup 3) (match_dup 1)))]
1394 "TARGET_POWER || TARGET_ISEL"
1399 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1402 operands[3] = gen_reg_rtx (SImode);
1403 operands[4] = gen_reg_rtx (SImode);
1404 operands[5] = GEN_INT (-2147483647 - 1);
1408 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1409 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1410 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1412 (minus:SI (match_dup 2) (match_dup 1))))]
1417 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1419 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1420 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1422 (minus:SI (match_dup 2) (match_dup 1)))
1424 (clobber (match_scratch:SI 3 "=r,r"))]
1429 [(set_attr "type" "delayed_compare")
1430 (set_attr "length" "4,8")])
1433 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1435 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1436 (match_operand:SI 2 "reg_or_short_operand" ""))
1438 (minus:SI (match_dup 2) (match_dup 1)))
1440 (clobber (match_scratch:SI 3 ""))]
1441 "TARGET_POWER && reload_completed"
1443 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1445 (minus:SI (match_dup 2) (match_dup 1))))
1447 (compare:CC (match_dup 3)
1452 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1454 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1455 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1457 (minus:SI (match_dup 2) (match_dup 1)))
1459 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1460 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1462 (minus:SI (match_dup 2) (match_dup 1))))]
1467 [(set_attr "type" "delayed_compare")
1468 (set_attr "length" "4,8")])
1471 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1473 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1474 (match_operand:SI 2 "reg_or_short_operand" ""))
1476 (minus:SI (match_dup 2) (match_dup 1)))
1478 (set (match_operand:SI 0 "gpc_reg_operand" "")
1479 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1481 (minus:SI (match_dup 2) (match_dup 1))))]
1482 "TARGET_POWER && reload_completed"
1484 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1486 (minus:SI (match_dup 2) (match_dup 1))))
1488 (compare:CC (match_dup 0)
1492 ;; We don't need abs with condition code because such comparisons should
1494 (define_expand "abssi2"
1495 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1496 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1502 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1505 else if (! TARGET_POWER)
1507 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1512 (define_insn "*abssi2_power"
1513 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1514 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1518 (define_insn_and_split "abssi2_isel"
1519 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1520 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1521 (clobber (match_scratch:SI 2 "=&b"))
1522 (clobber (match_scratch:CC 3 "=y"))]
1525 "&& reload_completed"
1526 [(set (match_dup 2) (neg:SI (match_dup 1)))
1528 (compare:CC (match_dup 1)
1531 (if_then_else:SI (ge (match_dup 3)
1537 (define_insn_and_split "abssi2_nopower"
1538 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1539 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1540 (clobber (match_scratch:SI 2 "=&r,&r"))]
1541 "! TARGET_POWER && ! TARGET_ISEL"
1543 "&& reload_completed"
1544 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1545 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1546 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1549 (define_insn "*nabs_power"
1550 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1551 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1555 (define_insn_and_split "*nabs_nopower"
1556 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1557 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1558 (clobber (match_scratch:SI 2 "=&r,&r"))]
1561 "&& reload_completed"
1562 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1563 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1564 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1567 (define_insn "negsi2"
1568 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1569 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1574 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1575 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1577 (clobber (match_scratch:SI 2 "=r,r"))]
1582 [(set_attr "type" "fast_compare")
1583 (set_attr "length" "4,8")])
1586 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1587 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1589 (clobber (match_scratch:SI 2 ""))]
1590 "TARGET_32BIT && reload_completed"
1592 (neg:SI (match_dup 1)))
1594 (compare:CC (match_dup 2)
1599 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1600 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1602 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1603 (neg:SI (match_dup 1)))]
1608 [(set_attr "type" "fast_compare")
1609 (set_attr "length" "4,8")])
1612 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1613 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1615 (set (match_operand:SI 0 "gpc_reg_operand" "")
1616 (neg:SI (match_dup 1)))]
1617 "TARGET_32BIT && reload_completed"
1619 (neg:SI (match_dup 1)))
1621 (compare:CC (match_dup 0)
1625 (define_insn "clzsi2"
1626 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1627 (clz:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1629 "{cntlz|cntlzw} %0,%1")
1631 (define_expand "ctzsi2"
1633 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1634 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1636 (clobber (scratch:CC))])
1637 (set (match_dup 4) (clz:SI (match_dup 3)))
1638 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1639 (minus:SI (const_int 31) (match_dup 4)))]
1642 operands[2] = gen_reg_rtx (SImode);
1643 operands[3] = gen_reg_rtx (SImode);
1644 operands[4] = gen_reg_rtx (SImode);
1647 (define_expand "ffssi2"
1649 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1650 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1652 (clobber (scratch:CC))])
1653 (set (match_dup 4) (clz:SI (match_dup 3)))
1654 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1655 (minus:SI (const_int 32) (match_dup 4)))]
1658 operands[2] = gen_reg_rtx (SImode);
1659 operands[3] = gen_reg_rtx (SImode);
1660 operands[4] = gen_reg_rtx (SImode);
1663 (define_expand "mulsi3"
1664 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1665 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1666 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1671 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1673 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1677 (define_insn "mulsi3_mq"
1678 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1679 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1680 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1681 (clobber (match_scratch:SI 3 "=q,q"))]
1684 {muls|mullw} %0,%1,%2
1685 {muli|mulli} %0,%1,%2"
1687 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1688 (const_string "imul3")
1689 (match_operand:SI 2 "short_cint_operand" "")
1690 (const_string "imul2")]
1691 (const_string "imul")))])
1693 (define_insn "mulsi3_no_mq"
1694 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1695 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1696 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1699 {muls|mullw} %0,%1,%2
1700 {muli|mulli} %0,%1,%2"
1702 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1703 (const_string "imul3")
1704 (match_operand:SI 2 "short_cint_operand" "")
1705 (const_string "imul2")]
1706 (const_string "imul")))])
1708 (define_insn "*mulsi3_mq_internal1"
1709 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1710 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1711 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1713 (clobber (match_scratch:SI 3 "=r,r"))
1714 (clobber (match_scratch:SI 4 "=q,q"))]
1717 {muls.|mullw.} %3,%1,%2
1719 [(set_attr "type" "imul_compare")
1720 (set_attr "length" "4,8")])
1723 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1724 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1725 (match_operand:SI 2 "gpc_reg_operand" ""))
1727 (clobber (match_scratch:SI 3 ""))
1728 (clobber (match_scratch:SI 4 ""))]
1729 "TARGET_POWER && reload_completed"
1730 [(parallel [(set (match_dup 3)
1731 (mult:SI (match_dup 1) (match_dup 2)))
1732 (clobber (match_dup 4))])
1734 (compare:CC (match_dup 3)
1738 (define_insn "*mulsi3_no_mq_internal1"
1739 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1740 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1741 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1743 (clobber (match_scratch:SI 3 "=r,r"))]
1746 {muls.|mullw.} %3,%1,%2
1748 [(set_attr "type" "imul_compare")
1749 (set_attr "length" "4,8")])
1752 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1753 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1754 (match_operand:SI 2 "gpc_reg_operand" ""))
1756 (clobber (match_scratch:SI 3 ""))]
1757 "! TARGET_POWER && reload_completed"
1759 (mult:SI (match_dup 1) (match_dup 2)))
1761 (compare:CC (match_dup 3)
1765 (define_insn "*mulsi3_mq_internal2"
1766 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1767 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1768 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1770 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1771 (mult:SI (match_dup 1) (match_dup 2)))
1772 (clobber (match_scratch:SI 4 "=q,q"))]
1775 {muls.|mullw.} %0,%1,%2
1777 [(set_attr "type" "imul_compare")
1778 (set_attr "length" "4,8")])
1781 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1782 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1783 (match_operand:SI 2 "gpc_reg_operand" ""))
1785 (set (match_operand:SI 0 "gpc_reg_operand" "")
1786 (mult:SI (match_dup 1) (match_dup 2)))
1787 (clobber (match_scratch:SI 4 ""))]
1788 "TARGET_POWER && reload_completed"
1789 [(parallel [(set (match_dup 0)
1790 (mult:SI (match_dup 1) (match_dup 2)))
1791 (clobber (match_dup 4))])
1793 (compare:CC (match_dup 0)
1797 (define_insn "*mulsi3_no_mq_internal2"
1798 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1799 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1800 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1802 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1803 (mult:SI (match_dup 1) (match_dup 2)))]
1806 {muls.|mullw.} %0,%1,%2
1808 [(set_attr "type" "imul_compare")
1809 (set_attr "length" "4,8")])
1812 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1813 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1814 (match_operand:SI 2 "gpc_reg_operand" ""))
1816 (set (match_operand:SI 0 "gpc_reg_operand" "")
1817 (mult:SI (match_dup 1) (match_dup 2)))]
1818 "! TARGET_POWER && reload_completed"
1820 (mult:SI (match_dup 1) (match_dup 2)))
1822 (compare:CC (match_dup 0)
1826 ;; Operand 1 is divided by operand 2; quotient goes to operand
1827 ;; 0 and remainder to operand 3.
1828 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1830 (define_expand "divmodsi4"
1831 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1832 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1833 (match_operand:SI 2 "gpc_reg_operand" "")))
1834 (set (match_operand:SI 3 "register_operand" "")
1835 (mod:SI (match_dup 1) (match_dup 2)))])]
1836 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1839 if (! TARGET_POWER && ! TARGET_POWERPC)
1841 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1842 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1843 emit_insn (gen_divss_call ());
1844 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1845 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1850 (define_insn "*divmodsi4_internal"
1851 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1852 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1853 (match_operand:SI 2 "gpc_reg_operand" "r")))
1854 (set (match_operand:SI 3 "register_operand" "=q")
1855 (mod:SI (match_dup 1) (match_dup 2)))]
1858 [(set_attr "type" "idiv")])
1860 (define_expand "udivsi3"
1861 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1862 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1863 (match_operand:SI 2 "gpc_reg_operand" "")))]
1864 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1867 if (! TARGET_POWER && ! TARGET_POWERPC)
1869 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1870 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1871 emit_insn (gen_quous_call ());
1872 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1875 else if (TARGET_POWER)
1877 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1882 (define_insn "udivsi3_mq"
1883 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1884 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1885 (match_operand:SI 2 "gpc_reg_operand" "r")))
1886 (clobber (match_scratch:SI 3 "=q"))]
1887 "TARGET_POWERPC && TARGET_POWER"
1889 [(set_attr "type" "idiv")])
1891 (define_insn "*udivsi3_no_mq"
1892 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1893 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1894 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1895 "TARGET_POWERPC && ! TARGET_POWER"
1897 [(set_attr "type" "idiv")])
1899 ;; For powers of two we can do srai/aze for divide and then adjust for
1900 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1901 ;; used; for PowerPC, force operands into register and do a normal divide;
1902 ;; for AIX common-mode, use quoss call on register operands.
1903 (define_expand "divsi3"
1904 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1905 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1906 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1910 if (GET_CODE (operands[2]) == CONST_INT
1911 && INTVAL (operands[2]) > 0
1912 && exact_log2 (INTVAL (operands[2])) >= 0)
1914 else if (TARGET_POWERPC)
1916 operands[2] = force_reg (SImode, operands[2]);
1919 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1923 else if (TARGET_POWER)
1927 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1928 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1929 emit_insn (gen_quoss_call ());
1930 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1935 (define_insn "divsi3_mq"
1936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1937 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1938 (match_operand:SI 2 "gpc_reg_operand" "r")))
1939 (clobber (match_scratch:SI 3 "=q"))]
1940 "TARGET_POWERPC && TARGET_POWER"
1942 [(set_attr "type" "idiv")])
1944 (define_insn "*divsi3_no_mq"
1945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1946 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1947 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1948 "TARGET_POWERPC && ! TARGET_POWER"
1950 [(set_attr "type" "idiv")])
1952 (define_expand "modsi3"
1953 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1954 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1955 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1963 if (GET_CODE (operands[2]) != CONST_INT
1964 || INTVAL (operands[2]) <= 0
1965 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
1968 temp1 = gen_reg_rtx (SImode);
1969 temp2 = gen_reg_rtx (SImode);
1971 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1972 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1973 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1978 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1979 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1980 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
1982 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1983 [(set_attr "type" "two")
1984 (set_attr "length" "8")])
1987 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1988 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1989 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1991 (clobber (match_scratch:SI 3 "=r,r"))]
1994 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
1996 [(set_attr "type" "compare")
1997 (set_attr "length" "8,12")])
2000 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2001 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2002 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2004 (clobber (match_scratch:SI 3 ""))]
2007 (div:SI (match_dup 1) (match_dup 2)))
2009 (compare:CC (match_dup 3)
2014 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2015 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2016 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2018 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2019 (div:SI (match_dup 1) (match_dup 2)))]
2022 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2024 [(set_attr "type" "compare")
2025 (set_attr "length" "8,12")])
2028 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2029 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2030 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2032 (set (match_operand:SI 0 "gpc_reg_operand" "")
2033 (div:SI (match_dup 1) (match_dup 2)))]
2036 (div:SI (match_dup 1) (match_dup 2)))
2038 (compare:CC (match_dup 0)
2043 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2046 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2048 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2049 (match_operand:SI 3 "gpc_reg_operand" "r")))
2050 (set (match_operand:SI 2 "register_operand" "=*q")
2053 (zero_extend:DI (match_dup 1)) (const_int 32))
2054 (zero_extend:DI (match_dup 4)))
2058 [(set_attr "type" "idiv")])
2060 ;; To do unsigned divide we handle the cases of the divisor looking like a
2061 ;; negative number. If it is a constant that is less than 2**31, we don't
2062 ;; have to worry about the branches. So make a few subroutines here.
2064 ;; First comes the normal case.
2065 (define_expand "udivmodsi4_normal"
2066 [(set (match_dup 4) (const_int 0))
2067 (parallel [(set (match_operand:SI 0 "" "")
2068 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2070 (zero_extend:DI (match_operand:SI 1 "" "")))
2071 (match_operand:SI 2 "" "")))
2072 (set (match_operand:SI 3 "" "")
2073 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2075 (zero_extend:DI (match_dup 1)))
2079 { operands[4] = gen_reg_rtx (SImode); }")
2081 ;; This handles the branches.
2082 (define_expand "udivmodsi4_tests"
2083 [(set (match_operand:SI 0 "" "") (const_int 0))
2084 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2085 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2086 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2087 (label_ref (match_operand:SI 4 "" "")) (pc)))
2088 (set (match_dup 0) (const_int 1))
2089 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2090 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2091 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2092 (label_ref (match_dup 4)) (pc)))]
2095 { operands[5] = gen_reg_rtx (CCUNSmode);
2096 operands[6] = gen_reg_rtx (CCmode);
2099 (define_expand "udivmodsi4"
2100 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2101 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2102 (match_operand:SI 2 "reg_or_cint_operand" "")))
2103 (set (match_operand:SI 3 "gpc_reg_operand" "")
2104 (umod:SI (match_dup 1) (match_dup 2)))])]
2112 if (! TARGET_POWERPC)
2114 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2115 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2116 emit_insn (gen_divus_call ());
2117 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2118 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2125 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2127 operands[2] = force_reg (SImode, operands[2]);
2128 label = gen_label_rtx ();
2129 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2130 operands[3], label));
2133 operands[2] = force_reg (SImode, operands[2]);
2135 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2143 ;; AIX architecture-independent common-mode multiply (DImode),
2144 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2145 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2146 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2147 ;; assumed unused if generating common-mode, so ignore.
2148 (define_insn "mulh_call"
2151 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2152 (sign_extend:DI (reg:SI 4)))
2154 (clobber (match_scratch:SI 0 "=l"))]
2155 "! TARGET_POWER && ! TARGET_POWERPC"
2157 [(set_attr "type" "imul")])
2159 (define_insn "mull_call"
2161 (mult:DI (sign_extend:DI (reg:SI 3))
2162 (sign_extend:DI (reg:SI 4))))
2163 (clobber (match_scratch:SI 0 "=l"))
2164 (clobber (reg:SI 0))]
2165 "! TARGET_POWER && ! TARGET_POWERPC"
2167 [(set_attr "type" "imul")])
2169 (define_insn "divss_call"
2171 (div:SI (reg:SI 3) (reg:SI 4)))
2173 (mod:SI (reg:SI 3) (reg:SI 4)))
2174 (clobber (match_scratch:SI 0 "=l"))
2175 (clobber (reg:SI 0))]
2176 "! TARGET_POWER && ! TARGET_POWERPC"
2178 [(set_attr "type" "idiv")])
2180 (define_insn "divus_call"
2182 (udiv:SI (reg:SI 3) (reg:SI 4)))
2184 (umod:SI (reg:SI 3) (reg:SI 4)))
2185 (clobber (match_scratch:SI 0 "=l"))
2186 (clobber (reg:SI 0))
2187 (clobber (match_scratch:CC 1 "=x"))
2188 (clobber (reg:CC 69))]
2189 "! TARGET_POWER && ! TARGET_POWERPC"
2191 [(set_attr "type" "idiv")])
2193 (define_insn "quoss_call"
2195 (div:SI (reg:SI 3) (reg:SI 4)))
2196 (clobber (match_scratch:SI 0 "=l"))]
2197 "! TARGET_POWER && ! TARGET_POWERPC"
2199 [(set_attr "type" "idiv")])
2201 (define_insn "quous_call"
2203 (udiv:SI (reg:SI 3) (reg:SI 4)))
2204 (clobber (match_scratch:SI 0 "=l"))
2205 (clobber (reg:SI 0))
2206 (clobber (match_scratch:CC 1 "=x"))
2207 (clobber (reg:CC 69))]
2208 "! TARGET_POWER && ! TARGET_POWERPC"
2210 [(set_attr "type" "idiv")])
2212 ;; Logical instructions
2213 ;; The logical instructions are mostly combined by using match_operator,
2214 ;; but the plain AND insns are somewhat different because there is no
2215 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2216 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2218 (define_insn "andsi3"
2219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2220 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2221 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2222 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2226 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2227 {andil.|andi.} %0,%1,%b2
2228 {andiu.|andis.} %0,%1,%u2"
2229 [(set_attr "type" "*,*,compare,compare")])
2231 ;; Note to set cr's other than cr0 we do the and immediate and then
2232 ;; the test again -- this avoids a mfcr which on the higher end
2233 ;; machines causes an execution serialization
2235 (define_insn "*andsi3_internal2"
2236 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2237 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2238 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2240 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2241 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2245 {andil.|andi.} %3,%1,%b2
2246 {andiu.|andis.} %3,%1,%u2
2247 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2252 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2253 (set_attr "length" "4,4,4,4,8,8,8,8")])
2255 (define_insn "*andsi3_internal3"
2256 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2257 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2258 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2260 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2261 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2265 {andil.|andi.} %3,%1,%b2
2266 {andiu.|andis.} %3,%1,%u2
2267 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2272 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2273 (set_attr "length" "8,4,4,4,8,8,8,8")])
2276 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2277 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2278 (match_operand:SI 2 "and_operand" ""))
2280 (clobber (match_scratch:SI 3 ""))
2281 (clobber (match_scratch:CC 4 ""))]
2283 [(parallel [(set (match_dup 3)
2284 (and:SI (match_dup 1)
2286 (clobber (match_dup 4))])
2288 (compare:CC (match_dup 3)
2292 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2293 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2296 [(set (match_operand:CC 0 "cc_reg_operand" "")
2297 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2298 (match_operand:SI 2 "gpc_reg_operand" ""))
2300 (clobber (match_scratch:SI 3 ""))
2301 (clobber (match_scratch:CC 4 ""))]
2302 "TARGET_POWERPC64 && reload_completed"
2303 [(parallel [(set (match_dup 3)
2304 (and:SI (match_dup 1)
2306 (clobber (match_dup 4))])
2308 (compare:CC (match_dup 3)
2312 (define_insn "*andsi3_internal4"
2313 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2314 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2315 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2317 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2318 (and:SI (match_dup 1)
2320 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2324 {andil.|andi.} %0,%1,%b2
2325 {andiu.|andis.} %0,%1,%u2
2326 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2331 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2332 (set_attr "length" "4,4,4,4,8,8,8,8")])
2334 (define_insn "*andsi3_internal5"
2335 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2336 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2337 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2339 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2340 (and:SI (match_dup 1)
2342 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2346 {andil.|andi.} %0,%1,%b2
2347 {andiu.|andis.} %0,%1,%u2
2348 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2353 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2354 (set_attr "length" "8,4,4,4,8,8,8,8")])
2357 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2358 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2359 (match_operand:SI 2 "and_operand" ""))
2361 (set (match_operand:SI 0 "gpc_reg_operand" "")
2362 (and:SI (match_dup 1)
2364 (clobber (match_scratch:CC 4 ""))]
2366 [(parallel [(set (match_dup 0)
2367 (and:SI (match_dup 1)
2369 (clobber (match_dup 4))])
2371 (compare:CC (match_dup 0)
2376 [(set (match_operand:CC 3 "cc_reg_operand" "")
2377 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2378 (match_operand:SI 2 "gpc_reg_operand" ""))
2380 (set (match_operand:SI 0 "gpc_reg_operand" "")
2381 (and:SI (match_dup 1)
2383 (clobber (match_scratch:CC 4 ""))]
2384 "TARGET_POWERPC64 && reload_completed"
2385 [(parallel [(set (match_dup 0)
2386 (and:SI (match_dup 1)
2388 (clobber (match_dup 4))])
2390 (compare:CC (match_dup 0)
2394 ;; Handle the PowerPC64 rlwinm corner case
2396 (define_insn_and_split "*andsi3_internal6"
2397 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2398 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2399 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2404 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2407 (rotate:SI (match_dup 0) (match_dup 5)))]
2410 int mb = extract_MB (operands[2]);
2411 int me = extract_ME (operands[2]);
2412 operands[3] = GEN_INT (me + 1);
2413 operands[5] = GEN_INT (32 - (me + 1));
2414 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2416 [(set_attr "length" "8")])
2418 (define_expand "iorsi3"
2419 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2420 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2421 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2425 if (GET_CODE (operands[2]) == CONST_INT
2426 && ! logical_operand (operands[2], SImode))
2428 HOST_WIDE_INT value = INTVAL (operands[2]);
2429 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2430 ? operands[0] : gen_reg_rtx (SImode));
2432 emit_insn (gen_iorsi3 (tmp, operands[1],
2433 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2434 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2439 (define_expand "xorsi3"
2440 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2441 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2442 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2446 if (GET_CODE (operands[2]) == CONST_INT
2447 && ! logical_operand (operands[2], SImode))
2449 HOST_WIDE_INT value = INTVAL (operands[2]);
2450 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2451 ? operands[0] : gen_reg_rtx (SImode));
2453 emit_insn (gen_xorsi3 (tmp, operands[1],
2454 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2455 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2460 (define_insn "*boolsi3_internal1"
2461 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2462 (match_operator:SI 3 "boolean_or_operator"
2463 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2464 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2468 {%q3il|%q3i} %0,%1,%b2
2469 {%q3iu|%q3is} %0,%1,%u2")
2471 (define_insn "*boolsi3_internal2"
2472 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2473 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2474 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2475 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2477 (clobber (match_scratch:SI 3 "=r,r"))]
2482 [(set_attr "type" "compare")
2483 (set_attr "length" "4,8")])
2486 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2487 (compare:CC (match_operator:SI 4 "boolean_operator"
2488 [(match_operand:SI 1 "gpc_reg_operand" "")
2489 (match_operand:SI 2 "gpc_reg_operand" "")])
2491 (clobber (match_scratch:SI 3 ""))]
2492 "TARGET_32BIT && reload_completed"
2493 [(set (match_dup 3) (match_dup 4))
2495 (compare:CC (match_dup 3)
2499 (define_insn "*boolsi3_internal3"
2500 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2501 (compare:CC (match_operator:SI 4 "boolean_operator"
2502 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2503 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2505 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2511 [(set_attr "type" "compare")
2512 (set_attr "length" "4,8")])
2515 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2516 (compare:CC (match_operator:SI 4 "boolean_operator"
2517 [(match_operand:SI 1 "gpc_reg_operand" "")
2518 (match_operand:SI 2 "gpc_reg_operand" "")])
2520 (set (match_operand:SI 0 "gpc_reg_operand" "")
2522 "TARGET_32BIT && reload_completed"
2523 [(set (match_dup 0) (match_dup 4))
2525 (compare:CC (match_dup 0)
2529 ;; Split a logical operation that we can't do in one insn into two insns,
2530 ;; each of which does one 16-bit part. This is used by combine.
2533 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2534 (match_operator:SI 3 "boolean_or_operator"
2535 [(match_operand:SI 1 "gpc_reg_operand" "")
2536 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2538 [(set (match_dup 0) (match_dup 4))
2539 (set (match_dup 0) (match_dup 5))]
2543 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2544 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2546 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2547 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2551 (define_insn "*boolcsi3_internal1"
2552 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2553 (match_operator:SI 3 "boolean_operator"
2554 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2555 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2559 (define_insn "*boolcsi3_internal2"
2560 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2561 (compare:CC (match_operator:SI 4 "boolean_operator"
2562 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2563 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2565 (clobber (match_scratch:SI 3 "=r,r"))]
2570 [(set_attr "type" "compare")
2571 (set_attr "length" "4,8")])
2574 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2575 (compare:CC (match_operator:SI 4 "boolean_operator"
2576 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2577 (match_operand:SI 2 "gpc_reg_operand" "")])
2579 (clobber (match_scratch:SI 3 ""))]
2580 "TARGET_32BIT && reload_completed"
2581 [(set (match_dup 3) (match_dup 4))
2583 (compare:CC (match_dup 3)
2587 (define_insn "*boolcsi3_internal3"
2588 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2589 (compare:CC (match_operator:SI 4 "boolean_operator"
2590 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2591 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2593 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2599 [(set_attr "type" "compare")
2600 (set_attr "length" "4,8")])
2603 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2604 (compare:CC (match_operator:SI 4 "boolean_operator"
2605 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2606 (match_operand:SI 2 "gpc_reg_operand" "")])
2608 (set (match_operand:SI 0 "gpc_reg_operand" "")
2610 "TARGET_32BIT && reload_completed"
2611 [(set (match_dup 0) (match_dup 4))
2613 (compare:CC (match_dup 0)
2617 (define_insn "*boolccsi3_internal1"
2618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2619 (match_operator:SI 3 "boolean_operator"
2620 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2621 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2625 (define_insn "*boolccsi3_internal2"
2626 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2627 (compare:CC (match_operator:SI 4 "boolean_operator"
2628 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2629 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2631 (clobber (match_scratch:SI 3 "=r,r"))]
2636 [(set_attr "type" "compare")
2637 (set_attr "length" "4,8")])
2640 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2641 (compare:CC (match_operator:SI 4 "boolean_operator"
2642 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2643 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2645 (clobber (match_scratch:SI 3 ""))]
2646 "TARGET_32BIT && reload_completed"
2647 [(set (match_dup 3) (match_dup 4))
2649 (compare:CC (match_dup 3)
2653 (define_insn "*boolccsi3_internal3"
2654 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2655 (compare:CC (match_operator:SI 4 "boolean_operator"
2656 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2657 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2659 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2665 [(set_attr "type" "compare")
2666 (set_attr "length" "4,8")])
2669 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2670 (compare:CC (match_operator:SI 4 "boolean_operator"
2671 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2672 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2674 (set (match_operand:SI 0 "gpc_reg_operand" "")
2676 "TARGET_32BIT && reload_completed"
2677 [(set (match_dup 0) (match_dup 4))
2679 (compare:CC (match_dup 0)
2683 ;; maskir insn. We need four forms because things might be in arbitrary
2684 ;; orders. Don't define forms that only set CR fields because these
2685 ;; would modify an input register.
2687 (define_insn "*maskir_internal1"
2688 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2689 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2690 (match_operand:SI 1 "gpc_reg_operand" "0"))
2691 (and:SI (match_dup 2)
2692 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2696 (define_insn "*maskir_internal2"
2697 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2698 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2699 (match_operand:SI 1 "gpc_reg_operand" "0"))
2700 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2705 (define_insn "*maskir_internal3"
2706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2707 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2708 (match_operand:SI 3 "gpc_reg_operand" "r"))
2709 (and:SI (not:SI (match_dup 2))
2710 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2714 (define_insn "*maskir_internal4"
2715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2716 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2717 (match_operand:SI 2 "gpc_reg_operand" "r"))
2718 (and:SI (not:SI (match_dup 2))
2719 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2723 (define_insn "*maskir_internal5"
2724 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2726 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2727 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2728 (and:SI (match_dup 2)
2729 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2731 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2732 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2733 (and:SI (match_dup 2) (match_dup 3))))]
2738 [(set_attr "type" "compare")
2739 (set_attr "length" "4,8")])
2742 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2744 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2745 (match_operand:SI 1 "gpc_reg_operand" ""))
2746 (and:SI (match_dup 2)
2747 (match_operand:SI 3 "gpc_reg_operand" "")))
2749 (set (match_operand:SI 0 "gpc_reg_operand" "")
2750 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2751 (and:SI (match_dup 2) (match_dup 3))))]
2752 "TARGET_POWER && reload_completed"
2754 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2755 (and:SI (match_dup 2) (match_dup 3))))
2757 (compare:CC (match_dup 0)
2761 (define_insn "*maskir_internal6"
2762 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2764 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2765 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2766 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2769 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2770 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2771 (and:SI (match_dup 3) (match_dup 2))))]
2776 [(set_attr "type" "compare")
2777 (set_attr "length" "4,8")])
2780 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2782 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2783 (match_operand:SI 1 "gpc_reg_operand" ""))
2784 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2787 (set (match_operand:SI 0 "gpc_reg_operand" "")
2788 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2789 (and:SI (match_dup 3) (match_dup 2))))]
2790 "TARGET_POWER && reload_completed"
2792 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2793 (and:SI (match_dup 3) (match_dup 2))))
2795 (compare:CC (match_dup 0)
2799 (define_insn "*maskir_internal7"
2800 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2802 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2803 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2804 (and:SI (not:SI (match_dup 2))
2805 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2807 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2808 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2809 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2814 [(set_attr "type" "compare")
2815 (set_attr "length" "4,8")])
2818 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2820 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2821 (match_operand:SI 3 "gpc_reg_operand" ""))
2822 (and:SI (not:SI (match_dup 2))
2823 (match_operand:SI 1 "gpc_reg_operand" "")))
2825 (set (match_operand:SI 0 "gpc_reg_operand" "")
2826 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2827 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2828 "TARGET_POWER && reload_completed"
2830 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2831 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2833 (compare:CC (match_dup 0)
2837 (define_insn "*maskir_internal8"
2838 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2840 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2841 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2842 (and:SI (not:SI (match_dup 2))
2843 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2845 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2846 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2847 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2852 [(set_attr "type" "compare")
2853 (set_attr "length" "4,8")])
2856 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2858 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2859 (match_operand:SI 2 "gpc_reg_operand" ""))
2860 (and:SI (not:SI (match_dup 2))
2861 (match_operand:SI 1 "gpc_reg_operand" "")))
2863 (set (match_operand:SI 0 "gpc_reg_operand" "")
2864 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2865 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2866 "TARGET_POWER && reload_completed"
2868 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2869 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2871 (compare:CC (match_dup 0)
2875 ;; Rotate and shift insns, in all their variants. These support shifts,
2876 ;; field inserts and extracts, and various combinations thereof.
2877 (define_expand "insv"
2878 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2879 (match_operand:SI 1 "const_int_operand" "")
2880 (match_operand:SI 2 "const_int_operand" ""))
2881 (match_operand 3 "gpc_reg_operand" ""))]
2885 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2886 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2887 compiler if the address of the structure is taken later. */
2888 if (GET_CODE (operands[0]) == SUBREG
2889 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2892 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2893 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2895 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2899 (define_insn "insvsi"
2900 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2901 (match_operand:SI 1 "const_int_operand" "i")
2902 (match_operand:SI 2 "const_int_operand" "i"))
2903 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2907 int start = INTVAL (operands[2]) & 31;
2908 int size = INTVAL (operands[1]) & 31;
2910 operands[4] = GEN_INT (32 - start - size);
2911 operands[1] = GEN_INT (start + size - 1);
2912 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2914 [(set_attr "type" "insert_word")])
2916 (define_insn "*insvsi_internal1"
2917 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2918 (match_operand:SI 1 "const_int_operand" "i")
2919 (match_operand:SI 2 "const_int_operand" "i"))
2920 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2921 (match_operand:SI 4 "const_int_operand" "i")))]
2922 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2925 int shift = INTVAL (operands[4]) & 31;
2926 int start = INTVAL (operands[2]) & 31;
2927 int size = INTVAL (operands[1]) & 31;
2929 operands[4] = GEN_INT (shift - start - size);
2930 operands[1] = GEN_INT (start + size - 1);
2931 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2933 [(set_attr "type" "insert_word")])
2935 (define_insn "*insvsi_internal2"
2936 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2937 (match_operand:SI 1 "const_int_operand" "i")
2938 (match_operand:SI 2 "const_int_operand" "i"))
2939 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2940 (match_operand:SI 4 "const_int_operand" "i")))]
2941 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2944 int shift = INTVAL (operands[4]) & 31;
2945 int start = INTVAL (operands[2]) & 31;
2946 int size = INTVAL (operands[1]) & 31;
2948 operands[4] = GEN_INT (32 - shift - start - size);
2949 operands[1] = GEN_INT (start + size - 1);
2950 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2952 [(set_attr "type" "insert_word")])
2954 (define_insn "*insvsi_internal3"
2955 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2956 (match_operand:SI 1 "const_int_operand" "i")
2957 (match_operand:SI 2 "const_int_operand" "i"))
2958 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2959 (match_operand:SI 4 "const_int_operand" "i")))]
2960 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2963 int shift = INTVAL (operands[4]) & 31;
2964 int start = INTVAL (operands[2]) & 31;
2965 int size = INTVAL (operands[1]) & 31;
2967 operands[4] = GEN_INT (32 - shift - start - size);
2968 operands[1] = GEN_INT (start + size - 1);
2969 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2971 [(set_attr "type" "insert_word")])
2973 (define_insn "*insvsi_internal4"
2974 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2975 (match_operand:SI 1 "const_int_operand" "i")
2976 (match_operand:SI 2 "const_int_operand" "i"))
2977 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2978 (match_operand:SI 4 "const_int_operand" "i")
2979 (match_operand:SI 5 "const_int_operand" "i")))]
2980 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2983 int extract_start = INTVAL (operands[5]) & 31;
2984 int extract_size = INTVAL (operands[4]) & 31;
2985 int insert_start = INTVAL (operands[2]) & 31;
2986 int insert_size = INTVAL (operands[1]) & 31;
2988 /* Align extract field with insert field */
2989 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
2990 operands[1] = GEN_INT (insert_start + insert_size - 1);
2991 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
2993 [(set_attr "type" "insert_word")])
2995 ;; combine patterns for rlwimi
2996 (define_insn "*insvsi_internal5"
2997 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2998 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
2999 (match_operand:SI 1 "mask_operand" "i"))
3000 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3001 (match_operand:SI 2 "const_int_operand" "i"))
3002 (match_operand:SI 5 "mask_operand" "i"))))]
3003 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3006 int me = extract_ME(operands[5]);
3007 int mb = extract_MB(operands[5]);
3008 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3009 operands[2] = GEN_INT(mb);
3010 operands[1] = GEN_INT(me);
3011 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3013 [(set_attr "type" "insert_word")])
3015 (define_insn "*insvsi_internal6"
3016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3017 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3018 (match_operand:SI 2 "const_int_operand" "i"))
3019 (match_operand:SI 5 "mask_operand" "i"))
3020 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3021 (match_operand:SI 1 "mask_operand" "i"))))]
3022 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3025 int me = extract_ME(operands[5]);
3026 int mb = extract_MB(operands[5]);
3027 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3028 operands[2] = GEN_INT(mb);
3029 operands[1] = GEN_INT(me);
3030 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3032 [(set_attr "type" "insert_word")])
3034 (define_insn "insvdi"
3035 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3036 (match_operand:SI 1 "const_int_operand" "i")
3037 (match_operand:SI 2 "const_int_operand" "i"))
3038 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3042 int start = INTVAL (operands[2]) & 63;
3043 int size = INTVAL (operands[1]) & 63;
3045 operands[1] = GEN_INT (64 - start - size);
3046 return \"rldimi %0,%3,%H1,%H2\";
3049 (define_insn "*insvdi_internal2"
3050 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3051 (match_operand:SI 1 "const_int_operand" "i")
3052 (match_operand:SI 2 "const_int_operand" "i"))
3053 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3054 (match_operand:SI 4 "const_int_operand" "i")))]
3056 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3059 int shift = INTVAL (operands[4]) & 63;
3060 int start = (INTVAL (operands[2]) & 63) - 32;
3061 int size = INTVAL (operands[1]) & 63;
3063 operands[4] = GEN_INT (64 - shift - start - size);
3064 operands[2] = GEN_INT (start);
3065 operands[1] = GEN_INT (start + size - 1);
3066 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3069 (define_insn "*insvdi_internal3"
3070 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3071 (match_operand:SI 1 "const_int_operand" "i")
3072 (match_operand:SI 2 "const_int_operand" "i"))
3073 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3074 (match_operand:SI 4 "const_int_operand" "i")))]
3076 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3079 int shift = INTVAL (operands[4]) & 63;
3080 int start = (INTVAL (operands[2]) & 63) - 32;
3081 int size = INTVAL (operands[1]) & 63;
3083 operands[4] = GEN_INT (64 - shift - start - size);
3084 operands[2] = GEN_INT (start);
3085 operands[1] = GEN_INT (start + size - 1);
3086 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3089 (define_expand "extzv"
3090 [(set (match_operand 0 "gpc_reg_operand" "")
3091 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3092 (match_operand:SI 2 "const_int_operand" "")
3093 (match_operand:SI 3 "const_int_operand" "")))]
3097 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3098 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3099 compiler if the address of the structure is taken later. */
3100 if (GET_CODE (operands[0]) == SUBREG
3101 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3104 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3105 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3107 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3111 (define_insn "extzvsi"
3112 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3113 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3114 (match_operand:SI 2 "const_int_operand" "i")
3115 (match_operand:SI 3 "const_int_operand" "i")))]
3119 int start = INTVAL (operands[3]) & 31;
3120 int size = INTVAL (operands[2]) & 31;
3122 if (start + size >= 32)
3123 operands[3] = const0_rtx;
3125 operands[3] = GEN_INT (start + size);
3126 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3129 (define_insn "*extzvsi_internal1"
3130 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3131 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3132 (match_operand:SI 2 "const_int_operand" "i,i")
3133 (match_operand:SI 3 "const_int_operand" "i,i"))
3135 (clobber (match_scratch:SI 4 "=r,r"))]
3139 int start = INTVAL (operands[3]) & 31;
3140 int size = INTVAL (operands[2]) & 31;
3142 /* Force split for non-cc0 compare. */
3143 if (which_alternative == 1)
3146 /* If the bit-field being tested fits in the upper or lower half of a
3147 word, it is possible to use andiu. or andil. to test it. This is
3148 useful because the condition register set-use delay is smaller for
3149 andi[ul]. than for rlinm. This doesn't work when the starting bit
3150 position is 0 because the LT and GT bits may be set wrong. */
3152 if ((start > 0 && start + size <= 16) || start >= 16)
3154 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3155 - (1 << (16 - (start & 15) - size))));
3157 return \"{andiu.|andis.} %4,%1,%3\";
3159 return \"{andil.|andi.} %4,%1,%3\";
3162 if (start + size >= 32)
3163 operands[3] = const0_rtx;
3165 operands[3] = GEN_INT (start + size);
3166 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3168 [(set_attr "type" "compare")
3169 (set_attr "length" "4,8")])
3172 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3173 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3174 (match_operand:SI 2 "const_int_operand" "")
3175 (match_operand:SI 3 "const_int_operand" ""))
3177 (clobber (match_scratch:SI 4 ""))]
3180 (zero_extract:SI (match_dup 1) (match_dup 2)
3183 (compare:CC (match_dup 4)
3187 (define_insn "*extzvsi_internal2"
3188 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3189 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3190 (match_operand:SI 2 "const_int_operand" "i,i")
3191 (match_operand:SI 3 "const_int_operand" "i,i"))
3193 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3194 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3198 int start = INTVAL (operands[3]) & 31;
3199 int size = INTVAL (operands[2]) & 31;
3201 /* Force split for non-cc0 compare. */
3202 if (which_alternative == 1)
3205 /* Since we are using the output value, we can't ignore any need for
3206 a shift. The bit-field must end at the LSB. */
3207 if (start >= 16 && start + size == 32)
3209 operands[3] = GEN_INT ((1 << size) - 1);
3210 return \"{andil.|andi.} %0,%1,%3\";
3213 if (start + size >= 32)
3214 operands[3] = const0_rtx;
3216 operands[3] = GEN_INT (start + size);
3217 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3219 [(set_attr "type" "compare")
3220 (set_attr "length" "4,8")])
3223 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3224 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3225 (match_operand:SI 2 "const_int_operand" "")
3226 (match_operand:SI 3 "const_int_operand" ""))
3228 (set (match_operand:SI 0 "gpc_reg_operand" "")
3229 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3232 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3234 (compare:CC (match_dup 0)
3238 (define_insn "extzvdi"
3239 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3240 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3241 (match_operand:SI 2 "const_int_operand" "i")
3242 (match_operand:SI 3 "const_int_operand" "i")))]
3246 int start = INTVAL (operands[3]) & 63;
3247 int size = INTVAL (operands[2]) & 63;
3249 if (start + size >= 64)
3250 operands[3] = const0_rtx;
3252 operands[3] = GEN_INT (start + size);
3253 operands[2] = GEN_INT (64 - size);
3254 return \"rldicl %0,%1,%3,%2\";
3257 (define_insn "*extzvdi_internal1"
3258 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3259 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3260 (match_operand:SI 2 "const_int_operand" "i")
3261 (match_operand:SI 3 "const_int_operand" "i"))
3263 (clobber (match_scratch:DI 4 "=r"))]
3267 int start = INTVAL (operands[3]) & 63;
3268 int size = INTVAL (operands[2]) & 63;
3270 if (start + size >= 64)
3271 operands[3] = const0_rtx;
3273 operands[3] = GEN_INT (start + size);
3274 operands[2] = GEN_INT (64 - size);
3275 return \"rldicl. %4,%1,%3,%2\";
3277 [(set_attr "type" "compare")])
3279 (define_insn "*extzvdi_internal2"
3280 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3281 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3282 (match_operand:SI 2 "const_int_operand" "i")
3283 (match_operand:SI 3 "const_int_operand" "i"))
3285 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3286 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3290 int start = INTVAL (operands[3]) & 63;
3291 int size = INTVAL (operands[2]) & 63;
3293 if (start + size >= 64)
3294 operands[3] = const0_rtx;
3296 operands[3] = GEN_INT (start + size);
3297 operands[2] = GEN_INT (64 - size);
3298 return \"rldicl. %0,%1,%3,%2\";
3300 [(set_attr "type" "compare")])
3302 (define_insn "rotlsi3"
3303 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3304 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3305 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3307 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3309 (define_insn "*rotlsi3_internal2"
3310 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3311 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3312 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3314 (clobber (match_scratch:SI 3 "=r,r"))]
3317 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3319 [(set_attr "type" "delayed_compare")
3320 (set_attr "length" "4,8")])
3323 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3324 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3325 (match_operand:SI 2 "reg_or_cint_operand" ""))
3327 (clobber (match_scratch:SI 3 ""))]
3330 (rotate:SI (match_dup 1) (match_dup 2)))
3332 (compare:CC (match_dup 3)
3336 (define_insn "*rotlsi3_internal3"
3337 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3338 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3339 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3341 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3342 (rotate:SI (match_dup 1) (match_dup 2)))]
3345 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3347 [(set_attr "type" "delayed_compare")
3348 (set_attr "length" "4,8")])
3351 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3352 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3353 (match_operand:SI 2 "reg_or_cint_operand" ""))
3355 (set (match_operand:SI 0 "gpc_reg_operand" "")
3356 (rotate:SI (match_dup 1) (match_dup 2)))]
3359 (rotate:SI (match_dup 1) (match_dup 2)))
3361 (compare:CC (match_dup 0)
3365 (define_insn "*rotlsi3_internal4"
3366 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3367 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3368 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3369 (match_operand:SI 3 "mask_operand" "n")))]
3371 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3373 (define_insn "*rotlsi3_internal5"
3374 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3376 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3377 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3378 (match_operand:SI 3 "mask_operand" "n,n"))
3380 (clobber (match_scratch:SI 4 "=r,r"))]
3383 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3385 [(set_attr "type" "delayed_compare")
3386 (set_attr "length" "4,8")])
3389 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3391 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3392 (match_operand:SI 2 "reg_or_cint_operand" ""))
3393 (match_operand:SI 3 "mask_operand" ""))
3395 (clobber (match_scratch:SI 4 ""))]
3398 (and:SI (rotate:SI (match_dup 1)
3402 (compare:CC (match_dup 4)
3406 (define_insn "*rotlsi3_internal6"
3407 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3409 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3410 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3411 (match_operand:SI 3 "mask_operand" "n,n"))
3413 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3414 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3417 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3419 [(set_attr "type" "delayed_compare")
3420 (set_attr "length" "4,8")])
3423 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3425 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3426 (match_operand:SI 2 "reg_or_cint_operand" ""))
3427 (match_operand:SI 3 "mask_operand" ""))
3429 (set (match_operand:SI 0 "gpc_reg_operand" "")
3430 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3433 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3435 (compare:CC (match_dup 0)
3439 (define_insn "*rotlsi3_internal7"
3440 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3443 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3444 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3446 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3448 (define_insn "*rotlsi3_internal8"
3449 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3450 (compare:CC (zero_extend:SI
3452 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3453 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3455 (clobber (match_scratch:SI 3 "=r,r"))]
3458 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3460 [(set_attr "type" "delayed_compare")
3461 (set_attr "length" "4,8")])
3464 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3465 (compare:CC (zero_extend:SI
3467 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3468 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3470 (clobber (match_scratch:SI 3 ""))]
3473 (zero_extend:SI (subreg:QI
3474 (rotate:SI (match_dup 1)
3477 (compare:CC (match_dup 3)
3481 (define_insn "*rotlsi3_internal9"
3482 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3483 (compare:CC (zero_extend:SI
3485 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3486 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3488 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3489 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3492 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3494 [(set_attr "type" "delayed_compare")
3495 (set_attr "length" "4,8")])
3498 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3499 (compare:CC (zero_extend:SI
3501 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3502 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3504 (set (match_operand:SI 0 "gpc_reg_operand" "")
3505 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3508 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3510 (compare:CC (match_dup 0)
3514 (define_insn "*rotlsi3_internal10"
3515 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3518 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3519 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3521 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3523 (define_insn "*rotlsi3_internal11"
3524 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3525 (compare:CC (zero_extend:SI
3527 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3528 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3530 (clobber (match_scratch:SI 3 "=r,r"))]
3533 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3535 [(set_attr "type" "delayed_compare")
3536 (set_attr "length" "4,8")])
3539 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3540 (compare:CC (zero_extend:SI
3542 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3543 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3545 (clobber (match_scratch:SI 3 ""))]
3548 (zero_extend:SI (subreg:HI
3549 (rotate:SI (match_dup 1)
3552 (compare:CC (match_dup 3)
3556 (define_insn "*rotlsi3_internal12"
3557 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3558 (compare:CC (zero_extend:SI
3560 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3561 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3563 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3564 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3567 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3569 [(set_attr "type" "delayed_compare")
3570 (set_attr "length" "4,8")])
3573 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3574 (compare:CC (zero_extend:SI
3576 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3577 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3579 (set (match_operand:SI 0 "gpc_reg_operand" "")
3580 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3583 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3585 (compare:CC (match_dup 0)
3589 ;; Note that we use "sle." instead of "sl." so that we can set
3590 ;; SHIFT_COUNT_TRUNCATED.
3592 (define_expand "ashlsi3"
3593 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3594 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3595 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3600 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3602 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3606 (define_insn "ashlsi3_power"
3607 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3608 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3609 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3610 (clobber (match_scratch:SI 3 "=q,X"))]
3614 {sli|slwi} %0,%1,%h2")
3616 (define_insn "ashlsi3_no_power"
3617 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3618 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3619 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3621 "{sl|slw}%I2 %0,%1,%h2")
3624 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3625 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3626 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3628 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3629 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3633 {sli.|slwi.} %3,%1,%h2
3636 [(set_attr "type" "delayed_compare")
3637 (set_attr "length" "4,4,8,8")])
3640 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3641 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3642 (match_operand:SI 2 "reg_or_cint_operand" ""))
3644 (clobber (match_scratch:SI 3 ""))
3645 (clobber (match_scratch:SI 4 ""))]
3646 "TARGET_POWER && reload_completed"
3647 [(parallel [(set (match_dup 3)
3648 (ashift:SI (match_dup 1) (match_dup 2)))
3649 (clobber (match_dup 4))])
3651 (compare:CC (match_dup 3)
3656 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3657 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3658 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3660 (clobber (match_scratch:SI 3 "=r,r"))]
3661 "! TARGET_POWER && TARGET_32BIT"
3663 {sl|slw}%I2. %3,%1,%h2
3665 [(set_attr "type" "delayed_compare")
3666 (set_attr "length" "4,8")])
3669 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3670 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3671 (match_operand:SI 2 "reg_or_cint_operand" ""))
3673 (clobber (match_scratch:SI 3 ""))]
3674 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3676 (ashift:SI (match_dup 1) (match_dup 2)))
3678 (compare:CC (match_dup 3)
3683 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3684 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3685 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3687 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3688 (ashift:SI (match_dup 1) (match_dup 2)))
3689 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3693 {sli.|slwi.} %0,%1,%h2
3696 [(set_attr "type" "delayed_compare")
3697 (set_attr "length" "4,4,8,8")])
3700 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3701 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3702 (match_operand:SI 2 "reg_or_cint_operand" ""))
3704 (set (match_operand:SI 0 "gpc_reg_operand" "")
3705 (ashift:SI (match_dup 1) (match_dup 2)))
3706 (clobber (match_scratch:SI 4 ""))]
3707 "TARGET_POWER && reload_completed"
3708 [(parallel [(set (match_dup 0)
3709 (ashift:SI (match_dup 1) (match_dup 2)))
3710 (clobber (match_dup 4))])
3712 (compare:CC (match_dup 0)
3717 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3718 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3719 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3721 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3722 (ashift:SI (match_dup 1) (match_dup 2)))]
3723 "! TARGET_POWER && TARGET_32BIT"
3725 {sl|slw}%I2. %0,%1,%h2
3727 [(set_attr "type" "delayed_compare")
3728 (set_attr "length" "4,8")])
3731 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3732 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3733 (match_operand:SI 2 "reg_or_cint_operand" ""))
3735 (set (match_operand:SI 0 "gpc_reg_operand" "")
3736 (ashift:SI (match_dup 1) (match_dup 2)))]
3737 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3739 (ashift:SI (match_dup 1) (match_dup 2)))
3741 (compare:CC (match_dup 0)
3746 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3747 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3748 (match_operand:SI 2 "const_int_operand" "i"))
3749 (match_operand:SI 3 "mask_operand" "n")))]
3750 "includes_lshift_p (operands[2], operands[3])"
3751 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3754 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3756 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3757 (match_operand:SI 2 "const_int_operand" "i,i"))
3758 (match_operand:SI 3 "mask_operand" "n,n"))
3760 (clobber (match_scratch:SI 4 "=r,r"))]
3761 "includes_lshift_p (operands[2], operands[3])"
3763 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3765 [(set_attr "type" "delayed_compare")
3766 (set_attr "length" "4,8")])
3769 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3771 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3772 (match_operand:SI 2 "const_int_operand" ""))
3773 (match_operand:SI 3 "mask_operand" ""))
3775 (clobber (match_scratch:SI 4 ""))]
3776 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3778 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3781 (compare:CC (match_dup 4)
3786 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3788 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3789 (match_operand:SI 2 "const_int_operand" "i,i"))
3790 (match_operand:SI 3 "mask_operand" "n,n"))
3792 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3793 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3794 "includes_lshift_p (operands[2], operands[3])"
3796 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3798 [(set_attr "type" "delayed_compare")
3799 (set_attr "length" "4,8")])
3802 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3804 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3805 (match_operand:SI 2 "const_int_operand" ""))
3806 (match_operand:SI 3 "mask_operand" ""))
3808 (set (match_operand:SI 0 "gpc_reg_operand" "")
3809 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3810 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3812 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3814 (compare:CC (match_dup 0)
3818 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3820 (define_expand "lshrsi3"
3821 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3822 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3823 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3828 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3830 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3834 (define_insn "lshrsi3_power"
3835 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3836 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3837 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3838 (clobber (match_scratch:SI 3 "=q,X,X"))]
3843 {s%A2i|s%A2wi} %0,%1,%h2")
3845 (define_insn "lshrsi3_no_power"
3846 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3847 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3848 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3852 {sr|srw}%I2 %0,%1,%h2")
3855 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3856 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3857 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3859 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3860 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3865 {s%A2i.|s%A2wi.} %3,%1,%h2
3869 [(set_attr "type" "delayed_compare")
3870 (set_attr "length" "4,4,4,8,8,8")])
3873 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3874 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3875 (match_operand:SI 2 "reg_or_cint_operand" ""))
3877 (clobber (match_scratch:SI 3 ""))
3878 (clobber (match_scratch:SI 4 ""))]
3879 "TARGET_POWER && reload_completed"
3880 [(parallel [(set (match_dup 3)
3881 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3882 (clobber (match_dup 4))])
3884 (compare:CC (match_dup 3)
3889 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3890 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3891 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3893 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3894 "! TARGET_POWER && TARGET_32BIT"
3897 {sr|srw}%I2. %3,%1,%h2
3900 [(set_attr "type" "delayed_compare")
3901 (set_attr "length" "4,4,8,8")])
3904 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3905 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3906 (match_operand:SI 2 "reg_or_cint_operand" ""))
3908 (clobber (match_scratch:SI 3 ""))]
3909 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3911 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3913 (compare:CC (match_dup 3)
3918 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3919 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3920 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3922 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3923 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3924 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3929 {s%A2i.|s%A2wi.} %0,%1,%h2
3933 [(set_attr "type" "delayed_compare")
3934 (set_attr "length" "4,4,4,8,8,8")])
3937 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3938 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3939 (match_operand:SI 2 "reg_or_cint_operand" ""))
3941 (set (match_operand:SI 0 "gpc_reg_operand" "")
3942 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3943 (clobber (match_scratch:SI 4 ""))]
3944 "TARGET_POWER && reload_completed"
3945 [(parallel [(set (match_dup 0)
3946 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3947 (clobber (match_dup 4))])
3949 (compare:CC (match_dup 0)
3954 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3955 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3956 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3958 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3959 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3960 "! TARGET_POWER && TARGET_32BIT"
3963 {sr|srw}%I2. %0,%1,%h2
3966 [(set_attr "type" "delayed_compare")
3967 (set_attr "length" "4,4,8,8")])
3970 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3971 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3972 (match_operand:SI 2 "reg_or_cint_operand" ""))
3974 (set (match_operand:SI 0 "gpc_reg_operand" "")
3975 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3976 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3978 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3980 (compare:CC (match_dup 0)
3985 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3986 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3987 (match_operand:SI 2 "const_int_operand" "i"))
3988 (match_operand:SI 3 "mask_operand" "n")))]
3989 "includes_rshift_p (operands[2], operands[3])"
3990 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3993 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3995 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3996 (match_operand:SI 2 "const_int_operand" "i,i"))
3997 (match_operand:SI 3 "mask_operand" "n,n"))
3999 (clobber (match_scratch:SI 4 "=r,r"))]
4000 "includes_rshift_p (operands[2], operands[3])"
4002 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4004 [(set_attr "type" "delayed_compare")
4005 (set_attr "length" "4,8")])
4008 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4010 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4011 (match_operand:SI 2 "const_int_operand" ""))
4012 (match_operand:SI 3 "mask_operand" ""))
4014 (clobber (match_scratch:SI 4 ""))]
4015 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4017 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4020 (compare:CC (match_dup 4)
4025 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4027 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4028 (match_operand:SI 2 "const_int_operand" "i,i"))
4029 (match_operand:SI 3 "mask_operand" "n,n"))
4031 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4032 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4033 "includes_rshift_p (operands[2], operands[3])"
4035 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4037 [(set_attr "type" "delayed_compare")
4038 (set_attr "length" "4,8")])
4041 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4043 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4044 (match_operand:SI 2 "const_int_operand" ""))
4045 (match_operand:SI 3 "mask_operand" ""))
4047 (set (match_operand:SI 0 "gpc_reg_operand" "")
4048 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4049 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4051 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4053 (compare:CC (match_dup 0)
4058 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4061 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4062 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4063 "includes_rshift_p (operands[2], GEN_INT (255))"
4064 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4067 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4071 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4072 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4074 (clobber (match_scratch:SI 3 "=r,r"))]
4075 "includes_rshift_p (operands[2], GEN_INT (255))"
4077 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4079 [(set_attr "type" "delayed_compare")
4080 (set_attr "length" "4,8")])
4083 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4087 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4088 (match_operand:SI 2 "const_int_operand" "")) 0))
4090 (clobber (match_scratch:SI 3 ""))]
4091 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4093 (zero_extend:SI (subreg:QI
4094 (lshiftrt:SI (match_dup 1)
4097 (compare:CC (match_dup 3)
4102 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4106 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4107 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4109 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4110 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4111 "includes_rshift_p (operands[2], GEN_INT (255))"
4113 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4115 [(set_attr "type" "delayed_compare")
4116 (set_attr "length" "4,8")])
4119 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4123 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4124 (match_operand:SI 2 "const_int_operand" "")) 0))
4126 (set (match_operand:SI 0 "gpc_reg_operand" "")
4127 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4128 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4130 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4132 (compare:CC (match_dup 0)
4137 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4140 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4141 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4142 "includes_rshift_p (operands[2], GEN_INT (65535))"
4143 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4146 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4150 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4151 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4153 (clobber (match_scratch:SI 3 "=r,r"))]
4154 "includes_rshift_p (operands[2], GEN_INT (65535))"
4156 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4158 [(set_attr "type" "delayed_compare")
4159 (set_attr "length" "4,8")])
4162 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4166 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4167 (match_operand:SI 2 "const_int_operand" "")) 0))
4169 (clobber (match_scratch:SI 3 ""))]
4170 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4172 (zero_extend:SI (subreg:HI
4173 (lshiftrt:SI (match_dup 1)
4176 (compare:CC (match_dup 3)
4181 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4185 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4186 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4188 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4189 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4190 "includes_rshift_p (operands[2], GEN_INT (65535))"
4192 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4194 [(set_attr "type" "delayed_compare")
4195 (set_attr "length" "4,8")])
4198 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4202 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4203 (match_operand:SI 2 "const_int_operand" "")) 0))
4205 (set (match_operand:SI 0 "gpc_reg_operand" "")
4206 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4207 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4209 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4211 (compare:CC (match_dup 0)
4216 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4218 (match_operand:SI 1 "gpc_reg_operand" "r"))
4219 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4225 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4227 (match_operand:SI 1 "gpc_reg_operand" "r"))
4228 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4234 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4236 (match_operand:SI 1 "gpc_reg_operand" "r"))
4237 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4243 (define_expand "ashrsi3"
4244 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4245 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4246 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4251 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4253 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4257 (define_insn "ashrsi3_power"
4258 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4259 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4260 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4261 (clobber (match_scratch:SI 3 "=q,X"))]
4265 {srai|srawi} %0,%1,%h2")
4267 (define_insn "ashrsi3_no_power"
4268 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4269 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4270 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4272 "{sra|sraw}%I2 %0,%1,%h2")
4275 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4276 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4277 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4279 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4280 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4284 {srai.|srawi.} %3,%1,%h2
4287 [(set_attr "type" "delayed_compare")
4288 (set_attr "length" "4,4,8,8")])
4291 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4292 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4293 (match_operand:SI 2 "reg_or_cint_operand" ""))
4295 (clobber (match_scratch:SI 3 ""))
4296 (clobber (match_scratch:SI 4 ""))]
4297 "TARGET_POWER && reload_completed"
4298 [(parallel [(set (match_dup 3)
4299 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4300 (clobber (match_dup 4))])
4302 (compare:CC (match_dup 3)
4307 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4308 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4309 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4311 (clobber (match_scratch:SI 3 "=r,r"))]
4314 {sra|sraw}%I2. %3,%1,%h2
4316 [(set_attr "type" "delayed_compare")
4317 (set_attr "length" "4,8")])
4320 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4321 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4322 (match_operand:SI 2 "reg_or_cint_operand" ""))
4324 (clobber (match_scratch:SI 3 ""))]
4325 "! TARGET_POWER && reload_completed"
4327 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4329 (compare:CC (match_dup 3)
4334 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4335 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4336 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4338 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4339 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4340 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4344 {srai.|srawi.} %0,%1,%h2
4347 [(set_attr "type" "delayed_compare")
4348 (set_attr "length" "4,4,8,8")])
4351 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4352 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4353 (match_operand:SI 2 "reg_or_cint_operand" ""))
4355 (set (match_operand:SI 0 "gpc_reg_operand" "")
4356 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4357 (clobber (match_scratch:SI 4 ""))]
4358 "TARGET_POWER && reload_completed"
4359 [(parallel [(set (match_dup 0)
4360 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4361 (clobber (match_dup 4))])
4363 (compare:CC (match_dup 0)
4368 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4369 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4370 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4372 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4373 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4376 {sra|sraw}%I2. %0,%1,%h2
4378 [(set_attr "type" "delayed_compare")
4379 (set_attr "length" "4,8")])
4382 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4383 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4384 (match_operand:SI 2 "reg_or_cint_operand" ""))
4386 (set (match_operand:SI 0 "gpc_reg_operand" "")
4387 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4388 "! TARGET_POWER && reload_completed"
4390 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4392 (compare:CC (match_dup 0)
4396 ;; Floating-point insns, excluding normal data motion.
4398 ;; PowerPC has a full set of single-precision floating point instructions.
4400 ;; For the POWER architecture, we pretend that we have both SFmode and
4401 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4402 ;; The only conversions we will do will be when storing to memory. In that
4403 ;; case, we will use the "frsp" instruction before storing.
4405 ;; Note that when we store into a single-precision memory location, we need to
4406 ;; use the frsp insn first. If the register being stored isn't dead, we
4407 ;; need a scratch register for the frsp. But this is difficult when the store
4408 ;; is done by reload. It is not incorrect to do the frsp on the register in
4409 ;; this case, we just lose precision that we would have otherwise gotten but
4410 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4412 (define_expand "extendsfdf2"
4413 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4414 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4415 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4418 (define_insn_and_split "*extendsfdf2_fpr"
4419 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4420 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4421 "TARGET_HARD_FLOAT && TARGET_FPRS"
4426 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
4429 emit_note (NOTE_INSN_DELETED);
4432 [(set_attr "type" "fp,fp,fpload")])
4434 (define_expand "truncdfsf2"
4435 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4436 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4437 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4440 (define_insn "*truncdfsf2_fpr"
4441 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4442 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4443 "TARGET_HARD_FLOAT && TARGET_FPRS"
4445 [(set_attr "type" "fp")])
4447 (define_insn "aux_truncdfsf2"
4448 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4449 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4450 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4452 [(set_attr "type" "fp")])
4454 (define_expand "negsf2"
4455 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4456 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4460 (define_insn "*negsf2"
4461 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4462 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4463 "TARGET_HARD_FLOAT && TARGET_FPRS"
4465 [(set_attr "type" "fp")])
4467 (define_expand "abssf2"
4468 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4469 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4473 (define_insn "*abssf2"
4474 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4475 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4476 "TARGET_HARD_FLOAT && TARGET_FPRS"
4478 [(set_attr "type" "fp")])
4481 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4482 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4483 "TARGET_HARD_FLOAT && TARGET_FPRS"
4485 [(set_attr "type" "fp")])
4487 (define_expand "addsf3"
4488 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4489 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4490 (match_operand:SF 2 "gpc_reg_operand" "")))]
4495 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4496 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4497 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4498 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4500 [(set_attr "type" "fp")])
4503 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4504 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4505 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4506 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4507 "{fa|fadd} %0,%1,%2"
4508 [(set_attr "type" "fp")])
4510 (define_expand "subsf3"
4511 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4512 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4513 (match_operand:SF 2 "gpc_reg_operand" "")))]
4518 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4519 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4520 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4521 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4523 [(set_attr "type" "fp")])
4526 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4527 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4528 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4529 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4530 "{fs|fsub} %0,%1,%2"
4531 [(set_attr "type" "fp")])
4533 (define_expand "mulsf3"
4534 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4535 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4536 (match_operand:SF 2 "gpc_reg_operand" "")))]
4541 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4542 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4543 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4544 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4546 [(set_attr "type" "fp")])
4549 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4550 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4551 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4552 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4553 "{fm|fmul} %0,%1,%2"
4554 [(set_attr "type" "dmul")])
4556 (define_expand "divsf3"
4557 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4558 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4559 (match_operand:SF 2 "gpc_reg_operand" "")))]
4564 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4565 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4566 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4567 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4569 [(set_attr "type" "sdiv")])
4572 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4573 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4574 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4575 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4576 "{fd|fdiv} %0,%1,%2"
4577 [(set_attr "type" "ddiv")])
4580 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4581 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4582 (match_operand:SF 2 "gpc_reg_operand" "f"))
4583 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4584 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4585 "fmadds %0,%1,%2,%3"
4586 [(set_attr "type" "fp")])
4589 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4590 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4591 (match_operand:SF 2 "gpc_reg_operand" "f"))
4592 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4593 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4594 "{fma|fmadd} %0,%1,%2,%3"
4595 [(set_attr "type" "dmul")])
4598 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4599 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4600 (match_operand:SF 2 "gpc_reg_operand" "f"))
4601 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4602 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4603 "fmsubs %0,%1,%2,%3"
4604 [(set_attr "type" "fp")])
4607 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4608 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4609 (match_operand:SF 2 "gpc_reg_operand" "f"))
4610 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4611 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4612 "{fms|fmsub} %0,%1,%2,%3"
4613 [(set_attr "type" "dmul")])
4616 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4617 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4618 (match_operand:SF 2 "gpc_reg_operand" "f"))
4619 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4620 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4621 && HONOR_SIGNED_ZEROS (SFmode)"
4622 "fnmadds %0,%1,%2,%3"
4623 [(set_attr "type" "fp")])
4626 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4627 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4628 (match_operand:SF 2 "gpc_reg_operand" "f"))
4629 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4630 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4631 && ! HONOR_SIGNED_ZEROS (SFmode)"
4632 "fnmadds %0,%1,%2,%3"
4633 [(set_attr "type" "fp")])
4636 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4637 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4638 (match_operand:SF 2 "gpc_reg_operand" "f"))
4639 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4640 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4641 "{fnma|fnmadd} %0,%1,%2,%3"
4642 [(set_attr "type" "dmul")])
4645 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4646 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4647 (match_operand:SF 2 "gpc_reg_operand" "f"))
4648 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4649 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4650 && ! HONOR_SIGNED_ZEROS (SFmode)"
4651 "{fnma|fnmadd} %0,%1,%2,%3"
4652 [(set_attr "type" "dmul")])
4655 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4656 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4657 (match_operand:SF 2 "gpc_reg_operand" "f"))
4658 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4659 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4660 && HONOR_SIGNED_ZEROS (SFmode)"
4661 "fnmsubs %0,%1,%2,%3"
4662 [(set_attr "type" "fp")])
4665 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4666 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4667 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4668 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4669 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4670 && ! HONOR_SIGNED_ZEROS (SFmode)"
4671 "fnmsubs %0,%1,%2,%3"
4672 [(set_attr "type" "fp")])
4675 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4676 (neg:SF (minus:SF (mult: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 "{fnms|fnmsub} %0,%1,%2,%3"
4681 [(set_attr "type" "dmul")])
4684 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4685 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4686 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4687 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4688 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4689 && ! HONOR_SIGNED_ZEROS (SFmode)"
4690 "{fnms|fnmsub} %0,%1,%2,%3"
4691 [(set_attr "type" "fp")])
4693 (define_expand "sqrtsf2"
4694 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4695 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4696 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4700 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4701 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4702 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4704 [(set_attr "type" "ssqrt")])
4707 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4708 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4709 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4711 [(set_attr "type" "dsqrt")])
4713 (define_expand "copysignsf3"
4715 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
4717 (neg:SF (abs:SF (match_dup 1))))
4718 (set (match_operand:SF 0 "gpc_reg_operand" "")
4719 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
4723 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4724 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
4726 operands[3] = gen_reg_rtx (SFmode);
4727 operands[4] = gen_reg_rtx (SFmode);
4728 operands[5] = CONST0_RTX (SFmode);
4731 (define_expand "copysigndf3"
4733 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
4735 (neg:DF (abs:DF (match_dup 1))))
4736 (set (match_operand:DF 0 "gpc_reg_operand" "")
4737 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
4741 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4742 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
4744 operands[3] = gen_reg_rtx (DFmode);
4745 operands[4] = gen_reg_rtx (DFmode);
4746 operands[5] = CONST0_RTX (DFmode);
4749 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4750 ;; fsel instruction and some auxiliary computations. Then we just have a
4751 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4753 (define_expand "smaxsf3"
4754 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4755 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4756 (match_operand:SF 2 "gpc_reg_operand" ""))
4759 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4760 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4762 (define_expand "sminsf3"
4763 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4764 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4765 (match_operand:SF 2 "gpc_reg_operand" ""))
4768 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4769 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4772 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4773 (match_operator:SF 3 "min_max_operator"
4774 [(match_operand:SF 1 "gpc_reg_operand" "")
4775 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4776 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4779 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4780 operands[1], operands[2]);
4784 (define_expand "movsicc"
4785 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4786 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4787 (match_operand:SI 2 "gpc_reg_operand" "")
4788 (match_operand:SI 3 "gpc_reg_operand" "")))]
4792 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4798 ;; We use the BASE_REGS for the isel input operands because, if rA is
4799 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4800 ;; because we may switch the operands and rB may end up being rA.
4802 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4803 ;; leave out the mode in operand 4 and use one pattern, but reload can
4804 ;; change the mode underneath our feet and then gets confused trying
4805 ;; to reload the value.
4806 (define_insn "isel_signed"
4807 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4809 (match_operator 1 "comparison_operator"
4810 [(match_operand:CC 4 "cc_reg_operand" "y")
4812 (match_operand:SI 2 "gpc_reg_operand" "b")
4813 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4816 { return output_isel (operands); }"
4817 [(set_attr "length" "4")])
4819 (define_insn "isel_unsigned"
4820 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4822 (match_operator 1 "comparison_operator"
4823 [(match_operand:CCUNS 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_expand "movsfcc"
4833 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4834 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4835 (match_operand:SF 2 "gpc_reg_operand" "")
4836 (match_operand:SF 3 "gpc_reg_operand" "")))]
4837 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4840 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4846 (define_insn "*fselsfsf4"
4847 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4848 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4849 (match_operand:SF 4 "zero_fp_constant" "F"))
4850 (match_operand:SF 2 "gpc_reg_operand" "f")
4851 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4852 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4854 [(set_attr "type" "fp")])
4856 (define_insn "*fseldfsf4"
4857 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4858 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4859 (match_operand:DF 4 "zero_fp_constant" "F"))
4860 (match_operand:SF 2 "gpc_reg_operand" "f")
4861 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4862 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4864 [(set_attr "type" "fp")])
4866 (define_expand "negdf2"
4867 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4868 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4869 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4872 (define_insn "*negdf2_fpr"
4873 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4874 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4875 "TARGET_HARD_FLOAT && TARGET_FPRS"
4877 [(set_attr "type" "fp")])
4879 (define_expand "absdf2"
4880 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4881 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4882 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4885 (define_insn "*absdf2_fpr"
4886 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4887 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4888 "TARGET_HARD_FLOAT && TARGET_FPRS"
4890 [(set_attr "type" "fp")])
4892 (define_insn "*nabsdf2_fpr"
4893 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4894 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4895 "TARGET_HARD_FLOAT && TARGET_FPRS"
4897 [(set_attr "type" "fp")])
4899 (define_expand "adddf3"
4900 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4901 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4902 (match_operand:DF 2 "gpc_reg_operand" "")))]
4903 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4906 (define_insn "*adddf3_fpr"
4907 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4908 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4909 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4910 "TARGET_HARD_FLOAT && TARGET_FPRS"
4911 "{fa|fadd} %0,%1,%2"
4912 [(set_attr "type" "fp")])
4914 (define_expand "subdf3"
4915 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4916 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4917 (match_operand:DF 2 "gpc_reg_operand" "")))]
4918 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4921 (define_insn "*subdf3_fpr"
4922 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4923 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4924 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4925 "TARGET_HARD_FLOAT && TARGET_FPRS"
4926 "{fs|fsub} %0,%1,%2"
4927 [(set_attr "type" "fp")])
4929 (define_expand "muldf3"
4930 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4931 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
4932 (match_operand:DF 2 "gpc_reg_operand" "")))]
4933 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4936 (define_insn "*muldf3_fpr"
4937 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4938 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4939 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4940 "TARGET_HARD_FLOAT && TARGET_FPRS"
4941 "{fm|fmul} %0,%1,%2"
4942 [(set_attr "type" "dmul")])
4944 (define_expand "divdf3"
4945 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4946 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
4947 (match_operand:DF 2 "gpc_reg_operand" "")))]
4948 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4951 (define_insn "*divdf3_fpr"
4952 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4953 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4954 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4955 "TARGET_HARD_FLOAT && TARGET_FPRS"
4956 "{fd|fdiv} %0,%1,%2"
4957 [(set_attr "type" "ddiv")])
4960 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4961 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4962 (match_operand:DF 2 "gpc_reg_operand" "f"))
4963 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4964 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4965 "{fma|fmadd} %0,%1,%2,%3"
4966 [(set_attr "type" "dmul")])
4969 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4970 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4971 (match_operand:DF 2 "gpc_reg_operand" "f"))
4972 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4973 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4974 "{fms|fmsub} %0,%1,%2,%3"
4975 [(set_attr "type" "dmul")])
4978 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4979 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4980 (match_operand:DF 2 "gpc_reg_operand" "f"))
4981 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4982 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4983 && HONOR_SIGNED_ZEROS (DFmode)"
4984 "{fnma|fnmadd} %0,%1,%2,%3"
4985 [(set_attr "type" "dmul")])
4988 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4989 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
4990 (match_operand:DF 2 "gpc_reg_operand" "f"))
4991 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4992 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4993 && ! HONOR_SIGNED_ZEROS (DFmode)"
4994 "{fnma|fnmadd} %0,%1,%2,%3"
4995 [(set_attr "type" "dmul")])
4998 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4999 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5000 (match_operand:DF 2 "gpc_reg_operand" "f"))
5001 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5002 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5003 && HONOR_SIGNED_ZEROS (DFmode)"
5004 "{fnms|fnmsub} %0,%1,%2,%3"
5005 [(set_attr "type" "dmul")])
5008 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5009 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5010 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5011 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5012 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5013 && ! HONOR_SIGNED_ZEROS (DFmode)"
5014 "{fnms|fnmsub} %0,%1,%2,%3"
5015 [(set_attr "type" "dmul")])
5017 (define_insn "sqrtdf2"
5018 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5019 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5020 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5022 [(set_attr "type" "dsqrt")])
5024 ;; The conditional move instructions allow us to perform max and min
5025 ;; operations even when
5027 (define_expand "smaxdf3"
5028 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5029 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5030 (match_operand:DF 2 "gpc_reg_operand" ""))
5033 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5034 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5036 (define_expand "smindf3"
5037 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5038 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5039 (match_operand:DF 2 "gpc_reg_operand" ""))
5042 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5043 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5046 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5047 (match_operator:DF 3 "min_max_operator"
5048 [(match_operand:DF 1 "gpc_reg_operand" "")
5049 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5050 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5053 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5054 operands[1], operands[2]);
5058 (define_expand "movdfcc"
5059 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5060 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5061 (match_operand:DF 2 "gpc_reg_operand" "")
5062 (match_operand:DF 3 "gpc_reg_operand" "")))]
5063 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5066 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5072 (define_insn "*fseldfdf4"
5073 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5074 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5075 (match_operand:DF 4 "zero_fp_constant" "F"))
5076 (match_operand:DF 2 "gpc_reg_operand" "f")
5077 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5078 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5080 [(set_attr "type" "fp")])
5082 (define_insn "*fselsfdf4"
5083 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5084 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5085 (match_operand:SF 4 "zero_fp_constant" "F"))
5086 (match_operand:DF 2 "gpc_reg_operand" "f")
5087 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5090 [(set_attr "type" "fp")])
5092 ;; Conversions to and from floating-point.
5094 (define_expand "fixuns_truncsfsi2"
5095 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5096 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5097 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5100 (define_expand "fix_truncsfsi2"
5101 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5102 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5103 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5106 ; For each of these conversions, there is a define_expand, a define_insn
5107 ; with a '#' template, and a define_split (with C code). The idea is
5108 ; to allow constant folding with the template of the define_insn,
5109 ; then to have the insns split later (between sched1 and final).
5111 (define_expand "floatsidf2"
5112 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5113 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5116 (clobber (match_dup 4))
5117 (clobber (match_dup 5))
5118 (clobber (match_dup 6))])]
5119 "TARGET_HARD_FLOAT && TARGET_FPRS"
5122 if (TARGET_E500_DOUBLE)
5124 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5127 if (TARGET_POWERPC64)
5129 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5130 rtx t1 = gen_reg_rtx (DImode);
5131 rtx t2 = gen_reg_rtx (DImode);
5132 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5136 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5137 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5138 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5139 operands[5] = gen_reg_rtx (DFmode);
5140 operands[6] = gen_reg_rtx (SImode);
5143 (define_insn "*floatsidf2_internal"
5144 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5145 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5146 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5147 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5148 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5149 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5150 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5151 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5153 [(set_attr "length" "24")])
5156 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5157 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5158 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5159 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5160 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5161 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5162 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5163 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5164 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5165 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5166 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5167 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5168 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5169 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5170 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5173 rtx lowword, highword;
5174 if (GET_CODE (operands[4]) != MEM)
5176 highword = XEXP (operands[4], 0);
5177 lowword = plus_constant (highword, 4);
5178 if (! WORDS_BIG_ENDIAN)
5181 tmp = highword; highword = lowword; lowword = tmp;
5184 emit_insn (gen_xorsi3 (operands[6], operands[1],
5185 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5186 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5187 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5188 emit_move_insn (operands[5], operands[4]);
5189 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5193 (define_expand "floatunssisf2"
5194 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5195 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5196 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5199 (define_expand "floatunssidf2"
5200 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5201 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5204 (clobber (match_dup 4))
5205 (clobber (match_dup 5))])]
5206 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5209 if (TARGET_E500_DOUBLE)
5211 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5214 if (TARGET_POWERPC64)
5216 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5217 rtx t1 = gen_reg_rtx (DImode);
5218 rtx t2 = gen_reg_rtx (DImode);
5219 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5224 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5225 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5226 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5227 operands[5] = gen_reg_rtx (DFmode);
5230 (define_insn "*floatunssidf2_internal"
5231 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5232 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5233 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5234 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5235 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5236 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5237 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5239 [(set_attr "length" "20")])
5242 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5243 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5244 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5245 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5246 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5247 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5248 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5249 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5250 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5251 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5252 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5253 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5254 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5257 rtx lowword, highword;
5258 if (GET_CODE (operands[4]) != MEM)
5260 highword = XEXP (operands[4], 0);
5261 lowword = plus_constant (highword, 4);
5262 if (! WORDS_BIG_ENDIAN)
5265 tmp = highword; highword = lowword; lowword = tmp;
5268 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5269 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5270 emit_move_insn (operands[5], operands[4]);
5271 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5275 (define_expand "fix_truncdfsi2"
5276 [(parallel [(set (match_operand:SI 0 "reg_or_mem_operand" "")
5277 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5278 (clobber (match_dup 2))
5279 (clobber (match_dup 3))])]
5280 "(TARGET_POWER2 || TARGET_POWERPC)
5281 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5284 if (TARGET_E500_DOUBLE)
5286 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5289 operands[2] = gen_reg_rtx (DImode);
5290 if (TARGET_PPC_GFXOPT)
5292 rtx orig_dest = operands[0];
5293 if (GET_CODE (orig_dest) != MEM)
5294 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5295 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5297 if (operands[0] != orig_dest)
5298 emit_move_insn (orig_dest, operands[0]);
5301 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5304 (define_insn_and_split "*fix_truncdfsi2_internal"
5305 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5306 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5307 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5308 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5309 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5316 if (GET_CODE (operands[3]) != MEM)
5318 lowword = XEXP (operands[3], 0);
5319 if (WORDS_BIG_ENDIAN)
5320 lowword = plus_constant (lowword, 4);
5322 emit_insn (gen_fctiwz (operands[2], operands[1]));
5323 emit_move_insn (operands[3], operands[2]);
5324 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5327 [(set_attr "length" "16")])
5329 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5330 [(set (match_operand:SI 0 "memory_operand" "=Z")
5331 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5332 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5333 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5334 && TARGET_PPC_GFXOPT"
5340 emit_insn (gen_fctiwz (operands[2], operands[1]));
5341 emit_insn (gen_stfiwx (operands[0], operands[2]));
5344 [(set_attr "length" "16")])
5346 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5347 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5348 ; because the first makes it clear that operand 0 is not live
5349 ; before the instruction.
5350 (define_insn "fctiwz"
5351 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5352 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5354 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5355 "{fcirz|fctiwz} %0,%1"
5356 [(set_attr "type" "fp")])
5358 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5359 (define_insn "stfiwx"
5360 [(set (match_operand:SI 0 "memory_operand" "=Z")
5361 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
5365 [(set_attr "type" "fpstore")])
5367 (define_expand "floatsisf2"
5368 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5369 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5370 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5373 (define_insn "floatdidf2"
5374 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5375 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5376 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5378 [(set_attr "type" "fp")])
5380 (define_insn_and_split "floatsidf_ppc64"
5381 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5382 (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) (sign_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_and_split "floatunssidf_ppc64"
5396 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5397 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5398 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5399 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5400 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5401 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5404 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5405 (set (match_dup 2) (match_dup 3))
5406 (set (match_dup 4) (match_dup 2))
5407 (set (match_dup 0) (float:DF (match_dup 4)))]
5410 (define_insn "fix_truncdfdi2"
5411 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5412 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5413 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5415 [(set_attr "type" "fp")])
5417 (define_expand "floatdisf2"
5418 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5419 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5420 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5423 rtx val = operands[1];
5424 if (!flag_unsafe_math_optimizations)
5426 rtx label = gen_label_rtx ();
5427 val = gen_reg_rtx (DImode);
5428 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5431 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5435 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5436 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5437 ;; from double rounding.
5438 (define_insn_and_split "floatdisf2_internal1"
5439 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5440 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5441 (clobber (match_scratch:DF 2 "=f"))]
5442 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5444 "&& reload_completed"
5446 (float:DF (match_dup 1)))
5448 (float_truncate:SF (match_dup 2)))]
5451 ;; Twiddles bits to avoid double rounding.
5452 ;; Bits that might be truncated when converting to DFmode are replaced
5453 ;; by a bit that won't be lost at that stage, but is below the SFmode
5454 ;; rounding position.
5455 (define_expand "floatdisf2_internal2"
5456 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
5458 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
5460 (clobber (scratch:CC))])
5461 (set (match_dup 3) (plus:DI (match_dup 3)
5463 (set (match_dup 0) (plus:DI (match_dup 0)
5465 (set (match_dup 4) (compare:CCUNS (match_dup 3)
5467 (set (match_dup 0) (ior:DI (match_dup 0)
5469 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
5471 (clobber (scratch:CC))])
5472 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
5473 (label_ref (match_operand:DI 2 "" ""))
5475 (set (match_dup 0) (match_dup 1))]
5476 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5479 operands[3] = gen_reg_rtx (DImode);
5480 operands[4] = gen_reg_rtx (CCUNSmode);
5483 ;; Define the DImode operations that can be done in a small number
5484 ;; of instructions. The & constraints are to prevent the register
5485 ;; allocator from allocating registers that overlap with the inputs
5486 ;; (for example, having an input in 7,8 and an output in 6,7). We
5487 ;; also allow for the output being the same as one of the inputs.
5489 (define_insn "*adddi3_noppc64"
5490 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5491 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5492 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5493 "! TARGET_POWERPC64"
5496 if (WORDS_BIG_ENDIAN)
5497 return (GET_CODE (operands[2])) != CONST_INT
5498 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5499 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5501 return (GET_CODE (operands[2])) != CONST_INT
5502 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5503 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5505 [(set_attr "type" "two")
5506 (set_attr "length" "8")])
5508 (define_insn "*subdi3_noppc64"
5509 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5510 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5511 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5512 "! TARGET_POWERPC64"
5515 if (WORDS_BIG_ENDIAN)
5516 return (GET_CODE (operands[1]) != CONST_INT)
5517 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5518 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5520 return (GET_CODE (operands[1]) != CONST_INT)
5521 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5522 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5524 [(set_attr "type" "two")
5525 (set_attr "length" "8")])
5527 (define_insn "*negdi2_noppc64"
5528 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5529 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5530 "! TARGET_POWERPC64"
5533 return (WORDS_BIG_ENDIAN)
5534 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5535 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5537 [(set_attr "type" "two")
5538 (set_attr "length" "8")])
5540 (define_expand "mulsidi3"
5541 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5542 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5543 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5544 "! TARGET_POWERPC64"
5547 if (! TARGET_POWER && ! TARGET_POWERPC)
5549 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5550 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5551 emit_insn (gen_mull_call ());
5552 if (WORDS_BIG_ENDIAN)
5553 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5556 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5557 gen_rtx_REG (SImode, 3));
5558 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5559 gen_rtx_REG (SImode, 4));
5563 else if (TARGET_POWER)
5565 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5570 (define_insn "mulsidi3_mq"
5571 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5572 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5573 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5574 (clobber (match_scratch:SI 3 "=q"))]
5576 "mul %0,%1,%2\;mfmq %L0"
5577 [(set_attr "type" "imul")
5578 (set_attr "length" "8")])
5580 (define_insn "*mulsidi3_no_mq"
5581 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5582 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5583 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5584 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5587 return (WORDS_BIG_ENDIAN)
5588 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5589 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5591 [(set_attr "type" "imul")
5592 (set_attr "length" "8")])
5595 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5596 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5597 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5598 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5601 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5602 (sign_extend:DI (match_dup 2)))
5605 (mult:SI (match_dup 1)
5609 int endian = (WORDS_BIG_ENDIAN == 0);
5610 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5611 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5614 (define_expand "umulsidi3"
5615 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5616 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5617 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5618 "TARGET_POWERPC && ! TARGET_POWERPC64"
5623 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5628 (define_insn "umulsidi3_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 (clobber (match_scratch:SI 3 "=q"))]
5633 "TARGET_POWERPC && TARGET_POWER"
5636 return (WORDS_BIG_ENDIAN)
5637 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5638 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5640 [(set_attr "type" "imul")
5641 (set_attr "length" "8")])
5643 (define_insn "*umulsidi3_no_mq"
5644 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5645 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5646 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5647 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5650 return (WORDS_BIG_ENDIAN)
5651 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5652 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5654 [(set_attr "type" "imul")
5655 (set_attr "length" "8")])
5658 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5659 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5660 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5661 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5664 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5665 (zero_extend:DI (match_dup 2)))
5668 (mult:SI (match_dup 1)
5672 int endian = (WORDS_BIG_ENDIAN == 0);
5673 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5674 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5677 (define_expand "smulsi3_highpart"
5678 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5680 (lshiftrt:DI (mult:DI (sign_extend:DI
5681 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5683 (match_operand:SI 2 "gpc_reg_operand" "r")))
5688 if (! TARGET_POWER && ! TARGET_POWERPC)
5690 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5691 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5692 emit_insn (gen_mulh_call ());
5693 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5696 else if (TARGET_POWER)
5698 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5703 (define_insn "smulsi3_highpart_mq"
5704 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5706 (lshiftrt:DI (mult:DI (sign_extend:DI
5707 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5709 (match_operand:SI 2 "gpc_reg_operand" "r")))
5711 (clobber (match_scratch:SI 3 "=q"))]
5714 [(set_attr "type" "imul")])
5716 (define_insn "*smulsi3_highpart_no_mq"
5717 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5719 (lshiftrt:DI (mult:DI (sign_extend:DI
5720 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5722 (match_operand:SI 2 "gpc_reg_operand" "r")))
5724 "TARGET_POWERPC && ! TARGET_POWER"
5726 [(set_attr "type" "imul")])
5728 (define_expand "umulsi3_highpart"
5729 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5731 (lshiftrt:DI (mult:DI (zero_extend:DI
5732 (match_operand:SI 1 "gpc_reg_operand" ""))
5734 (match_operand:SI 2 "gpc_reg_operand" "")))
5741 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5746 (define_insn "umulsi3_highpart_mq"
5747 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5749 (lshiftrt:DI (mult:DI (zero_extend:DI
5750 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5752 (match_operand:SI 2 "gpc_reg_operand" "r")))
5754 (clobber (match_scratch:SI 3 "=q"))]
5755 "TARGET_POWERPC && TARGET_POWER"
5757 [(set_attr "type" "imul")])
5759 (define_insn "*umulsi3_highpart_no_mq"
5760 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5762 (lshiftrt:DI (mult:DI (zero_extend:DI
5763 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5765 (match_operand:SI 2 "gpc_reg_operand" "r")))
5767 "TARGET_POWERPC && ! TARGET_POWER"
5769 [(set_attr "type" "imul")])
5771 ;; If operands 0 and 2 are in the same register, we have a problem. But
5772 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5773 ;; why we have the strange constraints below.
5774 (define_insn "ashldi3_power"
5775 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5776 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5777 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5778 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5781 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5782 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5783 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5784 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5785 [(set_attr "length" "8")])
5787 (define_insn "lshrdi3_power"
5788 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5789 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5790 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5791 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5794 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5795 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5796 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5797 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5798 [(set_attr "length" "8")])
5800 ;; Shift by a variable amount is too complex to be worth open-coding. We
5801 ;; just handle shifts by constants.
5802 (define_insn "ashrdi3_power"
5803 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5804 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5805 (match_operand:SI 2 "const_int_operand" "M,i")))
5806 (clobber (match_scratch:SI 3 "=X,q"))]
5809 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5810 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5811 [(set_attr "length" "8")])
5813 (define_insn "ashrdi3_no_power"
5814 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5815 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5816 (match_operand:SI 2 "const_int_operand" "M,i")))]
5817 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5819 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5820 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5821 [(set_attr "type" "two,three")
5822 (set_attr "length" "8,12")])
5824 (define_insn "*ashrdisi3_noppc64"
5825 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5826 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5827 (const_int 32)) 4))]
5828 "TARGET_32BIT && !TARGET_POWERPC64"
5831 if (REGNO (operands[0]) == REGNO (operands[1]))
5834 return \"mr %0,%1\";
5836 [(set_attr "length" "4")])
5839 ;; PowerPC64 DImode operations.
5841 (define_expand "adddi3"
5842 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5843 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5844 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5848 if (! TARGET_POWERPC64)
5850 if (non_short_cint_operand (operands[2], DImode))
5854 if (GET_CODE (operands[2]) == CONST_INT
5855 && ! add_operand (operands[2], DImode))
5857 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5858 ? operands[0] : gen_reg_rtx (DImode));
5860 HOST_WIDE_INT val = INTVAL (operands[2]);
5861 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5862 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5864 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5867 /* The ordering here is important for the prolog expander.
5868 When space is allocated from the stack, adding 'low' first may
5869 produce a temporary deallocation (which would be bad). */
5870 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5871 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5876 ;; Discourage ai/addic because of carry but provide it in an alternative
5877 ;; allowing register zero as source.
5879 (define_insn "*adddi3_internal1"
5880 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5881 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5882 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5890 (define_insn "*adddi3_internal2"
5891 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5892 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5893 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5895 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5902 [(set_attr "type" "fast_compare,compare,compare,compare")
5903 (set_attr "length" "4,4,8,8")])
5906 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5907 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5908 (match_operand:DI 2 "reg_or_short_operand" ""))
5910 (clobber (match_scratch:DI 3 ""))]
5911 "TARGET_POWERPC64 && reload_completed"
5913 (plus:DI (match_dup 1) (match_dup 2)))
5915 (compare:CC (match_dup 3)
5919 (define_insn "*adddi3_internal3"
5920 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5921 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5922 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5924 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5925 (plus:DI (match_dup 1) (match_dup 2)))]
5932 [(set_attr "type" "fast_compare,compare,compare,compare")
5933 (set_attr "length" "4,4,8,8")])
5936 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5937 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5938 (match_operand:DI 2 "reg_or_short_operand" ""))
5940 (set (match_operand:DI 0 "gpc_reg_operand" "")
5941 (plus:DI (match_dup 1) (match_dup 2)))]
5942 "TARGET_POWERPC64 && reload_completed"
5944 (plus:DI (match_dup 1) (match_dup 2)))
5946 (compare:CC (match_dup 0)
5950 ;; Split an add that we can't do in one insn into two insns, each of which
5951 ;; does one 16-bit part. This is used by combine. Note that the low-order
5952 ;; add should be last in case the result gets used in an address.
5955 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5956 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5957 (match_operand:DI 2 "non_add_cint_operand" "")))]
5959 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5960 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5963 HOST_WIDE_INT val = INTVAL (operands[2]);
5964 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5965 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5967 operands[4] = GEN_INT (low);
5968 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5969 operands[3] = GEN_INT (rest);
5970 else if (! no_new_pseudos)
5972 operands[3] = gen_reg_rtx (DImode);
5973 emit_move_insn (operands[3], operands[2]);
5974 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5981 (define_insn "one_cmpldi2"
5982 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5983 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5988 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5989 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5991 (clobber (match_scratch:DI 2 "=r,r"))]
5996 [(set_attr "type" "compare")
5997 (set_attr "length" "4,8")])
6000 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6001 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6003 (clobber (match_scratch:DI 2 ""))]
6004 "TARGET_POWERPC64 && reload_completed"
6006 (not:DI (match_dup 1)))
6008 (compare:CC (match_dup 2)
6013 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6014 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6016 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6017 (not:DI (match_dup 1)))]
6022 [(set_attr "type" "compare")
6023 (set_attr "length" "4,8")])
6026 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6027 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6029 (set (match_operand:DI 0 "gpc_reg_operand" "")
6030 (not:DI (match_dup 1)))]
6031 "TARGET_POWERPC64 && reload_completed"
6033 (not:DI (match_dup 1)))
6035 (compare:CC (match_dup 0)
6040 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6041 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
6042 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
6049 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6050 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6051 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6053 (clobber (match_scratch:DI 3 "=r,r"))]
6058 [(set_attr "type" "fast_compare")
6059 (set_attr "length" "4,8")])
6062 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6063 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6064 (match_operand:DI 2 "gpc_reg_operand" ""))
6066 (clobber (match_scratch:DI 3 ""))]
6067 "TARGET_POWERPC64 && reload_completed"
6069 (minus:DI (match_dup 1) (match_dup 2)))
6071 (compare:CC (match_dup 3)
6076 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6077 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6078 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6080 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6081 (minus:DI (match_dup 1) (match_dup 2)))]
6086 [(set_attr "type" "fast_compare")
6087 (set_attr "length" "4,8")])
6090 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6091 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6092 (match_operand:DI 2 "gpc_reg_operand" ""))
6094 (set (match_operand:DI 0 "gpc_reg_operand" "")
6095 (minus:DI (match_dup 1) (match_dup 2)))]
6096 "TARGET_POWERPC64 && reload_completed"
6098 (minus:DI (match_dup 1) (match_dup 2)))
6100 (compare:CC (match_dup 0)
6104 (define_expand "subdi3"
6105 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6106 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
6107 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
6111 if (GET_CODE (operands[2]) == CONST_INT)
6113 emit_insn (gen_adddi3 (operands[0], operands[1],
6114 negate_rtx (DImode, operands[2])));
6119 (define_insn_and_split "absdi2"
6120 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6121 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6122 (clobber (match_scratch:DI 2 "=&r,&r"))]
6125 "&& reload_completed"
6126 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6127 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6128 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6131 (define_insn_and_split "*nabsdi2"
6132 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6133 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6134 (clobber (match_scratch:DI 2 "=&r,&r"))]
6137 "&& reload_completed"
6138 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6139 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6140 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6143 (define_expand "negdi2"
6144 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6145 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
6150 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6151 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6156 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6157 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6159 (clobber (match_scratch:DI 2 "=r,r"))]
6164 [(set_attr "type" "fast_compare")
6165 (set_attr "length" "4,8")])
6168 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6169 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6171 (clobber (match_scratch:DI 2 ""))]
6172 "TARGET_POWERPC64 && reload_completed"
6174 (neg:DI (match_dup 1)))
6176 (compare:CC (match_dup 2)
6181 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6182 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6184 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6185 (neg:DI (match_dup 1)))]
6190 [(set_attr "type" "fast_compare")
6191 (set_attr "length" "4,8")])
6194 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6195 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6197 (set (match_operand:DI 0 "gpc_reg_operand" "")
6198 (neg:DI (match_dup 1)))]
6199 "TARGET_POWERPC64 && reload_completed"
6201 (neg:DI (match_dup 1)))
6203 (compare:CC (match_dup 0)
6207 (define_insn "clzdi2"
6208 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6209 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6213 (define_expand "ctzdi2"
6215 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6216 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6218 (clobber (scratch:CC))])
6219 (set (match_dup 4) (clz:DI (match_dup 3)))
6220 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6221 (minus:DI (const_int 63) (match_dup 4)))]
6224 operands[2] = gen_reg_rtx (DImode);
6225 operands[3] = gen_reg_rtx (DImode);
6226 operands[4] = gen_reg_rtx (DImode);
6229 (define_expand "ffsdi2"
6231 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6232 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6234 (clobber (scratch:CC))])
6235 (set (match_dup 4) (clz:DI (match_dup 3)))
6236 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6237 (minus:DI (const_int 64) (match_dup 4)))]
6240 operands[2] = gen_reg_rtx (DImode);
6241 operands[3] = gen_reg_rtx (DImode);
6242 operands[4] = gen_reg_rtx (DImode);
6245 (define_insn "muldi3"
6246 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6247 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6248 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6251 [(set_attr "type" "lmul")])
6253 (define_insn "*muldi3_internal1"
6254 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6255 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6256 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6258 (clobber (match_scratch:DI 3 "=r,r"))]
6263 [(set_attr "type" "lmul_compare")
6264 (set_attr "length" "4,8")])
6267 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6268 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6269 (match_operand:DI 2 "gpc_reg_operand" ""))
6271 (clobber (match_scratch:DI 3 ""))]
6272 "TARGET_POWERPC64 && reload_completed"
6274 (mult:DI (match_dup 1) (match_dup 2)))
6276 (compare:CC (match_dup 3)
6280 (define_insn "*muldi3_internal2"
6281 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6282 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6283 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6285 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6286 (mult:DI (match_dup 1) (match_dup 2)))]
6291 [(set_attr "type" "lmul_compare")
6292 (set_attr "length" "4,8")])
6295 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6296 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6297 (match_operand:DI 2 "gpc_reg_operand" ""))
6299 (set (match_operand:DI 0 "gpc_reg_operand" "")
6300 (mult:DI (match_dup 1) (match_dup 2)))]
6301 "TARGET_POWERPC64 && reload_completed"
6303 (mult:DI (match_dup 1) (match_dup 2)))
6305 (compare:CC (match_dup 0)
6309 (define_insn "smuldi3_highpart"
6310 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6312 (lshiftrt:TI (mult:TI (sign_extend:TI
6313 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6315 (match_operand:DI 2 "gpc_reg_operand" "r")))
6319 [(set_attr "type" "lmul")])
6321 (define_insn "umuldi3_highpart"
6322 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6324 (lshiftrt:TI (mult:TI (zero_extend:TI
6325 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6327 (match_operand:DI 2 "gpc_reg_operand" "r")))
6331 [(set_attr "type" "lmul")])
6333 (define_expand "divdi3"
6334 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6335 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6336 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6340 if (GET_CODE (operands[2]) == CONST_INT
6341 && INTVAL (operands[2]) > 0
6342 && exact_log2 (INTVAL (operands[2])) >= 0)
6345 operands[2] = force_reg (DImode, operands[2]);
6348 (define_expand "moddi3"
6349 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6350 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6351 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6359 if (GET_CODE (operands[2]) != CONST_INT
6360 || INTVAL (operands[2]) <= 0
6361 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6364 temp1 = gen_reg_rtx (DImode);
6365 temp2 = gen_reg_rtx (DImode);
6367 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6368 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6369 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6374 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6375 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6376 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6378 "sradi %0,%1,%p2\;addze %0,%0"
6379 [(set_attr "type" "two")
6380 (set_attr "length" "8")])
6383 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6384 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6385 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6387 (clobber (match_scratch:DI 3 "=r,r"))]
6390 sradi %3,%1,%p2\;addze. %3,%3
6392 [(set_attr "type" "compare")
6393 (set_attr "length" "8,12")])
6396 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6397 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6398 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6400 (clobber (match_scratch:DI 3 ""))]
6401 "TARGET_POWERPC64 && reload_completed"
6403 (div:DI (match_dup 1) (match_dup 2)))
6405 (compare:CC (match_dup 3)
6410 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6411 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6412 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6414 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6415 (div:DI (match_dup 1) (match_dup 2)))]
6418 sradi %0,%1,%p2\;addze. %0,%0
6420 [(set_attr "type" "compare")
6421 (set_attr "length" "8,12")])
6424 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6425 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6426 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6428 (set (match_operand:DI 0 "gpc_reg_operand" "")
6429 (div:DI (match_dup 1) (match_dup 2)))]
6430 "TARGET_POWERPC64 && reload_completed"
6432 (div:DI (match_dup 1) (match_dup 2)))
6434 (compare:CC (match_dup 0)
6439 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6440 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6441 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6444 [(set_attr "type" "ldiv")])
6446 (define_insn "udivdi3"
6447 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6448 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6449 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6452 [(set_attr "type" "ldiv")])
6454 (define_insn "rotldi3"
6455 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6456 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6457 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6459 "rld%I2cl %0,%1,%H2,0")
6461 (define_insn "*rotldi3_internal2"
6462 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6463 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6464 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6466 (clobber (match_scratch:DI 3 "=r,r"))]
6469 rld%I2cl. %3,%1,%H2,0
6471 [(set_attr "type" "delayed_compare")
6472 (set_attr "length" "4,8")])
6475 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6476 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6477 (match_operand:DI 2 "reg_or_cint_operand" ""))
6479 (clobber (match_scratch:DI 3 ""))]
6480 "TARGET_POWERPC64 && reload_completed"
6482 (rotate:DI (match_dup 1) (match_dup 2)))
6484 (compare:CC (match_dup 3)
6488 (define_insn "*rotldi3_internal3"
6489 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6490 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6491 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6493 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6494 (rotate:DI (match_dup 1) (match_dup 2)))]
6497 rld%I2cl. %0,%1,%H2,0
6499 [(set_attr "type" "delayed_compare")
6500 (set_attr "length" "4,8")])
6503 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6504 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6505 (match_operand:DI 2 "reg_or_cint_operand" ""))
6507 (set (match_operand:DI 0 "gpc_reg_operand" "")
6508 (rotate:DI (match_dup 1) (match_dup 2)))]
6509 "TARGET_POWERPC64 && reload_completed"
6511 (rotate:DI (match_dup 1) (match_dup 2)))
6513 (compare:CC (match_dup 0)
6517 (define_insn "*rotldi3_internal4"
6518 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6519 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6520 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6521 (match_operand:DI 3 "mask64_operand" "n")))]
6523 "rld%I2c%B3 %0,%1,%H2,%S3")
6525 (define_insn "*rotldi3_internal5"
6526 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6528 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6529 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6530 (match_operand:DI 3 "mask64_operand" "n,n"))
6532 (clobber (match_scratch:DI 4 "=r,r"))]
6535 rld%I2c%B3. %4,%1,%H2,%S3
6537 [(set_attr "type" "delayed_compare")
6538 (set_attr "length" "4,8")])
6541 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6543 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6544 (match_operand:DI 2 "reg_or_cint_operand" ""))
6545 (match_operand:DI 3 "mask64_operand" ""))
6547 (clobber (match_scratch:DI 4 ""))]
6548 "TARGET_POWERPC64 && reload_completed"
6550 (and:DI (rotate:DI (match_dup 1)
6554 (compare:CC (match_dup 4)
6558 (define_insn "*rotldi3_internal6"
6559 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6561 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6562 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6563 (match_operand:DI 3 "mask64_operand" "n,n"))
6565 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6566 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6569 rld%I2c%B3. %0,%1,%H2,%S3
6571 [(set_attr "type" "delayed_compare")
6572 (set_attr "length" "4,8")])
6575 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6577 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6578 (match_operand:DI 2 "reg_or_cint_operand" ""))
6579 (match_operand:DI 3 "mask64_operand" ""))
6581 (set (match_operand:DI 0 "gpc_reg_operand" "")
6582 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6583 "TARGET_POWERPC64 && reload_completed"
6585 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6587 (compare:CC (match_dup 0)
6591 (define_insn "*rotldi3_internal7"
6592 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6595 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6596 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6598 "rld%I2cl %0,%1,%H2,56")
6600 (define_insn "*rotldi3_internal8"
6601 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6602 (compare:CC (zero_extend:DI
6604 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6605 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6607 (clobber (match_scratch:DI 3 "=r,r"))]
6610 rld%I2cl. %3,%1,%H2,56
6612 [(set_attr "type" "delayed_compare")
6613 (set_attr "length" "4,8")])
6616 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6617 (compare:CC (zero_extend:DI
6619 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6620 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6622 (clobber (match_scratch:DI 3 ""))]
6623 "TARGET_POWERPC64 && reload_completed"
6625 (zero_extend:DI (subreg:QI
6626 (rotate:DI (match_dup 1)
6629 (compare:CC (match_dup 3)
6633 (define_insn "*rotldi3_internal9"
6634 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6635 (compare:CC (zero_extend:DI
6637 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6638 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6640 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6641 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6644 rld%I2cl. %0,%1,%H2,56
6646 [(set_attr "type" "delayed_compare")
6647 (set_attr "length" "4,8")])
6650 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6651 (compare:CC (zero_extend:DI
6653 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6654 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6656 (set (match_operand:DI 0 "gpc_reg_operand" "")
6657 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6658 "TARGET_POWERPC64 && reload_completed"
6660 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6662 (compare:CC (match_dup 0)
6666 (define_insn "*rotldi3_internal10"
6667 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6670 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6671 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6673 "rld%I2cl %0,%1,%H2,48")
6675 (define_insn "*rotldi3_internal11"
6676 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6677 (compare:CC (zero_extend:DI
6679 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6680 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6682 (clobber (match_scratch:DI 3 "=r,r"))]
6685 rld%I2cl. %3,%1,%H2,48
6687 [(set_attr "type" "delayed_compare")
6688 (set_attr "length" "4,8")])
6691 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6692 (compare:CC (zero_extend:DI
6694 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6695 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6697 (clobber (match_scratch:DI 3 ""))]
6698 "TARGET_POWERPC64 && reload_completed"
6700 (zero_extend:DI (subreg:HI
6701 (rotate:DI (match_dup 1)
6704 (compare:CC (match_dup 3)
6708 (define_insn "*rotldi3_internal12"
6709 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6710 (compare:CC (zero_extend:DI
6712 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6713 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6715 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6716 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6719 rld%I2cl. %0,%1,%H2,48
6721 [(set_attr "type" "delayed_compare")
6722 (set_attr "length" "4,8")])
6725 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6726 (compare:CC (zero_extend:DI
6728 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6729 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6731 (set (match_operand:DI 0 "gpc_reg_operand" "")
6732 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6733 "TARGET_POWERPC64 && reload_completed"
6735 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6737 (compare:CC (match_dup 0)
6741 (define_insn "*rotldi3_internal13"
6742 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6745 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6746 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6748 "rld%I2cl %0,%1,%H2,32")
6750 (define_insn "*rotldi3_internal14"
6751 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6752 (compare:CC (zero_extend:DI
6754 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6755 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6757 (clobber (match_scratch:DI 3 "=r,r"))]
6760 rld%I2cl. %3,%1,%H2,32
6762 [(set_attr "type" "delayed_compare")
6763 (set_attr "length" "4,8")])
6766 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6767 (compare:CC (zero_extend:DI
6769 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6770 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6772 (clobber (match_scratch:DI 3 ""))]
6773 "TARGET_POWERPC64 && reload_completed"
6775 (zero_extend:DI (subreg:SI
6776 (rotate:DI (match_dup 1)
6779 (compare:CC (match_dup 3)
6783 (define_insn "*rotldi3_internal15"
6784 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6785 (compare:CC (zero_extend:DI
6787 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6788 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6790 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6791 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6794 rld%I2cl. %0,%1,%H2,32
6796 [(set_attr "type" "delayed_compare")
6797 (set_attr "length" "4,8")])
6800 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6801 (compare:CC (zero_extend:DI
6803 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6804 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6806 (set (match_operand:DI 0 "gpc_reg_operand" "")
6807 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6808 "TARGET_POWERPC64 && reload_completed"
6810 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6812 (compare:CC (match_dup 0)
6816 (define_expand "ashldi3"
6817 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6818 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6819 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6820 "TARGET_POWERPC64 || TARGET_POWER"
6823 if (TARGET_POWERPC64)
6825 else if (TARGET_POWER)
6827 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6834 (define_insn "*ashldi3_internal1"
6835 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6836 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6837 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6841 (define_insn "*ashldi3_internal2"
6842 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6843 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6844 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6846 (clobber (match_scratch:DI 3 "=r,r"))]
6851 [(set_attr "type" "delayed_compare")
6852 (set_attr "length" "4,8")])
6855 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6856 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6857 (match_operand:SI 2 "reg_or_cint_operand" ""))
6859 (clobber (match_scratch:DI 3 ""))]
6860 "TARGET_POWERPC64 && reload_completed"
6862 (ashift:DI (match_dup 1) (match_dup 2)))
6864 (compare:CC (match_dup 3)
6868 (define_insn "*ashldi3_internal3"
6869 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6870 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6871 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6873 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6874 (ashift:DI (match_dup 1) (match_dup 2)))]
6879 [(set_attr "type" "delayed_compare")
6880 (set_attr "length" "4,8")])
6883 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6884 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6885 (match_operand:SI 2 "reg_or_cint_operand" ""))
6887 (set (match_operand:DI 0 "gpc_reg_operand" "")
6888 (ashift:DI (match_dup 1) (match_dup 2)))]
6889 "TARGET_POWERPC64 && reload_completed"
6891 (ashift:DI (match_dup 1) (match_dup 2)))
6893 (compare:CC (match_dup 0)
6897 (define_insn "*ashldi3_internal4"
6898 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6899 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6900 (match_operand:SI 2 "const_int_operand" "i"))
6901 (match_operand:DI 3 "const_int_operand" "n")))]
6902 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6903 "rldic %0,%1,%H2,%W3")
6905 (define_insn "ashldi3_internal5"
6906 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6908 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6909 (match_operand:SI 2 "const_int_operand" "i,i"))
6910 (match_operand:DI 3 "const_int_operand" "n,n"))
6912 (clobber (match_scratch:DI 4 "=r,r"))]
6913 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6915 rldic. %4,%1,%H2,%W3
6917 [(set_attr "type" "delayed_compare")
6918 (set_attr "length" "4,8")])
6921 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6923 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6924 (match_operand:SI 2 "const_int_operand" ""))
6925 (match_operand:DI 3 "const_int_operand" ""))
6927 (clobber (match_scratch:DI 4 ""))]
6928 "TARGET_POWERPC64 && reload_completed
6929 && includes_rldic_lshift_p (operands[2], operands[3])"
6931 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6934 (compare:CC (match_dup 4)
6938 (define_insn "*ashldi3_internal6"
6939 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6941 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6942 (match_operand:SI 2 "const_int_operand" "i,i"))
6943 (match_operand:DI 3 "const_int_operand" "n,n"))
6945 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6946 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6947 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6949 rldic. %0,%1,%H2,%W3
6951 [(set_attr "type" "delayed_compare")
6952 (set_attr "length" "4,8")])
6955 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6957 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6958 (match_operand:SI 2 "const_int_operand" ""))
6959 (match_operand:DI 3 "const_int_operand" ""))
6961 (set (match_operand:DI 0 "gpc_reg_operand" "")
6962 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6963 "TARGET_POWERPC64 && reload_completed
6964 && includes_rldic_lshift_p (operands[2], operands[3])"
6966 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6969 (compare:CC (match_dup 0)
6973 (define_insn "*ashldi3_internal7"
6974 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6975 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6976 (match_operand:SI 2 "const_int_operand" "i"))
6977 (match_operand:DI 3 "mask64_operand" "n")))]
6978 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6979 "rldicr %0,%1,%H2,%S3")
6981 (define_insn "ashldi3_internal8"
6982 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6984 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6985 (match_operand:SI 2 "const_int_operand" "i,i"))
6986 (match_operand:DI 3 "mask64_operand" "n,n"))
6988 (clobber (match_scratch:DI 4 "=r,r"))]
6989 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6991 rldicr. %4,%1,%H2,%S3
6993 [(set_attr "type" "delayed_compare")
6994 (set_attr "length" "4,8")])
6997 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6999 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7000 (match_operand:SI 2 "const_int_operand" ""))
7001 (match_operand:DI 3 "mask64_operand" ""))
7003 (clobber (match_scratch:DI 4 ""))]
7004 "TARGET_POWERPC64 && reload_completed
7005 && includes_rldicr_lshift_p (operands[2], operands[3])"
7007 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7010 (compare:CC (match_dup 4)
7014 (define_insn "*ashldi3_internal9"
7015 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7017 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7018 (match_operand:SI 2 "const_int_operand" "i,i"))
7019 (match_operand:DI 3 "mask64_operand" "n,n"))
7021 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7022 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7023 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7025 rldicr. %0,%1,%H2,%S3
7027 [(set_attr "type" "delayed_compare")
7028 (set_attr "length" "4,8")])
7031 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7033 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7034 (match_operand:SI 2 "const_int_operand" ""))
7035 (match_operand:DI 3 "mask64_operand" ""))
7037 (set (match_operand:DI 0 "gpc_reg_operand" "")
7038 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7039 "TARGET_POWERPC64 && reload_completed
7040 && includes_rldicr_lshift_p (operands[2], operands[3])"
7042 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7045 (compare:CC (match_dup 0)
7049 (define_expand "lshrdi3"
7050 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7051 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7052 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7053 "TARGET_POWERPC64 || TARGET_POWER"
7056 if (TARGET_POWERPC64)
7058 else if (TARGET_POWER)
7060 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7067 (define_insn "*lshrdi3_internal1"
7068 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7069 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7070 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7074 (define_insn "*lshrdi3_internal2"
7075 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7076 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7077 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7079 (clobber (match_scratch:DI 3 "=r,r"))]
7084 [(set_attr "type" "delayed_compare")
7085 (set_attr "length" "4,8")])
7088 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7089 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7090 (match_operand:SI 2 "reg_or_cint_operand" ""))
7092 (clobber (match_scratch:DI 3 ""))]
7093 "TARGET_POWERPC64 && reload_completed"
7095 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7097 (compare:CC (match_dup 3)
7101 (define_insn "*lshrdi3_internal3"
7102 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7103 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7104 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7106 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7107 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7112 [(set_attr "type" "delayed_compare")
7113 (set_attr "length" "4,8")])
7116 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7117 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7118 (match_operand:SI 2 "reg_or_cint_operand" ""))
7120 (set (match_operand:DI 0 "gpc_reg_operand" "")
7121 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7122 "TARGET_POWERPC64 && reload_completed"
7124 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7126 (compare:CC (match_dup 0)
7130 (define_expand "ashrdi3"
7131 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7132 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7133 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7137 if (TARGET_POWERPC64)
7139 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7141 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7144 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7145 && WORDS_BIG_ENDIAN)
7147 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7154 (define_insn "*ashrdi3_internal1"
7155 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7156 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7157 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7159 "srad%I2 %0,%1,%H2")
7161 (define_insn "*ashrdi3_internal2"
7162 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7163 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7164 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7166 (clobber (match_scratch:DI 3 "=r,r"))]
7171 [(set_attr "type" "delayed_compare")
7172 (set_attr "length" "4,8")])
7175 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7176 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7177 (match_operand:SI 2 "reg_or_cint_operand" ""))
7179 (clobber (match_scratch:DI 3 ""))]
7180 "TARGET_POWERPC64 && reload_completed"
7182 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7184 (compare:CC (match_dup 3)
7188 (define_insn "*ashrdi3_internal3"
7189 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7190 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7191 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7193 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7194 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7199 [(set_attr "type" "delayed_compare")
7200 (set_attr "length" "4,8")])
7203 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7204 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7205 (match_operand:SI 2 "reg_or_cint_operand" ""))
7207 (set (match_operand:DI 0 "gpc_reg_operand" "")
7208 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7209 "TARGET_POWERPC64 && reload_completed"
7211 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7213 (compare:CC (match_dup 0)
7217 (define_insn "anddi3"
7218 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7219 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7220 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7221 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7225 rldic%B2 %0,%1,0,%S2
7226 rlwinm %0,%1,0,%m2,%M2
7230 [(set_attr "type" "*,*,*,compare,compare,*")
7231 (set_attr "length" "4,4,4,4,4,8")])
7234 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7235 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7236 (match_operand:DI 2 "mask64_2_operand" "")))
7237 (clobber (match_scratch:CC 3 ""))]
7239 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7240 && !mask64_operand (operands[2], DImode)"
7242 (and:DI (rotate:DI (match_dup 1)
7246 (and:DI (rotate:DI (match_dup 0)
7250 build_mask64_2_operands (operands[2], &operands[4]);
7253 (define_insn "*anddi3_internal2"
7254 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7255 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7256 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7258 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7259 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7263 rldic%B2. %3,%1,0,%S2
7272 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7273 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7276 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7277 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7278 (match_operand:DI 2 "and64_operand" ""))
7280 (clobber (match_scratch:DI 3 ""))
7281 (clobber (match_scratch:CC 4 ""))]
7282 "TARGET_POWERPC64 && reload_completed"
7283 [(parallel [(set (match_dup 3)
7284 (and:DI (match_dup 1)
7286 (clobber (match_dup 4))])
7288 (compare:CC (match_dup 3)
7293 [(set (match_operand:CC 0 "cc_reg_operand" "")
7294 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7295 (match_operand:DI 2 "mask64_2_operand" ""))
7297 (clobber (match_scratch:DI 3 ""))
7298 (clobber (match_scratch:CC 4 ""))]
7299 "TARGET_POWERPC64 && reload_completed
7300 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7301 && !mask64_operand (operands[2], DImode)"
7303 (and:DI (rotate:DI (match_dup 1)
7306 (parallel [(set (match_dup 0)
7307 (compare:CC (and:DI (rotate:DI (match_dup 3)
7311 (clobber (match_dup 3))])]
7314 build_mask64_2_operands (operands[2], &operands[5]);
7317 (define_insn "*anddi3_internal3"
7318 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7319 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7320 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7322 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7323 (and:DI (match_dup 1) (match_dup 2)))
7324 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7328 rldic%B2. %0,%1,0,%S2
7337 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7338 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7341 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7342 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7343 (match_operand:DI 2 "and64_operand" ""))
7345 (set (match_operand:DI 0 "gpc_reg_operand" "")
7346 (and:DI (match_dup 1) (match_dup 2)))
7347 (clobber (match_scratch:CC 4 ""))]
7348 "TARGET_POWERPC64 && reload_completed"
7349 [(parallel [(set (match_dup 0)
7350 (and:DI (match_dup 1) (match_dup 2)))
7351 (clobber (match_dup 4))])
7353 (compare:CC (match_dup 0)
7358 [(set (match_operand:CC 3 "cc_reg_operand" "")
7359 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7360 (match_operand:DI 2 "mask64_2_operand" ""))
7362 (set (match_operand:DI 0 "gpc_reg_operand" "")
7363 (and:DI (match_dup 1) (match_dup 2)))
7364 (clobber (match_scratch:CC 4 ""))]
7365 "TARGET_POWERPC64 && reload_completed
7366 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7367 && !mask64_operand (operands[2], DImode)"
7369 (and:DI (rotate:DI (match_dup 1)
7372 (parallel [(set (match_dup 3)
7373 (compare:CC (and:DI (rotate:DI (match_dup 0)
7378 (and:DI (rotate:DI (match_dup 0)
7383 build_mask64_2_operands (operands[2], &operands[5]);
7386 (define_expand "iordi3"
7387 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7388 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7389 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7393 if (non_logical_cint_operand (operands[2], DImode))
7395 HOST_WIDE_INT value;
7396 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7397 ? operands[0] : gen_reg_rtx (DImode));
7399 if (GET_CODE (operands[2]) == CONST_INT)
7401 value = INTVAL (operands[2]);
7402 emit_insn (gen_iordi3 (tmp, operands[1],
7403 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7407 value = CONST_DOUBLE_LOW (operands[2]);
7408 emit_insn (gen_iordi3 (tmp, operands[1],
7409 immed_double_const (value
7410 & (~ (HOST_WIDE_INT) 0xffff),
7414 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7419 (define_expand "xordi3"
7420 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7421 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7422 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7426 if (non_logical_cint_operand (operands[2], DImode))
7428 HOST_WIDE_INT value;
7429 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7430 ? operands[0] : gen_reg_rtx (DImode));
7432 if (GET_CODE (operands[2]) == CONST_INT)
7434 value = INTVAL (operands[2]);
7435 emit_insn (gen_xordi3 (tmp, operands[1],
7436 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7440 value = CONST_DOUBLE_LOW (operands[2]);
7441 emit_insn (gen_xordi3 (tmp, operands[1],
7442 immed_double_const (value
7443 & (~ (HOST_WIDE_INT) 0xffff),
7447 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7452 (define_insn "*booldi3_internal1"
7453 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7454 (match_operator:DI 3 "boolean_or_operator"
7455 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7456 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7463 (define_insn "*booldi3_internal2"
7464 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7465 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7466 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7467 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7469 (clobber (match_scratch:DI 3 "=r,r"))]
7474 [(set_attr "type" "compare")
7475 (set_attr "length" "4,8")])
7478 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7479 (compare:CC (match_operator:DI 4 "boolean_operator"
7480 [(match_operand:DI 1 "gpc_reg_operand" "")
7481 (match_operand:DI 2 "gpc_reg_operand" "")])
7483 (clobber (match_scratch:DI 3 ""))]
7484 "TARGET_POWERPC64 && reload_completed"
7485 [(set (match_dup 3) (match_dup 4))
7487 (compare:CC (match_dup 3)
7491 (define_insn "*booldi3_internal3"
7492 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7493 (compare:CC (match_operator:DI 4 "boolean_operator"
7494 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7495 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7497 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7503 [(set_attr "type" "compare")
7504 (set_attr "length" "4,8")])
7507 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7508 (compare:CC (match_operator:DI 4 "boolean_operator"
7509 [(match_operand:DI 1 "gpc_reg_operand" "")
7510 (match_operand:DI 2 "gpc_reg_operand" "")])
7512 (set (match_operand:DI 0 "gpc_reg_operand" "")
7514 "TARGET_POWERPC64 && reload_completed"
7515 [(set (match_dup 0) (match_dup 4))
7517 (compare:CC (match_dup 0)
7521 ;; Split a logical operation that we can't do in one insn into two insns,
7522 ;; each of which does one 16-bit part. This is used by combine.
7525 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7526 (match_operator:DI 3 "boolean_or_operator"
7527 [(match_operand:DI 1 "gpc_reg_operand" "")
7528 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7530 [(set (match_dup 0) (match_dup 4))
7531 (set (match_dup 0) (match_dup 5))]
7536 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7538 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7539 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7541 i4 = GEN_INT (value & 0xffff);
7545 i3 = GEN_INT (INTVAL (operands[2])
7546 & (~ (HOST_WIDE_INT) 0xffff));
7547 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7549 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7551 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7555 (define_insn "*boolcdi3_internal1"
7556 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7557 (match_operator:DI 3 "boolean_operator"
7558 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7559 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7563 (define_insn "*boolcdi3_internal2"
7564 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7565 (compare:CC (match_operator:DI 4 "boolean_operator"
7566 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7567 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7569 (clobber (match_scratch:DI 3 "=r,r"))]
7574 [(set_attr "type" "compare")
7575 (set_attr "length" "4,8")])
7578 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7579 (compare:CC (match_operator:DI 4 "boolean_operator"
7580 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7581 (match_operand:DI 2 "gpc_reg_operand" "")])
7583 (clobber (match_scratch:DI 3 ""))]
7584 "TARGET_POWERPC64 && reload_completed"
7585 [(set (match_dup 3) (match_dup 4))
7587 (compare:CC (match_dup 3)
7591 (define_insn "*boolcdi3_internal3"
7592 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7593 (compare:CC (match_operator:DI 4 "boolean_operator"
7594 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7595 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7597 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7603 [(set_attr "type" "compare")
7604 (set_attr "length" "4,8")])
7607 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7608 (compare:CC (match_operator:DI 4 "boolean_operator"
7609 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7610 (match_operand:DI 2 "gpc_reg_operand" "")])
7612 (set (match_operand:DI 0 "gpc_reg_operand" "")
7614 "TARGET_POWERPC64 && reload_completed"
7615 [(set (match_dup 0) (match_dup 4))
7617 (compare:CC (match_dup 0)
7621 (define_insn "*boolccdi3_internal1"
7622 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7623 (match_operator:DI 3 "boolean_operator"
7624 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7625 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7629 (define_insn "*boolccdi3_internal2"
7630 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7631 (compare:CC (match_operator:DI 4 "boolean_operator"
7632 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7633 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7635 (clobber (match_scratch:DI 3 "=r,r"))]
7640 [(set_attr "type" "compare")
7641 (set_attr "length" "4,8")])
7644 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7645 (compare:CC (match_operator:DI 4 "boolean_operator"
7646 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7647 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7649 (clobber (match_scratch:DI 3 ""))]
7650 "TARGET_POWERPC64 && reload_completed"
7651 [(set (match_dup 3) (match_dup 4))
7653 (compare:CC (match_dup 3)
7657 (define_insn "*boolccdi3_internal3"
7658 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7659 (compare:CC (match_operator:DI 4 "boolean_operator"
7660 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7661 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7663 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7669 [(set_attr "type" "compare")
7670 (set_attr "length" "4,8")])
7673 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7674 (compare:CC (match_operator:DI 4 "boolean_operator"
7675 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7676 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7678 (set (match_operand:DI 0 "gpc_reg_operand" "")
7680 "TARGET_POWERPC64 && reload_completed"
7681 [(set (match_dup 0) (match_dup 4))
7683 (compare:CC (match_dup 0)
7687 ;; Now define ways of moving data around.
7689 ;; Elf specific ways of loading addresses for non-PIC code.
7690 ;; The output of this could be r0, but we make a very strong
7691 ;; preference for a base register because it will usually
7693 (define_insn "elf_high"
7694 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7695 (high:SI (match_operand 1 "" "")))]
7696 "TARGET_ELF && ! TARGET_64BIT"
7697 "{liu|lis} %0,%1@ha")
7699 (define_insn "elf_low"
7700 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7701 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7702 (match_operand 2 "" "")))]
7703 "TARGET_ELF && ! TARGET_64BIT"
7705 {cal|la} %0,%2@l(%1)
7706 {ai|addic} %0,%1,%K2")
7709 ;; Set up a register with a value from the GOT table
7711 (define_expand "movsi_got"
7712 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7713 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7714 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7715 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7718 if (GET_CODE (operands[1]) == CONST)
7720 rtx offset = const0_rtx;
7721 HOST_WIDE_INT value;
7723 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7724 value = INTVAL (offset);
7727 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7728 emit_insn (gen_movsi_got (tmp, operands[1]));
7729 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7734 operands[2] = rs6000_got_register (operands[1]);
7737 (define_insn "*movsi_got_internal"
7738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7739 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7740 (match_operand:SI 2 "gpc_reg_operand" "b")]
7742 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7743 "{l|lwz} %0,%a1@got(%2)"
7744 [(set_attr "type" "load")])
7746 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7747 ;; didn't get allocated to a hard register.
7749 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7750 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7751 (match_operand:SI 2 "memory_operand" "")]
7753 "DEFAULT_ABI == ABI_V4
7755 && (reload_in_progress || reload_completed)"
7756 [(set (match_dup 0) (match_dup 2))
7757 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7761 ;; For SI, we special-case integers that can't be loaded in one insn. We
7762 ;; do the load 16-bits at a time. We could do this by loading from memory,
7763 ;; and this is even supposed to be faster, but it is simpler not to get
7764 ;; integers in the TOC.
7765 (define_expand "movsi"
7766 [(set (match_operand:SI 0 "general_operand" "")
7767 (match_operand:SI 1 "any_operand" ""))]
7769 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7771 (define_insn "movsi_low"
7772 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7773 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7774 (match_operand 2 "" ""))))]
7775 "TARGET_MACHO && ! TARGET_64BIT"
7776 "{l|lwz} %0,lo16(%2)(%1)"
7777 [(set_attr "type" "load")
7778 (set_attr "length" "4")])
7780 (define_insn "*movsi_internal1"
7781 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7782 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7783 "gpc_reg_operand (operands[0], SImode)
7784 || gpc_reg_operand (operands[1], SImode)"
7788 {l%U1%X1|lwz%U1%X1} %0,%1
7789 {st%U0%X0|stw%U0%X0} %1,%0
7799 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7800 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7802 ;; Split a load of a large constant into the appropriate two-insn
7806 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7807 (match_operand:SI 1 "const_int_operand" ""))]
7808 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7809 && (INTVAL (operands[1]) & 0xffff) != 0"
7813 (ior:SI (match_dup 0)
7816 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7818 if (tem == operands[0])
7824 (define_insn "*movsi_internal2"
7825 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7826 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "0,r,r")
7828 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7831 {cmpi|cmpwi} %2,%0,0
7834 [(set_attr "type" "cmp,compare,cmp")
7835 (set_attr "length" "4,4,8")])
7838 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7839 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7841 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7842 "TARGET_32BIT && reload_completed"
7843 [(set (match_dup 0) (match_dup 1))
7845 (compare:CC (match_dup 0)
7849 (define_expand "movhi"
7850 [(set (match_operand:HI 0 "general_operand" "")
7851 (match_operand:HI 1 "any_operand" ""))]
7853 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7855 (define_insn "*movhi_internal"
7856 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7857 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7858 "gpc_reg_operand (operands[0], HImode)
7859 || gpc_reg_operand (operands[1], HImode)"
7869 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7871 (define_expand "movqi"
7872 [(set (match_operand:QI 0 "general_operand" "")
7873 (match_operand:QI 1 "any_operand" ""))]
7875 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7877 (define_insn "*movqi_internal"
7878 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7879 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7880 "gpc_reg_operand (operands[0], QImode)
7881 || gpc_reg_operand (operands[1], QImode)"
7891 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7893 ;; Here is how to move condition codes around. When we store CC data in
7894 ;; an integer register or memory, we store just the high-order 4 bits.
7895 ;; This lets us not shift in the most common case of CR0.
7896 (define_expand "movcc"
7897 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7898 (match_operand:CC 1 "nonimmediate_operand" ""))]
7902 (define_insn "*movcc_internal1"
7903 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7904 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7905 "register_operand (operands[0], CCmode)
7906 || register_operand (operands[1], CCmode)"
7910 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7912 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7917 {l%U1%X1|lwz%U1%X1} %0,%1
7918 {st%U0%U1|stw%U0%U1} %1,%0"
7920 (cond [(eq_attr "alternative" "0")
7921 (const_string "cr_logical")
7922 (eq_attr "alternative" "1,2")
7923 (const_string "mtcr")
7924 (eq_attr "alternative" "5,7")
7925 (const_string "integer")
7926 (eq_attr "alternative" "6")
7927 (const_string "mfjmpr")
7928 (eq_attr "alternative" "8")
7929 (const_string "mtjmpr")
7930 (eq_attr "alternative" "9")
7931 (const_string "load")
7932 (eq_attr "alternative" "10")
7933 (const_string "store")
7934 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7935 (const_string "mfcrf")
7937 (const_string "mfcr")))
7938 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7940 ;; For floating-point, we normally deal with the floating-point registers
7941 ;; unless -msoft-float is used. The sole exception is that parameter passing
7942 ;; can produce floating-point values in fixed-point registers. Unless the
7943 ;; value is a simple constant or already in memory, we deal with this by
7944 ;; allocating memory and copying the value explicitly via that memory location.
7945 (define_expand "movsf"
7946 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7947 (match_operand:SF 1 "any_operand" ""))]
7949 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7952 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7953 (match_operand:SF 1 "const_double_operand" ""))]
7955 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7956 || (GET_CODE (operands[0]) == SUBREG
7957 && GET_CODE (SUBREG_REG (operands[0])) == REG
7958 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7959 [(set (match_dup 2) (match_dup 3))]
7965 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7966 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7968 if (! TARGET_POWERPC64)
7969 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7971 operands[2] = gen_lowpart (SImode, operands[0]);
7973 operands[3] = gen_int_mode (l, SImode);
7976 (define_insn "*movsf_hardfloat"
7977 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7978 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7979 "(gpc_reg_operand (operands[0], SFmode)
7980 || gpc_reg_operand (operands[1], SFmode))
7981 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7984 {l%U1%X1|lwz%U1%X1} %0,%1
7985 {st%U0%X0|stw%U0%X0} %1,%0
7995 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7996 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7998 (define_insn "*movsf_softfloat"
7999 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8000 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8001 "(gpc_reg_operand (operands[0], SFmode)
8002 || gpc_reg_operand (operands[1], SFmode))
8003 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8009 {l%U1%X1|lwz%U1%X1} %0,%1
8010 {st%U0%X0|stw%U0%X0} %1,%0
8017 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
8018 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8021 (define_expand "movdf"
8022 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8023 (match_operand:DF 1 "any_operand" ""))]
8025 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8028 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8029 (match_operand:DF 1 "const_int_operand" ""))]
8030 "! TARGET_POWERPC64 && reload_completed
8031 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8032 || (GET_CODE (operands[0]) == SUBREG
8033 && GET_CODE (SUBREG_REG (operands[0])) == REG
8034 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8035 [(set (match_dup 2) (match_dup 4))
8036 (set (match_dup 3) (match_dup 1))]
8039 int endian = (WORDS_BIG_ENDIAN == 0);
8040 HOST_WIDE_INT value = INTVAL (operands[1]);
8042 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8043 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8044 #if HOST_BITS_PER_WIDE_INT == 32
8045 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8047 operands[4] = GEN_INT (value >> 32);
8048 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8053 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8054 (match_operand:DF 1 "const_double_operand" ""))]
8055 "! TARGET_POWERPC64 && reload_completed
8056 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8057 || (GET_CODE (operands[0]) == SUBREG
8058 && GET_CODE (SUBREG_REG (operands[0])) == REG
8059 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8060 [(set (match_dup 2) (match_dup 4))
8061 (set (match_dup 3) (match_dup 5))]
8064 int endian = (WORDS_BIG_ENDIAN == 0);
8068 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8069 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8071 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8072 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8073 operands[4] = gen_int_mode (l[endian], SImode);
8074 operands[5] = gen_int_mode (l[1 - endian], SImode);
8078 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8079 (match_operand:DF 1 "easy_fp_constant" ""))]
8080 "TARGET_POWERPC64 && reload_completed
8081 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8082 || (GET_CODE (operands[0]) == SUBREG
8083 && GET_CODE (SUBREG_REG (operands[0])) == REG
8084 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8085 [(set (match_dup 2) (match_dup 3))]
8088 int endian = (WORDS_BIG_ENDIAN == 0);
8091 #if HOST_BITS_PER_WIDE_INT >= 64
8095 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8096 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8098 operands[2] = gen_lowpart (DImode, operands[0]);
8099 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8100 #if HOST_BITS_PER_WIDE_INT >= 64
8101 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8102 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8104 operands[3] = gen_int_mode (val, DImode);
8106 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8110 ;; Don't have reload use general registers to load a constant. First,
8111 ;; it might not work if the output operand is the equivalent of
8112 ;; a non-offsettable memref, but also it is less efficient than loading
8113 ;; the constant into an FP register, since it will probably be used there.
8114 ;; The "??" is a kludge until we can figure out a more reasonable way
8115 ;; of handling these non-offsettable values.
8116 (define_insn "*movdf_hardfloat32"
8117 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8118 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8119 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8120 && (gpc_reg_operand (operands[0], DFmode)
8121 || gpc_reg_operand (operands[1], DFmode))"
8124 switch (which_alternative)
8129 /* We normally copy the low-numbered register first. However, if
8130 the first register operand 0 is the same as the second register
8131 of operand 1, we must copy in the opposite order. */
8132 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8133 return \"mr %L0,%L1\;mr %0,%1\";
8135 return \"mr %0,%1\;mr %L0,%L1\";
8137 if (GET_CODE (operands[1]) == MEM
8138 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[1], 0),
8139 reload_completed || reload_in_progress)
8140 || GET_CODE (XEXP (operands[1], 0)) == REG
8141 || GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8142 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8143 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC))
8145 /* If the low-address word is used in the address, we must load
8146 it last. Otherwise, load it first. Note that we cannot have
8147 auto-increment in that case since the address register is
8148 known to be dead. */
8149 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8151 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8153 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8159 addreg = find_addr_reg (XEXP (operands[1], 0));
8160 if (refers_to_regno_p (REGNO (operands[0]),
8161 REGNO (operands[0]) + 1,
8164 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8165 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8166 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8167 return \"{lx|lwzx} %0,%1\";
8171 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8172 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8173 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8174 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8179 if (GET_CODE (operands[0]) == MEM
8180 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[0], 0),
8181 reload_completed || reload_in_progress)
8182 || GET_CODE (XEXP (operands[0], 0)) == REG
8183 || GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8184 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8185 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))
8186 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8191 addreg = find_addr_reg (XEXP (operands[0], 0));
8192 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8193 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8194 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8195 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8199 return \"fmr %0,%1\";
8201 return \"lfd%U1%X1 %0,%1\";
8203 return \"stfd%U0%X0 %1,%0\";
8210 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8211 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8213 (define_insn "*movdf_softfloat32"
8214 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8215 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8216 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8217 && (gpc_reg_operand (operands[0], DFmode)
8218 || gpc_reg_operand (operands[1], DFmode))"
8221 switch (which_alternative)
8226 /* We normally copy the low-numbered register first. However, if
8227 the first register operand 0 is the same as the second register of
8228 operand 1, we must copy in the opposite order. */
8229 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8230 return \"mr %L0,%L1\;mr %0,%1\";
8232 return \"mr %0,%1\;mr %L0,%L1\";
8234 /* If the low-address word is used in the address, we must load
8235 it last. Otherwise, load it first. Note that we cannot have
8236 auto-increment in that case since the address register is
8237 known to be dead. */
8238 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8240 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8242 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8244 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8251 [(set_attr "type" "two,load,store,*,*,*")
8252 (set_attr "length" "8,8,8,8,12,16")])
8254 ; ld/std require word-aligned displacements -> 'Y' constraint.
8255 ; List Y->r and r->Y before r->r for reload.
8256 (define_insn "*movdf_hardfloat64"
8257 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
8258 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8259 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8260 && (gpc_reg_operand (operands[0], DFmode)
8261 || gpc_reg_operand (operands[1], DFmode))"
8275 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
8276 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8278 (define_insn "*movdf_softfloat64"
8279 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8280 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8281 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8282 && (gpc_reg_operand (operands[0], DFmode)
8283 || gpc_reg_operand (operands[1], DFmode))"
8294 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
8295 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8297 (define_expand "movtf"
8298 [(set (match_operand:TF 0 "general_operand" "")
8299 (match_operand:TF 1 "any_operand" ""))]
8300 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8301 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8302 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8304 ; It's important to list the o->f and f->o moves before f->f because
8305 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8306 ; which doesn't make progress. Likewise r->Y must be before r->r.
8307 (define_insn_and_split "*movtf_internal"
8308 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8309 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8310 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8311 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8312 && (gpc_reg_operand (operands[0], TFmode)
8313 || gpc_reg_operand (operands[1], TFmode))"
8315 "&& reload_completed"
8317 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8318 [(set_attr "length" "8,8,8,20,20,16")])
8320 (define_expand "extenddftf2"
8321 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8322 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8323 (use (match_dup 2))])]
8324 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8325 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8327 operands[2] = CONST0_RTX (DFmode);
8330 (define_insn_and_split "*extenddftf2_internal"
8331 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8332 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8333 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8334 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8335 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8337 "&& reload_completed"
8340 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8341 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8342 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8344 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8349 (define_expand "extendsftf2"
8350 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8351 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8352 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8353 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8355 rtx tmp = gen_reg_rtx (DFmode);
8356 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8357 emit_insn (gen_extenddftf2 (operands[0], tmp));
8361 (define_expand "trunctfdf2"
8362 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8363 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8364 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8365 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8368 (define_insn_and_split "trunctfdf2_internal1"
8369 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8370 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8371 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
8372 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8376 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8379 emit_note (NOTE_INSN_DELETED);
8382 [(set_attr "type" "fp")])
8384 (define_insn "trunctfdf2_internal2"
8385 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8386 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8387 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
8388 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8390 [(set_attr "type" "fp")])
8392 (define_insn_and_split "trunctfsf2"
8393 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8394 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8395 (clobber (match_scratch:DF 2 "=f"))]
8396 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8397 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8399 "&& reload_completed"
8401 (float_truncate:DF (match_dup 1)))
8403 (float_truncate:SF (match_dup 2)))]
8406 (define_expand "floatsitf2"
8407 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8408 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8409 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8410 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8412 rtx tmp = gen_reg_rtx (DFmode);
8413 expand_float (tmp, operands[1], false);
8414 emit_insn (gen_extenddftf2 (operands[0], tmp));
8418 ; fadd, but rounding towards zero.
8419 ; This is probably not the optimal code sequence.
8420 (define_insn "fix_trunc_helper"
8421 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8422 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8423 UNSPEC_FIX_TRUNC_TF))
8424 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8425 "TARGET_HARD_FLOAT && TARGET_FPRS"
8426 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8427 [(set_attr "type" "fp")
8428 (set_attr "length" "20")])
8430 (define_expand "fix_trunctfsi2"
8431 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8432 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8433 (clobber (match_dup 2))
8434 (clobber (match_dup 3))
8435 (clobber (match_dup 4))
8436 (clobber (match_dup 5))])]
8437 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8438 && (TARGET_POWER2 || TARGET_POWERPC)
8439 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8441 operands[2] = gen_reg_rtx (DFmode);
8442 operands[3] = gen_reg_rtx (DFmode);
8443 operands[4] = gen_reg_rtx (DImode);
8444 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8447 (define_insn_and_split "*fix_trunctfsi2_internal"
8448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8449 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8450 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8451 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8452 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8453 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8454 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8455 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8457 "&& reload_completed"
8461 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8463 if (GET_CODE (operands[5]) != MEM)
8465 lowword = XEXP (operands[5], 0);
8466 if (WORDS_BIG_ENDIAN)
8467 lowword = plus_constant (lowword, 4);
8469 emit_insn (gen_fctiwz (operands[4], operands[2]));
8470 emit_move_insn (operands[5], operands[4]);
8471 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
8475 (define_insn "negtf2"
8476 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8477 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8478 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8479 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8482 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8483 return \"fneg %L0,%L1\;fneg %0,%1\";
8485 return \"fneg %0,%1\;fneg %L0,%L1\";
8487 [(set_attr "type" "fp")
8488 (set_attr "length" "8")])
8490 (define_expand "abstf2"
8491 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8492 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8493 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8494 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8497 rtx label = gen_label_rtx ();
8498 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8503 (define_expand "abstf2_internal"
8504 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8505 (match_operand:TF 1 "gpc_reg_operand" "f"))
8506 (set (match_dup 3) (match_dup 5))
8507 (set (match_dup 5) (abs:DF (match_dup 5)))
8508 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8509 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8510 (label_ref (match_operand 2 "" ""))
8512 (set (match_dup 6) (neg:DF (match_dup 6)))]
8513 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8514 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8517 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8518 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8519 operands[3] = gen_reg_rtx (DFmode);
8520 operands[4] = gen_reg_rtx (CCFPmode);
8521 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8522 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8525 ;; Next come the multi-word integer load and store and the load and store
8527 (define_expand "movdi"
8528 [(set (match_operand:DI 0 "general_operand" "")
8529 (match_operand:DI 1 "any_operand" ""))]
8531 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8533 ; List r->r after r->"o<>", otherwise reload will try to reload a
8534 ; non-offsettable address by using r->r which won't make progress.
8535 (define_insn "*movdi_internal32"
8536 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8537 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8539 && (gpc_reg_operand (operands[0], DImode)
8540 || gpc_reg_operand (operands[1], DImode))"
8549 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8552 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8553 (match_operand:DI 1 "const_int_operand" ""))]
8554 "! TARGET_POWERPC64 && reload_completed"
8555 [(set (match_dup 2) (match_dup 4))
8556 (set (match_dup 3) (match_dup 1))]
8559 HOST_WIDE_INT value = INTVAL (operands[1]);
8560 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8562 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8564 #if HOST_BITS_PER_WIDE_INT == 32
8565 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8567 operands[4] = GEN_INT (value >> 32);
8568 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8573 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8574 (match_operand:DI 1 "input_operand" ""))]
8575 "reload_completed && !TARGET_POWERPC64
8576 && gpr_or_gpr_p (operands[0], operands[1])"
8578 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8580 (define_insn "*movdi_internal64"
8581 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8582 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8584 && (gpc_reg_operand (operands[0], DImode)
8585 || gpc_reg_operand (operands[1], DImode))"
8600 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8601 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8603 ;; immediate value valid for a single instruction hiding in a const_double
8605 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8606 (match_operand:DI 1 "const_double_operand" "F"))]
8607 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8608 && GET_CODE (operands[1]) == CONST_DOUBLE
8609 && num_insns_constant (operands[1], DImode) == 1"
8612 return ((unsigned HOST_WIDE_INT)
8613 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8614 ? \"li %0,%1\" : \"lis %0,%v1\";
8617 ;; Generate all one-bits and clear left or right.
8618 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8620 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8621 (match_operand:DI 1 "mask64_operand" ""))]
8622 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8623 [(set (match_dup 0) (const_int -1))
8625 (and:DI (rotate:DI (match_dup 0)
8630 ;; Split a load of a large constant into the appropriate five-instruction
8631 ;; sequence. Handle anything in a constant number of insns.
8632 ;; When non-easy constants can go in the TOC, this should use
8633 ;; easy_fp_constant predicate.
8635 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8636 (match_operand:DI 1 "const_int_operand" ""))]
8637 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8638 [(set (match_dup 0) (match_dup 2))
8639 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8641 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8643 if (tem == operands[0])
8650 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8651 (match_operand:DI 1 "const_double_operand" ""))]
8652 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8653 [(set (match_dup 0) (match_dup 2))
8654 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8656 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8658 if (tem == operands[0])
8664 (define_insn "*movdi_internal2"
8665 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8666 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "0,r,r")
8668 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8674 [(set_attr "type" "cmp,compare,cmp")
8675 (set_attr "length" "4,4,8")])
8678 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8679 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8681 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8682 "TARGET_POWERPC64 && reload_completed"
8683 [(set (match_dup 0) (match_dup 1))
8685 (compare:CC (match_dup 0)
8689 ;; TImode is similar, except that we usually want to compute the address into
8690 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8691 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8692 (define_expand "movti"
8693 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8694 (match_operand:TI 1 "general_operand" ""))
8695 (clobber (scratch:SI))])]
8697 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8699 ;; We say that MQ is clobbered in the last alternative because the first
8700 ;; alternative would never get used otherwise since it would need a reload
8701 ;; while the 2nd alternative would not. We put memory cases first so they
8702 ;; are preferred. Otherwise, we'd try to reload the output instead of
8703 ;; giving the SCRATCH mq.
8705 (define_insn "*movti_power"
8706 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8707 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8708 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8709 "TARGET_POWER && ! TARGET_POWERPC64
8710 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8713 switch (which_alternative)
8720 return \"{stsi|stswi} %1,%P0,16\";
8725 /* If the address is not used in the output, we can use lsi. Otherwise,
8726 fall through to generating four loads. */
8728 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8729 return \"{lsi|lswi} %0,%P1,16\";
8730 /* ... fall through ... */
8736 [(set_attr "type" "store,store,*,load,load,*")])
8738 (define_insn "*movti_string"
8739 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8740 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8741 "! TARGET_POWER && ! TARGET_POWERPC64
8742 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8745 switch (which_alternative)
8751 return \"{stsi|stswi} %1,%P0,16\";
8756 /* If the address is not used in the output, we can use lsi. Otherwise,
8757 fall through to generating four loads. */
8759 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8760 return \"{lsi|lswi} %0,%P1,16\";
8761 /* ... fall through ... */
8767 [(set_attr "type" "store,store,*,load,load,*")])
8769 (define_insn "*movti_ppc64"
8770 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8771 (match_operand:TI 1 "input_operand" "r,r,m"))]
8772 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8773 || gpc_reg_operand (operands[1], TImode))"
8775 [(set_attr "type" "*,load,store")])
8778 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8779 (match_operand:TI 1 "const_double_operand" ""))]
8781 [(set (match_dup 2) (match_dup 4))
8782 (set (match_dup 3) (match_dup 5))]
8785 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8787 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8789 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8791 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8792 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8794 else if (GET_CODE (operands[1]) == CONST_INT)
8796 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8797 operands[5] = operands[1];
8804 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8805 (match_operand:TI 1 "input_operand" ""))]
8807 && gpr_or_gpr_p (operands[0], operands[1])"
8809 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8811 (define_expand "load_multiple"
8812 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8813 (match_operand:SI 1 "" ""))
8814 (use (match_operand:SI 2 "" ""))])]
8815 "TARGET_STRING && !TARGET_POWERPC64"
8823 /* Support only loading a constant number of fixed-point registers from
8824 memory and only bother with this if more than two; the machine
8825 doesn't support more than eight. */
8826 if (GET_CODE (operands[2]) != CONST_INT
8827 || INTVAL (operands[2]) <= 2
8828 || INTVAL (operands[2]) > 8
8829 || GET_CODE (operands[1]) != MEM
8830 || GET_CODE (operands[0]) != REG
8831 || REGNO (operands[0]) >= 32)
8834 count = INTVAL (operands[2]);
8835 regno = REGNO (operands[0]);
8837 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8838 op1 = replace_equiv_address (operands[1],
8839 force_reg (SImode, XEXP (operands[1], 0)));
8841 for (i = 0; i < count; i++)
8842 XVECEXP (operands[3], 0, i)
8843 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8844 adjust_address_nv (op1, SImode, i * 4));
8847 (define_insn "*ldmsi8"
8848 [(match_parallel 0 "load_multiple_operation"
8849 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8850 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8851 (set (match_operand:SI 3 "gpc_reg_operand" "")
8852 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8853 (set (match_operand:SI 4 "gpc_reg_operand" "")
8854 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8855 (set (match_operand:SI 5 "gpc_reg_operand" "")
8856 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8857 (set (match_operand:SI 6 "gpc_reg_operand" "")
8858 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8859 (set (match_operand:SI 7 "gpc_reg_operand" "")
8860 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8861 (set (match_operand:SI 8 "gpc_reg_operand" "")
8862 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8863 (set (match_operand:SI 9 "gpc_reg_operand" "")
8864 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8865 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8867 { return rs6000_output_load_multiple (operands); }"
8868 [(set_attr "type" "load")
8869 (set_attr "length" "32")])
8871 (define_insn "*ldmsi7"
8872 [(match_parallel 0 "load_multiple_operation"
8873 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8874 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8875 (set (match_operand:SI 3 "gpc_reg_operand" "")
8876 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8877 (set (match_operand:SI 4 "gpc_reg_operand" "")
8878 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8879 (set (match_operand:SI 5 "gpc_reg_operand" "")
8880 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8881 (set (match_operand:SI 6 "gpc_reg_operand" "")
8882 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8883 (set (match_operand:SI 7 "gpc_reg_operand" "")
8884 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8885 (set (match_operand:SI 8 "gpc_reg_operand" "")
8886 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8887 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8889 { return rs6000_output_load_multiple (operands); }"
8890 [(set_attr "type" "load")
8891 (set_attr "length" "32")])
8893 (define_insn "*ldmsi6"
8894 [(match_parallel 0 "load_multiple_operation"
8895 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8896 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8897 (set (match_operand:SI 3 "gpc_reg_operand" "")
8898 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8899 (set (match_operand:SI 4 "gpc_reg_operand" "")
8900 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8901 (set (match_operand:SI 5 "gpc_reg_operand" "")
8902 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8903 (set (match_operand:SI 6 "gpc_reg_operand" "")
8904 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8905 (set (match_operand:SI 7 "gpc_reg_operand" "")
8906 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8907 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8909 { return rs6000_output_load_multiple (operands); }"
8910 [(set_attr "type" "load")
8911 (set_attr "length" "32")])
8913 (define_insn "*ldmsi5"
8914 [(match_parallel 0 "load_multiple_operation"
8915 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8916 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8917 (set (match_operand:SI 3 "gpc_reg_operand" "")
8918 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8919 (set (match_operand:SI 4 "gpc_reg_operand" "")
8920 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8921 (set (match_operand:SI 5 "gpc_reg_operand" "")
8922 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8923 (set (match_operand:SI 6 "gpc_reg_operand" "")
8924 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8925 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8927 { return rs6000_output_load_multiple (operands); }"
8928 [(set_attr "type" "load")
8929 (set_attr "length" "32")])
8931 (define_insn "*ldmsi4"
8932 [(match_parallel 0 "load_multiple_operation"
8933 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8934 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8935 (set (match_operand:SI 3 "gpc_reg_operand" "")
8936 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8937 (set (match_operand:SI 4 "gpc_reg_operand" "")
8938 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8939 (set (match_operand:SI 5 "gpc_reg_operand" "")
8940 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8941 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8943 { return rs6000_output_load_multiple (operands); }"
8944 [(set_attr "type" "load")
8945 (set_attr "length" "32")])
8947 (define_insn "*ldmsi3"
8948 [(match_parallel 0 "load_multiple_operation"
8949 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8950 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8951 (set (match_operand:SI 3 "gpc_reg_operand" "")
8952 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8953 (set (match_operand:SI 4 "gpc_reg_operand" "")
8954 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8955 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8957 { return rs6000_output_load_multiple (operands); }"
8958 [(set_attr "type" "load")
8959 (set_attr "length" "32")])
8961 (define_expand "store_multiple"
8962 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8963 (match_operand:SI 1 "" ""))
8964 (clobber (scratch:SI))
8965 (use (match_operand:SI 2 "" ""))])]
8966 "TARGET_STRING && !TARGET_POWERPC64"
8975 /* Support only storing a constant number of fixed-point registers to
8976 memory and only bother with this if more than two; the machine
8977 doesn't support more than eight. */
8978 if (GET_CODE (operands[2]) != CONST_INT
8979 || INTVAL (operands[2]) <= 2
8980 || INTVAL (operands[2]) > 8
8981 || GET_CODE (operands[0]) != MEM
8982 || GET_CODE (operands[1]) != REG
8983 || REGNO (operands[1]) >= 32)
8986 count = INTVAL (operands[2]);
8987 regno = REGNO (operands[1]);
8989 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8990 to = force_reg (SImode, XEXP (operands[0], 0));
8991 op0 = replace_equiv_address (operands[0], to);
8993 XVECEXP (operands[3], 0, 0)
8994 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8995 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8996 gen_rtx_SCRATCH (SImode));
8998 for (i = 1; i < count; i++)
8999 XVECEXP (operands[3], 0, i + 1)
9000 = gen_rtx_SET (VOIDmode,
9001 adjust_address_nv (op0, SImode, i * 4),
9002 gen_rtx_REG (SImode, regno + i));
9005 (define_insn "*store_multiple_power"
9006 [(match_parallel 0 "store_multiple_operation"
9007 [(set (match_operand:SI 1 "indirect_operand" "=Q")
9008 (match_operand:SI 2 "gpc_reg_operand" "r"))
9009 (clobber (match_scratch:SI 3 "=q"))])]
9010 "TARGET_STRING && TARGET_POWER"
9011 "{stsi|stswi} %2,%P1,%O0"
9012 [(set_attr "type" "store")])
9014 (define_insn "*stmsi8"
9015 [(match_parallel 0 "store_multiple_operation"
9016 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9017 (match_operand:SI 2 "gpc_reg_operand" "r"))
9018 (clobber (match_scratch:SI 3 "X"))
9019 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9020 (match_operand:SI 4 "gpc_reg_operand" "r"))
9021 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9022 (match_operand:SI 5 "gpc_reg_operand" "r"))
9023 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9024 (match_operand:SI 6 "gpc_reg_operand" "r"))
9025 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9026 (match_operand:SI 7 "gpc_reg_operand" "r"))
9027 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9028 (match_operand:SI 8 "gpc_reg_operand" "r"))
9029 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9030 (match_operand:SI 9 "gpc_reg_operand" "r"))
9031 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9032 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9033 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9034 "{stsi|stswi} %2,%1,%O0"
9035 [(set_attr "type" "store")])
9037 (define_insn "*stmsi7"
9038 [(match_parallel 0 "store_multiple_operation"
9039 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9040 (match_operand:SI 2 "gpc_reg_operand" "r"))
9041 (clobber (match_scratch:SI 3 "X"))
9042 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9043 (match_operand:SI 4 "gpc_reg_operand" "r"))
9044 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9045 (match_operand:SI 5 "gpc_reg_operand" "r"))
9046 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9047 (match_operand:SI 6 "gpc_reg_operand" "r"))
9048 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9049 (match_operand:SI 7 "gpc_reg_operand" "r"))
9050 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9051 (match_operand:SI 8 "gpc_reg_operand" "r"))
9052 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9053 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9054 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9055 "{stsi|stswi} %2,%1,%O0"
9056 [(set_attr "type" "store")])
9058 (define_insn "*stmsi6"
9059 [(match_parallel 0 "store_multiple_operation"
9060 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9061 (match_operand:SI 2 "gpc_reg_operand" "r"))
9062 (clobber (match_scratch:SI 3 "X"))
9063 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9064 (match_operand:SI 4 "gpc_reg_operand" "r"))
9065 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9066 (match_operand:SI 5 "gpc_reg_operand" "r"))
9067 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9068 (match_operand:SI 6 "gpc_reg_operand" "r"))
9069 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9070 (match_operand:SI 7 "gpc_reg_operand" "r"))
9071 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9072 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9073 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9074 "{stsi|stswi} %2,%1,%O0"
9075 [(set_attr "type" "store")])
9077 (define_insn "*stmsi5"
9078 [(match_parallel 0 "store_multiple_operation"
9079 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9080 (match_operand:SI 2 "gpc_reg_operand" "r"))
9081 (clobber (match_scratch:SI 3 "X"))
9082 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9083 (match_operand:SI 4 "gpc_reg_operand" "r"))
9084 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9085 (match_operand:SI 5 "gpc_reg_operand" "r"))
9086 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9087 (match_operand:SI 6 "gpc_reg_operand" "r"))
9088 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9089 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9090 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9091 "{stsi|stswi} %2,%1,%O0"
9092 [(set_attr "type" "store")])
9094 (define_insn "*stmsi4"
9095 [(match_parallel 0 "store_multiple_operation"
9096 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9097 (match_operand:SI 2 "gpc_reg_operand" "r"))
9098 (clobber (match_scratch:SI 3 "X"))
9099 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9100 (match_operand:SI 4 "gpc_reg_operand" "r"))
9101 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9102 (match_operand:SI 5 "gpc_reg_operand" "r"))
9103 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9104 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9105 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9106 "{stsi|stswi} %2,%1,%O0"
9107 [(set_attr "type" "store")])
9109 (define_insn "*stmsi3"
9110 [(match_parallel 0 "store_multiple_operation"
9111 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9112 (match_operand:SI 2 "gpc_reg_operand" "r"))
9113 (clobber (match_scratch:SI 3 "X"))
9114 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9115 (match_operand:SI 4 "gpc_reg_operand" "r"))
9116 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9117 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9118 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9119 "{stsi|stswi} %2,%1,%O0"
9120 [(set_attr "type" "store")])
9122 (define_expand "clrmemsi"
9123 [(parallel [(set (match_operand:BLK 0 "" "")
9125 (use (match_operand:SI 1 "" ""))
9126 (use (match_operand:SI 2 "" ""))])]
9130 if (expand_block_clear (operands))
9136 ;; String/block move insn.
9137 ;; Argument 0 is the destination
9138 ;; Argument 1 is the source
9139 ;; Argument 2 is the length
9140 ;; Argument 3 is the alignment
9142 (define_expand "movmemsi"
9143 [(parallel [(set (match_operand:BLK 0 "" "")
9144 (match_operand:BLK 1 "" ""))
9145 (use (match_operand:SI 2 "" ""))
9146 (use (match_operand:SI 3 "" ""))])]
9150 if (expand_block_move (operands))
9156 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9157 ;; register allocator doesn't have a clue about allocating 8 word registers.
9158 ;; rD/rS = r5 is preferred, efficient form.
9159 (define_expand "movmemsi_8reg"
9160 [(parallel [(set (match_operand 0 "" "")
9161 (match_operand 1 "" ""))
9162 (use (match_operand 2 "" ""))
9163 (use (match_operand 3 "" ""))
9164 (clobber (reg:SI 5))
9165 (clobber (reg:SI 6))
9166 (clobber (reg:SI 7))
9167 (clobber (reg:SI 8))
9168 (clobber (reg:SI 9))
9169 (clobber (reg:SI 10))
9170 (clobber (reg:SI 11))
9171 (clobber (reg:SI 12))
9172 (clobber (match_scratch:SI 4 ""))])]
9177 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9178 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9179 (use (match_operand:SI 2 "immediate_operand" "i"))
9180 (use (match_operand:SI 3 "immediate_operand" "i"))
9181 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9182 (clobber (reg:SI 6))
9183 (clobber (reg:SI 7))
9184 (clobber (reg:SI 8))
9185 (clobber (reg:SI 9))
9186 (clobber (reg:SI 10))
9187 (clobber (reg:SI 11))
9188 (clobber (reg:SI 12))
9189 (clobber (match_scratch:SI 5 "=q"))]
9190 "TARGET_STRING && TARGET_POWER
9191 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9192 || INTVAL (operands[2]) == 0)
9193 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9194 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9195 && REGNO (operands[4]) == 5"
9196 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9197 [(set_attr "type" "load")
9198 (set_attr "length" "8")])
9201 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9202 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9203 (use (match_operand:SI 2 "immediate_operand" "i"))
9204 (use (match_operand:SI 3 "immediate_operand" "i"))
9205 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9206 (clobber (reg:SI 6))
9207 (clobber (reg:SI 7))
9208 (clobber (reg:SI 8))
9209 (clobber (reg:SI 9))
9210 (clobber (reg:SI 10))
9211 (clobber (reg:SI 11))
9212 (clobber (reg:SI 12))
9213 (clobber (match_scratch:SI 5 "X"))]
9214 "TARGET_STRING && ! TARGET_POWER
9215 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9216 || INTVAL (operands[2]) == 0)
9217 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9218 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9219 && REGNO (operands[4]) == 5"
9220 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9221 [(set_attr "type" "load")
9222 (set_attr "length" "8")])
9225 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9226 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9227 (use (match_operand:SI 2 "immediate_operand" "i"))
9228 (use (match_operand:SI 3 "immediate_operand" "i"))
9229 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9230 (clobber (reg:SI 6))
9231 (clobber (reg:SI 7))
9232 (clobber (reg:SI 8))
9233 (clobber (reg:SI 9))
9234 (clobber (reg:SI 10))
9235 (clobber (reg:SI 11))
9236 (clobber (reg:SI 12))
9237 (clobber (match_scratch:SI 5 "X"))]
9238 "TARGET_STRING && TARGET_POWERPC64
9239 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9240 || INTVAL (operands[2]) == 0)
9241 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9242 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
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")])
9248 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9249 ;; register allocator doesn't have a clue about allocating 6 word registers.
9250 ;; rD/rS = r5 is preferred, efficient form.
9251 (define_expand "movmemsi_6reg"
9252 [(parallel [(set (match_operand 0 "" "")
9253 (match_operand 1 "" ""))
9254 (use (match_operand 2 "" ""))
9255 (use (match_operand 3 "" ""))
9256 (clobber (reg:SI 5))
9257 (clobber (reg:SI 6))
9258 (clobber (reg:SI 7))
9259 (clobber (reg:SI 8))
9260 (clobber (reg:SI 9))
9261 (clobber (reg:SI 10))
9262 (clobber (match_scratch:SI 4 ""))])]
9267 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9268 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9269 (use (match_operand:SI 2 "immediate_operand" "i"))
9270 (use (match_operand:SI 3 "immediate_operand" "i"))
9271 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9272 (clobber (reg:SI 6))
9273 (clobber (reg:SI 7))
9274 (clobber (reg:SI 8))
9275 (clobber (reg:SI 9))
9276 (clobber (reg:SI 10))
9277 (clobber (match_scratch:SI 5 "=q"))]
9278 "TARGET_STRING && TARGET_POWER
9279 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9280 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9281 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9282 && REGNO (operands[4]) == 5"
9283 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9284 [(set_attr "type" "load")
9285 (set_attr "length" "8")])
9288 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9289 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9290 (use (match_operand:SI 2 "immediate_operand" "i"))
9291 (use (match_operand:SI 3 "immediate_operand" "i"))
9292 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9293 (clobber (reg:SI 6))
9294 (clobber (reg:SI 7))
9295 (clobber (reg:SI 8))
9296 (clobber (reg:SI 9))
9297 (clobber (reg:SI 10))
9298 (clobber (match_scratch:SI 5 "X"))]
9299 "TARGET_STRING && ! TARGET_POWER
9300 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9301 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9302 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9303 && REGNO (operands[4]) == 5"
9304 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9305 [(set_attr "type" "load")
9306 (set_attr "length" "8")])
9309 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9310 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9311 (use (match_operand:SI 2 "immediate_operand" "i"))
9312 (use (match_operand:SI 3 "immediate_operand" "i"))
9313 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9314 (clobber (reg:SI 6))
9315 (clobber (reg:SI 7))
9316 (clobber (reg:SI 8))
9317 (clobber (reg:SI 9))
9318 (clobber (reg:SI 10))
9319 (clobber (match_scratch:SI 5 "X"))]
9320 "TARGET_STRING && TARGET_POWERPC64
9321 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9322 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9323 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9324 && REGNO (operands[4]) == 5"
9325 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9326 [(set_attr "type" "load")
9327 (set_attr "length" "8")])
9329 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9330 ;; problems with TImode.
9331 ;; rD/rS = r5 is preferred, efficient form.
9332 (define_expand "movmemsi_4reg"
9333 [(parallel [(set (match_operand 0 "" "")
9334 (match_operand 1 "" ""))
9335 (use (match_operand 2 "" ""))
9336 (use (match_operand 3 "" ""))
9337 (clobber (reg:SI 5))
9338 (clobber (reg:SI 6))
9339 (clobber (reg:SI 7))
9340 (clobber (reg:SI 8))
9341 (clobber (match_scratch:SI 4 ""))])]
9346 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9347 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9348 (use (match_operand:SI 2 "immediate_operand" "i"))
9349 (use (match_operand:SI 3 "immediate_operand" "i"))
9350 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9351 (clobber (reg:SI 6))
9352 (clobber (reg:SI 7))
9353 (clobber (reg:SI 8))
9354 (clobber (match_scratch:SI 5 "=q"))]
9355 "TARGET_STRING && TARGET_POWER
9356 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9357 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9358 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9359 && REGNO (operands[4]) == 5"
9360 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9361 [(set_attr "type" "load")
9362 (set_attr "length" "8")])
9365 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9366 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9367 (use (match_operand:SI 2 "immediate_operand" "i"))
9368 (use (match_operand:SI 3 "immediate_operand" "i"))
9369 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9370 (clobber (reg:SI 6))
9371 (clobber (reg:SI 7))
9372 (clobber (reg:SI 8))
9373 (clobber (match_scratch:SI 5 "X"))]
9374 "TARGET_STRING && ! TARGET_POWER
9375 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9376 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9377 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9378 && REGNO (operands[4]) == 5"
9379 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9380 [(set_attr "type" "load")
9381 (set_attr "length" "8")])
9384 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9385 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9386 (use (match_operand:SI 2 "immediate_operand" "i"))
9387 (use (match_operand:SI 3 "immediate_operand" "i"))
9388 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9389 (clobber (reg:SI 6))
9390 (clobber (reg:SI 7))
9391 (clobber (reg:SI 8))
9392 (clobber (match_scratch:SI 5 "X"))]
9393 "TARGET_STRING && TARGET_POWERPC64
9394 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9395 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9396 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9397 && REGNO (operands[4]) == 5"
9398 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9399 [(set_attr "type" "load")
9400 (set_attr "length" "8")])
9402 ;; Move up to 8 bytes at a time.
9403 (define_expand "movmemsi_2reg"
9404 [(parallel [(set (match_operand 0 "" "")
9405 (match_operand 1 "" ""))
9406 (use (match_operand 2 "" ""))
9407 (use (match_operand 3 "" ""))
9408 (clobber (match_scratch:DI 4 ""))
9409 (clobber (match_scratch:SI 5 ""))])]
9410 "TARGET_STRING && ! TARGET_POWERPC64"
9414 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9415 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9416 (use (match_operand:SI 2 "immediate_operand" "i"))
9417 (use (match_operand:SI 3 "immediate_operand" "i"))
9418 (clobber (match_scratch:DI 4 "=&r"))
9419 (clobber (match_scratch:SI 5 "=q"))]
9420 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9421 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9422 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9423 [(set_attr "type" "load")
9424 (set_attr "length" "8")])
9427 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9428 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9429 (use (match_operand:SI 2 "immediate_operand" "i"))
9430 (use (match_operand:SI 3 "immediate_operand" "i"))
9431 (clobber (match_scratch:DI 4 "=&r"))
9432 (clobber (match_scratch:SI 5 "X"))]
9433 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9434 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9435 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9436 [(set_attr "type" "load")
9437 (set_attr "length" "8")])
9439 ;; Move up to 4 bytes at a time.
9440 (define_expand "movmemsi_1reg"
9441 [(parallel [(set (match_operand 0 "" "")
9442 (match_operand 1 "" ""))
9443 (use (match_operand 2 "" ""))
9444 (use (match_operand 3 "" ""))
9445 (clobber (match_scratch:SI 4 ""))
9446 (clobber (match_scratch:SI 5 ""))])]
9451 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9452 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9453 (use (match_operand:SI 2 "immediate_operand" "i"))
9454 (use (match_operand:SI 3 "immediate_operand" "i"))
9455 (clobber (match_scratch:SI 4 "=&r"))
9456 (clobber (match_scratch:SI 5 "=q"))]
9457 "TARGET_STRING && TARGET_POWER
9458 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9459 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9460 [(set_attr "type" "load")
9461 (set_attr "length" "8")])
9464 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9465 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9466 (use (match_operand:SI 2 "immediate_operand" "i"))
9467 (use (match_operand:SI 3 "immediate_operand" "i"))
9468 (clobber (match_scratch:SI 4 "=&r"))
9469 (clobber (match_scratch:SI 5 "X"))]
9470 "TARGET_STRING && ! TARGET_POWER
9471 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9472 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9473 [(set_attr "type" "load")
9474 (set_attr "length" "8")])
9477 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9478 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9479 (use (match_operand:SI 2 "immediate_operand" "i"))
9480 (use (match_operand:SI 3 "immediate_operand" "i"))
9481 (clobber (match_scratch:SI 4 "=&r"))
9482 (clobber (match_scratch:SI 5 "X"))]
9483 "TARGET_STRING && TARGET_POWERPC64
9484 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9485 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9486 [(set_attr "type" "load")
9487 (set_attr "length" "8")])
9490 ;; Define insns that do load or store with update. Some of these we can
9491 ;; get by using pre-decrement or pre-increment, but the hardware can also
9492 ;; do cases where the increment is not the size of the object.
9494 ;; In all these cases, we use operands 0 and 1 for the register being
9495 ;; incremented because those are the operands that local-alloc will
9496 ;; tie and these are the pair most likely to be tieable (and the ones
9497 ;; that will benefit the most).
9499 (define_insn "*movdi_update1"
9500 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9501 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9502 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9503 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9504 (plus:DI (match_dup 1) (match_dup 2)))]
9505 "TARGET_POWERPC64 && TARGET_UPDATE"
9509 [(set_attr "type" "load_ux,load_u")])
9511 (define_insn "movdi_<mode>_update"
9512 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9513 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9514 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9515 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9516 (plus:P (match_dup 1) (match_dup 2)))]
9517 "TARGET_POWERPC64 && TARGET_UPDATE"
9521 [(set_attr "type" "store_ux,store_u")])
9523 (define_insn "*movsi_update1"
9524 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9525 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9526 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9527 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9528 (plus:SI (match_dup 1) (match_dup 2)))]
9531 {lux|lwzux} %3,%0,%2
9532 {lu|lwzu} %3,%2(%0)"
9533 [(set_attr "type" "load_ux,load_u")])
9535 (define_insn "*movsi_update2"
9536 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9538 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9539 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9540 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9541 (plus:DI (match_dup 1) (match_dup 2)))]
9544 [(set_attr "type" "load_ext_ux")])
9546 (define_insn "movsi_update"
9547 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9548 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9549 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9550 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9551 (plus:SI (match_dup 1) (match_dup 2)))]
9554 {stux|stwux} %3,%0,%2
9555 {stu|stwu} %3,%2(%0)"
9556 [(set_attr "type" "store_ux,store_u")])
9558 (define_insn "*movhi_update1"
9559 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9560 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9561 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9562 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9563 (plus:SI (match_dup 1) (match_dup 2)))]
9568 [(set_attr "type" "load_ux,load_u")])
9570 (define_insn "*movhi_update2"
9571 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9573 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9574 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9575 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9576 (plus:SI (match_dup 1) (match_dup 2)))]
9581 [(set_attr "type" "load_ux,load_u")])
9583 (define_insn "*movhi_update3"
9584 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9586 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9587 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9588 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9589 (plus:SI (match_dup 1) (match_dup 2)))]
9594 [(set_attr "type" "load_ext_ux,load_ext_u")])
9596 (define_insn "*movhi_update4"
9597 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9598 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9599 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9600 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9601 (plus:SI (match_dup 1) (match_dup 2)))]
9606 [(set_attr "type" "store_ux,store_u")])
9608 (define_insn "*movqi_update1"
9609 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9610 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9611 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9612 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9613 (plus:SI (match_dup 1) (match_dup 2)))]
9618 [(set_attr "type" "load_ux,load_u")])
9620 (define_insn "*movqi_update2"
9621 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9623 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9624 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9625 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9626 (plus:SI (match_dup 1) (match_dup 2)))]
9631 [(set_attr "type" "load_ux,load_u")])
9633 (define_insn "*movqi_update3"
9634 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9635 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9636 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9637 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9638 (plus:SI (match_dup 1) (match_dup 2)))]
9643 [(set_attr "type" "store_ux,store_u")])
9645 (define_insn "*movsf_update1"
9646 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9647 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9648 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9649 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9650 (plus:SI (match_dup 1) (match_dup 2)))]
9651 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9655 [(set_attr "type" "fpload_ux,fpload_u")])
9657 (define_insn "*movsf_update2"
9658 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9659 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9660 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9661 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9662 (plus:SI (match_dup 1) (match_dup 2)))]
9663 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9667 [(set_attr "type" "fpstore_ux,fpstore_u")])
9669 (define_insn "*movsf_update3"
9670 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9671 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9672 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9673 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9674 (plus:SI (match_dup 1) (match_dup 2)))]
9675 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9677 {lux|lwzux} %3,%0,%2
9678 {lu|lwzu} %3,%2(%0)"
9679 [(set_attr "type" "load_ux,load_u")])
9681 (define_insn "*movsf_update4"
9682 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9683 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9684 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9685 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9686 (plus:SI (match_dup 1) (match_dup 2)))]
9687 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9689 {stux|stwux} %3,%0,%2
9690 {stu|stwu} %3,%2(%0)"
9691 [(set_attr "type" "store_ux,store_u")])
9693 (define_insn "*movdf_update1"
9694 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9695 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9696 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9697 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9698 (plus:SI (match_dup 1) (match_dup 2)))]
9699 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9703 [(set_attr "type" "fpload_ux,fpload_u")])
9705 (define_insn "*movdf_update2"
9706 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9707 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9708 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9709 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9710 (plus:SI (match_dup 1) (match_dup 2)))]
9711 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9715 [(set_attr "type" "fpstore_ux,fpstore_u")])
9717 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9719 (define_insn "*lfq_power2"
9720 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9721 (match_operand:TF 1 "memory_operand" ""))]
9723 && TARGET_HARD_FLOAT && TARGET_FPRS"
9727 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9728 (match_operand:DF 1 "memory_operand" ""))
9729 (set (match_operand:DF 2 "gpc_reg_operand" "")
9730 (match_operand:DF 3 "memory_operand" ""))]
9732 && TARGET_HARD_FLOAT && TARGET_FPRS
9733 && registers_ok_for_quad_peep (operands[0], operands[2])
9734 && mems_ok_for_quad_peep (operands[1], operands[3])"
9737 "operands[1] = widen_memory_access (operands[1], TFmode, 0);
9738 operands[0] = gen_rtx_REG (TFmode, REGNO (operands[0]));")
9740 (define_insn "*stfq_power2"
9741 [(set (match_operand:TF 0 "memory_operand" "")
9742 (match_operand:TF 1 "gpc_reg_operand" "f"))]
9744 && TARGET_HARD_FLOAT && TARGET_FPRS"
9749 [(set (match_operand:DF 0 "memory_operand" "")
9750 (match_operand:DF 1 "gpc_reg_operand" ""))
9751 (set (match_operand:DF 2 "memory_operand" "")
9752 (match_operand:DF 3 "gpc_reg_operand" ""))]
9754 && TARGET_HARD_FLOAT && TARGET_FPRS
9755 && registers_ok_for_quad_peep (operands[1], operands[3])
9756 && mems_ok_for_quad_peep (operands[0], operands[2])"
9759 "operands[0] = widen_memory_access (operands[0], TFmode, 0);
9760 operands[1] = gen_rtx_REG (TFmode, REGNO (operands[1]));")
9762 ;; after inserting conditional returns we can sometimes have
9763 ;; unnecessary register moves. Unfortunately we cannot have a
9764 ;; modeless peephole here, because some single SImode sets have early
9765 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9766 ;; sequences, using get_attr_length here will smash the operands
9767 ;; array. Neither is there an early_cobbler_p predicate.
9769 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9770 (match_operand:DF 1 "any_operand" ""))
9771 (set (match_operand:DF 2 "gpc_reg_operand" "")
9773 "peep2_reg_dead_p (2, operands[0])"
9774 [(set (match_dup 2) (match_dup 1))])
9777 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9778 (match_operand:SF 1 "any_operand" ""))
9779 (set (match_operand:SF 2 "gpc_reg_operand" "")
9781 "peep2_reg_dead_p (2, operands[0])"
9782 [(set (match_dup 2) (match_dup 1))])
9787 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9788 (define_insn "tls_gd_32"
9789 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9790 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9791 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9793 "HAVE_AS_TLS && !TARGET_64BIT"
9794 "addi %0,%1,%2@got@tlsgd")
9796 (define_insn "tls_gd_64"
9797 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9798 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9799 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9801 "HAVE_AS_TLS && TARGET_64BIT"
9802 "addi %0,%1,%2@got@tlsgd")
9804 (define_insn "tls_ld_32"
9805 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9806 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9808 "HAVE_AS_TLS && !TARGET_64BIT"
9809 "addi %0,%1,%&@got@tlsld")
9811 (define_insn "tls_ld_64"
9812 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9813 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9815 "HAVE_AS_TLS && TARGET_64BIT"
9816 "addi %0,%1,%&@got@tlsld")
9818 (define_insn "tls_dtprel_32"
9819 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9820 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9821 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9823 "HAVE_AS_TLS && !TARGET_64BIT"
9824 "addi %0,%1,%2@dtprel")
9826 (define_insn "tls_dtprel_64"
9827 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9828 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9829 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9831 "HAVE_AS_TLS && TARGET_64BIT"
9832 "addi %0,%1,%2@dtprel")
9834 (define_insn "tls_dtprel_ha_32"
9835 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9836 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9837 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9838 UNSPEC_TLSDTPRELHA))]
9839 "HAVE_AS_TLS && !TARGET_64BIT"
9840 "addis %0,%1,%2@dtprel@ha")
9842 (define_insn "tls_dtprel_ha_64"
9843 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9844 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9845 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9846 UNSPEC_TLSDTPRELHA))]
9847 "HAVE_AS_TLS && TARGET_64BIT"
9848 "addis %0,%1,%2@dtprel@ha")
9850 (define_insn "tls_dtprel_lo_32"
9851 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9852 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9853 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9854 UNSPEC_TLSDTPRELLO))]
9855 "HAVE_AS_TLS && !TARGET_64BIT"
9856 "addi %0,%1,%2@dtprel@l")
9858 (define_insn "tls_dtprel_lo_64"
9859 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9860 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9861 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9862 UNSPEC_TLSDTPRELLO))]
9863 "HAVE_AS_TLS && TARGET_64BIT"
9864 "addi %0,%1,%2@dtprel@l")
9866 (define_insn "tls_got_dtprel_32"
9867 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9868 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9869 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9870 UNSPEC_TLSGOTDTPREL))]
9871 "HAVE_AS_TLS && !TARGET_64BIT"
9872 "lwz %0,%2@got@dtprel(%1)")
9874 (define_insn "tls_got_dtprel_64"
9875 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9876 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9877 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9878 UNSPEC_TLSGOTDTPREL))]
9879 "HAVE_AS_TLS && TARGET_64BIT"
9880 "ld %0,%2@got@dtprel(%1)")
9882 (define_insn "tls_tprel_32"
9883 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9884 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9885 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9887 "HAVE_AS_TLS && !TARGET_64BIT"
9888 "addi %0,%1,%2@tprel")
9890 (define_insn "tls_tprel_64"
9891 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9892 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9893 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9895 "HAVE_AS_TLS && TARGET_64BIT"
9896 "addi %0,%1,%2@tprel")
9898 (define_insn "tls_tprel_ha_32"
9899 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9900 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9901 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9902 UNSPEC_TLSTPRELHA))]
9903 "HAVE_AS_TLS && !TARGET_64BIT"
9904 "addis %0,%1,%2@tprel@ha")
9906 (define_insn "tls_tprel_ha_64"
9907 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9908 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9909 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9910 UNSPEC_TLSTPRELHA))]
9911 "HAVE_AS_TLS && TARGET_64BIT"
9912 "addis %0,%1,%2@tprel@ha")
9914 (define_insn "tls_tprel_lo_32"
9915 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9916 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9917 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9918 UNSPEC_TLSTPRELLO))]
9919 "HAVE_AS_TLS && !TARGET_64BIT"
9920 "addi %0,%1,%2@tprel@l")
9922 (define_insn "tls_tprel_lo_64"
9923 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9924 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9925 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9926 UNSPEC_TLSTPRELLO))]
9927 "HAVE_AS_TLS && TARGET_64BIT"
9928 "addi %0,%1,%2@tprel@l")
9930 ;; "b" output constraint here and on tls_tls input to support linker tls
9931 ;; optimization. The linker may edit the instructions emitted by a
9932 ;; tls_got_tprel/tls_tls pair to addis,addi.
9933 (define_insn "tls_got_tprel_32"
9934 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9935 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9936 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9937 UNSPEC_TLSGOTTPREL))]
9938 "HAVE_AS_TLS && !TARGET_64BIT"
9939 "lwz %0,%2@got@tprel(%1)")
9941 (define_insn "tls_got_tprel_64"
9942 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9943 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9944 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9945 UNSPEC_TLSGOTTPREL))]
9946 "HAVE_AS_TLS && TARGET_64BIT"
9947 "ld %0,%2@got@tprel(%1)")
9949 (define_insn "tls_tls_32"
9950 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9951 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9952 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9954 "HAVE_AS_TLS && !TARGET_64BIT"
9957 (define_insn "tls_tls_64"
9958 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9959 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9960 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9962 "HAVE_AS_TLS && TARGET_64BIT"
9965 ;; Next come insns related to the calling sequence.
9967 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9968 ;; We move the back-chain and decrement the stack pointer.
9970 (define_expand "allocate_stack"
9971 [(set (match_operand 0 "gpc_reg_operand" "=r")
9972 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9974 (minus (reg 1) (match_dup 1)))]
9977 { rtx chain = gen_reg_rtx (Pmode);
9978 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9981 emit_move_insn (chain, stack_bot);
9983 /* Check stack bounds if necessary. */
9984 if (current_function_limit_stack)
9987 available = expand_binop (Pmode, sub_optab,
9988 stack_pointer_rtx, stack_limit_rtx,
9989 NULL_RTX, 1, OPTAB_WIDEN);
9990 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9993 if (GET_CODE (operands[1]) != CONST_INT
9994 || INTVAL (operands[1]) < -32767
9995 || INTVAL (operands[1]) > 32768)
9997 neg_op0 = gen_reg_rtx (Pmode);
9999 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10001 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10004 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10007 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
10008 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10012 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10013 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10014 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10017 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10021 ;; These patterns say how to save and restore the stack pointer. We need not
10022 ;; save the stack pointer at function level since we are careful to
10023 ;; preserve the backchain. At block level, we have to restore the backchain
10024 ;; when we restore the stack pointer.
10026 ;; For nonlocal gotos, we must save both the stack pointer and its
10027 ;; backchain and restore both. Note that in the nonlocal case, the
10028 ;; save area is a memory location.
10030 (define_expand "save_stack_function"
10031 [(match_operand 0 "any_operand" "")
10032 (match_operand 1 "any_operand" "")]
10036 (define_expand "restore_stack_function"
10037 [(match_operand 0 "any_operand" "")
10038 (match_operand 1 "any_operand" "")]
10042 (define_expand "restore_stack_block"
10043 [(use (match_operand 0 "register_operand" ""))
10044 (set (match_dup 2) (match_dup 3))
10045 (set (match_dup 0) (match_operand 1 "register_operand" ""))
10046 (set (match_dup 3) (match_dup 2))]
10050 operands[2] = gen_reg_rtx (Pmode);
10051 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
10054 (define_expand "save_stack_nonlocal"
10055 [(match_operand 0 "memory_operand" "")
10056 (match_operand 1 "register_operand" "")]
10060 rtx temp = gen_reg_rtx (Pmode);
10061 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10063 /* Copy the backchain to the first word, sp to the second. */
10064 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
10065 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
10066 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
10071 (define_expand "restore_stack_nonlocal"
10072 [(match_operand 0 "register_operand" "")
10073 (match_operand 1 "memory_operand" "")]
10077 rtx temp = gen_reg_rtx (Pmode);
10078 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10080 /* Restore the backchain from the first word, sp from the second. */
10081 emit_move_insn (temp,
10082 adjust_address_nv (operands[1], Pmode, 0));
10083 emit_move_insn (operands[0],
10084 adjust_address_nv (operands[1], Pmode, units_per_word));
10085 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
10089 ;; TOC register handling.
10091 ;; Code to initialize the TOC register...
10093 (define_insn "load_toc_aix_si"
10094 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10095 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10096 (use (reg:SI 2))])]
10097 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10101 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10102 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10103 operands[2] = gen_rtx_REG (Pmode, 2);
10104 return \"{l|lwz} %0,%1(%2)\";
10106 [(set_attr "type" "load")])
10108 (define_insn "load_toc_aix_di"
10109 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10110 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10111 (use (reg:DI 2))])]
10112 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10116 #ifdef TARGET_RELOCATABLE
10117 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10118 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10120 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10123 strcat (buf, \"@toc\");
10124 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10125 operands[2] = gen_rtx_REG (Pmode, 2);
10126 return \"ld %0,%1(%2)\";
10128 [(set_attr "type" "load")])
10130 (define_insn "load_toc_v4_pic_si"
10131 [(set (match_operand:SI 0 "register_operand" "=l")
10132 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10133 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10134 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10135 [(set_attr "type" "branch")
10136 (set_attr "length" "4")])
10138 (define_insn "load_toc_v4_PIC_1"
10139 [(set (match_operand:SI 0 "register_operand" "=l")
10140 (match_operand:SI 1 "immediate_operand" "s"))
10141 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
10142 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10143 "bcl 20,31,%1\\n%1:"
10144 [(set_attr "type" "branch")
10145 (set_attr "length" "4")])
10147 (define_insn "load_toc_v4_PIC_1b"
10148 [(set (match_operand:SI 0 "register_operand" "=l")
10149 (match_operand:SI 1 "immediate_operand" "s"))
10150 (use (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")]
10152 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10153 "bcl 20,31,%1+4\\n%1:\\n\\t.long %2-%1"
10154 [(set_attr "type" "branch")
10155 (set_attr "length" "8")])
10157 (define_insn "load_toc_v4_PIC_2"
10158 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10159 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10160 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10161 (match_operand:SI 3 "immediate_operand" "s")))))]
10162 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10163 "{l|lwz} %0,%2-%3(%1)"
10164 [(set_attr "type" "load")])
10167 ;; If the TOC is shared over a translation unit, as happens with all
10168 ;; the kinds of PIC that we support, we need to restore the TOC
10169 ;; pointer only when jumping over units of translation.
10170 ;; On Darwin, we need to reload the picbase.
10172 (define_expand "builtin_setjmp_receiver"
10173 [(use (label_ref (match_operand 0 "" "")))]
10174 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10175 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10176 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10180 if (DEFAULT_ABI == ABI_DARWIN)
10182 const char *picbase = machopic_function_base_name ();
10183 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10184 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10188 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10189 CODE_LABEL_NUMBER (operands[0]));
10190 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10192 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10193 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10197 rs6000_emit_load_toc_table (FALSE);
10201 ;; A function pointer under AIX is a pointer to a data area whose first word
10202 ;; contains the actual address of the function, whose second word contains a
10203 ;; pointer to its TOC, and whose third word contains a value to place in the
10204 ;; static chain register (r11). Note that if we load the static chain, our
10205 ;; "trampoline" need not have any executable code.
10207 (define_expand "call_indirect_aix32"
10208 [(set (match_dup 2)
10209 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10210 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10213 (mem:SI (plus:SI (match_dup 0)
10216 (mem:SI (plus:SI (match_dup 0)
10218 (parallel [(call (mem:SI (match_dup 2))
10219 (match_operand 1 "" ""))
10223 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10224 (clobber (scratch:SI))])]
10227 { operands[2] = gen_reg_rtx (SImode); }")
10229 (define_expand "call_indirect_aix64"
10230 [(set (match_dup 2)
10231 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10232 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10235 (mem:DI (plus:DI (match_dup 0)
10238 (mem:DI (plus:DI (match_dup 0)
10240 (parallel [(call (mem:SI (match_dup 2))
10241 (match_operand 1 "" ""))
10245 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10246 (clobber (scratch:SI))])]
10249 { operands[2] = gen_reg_rtx (DImode); }")
10251 (define_expand "call_value_indirect_aix32"
10252 [(set (match_dup 3)
10253 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10254 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10257 (mem:SI (plus:SI (match_dup 1)
10260 (mem:SI (plus:SI (match_dup 1)
10262 (parallel [(set (match_operand 0 "" "")
10263 (call (mem:SI (match_dup 3))
10264 (match_operand 2 "" "")))
10268 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10269 (clobber (scratch:SI))])]
10272 { operands[3] = gen_reg_rtx (SImode); }")
10274 (define_expand "call_value_indirect_aix64"
10275 [(set (match_dup 3)
10276 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10277 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10280 (mem:DI (plus:DI (match_dup 1)
10283 (mem:DI (plus:DI (match_dup 1)
10285 (parallel [(set (match_operand 0 "" "")
10286 (call (mem:SI (match_dup 3))
10287 (match_operand 2 "" "")))
10291 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10292 (clobber (scratch:SI))])]
10295 { operands[3] = gen_reg_rtx (DImode); }")
10297 ;; Now the definitions for the call and call_value insns
10298 (define_expand "call"
10299 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10300 (match_operand 1 "" ""))
10301 (use (match_operand 2 "" ""))
10302 (clobber (scratch:SI))])]
10307 if (MACHOPIC_INDIRECT)
10308 operands[0] = machopic_indirect_call_target (operands[0]);
10311 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10314 operands[0] = XEXP (operands[0], 0);
10316 if (GET_CODE (operands[0]) != SYMBOL_REF
10317 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10318 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10320 if (INTVAL (operands[2]) & CALL_LONG)
10321 operands[0] = rs6000_longcall_ref (operands[0]);
10323 if (DEFAULT_ABI == ABI_V4
10324 || DEFAULT_ABI == ABI_DARWIN)
10325 operands[0] = force_reg (Pmode, operands[0]);
10327 else if (DEFAULT_ABI == ABI_AIX)
10329 /* AIX function pointers are really pointers to a three word
10331 emit_call_insn (TARGET_32BIT
10332 ? gen_call_indirect_aix32 (force_reg (SImode,
10335 : gen_call_indirect_aix64 (force_reg (DImode,
10345 (define_expand "call_value"
10346 [(parallel [(set (match_operand 0 "" "")
10347 (call (mem:SI (match_operand 1 "address_operand" ""))
10348 (match_operand 2 "" "")))
10349 (use (match_operand 3 "" ""))
10350 (clobber (scratch:SI))])]
10355 if (MACHOPIC_INDIRECT)
10356 operands[1] = machopic_indirect_call_target (operands[1]);
10359 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10362 operands[1] = XEXP (operands[1], 0);
10364 if (GET_CODE (operands[1]) != SYMBOL_REF
10365 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10366 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10368 if (INTVAL (operands[3]) & CALL_LONG)
10369 operands[1] = rs6000_longcall_ref (operands[1]);
10371 if (DEFAULT_ABI == ABI_V4
10372 || DEFAULT_ABI == ABI_DARWIN)
10373 operands[1] = force_reg (Pmode, operands[1]);
10375 else if (DEFAULT_ABI == ABI_AIX)
10377 /* AIX function pointers are really pointers to a three word
10379 emit_call_insn (TARGET_32BIT
10380 ? gen_call_value_indirect_aix32 (operands[0],
10384 : gen_call_value_indirect_aix64 (operands[0],
10395 ;; Call to function in current module. No TOC pointer reload needed.
10396 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10397 ;; either the function was not prototyped, or it was prototyped as a
10398 ;; variable argument function. It is > 0 if FP registers were passed
10399 ;; and < 0 if they were not.
10401 (define_insn "*call_local32"
10402 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10403 (match_operand 1 "" "g,g"))
10404 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10405 (clobber (match_scratch:SI 3 "=l,l"))]
10406 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10409 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10410 output_asm_insn (\"crxor 6,6,6\", operands);
10412 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10413 output_asm_insn (\"creqv 6,6,6\", operands);
10415 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10417 [(set_attr "type" "branch")
10418 (set_attr "length" "4,8")])
10420 (define_insn "*call_local64"
10421 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10422 (match_operand 1 "" "g,g"))
10423 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10424 (clobber (match_scratch:SI 3 "=l,l"))]
10425 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10428 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10429 output_asm_insn (\"crxor 6,6,6\", operands);
10431 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10432 output_asm_insn (\"creqv 6,6,6\", operands);
10434 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10436 [(set_attr "type" "branch")
10437 (set_attr "length" "4,8")])
10439 (define_insn "*call_value_local32"
10440 [(set (match_operand 0 "" "")
10441 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10442 (match_operand 2 "" "g,g")))
10443 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10444 (clobber (match_scratch:SI 4 "=l,l"))]
10445 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10448 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10449 output_asm_insn (\"crxor 6,6,6\", operands);
10451 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10452 output_asm_insn (\"creqv 6,6,6\", operands);
10454 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10456 [(set_attr "type" "branch")
10457 (set_attr "length" "4,8")])
10460 (define_insn "*call_value_local64"
10461 [(set (match_operand 0 "" "")
10462 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10463 (match_operand 2 "" "g,g")))
10464 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10465 (clobber (match_scratch:SI 4 "=l,l"))]
10466 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10469 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10470 output_asm_insn (\"crxor 6,6,6\", operands);
10472 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10473 output_asm_insn (\"creqv 6,6,6\", operands);
10475 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10477 [(set_attr "type" "branch")
10478 (set_attr "length" "4,8")])
10480 ;; Call to function which may be in another module. Restore the TOC
10481 ;; pointer (r2) after the call unless this is System V.
10482 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10483 ;; either the function was not prototyped, or it was prototyped as a
10484 ;; variable argument function. It is > 0 if FP registers were passed
10485 ;; and < 0 if they were not.
10487 (define_insn "*call_indirect_nonlocal_aix32"
10488 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10489 (match_operand 1 "" "g"))
10493 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10494 (clobber (match_scratch:SI 2 "=l"))]
10495 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10496 "b%T0l\;{l|lwz} 2,20(1)"
10497 [(set_attr "type" "jmpreg")
10498 (set_attr "length" "8")])
10500 (define_insn "*call_nonlocal_aix32"
10501 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10502 (match_operand 1 "" "g"))
10503 (use (match_operand:SI 2 "immediate_operand" "O"))
10504 (clobber (match_scratch:SI 3 "=l"))]
10506 && DEFAULT_ABI == ABI_AIX
10507 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10509 [(set_attr "type" "branch")
10510 (set_attr "length" "8")])
10512 (define_insn "*call_indirect_nonlocal_aix64"
10513 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10514 (match_operand 1 "" "g"))
10518 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10519 (clobber (match_scratch:SI 2 "=l"))]
10520 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10521 "b%T0l\;ld 2,40(1)"
10522 [(set_attr "type" "jmpreg")
10523 (set_attr "length" "8")])
10525 (define_insn "*call_nonlocal_aix64"
10526 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10527 (match_operand 1 "" "g"))
10528 (use (match_operand:SI 2 "immediate_operand" "O"))
10529 (clobber (match_scratch:SI 3 "=l"))]
10531 && DEFAULT_ABI == ABI_AIX
10532 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10534 [(set_attr "type" "branch")
10535 (set_attr "length" "8")])
10537 (define_insn "*call_value_indirect_nonlocal_aix32"
10538 [(set (match_operand 0 "" "")
10539 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10540 (match_operand 2 "" "g")))
10544 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10545 (clobber (match_scratch:SI 3 "=l"))]
10546 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10547 "b%T1l\;{l|lwz} 2,20(1)"
10548 [(set_attr "type" "jmpreg")
10549 (set_attr "length" "8")])
10551 (define_insn "*call_value_nonlocal_aix32"
10552 [(set (match_operand 0 "" "")
10553 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10554 (match_operand 2 "" "g")))
10555 (use (match_operand:SI 3 "immediate_operand" "O"))
10556 (clobber (match_scratch:SI 4 "=l"))]
10558 && DEFAULT_ABI == ABI_AIX
10559 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10561 [(set_attr "type" "branch")
10562 (set_attr "length" "8")])
10564 (define_insn "*call_value_indirect_nonlocal_aix64"
10565 [(set (match_operand 0 "" "")
10566 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10567 (match_operand 2 "" "g")))
10571 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10572 (clobber (match_scratch:SI 3 "=l"))]
10573 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10574 "b%T1l\;ld 2,40(1)"
10575 [(set_attr "type" "jmpreg")
10576 (set_attr "length" "8")])
10578 (define_insn "*call_value_nonlocal_aix64"
10579 [(set (match_operand 0 "" "")
10580 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10581 (match_operand 2 "" "g")))
10582 (use (match_operand:SI 3 "immediate_operand" "O"))
10583 (clobber (match_scratch:SI 4 "=l"))]
10585 && DEFAULT_ABI == ABI_AIX
10586 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10588 [(set_attr "type" "branch")
10589 (set_attr "length" "8")])
10591 ;; A function pointer under System V is just a normal pointer
10592 ;; operands[0] is the function pointer
10593 ;; operands[1] is the stack size to clean up
10594 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10595 ;; which indicates how to set cr1
10597 (define_insn "*call_indirect_nonlocal_sysv"
10598 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10599 (match_operand 1 "" "g,g"))
10600 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10601 (clobber (match_scratch:SI 3 "=l,l"))]
10602 "DEFAULT_ABI == ABI_V4
10603 || DEFAULT_ABI == ABI_DARWIN"
10605 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10606 output_asm_insn ("crxor 6,6,6", operands);
10608 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10609 output_asm_insn ("creqv 6,6,6", operands);
10613 [(set_attr "type" "jmpreg,jmpreg")
10614 (set_attr "length" "4,8")])
10616 (define_insn "*call_nonlocal_sysv"
10617 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10618 (match_operand 1 "" "g,g"))
10619 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10620 (clobber (match_scratch:SI 3 "=l,l"))]
10621 "(DEFAULT_ABI == ABI_DARWIN
10622 || (DEFAULT_ABI == ABI_V4
10623 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10625 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10626 output_asm_insn ("crxor 6,6,6", operands);
10628 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10629 output_asm_insn ("creqv 6,6,6", operands);
10632 return output_call(insn, operands, 0, 2);
10634 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10637 [(set_attr "type" "branch,branch")
10638 (set_attr "length" "4,8")])
10640 (define_insn "*call_value_indirect_nonlocal_sysv"
10641 [(set (match_operand 0 "" "")
10642 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10643 (match_operand 2 "" "g,g")))
10644 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10645 (clobber (match_scratch:SI 4 "=l,l"))]
10646 "DEFAULT_ABI == ABI_V4
10647 || DEFAULT_ABI == ABI_DARWIN"
10649 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10650 output_asm_insn ("crxor 6,6,6", operands);
10652 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10653 output_asm_insn ("creqv 6,6,6", operands);
10657 [(set_attr "type" "jmpreg,jmpreg")
10658 (set_attr "length" "4,8")])
10660 (define_insn "*call_value_nonlocal_sysv"
10661 [(set (match_operand 0 "" "")
10662 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10663 (match_operand 2 "" "g,g")))
10664 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10665 (clobber (match_scratch:SI 4 "=l,l"))]
10666 "(DEFAULT_ABI == ABI_DARWIN
10667 || (DEFAULT_ABI == ABI_V4
10668 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10670 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10671 output_asm_insn ("crxor 6,6,6", operands);
10673 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10674 output_asm_insn ("creqv 6,6,6", operands);
10677 return output_call(insn, operands, 1, 3);
10679 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10682 [(set_attr "type" "branch,branch")
10683 (set_attr "length" "4,8")])
10685 ;; Call subroutine returning any type.
10686 (define_expand "untyped_call"
10687 [(parallel [(call (match_operand 0 "" "")
10689 (match_operand 1 "" "")
10690 (match_operand 2 "" "")])]
10696 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10698 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10700 rtx set = XVECEXP (operands[2], 0, i);
10701 emit_move_insn (SET_DEST (set), SET_SRC (set));
10704 /* The optimizer does not know that the call sets the function value
10705 registers we stored in the result block. We avoid problems by
10706 claiming that all hard registers are used and clobbered at this
10708 emit_insn (gen_blockage ());
10713 ;; sibling call patterns
10714 (define_expand "sibcall"
10715 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10716 (match_operand 1 "" ""))
10717 (use (match_operand 2 "" ""))
10718 (use (match_operand 3 "" ""))
10724 if (MACHOPIC_INDIRECT)
10725 operands[0] = machopic_indirect_call_target (operands[0]);
10728 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10731 operands[0] = XEXP (operands[0], 0);
10732 operands[3] = gen_reg_rtx (SImode);
10736 ;; this and similar patterns must be marked as using LR, otherwise
10737 ;; dataflow will try to delete the store into it. This is true
10738 ;; even when the actual reg to jump to is in CTR, when LR was
10739 ;; saved and restored around the PIC-setting BCL.
10740 (define_insn "*sibcall_local32"
10741 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10742 (match_operand 1 "" "g,g"))
10743 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10744 (use (match_operand:SI 3 "register_operand" "l,l"))
10746 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10749 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10750 output_asm_insn (\"crxor 6,6,6\", operands);
10752 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10753 output_asm_insn (\"creqv 6,6,6\", operands);
10755 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10757 [(set_attr "type" "branch")
10758 (set_attr "length" "4,8")])
10760 (define_insn "*sibcall_local64"
10761 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10762 (match_operand 1 "" "g,g"))
10763 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10764 (use (match_operand:SI 3 "register_operand" "l,l"))
10766 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10769 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10770 output_asm_insn (\"crxor 6,6,6\", operands);
10772 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10773 output_asm_insn (\"creqv 6,6,6\", operands);
10775 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10777 [(set_attr "type" "branch")
10778 (set_attr "length" "4,8")])
10780 (define_insn "*sibcall_value_local32"
10781 [(set (match_operand 0 "" "")
10782 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10783 (match_operand 2 "" "g,g")))
10784 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10785 (use (match_operand:SI 4 "register_operand" "l,l"))
10787 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10790 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10791 output_asm_insn (\"crxor 6,6,6\", operands);
10793 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10794 output_asm_insn (\"creqv 6,6,6\", operands);
10796 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10798 [(set_attr "type" "branch")
10799 (set_attr "length" "4,8")])
10802 (define_insn "*sibcall_value_local64"
10803 [(set (match_operand 0 "" "")
10804 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10805 (match_operand 2 "" "g,g")))
10806 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10807 (use (match_operand:SI 4 "register_operand" "l,l"))
10809 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10812 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10813 output_asm_insn (\"crxor 6,6,6\", operands);
10815 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10816 output_asm_insn (\"creqv 6,6,6\", operands);
10818 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10820 [(set_attr "type" "branch")
10821 (set_attr "length" "4,8")])
10823 (define_insn "*sibcall_nonlocal_aix32"
10824 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10825 (match_operand 1 "" "g"))
10826 (use (match_operand:SI 2 "immediate_operand" "O"))
10827 (use (match_operand:SI 3 "register_operand" "l"))
10830 && DEFAULT_ABI == ABI_AIX
10831 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10833 [(set_attr "type" "branch")
10834 (set_attr "length" "4")])
10836 (define_insn "*sibcall_nonlocal_aix64"
10837 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10838 (match_operand 1 "" "g"))
10839 (use (match_operand:SI 2 "immediate_operand" "O"))
10840 (use (match_operand:SI 3 "register_operand" "l"))
10843 && DEFAULT_ABI == ABI_AIX
10844 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10846 [(set_attr "type" "branch")
10847 (set_attr "length" "4")])
10849 (define_insn "*sibcall_value_nonlocal_aix32"
10850 [(set (match_operand 0 "" "")
10851 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10852 (match_operand 2 "" "g")))
10853 (use (match_operand:SI 3 "immediate_operand" "O"))
10854 (use (match_operand:SI 4 "register_operand" "l"))
10857 && DEFAULT_ABI == ABI_AIX
10858 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10860 [(set_attr "type" "branch")
10861 (set_attr "length" "4")])
10863 (define_insn "*sibcall_value_nonlocal_aix64"
10864 [(set (match_operand 0 "" "")
10865 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10866 (match_operand 2 "" "g")))
10867 (use (match_operand:SI 3 "immediate_operand" "O"))
10868 (use (match_operand:SI 4 "register_operand" "l"))
10871 && DEFAULT_ABI == ABI_AIX
10872 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10874 [(set_attr "type" "branch")
10875 (set_attr "length" "4")])
10877 (define_insn "*sibcall_nonlocal_sysv"
10878 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10879 (match_operand 1 "" ""))
10880 (use (match_operand 2 "immediate_operand" "O,n"))
10881 (use (match_operand:SI 3 "register_operand" "l,l"))
10883 "(DEFAULT_ABI == ABI_DARWIN
10884 || DEFAULT_ABI == ABI_V4)
10885 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10888 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10889 output_asm_insn (\"crxor 6,6,6\", operands);
10891 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10892 output_asm_insn (\"creqv 6,6,6\", operands);
10894 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
10896 [(set_attr "type" "branch,branch")
10897 (set_attr "length" "4,8")])
10899 (define_expand "sibcall_value"
10900 [(parallel [(set (match_operand 0 "register_operand" "")
10901 (call (mem:SI (match_operand 1 "address_operand" ""))
10902 (match_operand 2 "" "")))
10903 (use (match_operand 3 "" ""))
10904 (use (match_operand 4 "" ""))
10910 if (MACHOPIC_INDIRECT)
10911 operands[1] = machopic_indirect_call_target (operands[1]);
10914 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10917 operands[1] = XEXP (operands[1], 0);
10918 operands[4] = gen_reg_rtx (SImode);
10922 (define_insn "*sibcall_value_nonlocal_sysv"
10923 [(set (match_operand 0 "" "")
10924 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10925 (match_operand 2 "" "")))
10926 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10927 (use (match_operand:SI 4 "register_operand" "l,l"))
10929 "(DEFAULT_ABI == ABI_DARWIN
10930 || DEFAULT_ABI == ABI_V4)
10931 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10934 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10935 output_asm_insn (\"crxor 6,6,6\", operands);
10937 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10938 output_asm_insn (\"creqv 6,6,6\", operands);
10940 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
10942 [(set_attr "type" "branch,branch")
10943 (set_attr "length" "4,8")])
10945 (define_expand "sibcall_epilogue"
10946 [(use (const_int 0))]
10947 "TARGET_SCHED_PROLOG"
10950 rs6000_emit_epilogue (TRUE);
10954 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10955 ;; all of memory. This blocks insns from being moved across this point.
10957 (define_insn "blockage"
10958 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10962 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10963 ;; signed & unsigned, and one type of branch.
10965 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10966 ;; insns, and branches. We store the operands of compares until we see
10968 (define_expand "cmpsi"
10970 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10971 (match_operand:SI 1 "reg_or_short_operand" "")))]
10975 /* Take care of the possibility that operands[1] might be negative but
10976 this might be a logical operation. That insn doesn't exist. */
10977 if (GET_CODE (operands[1]) == CONST_INT
10978 && INTVAL (operands[1]) < 0)
10979 operands[1] = force_reg (SImode, operands[1]);
10981 rs6000_compare_op0 = operands[0];
10982 rs6000_compare_op1 = operands[1];
10983 rs6000_compare_fp_p = 0;
10987 (define_expand "cmpdi"
10989 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10990 (match_operand:DI 1 "reg_or_short_operand" "")))]
10994 /* Take care of the possibility that operands[1] might be negative but
10995 this might be a logical operation. That insn doesn't exist. */
10996 if (GET_CODE (operands[1]) == CONST_INT
10997 && INTVAL (operands[1]) < 0)
10998 operands[1] = force_reg (DImode, operands[1]);
11000 rs6000_compare_op0 = operands[0];
11001 rs6000_compare_op1 = operands[1];
11002 rs6000_compare_fp_p = 0;
11006 (define_expand "cmpsf"
11007 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
11008 (match_operand:SF 1 "gpc_reg_operand" "")))]
11009 "TARGET_HARD_FLOAT"
11012 rs6000_compare_op0 = operands[0];
11013 rs6000_compare_op1 = operands[1];
11014 rs6000_compare_fp_p = 1;
11018 (define_expand "cmpdf"
11019 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
11020 (match_operand:DF 1 "gpc_reg_operand" "")))]
11021 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
11024 rs6000_compare_op0 = operands[0];
11025 rs6000_compare_op1 = operands[1];
11026 rs6000_compare_fp_p = 1;
11030 (define_expand "cmptf"
11031 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
11032 (match_operand:TF 1 "gpc_reg_operand" "")))]
11033 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
11034 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11037 rs6000_compare_op0 = operands[0];
11038 rs6000_compare_op1 = operands[1];
11039 rs6000_compare_fp_p = 1;
11043 (define_expand "beq"
11044 [(use (match_operand 0 "" ""))]
11046 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11048 (define_expand "bne"
11049 [(use (match_operand 0 "" ""))]
11051 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11053 (define_expand "bge"
11054 [(use (match_operand 0 "" ""))]
11056 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11058 (define_expand "bgt"
11059 [(use (match_operand 0 "" ""))]
11061 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11063 (define_expand "ble"
11064 [(use (match_operand 0 "" ""))]
11066 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11068 (define_expand "blt"
11069 [(use (match_operand 0 "" ""))]
11071 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11073 (define_expand "bgeu"
11074 [(use (match_operand 0 "" ""))]
11076 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11078 (define_expand "bgtu"
11079 [(use (match_operand 0 "" ""))]
11081 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11083 (define_expand "bleu"
11084 [(use (match_operand 0 "" ""))]
11086 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11088 (define_expand "bltu"
11089 [(use (match_operand 0 "" ""))]
11091 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11093 (define_expand "bunordered"
11094 [(use (match_operand 0 "" ""))]
11095 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11096 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11098 (define_expand "bordered"
11099 [(use (match_operand 0 "" ""))]
11100 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11101 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11103 (define_expand "buneq"
11104 [(use (match_operand 0 "" ""))]
11106 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11108 (define_expand "bunge"
11109 [(use (match_operand 0 "" ""))]
11111 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11113 (define_expand "bungt"
11114 [(use (match_operand 0 "" ""))]
11116 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11118 (define_expand "bunle"
11119 [(use (match_operand 0 "" ""))]
11121 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11123 (define_expand "bunlt"
11124 [(use (match_operand 0 "" ""))]
11126 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11128 (define_expand "bltgt"
11129 [(use (match_operand 0 "" ""))]
11131 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11133 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11134 ;; For SEQ, likewise, except that comparisons with zero should be done
11135 ;; with an scc insns. However, due to the order that combine see the
11136 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11137 ;; the cases we don't want to handle.
11138 (define_expand "seq"
11139 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11141 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11143 (define_expand "sne"
11144 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11148 if (! rs6000_compare_fp_p)
11151 rs6000_emit_sCOND (NE, operands[0]);
11155 ;; A >= 0 is best done the portable way for A an integer.
11156 (define_expand "sge"
11157 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11161 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11164 rs6000_emit_sCOND (GE, operands[0]);
11168 ;; A > 0 is best done using the portable sequence, so fail in that case.
11169 (define_expand "sgt"
11170 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11174 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11177 rs6000_emit_sCOND (GT, operands[0]);
11181 ;; A <= 0 is best done the portable way for A an integer.
11182 (define_expand "sle"
11183 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11187 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11190 rs6000_emit_sCOND (LE, operands[0]);
11194 ;; A < 0 is best done in the portable way for A an integer.
11195 (define_expand "slt"
11196 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11200 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11203 rs6000_emit_sCOND (LT, operands[0]);
11207 (define_expand "sgeu"
11208 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11210 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11212 (define_expand "sgtu"
11213 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11215 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11217 (define_expand "sleu"
11218 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11220 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11222 (define_expand "sltu"
11223 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11225 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11227 (define_expand "sunordered"
11228 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11229 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11230 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11232 (define_expand "sordered"
11233 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11234 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11235 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11237 (define_expand "suneq"
11238 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11240 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11242 (define_expand "sunge"
11243 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11245 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11247 (define_expand "sungt"
11248 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11250 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11252 (define_expand "sunle"
11253 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11255 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11257 (define_expand "sunlt"
11258 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11260 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11262 (define_expand "sltgt"
11263 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11265 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11268 ;; Here are the actual compare insns.
11269 (define_insn "*cmpsi_internal1"
11270 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11271 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11272 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11274 "{cmp%I2|cmpw%I2} %0,%1,%2"
11275 [(set_attr "type" "cmp")])
11277 (define_insn "*cmpdi_internal1"
11278 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11279 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11280 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11283 [(set_attr "type" "cmp")])
11285 ;; If we are comparing a register for equality with a large constant,
11286 ;; we can do this with an XOR followed by a compare. But we need a scratch
11287 ;; register for the result of the XOR.
11290 [(set (match_operand:CC 0 "cc_reg_operand" "")
11291 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11292 (match_operand:SI 2 "non_short_cint_operand" "")))
11293 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11294 "find_single_use (operands[0], insn, 0)
11295 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11296 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11297 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11298 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11301 /* Get the constant we are comparing against, C, and see what it looks like
11302 sign-extended to 16 bits. Then see what constant could be XOR'ed
11303 with C to get the sign-extended value. */
11305 HOST_WIDE_INT c = INTVAL (operands[2]);
11306 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11307 HOST_WIDE_INT xorv = c ^ sextc;
11309 operands[4] = GEN_INT (xorv);
11310 operands[5] = GEN_INT (sextc);
11313 (define_insn "*cmpsi_internal2"
11314 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11315 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11316 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11318 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11319 [(set_attr "type" "cmp")])
11321 (define_insn "*cmpdi_internal2"
11322 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11323 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11324 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11326 "cmpld%I2 %0,%1,%b2"
11327 [(set_attr "type" "cmp")])
11329 ;; The following two insns don't exist as single insns, but if we provide
11330 ;; them, we can swap an add and compare, which will enable us to overlap more
11331 ;; of the required delay between a compare and branch. We generate code for
11332 ;; them by splitting.
11335 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11336 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11337 (match_operand:SI 2 "short_cint_operand" "i")))
11338 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11339 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11342 [(set_attr "length" "8")])
11345 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11346 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11347 (match_operand:SI 2 "u_short_cint_operand" "i")))
11348 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11349 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11352 [(set_attr "length" "8")])
11355 [(set (match_operand:CC 3 "cc_reg_operand" "")
11356 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11357 (match_operand:SI 2 "short_cint_operand" "")))
11358 (set (match_operand:SI 0 "gpc_reg_operand" "")
11359 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11361 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11362 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11365 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11366 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11367 (match_operand:SI 2 "u_short_cint_operand" "")))
11368 (set (match_operand:SI 0 "gpc_reg_operand" "")
11369 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11371 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11372 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11374 (define_insn "*cmpsf_internal1"
11375 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11376 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11377 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11378 "TARGET_HARD_FLOAT && TARGET_FPRS"
11380 [(set_attr "type" "fpcompare")])
11382 (define_insn "*cmpdf_internal1"
11383 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11384 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11385 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11386 "TARGET_HARD_FLOAT && TARGET_FPRS"
11388 [(set_attr "type" "fpcompare")])
11390 ;; Only need to compare second words if first words equal
11391 (define_insn "*cmptf_internal1"
11392 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11393 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11394 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11395 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
11396 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11397 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11398 [(set_attr "type" "fpcompare")
11399 (set_attr "length" "12")])
11401 (define_insn_and_split "*cmptf_internal2"
11402 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11403 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11404 (match_operand:TF 2 "gpc_reg_operand" "f")))
11405 (clobber (match_scratch:DF 3 "=f"))
11406 (clobber (match_scratch:DF 4 "=f"))
11407 (clobber (match_scratch:DF 5 "=f"))
11408 (clobber (match_scratch:DF 6 "=f"))
11409 (clobber (match_scratch:DF 7 "=f"))
11410 (clobber (match_scratch:DF 8 "=f"))
11411 (clobber (match_scratch:DF 9 "=f"))
11412 (clobber (match_scratch:DF 10 "=f"))]
11413 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
11414 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11416 "&& reload_completed"
11417 [(set (match_dup 3) (match_dup 13))
11418 (set (match_dup 4) (match_dup 14))
11419 (set (match_dup 9) (abs:DF (match_dup 5)))
11420 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11421 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11422 (label_ref (match_dup 11))
11424 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11425 (set (pc) (label_ref (match_dup 12)))
11427 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11428 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11429 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11430 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11433 REAL_VALUE_TYPE rv;
11434 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11435 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11437 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11438 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11439 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11440 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11441 operands[11] = gen_label_rtx ();
11442 operands[12] = gen_label_rtx ();
11444 operands[13] = force_const_mem (DFmode,
11445 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11446 operands[14] = force_const_mem (DFmode,
11447 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11451 operands[13] = gen_const_mem (DFmode,
11452 create_TOC_reference (XEXP (operands[13], 0)));
11453 operands[14] = gen_const_mem (DFmode,
11454 create_TOC_reference (XEXP (operands[14], 0)));
11455 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11456 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11460 ;; Now we have the scc insns. We can do some combinations because of the
11461 ;; way the machine works.
11463 ;; Note that this is probably faster if we can put an insn between the
11464 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11465 ;; cases the insns below which don't use an intermediate CR field will
11466 ;; be used instead.
11468 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11469 (match_operator:SI 1 "scc_comparison_operator"
11470 [(match_operand 2 "cc_reg_operand" "y")
11473 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11474 [(set (attr "type")
11475 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11476 (const_string "mfcrf")
11478 (const_string "mfcr")))
11479 (set_attr "length" "8")])
11481 ;; Same as above, but get the GT bit.
11482 (define_insn "move_from_CR_gt_bit"
11483 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11484 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11486 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11487 [(set_attr "type" "mfcr")
11488 (set_attr "length" "8")])
11490 ;; Same as above, but get the OV/ORDERED bit.
11491 (define_insn "move_from_CR_ov_bit"
11492 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11493 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11495 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11496 [(set_attr "type" "mfcr")
11497 (set_attr "length" "8")])
11500 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11501 (match_operator:DI 1 "scc_comparison_operator"
11502 [(match_operand 2 "cc_reg_operand" "y")
11505 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11506 [(set (attr "type")
11507 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11508 (const_string "mfcrf")
11510 (const_string "mfcr")))
11511 (set_attr "length" "8")])
11514 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11515 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11516 [(match_operand 2 "cc_reg_operand" "y,y")
11519 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11520 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11523 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11525 [(set_attr "type" "delayed_compare")
11526 (set_attr "length" "8,16")])
11529 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11530 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11531 [(match_operand 2 "cc_reg_operand" "")
11534 (set (match_operand:SI 3 "gpc_reg_operand" "")
11535 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11536 "TARGET_32BIT && reload_completed"
11537 [(set (match_dup 3)
11538 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11540 (compare:CC (match_dup 3)
11545 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11546 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11547 [(match_operand 2 "cc_reg_operand" "y")
11549 (match_operand:SI 3 "const_int_operand" "n")))]
11553 int is_bit = ccr_bit (operands[1], 1);
11554 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11557 if (is_bit >= put_bit)
11558 count = is_bit - put_bit;
11560 count = 32 - (put_bit - is_bit);
11562 operands[4] = GEN_INT (count);
11563 operands[5] = GEN_INT (put_bit);
11565 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11567 [(set (attr "type")
11568 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11569 (const_string "mfcrf")
11571 (const_string "mfcr")))
11572 (set_attr "length" "8")])
11575 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11577 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11578 [(match_operand 2 "cc_reg_operand" "y,y")
11580 (match_operand:SI 3 "const_int_operand" "n,n"))
11582 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11583 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11588 int is_bit = ccr_bit (operands[1], 1);
11589 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11592 /* Force split for non-cc0 compare. */
11593 if (which_alternative == 1)
11596 if (is_bit >= put_bit)
11597 count = is_bit - put_bit;
11599 count = 32 - (put_bit - is_bit);
11601 operands[5] = GEN_INT (count);
11602 operands[6] = GEN_INT (put_bit);
11604 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11606 [(set_attr "type" "delayed_compare")
11607 (set_attr "length" "8,16")])
11610 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11612 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11613 [(match_operand 2 "cc_reg_operand" "")
11615 (match_operand:SI 3 "const_int_operand" ""))
11617 (set (match_operand:SI 4 "gpc_reg_operand" "")
11618 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11621 [(set (match_dup 4)
11622 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11625 (compare:CC (match_dup 4)
11629 ;; There is a 3 cycle delay between consecutive mfcr instructions
11630 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11633 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11634 (match_operator:SI 1 "scc_comparison_operator"
11635 [(match_operand 2 "cc_reg_operand" "y")
11637 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11638 (match_operator:SI 4 "scc_comparison_operator"
11639 [(match_operand 5 "cc_reg_operand" "y")
11641 "REGNO (operands[2]) != REGNO (operands[5])"
11642 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11643 [(set_attr "type" "mfcr")
11644 (set_attr "length" "12")])
11647 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11648 (match_operator:DI 1 "scc_comparison_operator"
11649 [(match_operand 2 "cc_reg_operand" "y")
11651 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11652 (match_operator:DI 4 "scc_comparison_operator"
11653 [(match_operand 5 "cc_reg_operand" "y")
11655 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11656 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11657 [(set_attr "type" "mfcr")
11658 (set_attr "length" "12")])
11660 ;; There are some scc insns that can be done directly, without a compare.
11661 ;; These are faster because they don't involve the communications between
11662 ;; the FXU and branch units. In fact, we will be replacing all of the
11663 ;; integer scc insns here or in the portable methods in emit_store_flag.
11665 ;; Also support (neg (scc ..)) since that construct is used to replace
11666 ;; branches, (plus (scc ..) ..) since that construct is common and
11667 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11668 ;; cases where it is no more expensive than (neg (scc ..)).
11670 ;; Have reload force a constant into a register for the simple insns that
11671 ;; otherwise won't accept constants. We do this because it is faster than
11672 ;; the cmp/mfcr sequence we would otherwise generate.
11675 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11676 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11677 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11678 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11681 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11682 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11683 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11684 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11685 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11686 [(set_attr "type" "three,two,three,three,three")
11687 (set_attr "length" "12,8,12,12,12")])
11690 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11691 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11692 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11693 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11696 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11697 subfic %3,%1,0\;adde %0,%3,%1
11698 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11699 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11700 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11701 [(set_attr "type" "three,two,three,three,three")
11702 (set_attr "length" "12,8,12,12,12")])
11705 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11707 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11708 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11710 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11711 (eq:SI (match_dup 1) (match_dup 2)))
11712 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11715 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11716 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11717 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11718 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11719 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11725 [(set_attr "type" "compare")
11726 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11729 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11731 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11732 (match_operand:SI 2 "reg_or_cint_operand" ""))
11734 (set (match_operand:SI 0 "gpc_reg_operand" "")
11735 (eq:SI (match_dup 1) (match_dup 2)))
11736 (clobber (match_scratch:SI 3 ""))]
11737 "TARGET_32BIT && reload_completed"
11738 [(parallel [(set (match_dup 0)
11739 (eq:SI (match_dup 1) (match_dup 2)))
11740 (clobber (match_dup 3))])
11742 (compare:CC (match_dup 0)
11747 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11749 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11750 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11752 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11753 (eq:DI (match_dup 1) (match_dup 2)))
11754 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11757 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11758 subfic %3,%1,0\;adde. %0,%3,%1
11759 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11760 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11761 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11767 [(set_attr "type" "compare")
11768 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11771 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11773 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11774 (match_operand:DI 2 "reg_or_cint_operand" ""))
11776 (set (match_operand:DI 0 "gpc_reg_operand" "")
11777 (eq:DI (match_dup 1) (match_dup 2)))
11778 (clobber (match_scratch:DI 3 ""))]
11779 "TARGET_64BIT && reload_completed"
11780 [(parallel [(set (match_dup 0)
11781 (eq:DI (match_dup 1) (match_dup 2)))
11782 (clobber (match_dup 3))])
11784 (compare:CC (match_dup 0)
11788 ;; We have insns of the form shown by the first define_insn below. If
11789 ;; there is something inside the comparison operation, we must split it.
11791 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11792 (plus:SI (match_operator 1 "comparison_operator"
11793 [(match_operand:SI 2 "" "")
11794 (match_operand:SI 3
11795 "reg_or_cint_operand" "")])
11796 (match_operand:SI 4 "gpc_reg_operand" "")))
11797 (clobber (match_operand:SI 5 "register_operand" ""))]
11798 "! gpc_reg_operand (operands[2], SImode)"
11799 [(set (match_dup 5) (match_dup 2))
11800 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11804 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11805 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11806 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11807 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11810 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11811 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11812 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11813 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11814 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11815 [(set_attr "type" "three,two,three,three,three")
11816 (set_attr "length" "12,8,12,12,12")])
11819 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11822 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11823 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11824 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11826 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11829 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11830 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11831 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11832 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11833 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11839 [(set_attr "type" "compare")
11840 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11843 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11846 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11847 (match_operand:SI 2 "reg_or_cint_operand" ""))
11848 (match_operand:SI 3 "gpc_reg_operand" ""))
11850 (clobber (match_scratch:SI 4 ""))]
11851 "TARGET_32BIT && reload_completed"
11852 [(set (match_dup 4)
11853 (plus:SI (eq:SI (match_dup 1)
11857 (compare:CC (match_dup 4)
11862 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11865 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11866 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11867 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11869 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11870 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11873 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11874 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11875 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11876 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11877 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11883 [(set_attr "type" "compare")
11884 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11887 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11890 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11891 (match_operand:SI 2 "reg_or_cint_operand" ""))
11892 (match_operand:SI 3 "gpc_reg_operand" ""))
11894 (set (match_operand:SI 0 "gpc_reg_operand" "")
11895 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11896 "TARGET_32BIT && reload_completed"
11897 [(set (match_dup 0)
11898 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11900 (compare:CC (match_dup 0)
11905 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11906 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11907 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11910 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11911 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11912 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11913 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11914 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11915 [(set_attr "type" "three,two,three,three,three")
11916 (set_attr "length" "12,8,12,12,12")])
11918 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11919 ;; since it nabs/sr is just as fast.
11920 (define_insn "*ne0"
11921 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11922 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11924 (clobber (match_scratch:SI 2 "=&r"))]
11925 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11926 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11927 [(set_attr "type" "two")
11928 (set_attr "length" "8")])
11931 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11932 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11934 (clobber (match_scratch:DI 2 "=&r"))]
11936 "addic %2,%1,-1\;subfe %0,%2,%1"
11937 [(set_attr "type" "two")
11938 (set_attr "length" "8")])
11940 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11942 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11943 (plus:SI (lshiftrt:SI
11944 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11946 (match_operand:SI 2 "gpc_reg_operand" "r")))
11947 (clobber (match_scratch:SI 3 "=&r"))]
11949 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11950 [(set_attr "type" "two")
11951 (set_attr "length" "8")])
11954 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11955 (plus:DI (lshiftrt:DI
11956 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11958 (match_operand:DI 2 "gpc_reg_operand" "r")))
11959 (clobber (match_scratch:DI 3 "=&r"))]
11961 "addic %3,%1,-1\;addze %0,%2"
11962 [(set_attr "type" "two")
11963 (set_attr "length" "8")])
11966 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11968 (plus:SI (lshiftrt:SI
11969 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11971 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11973 (clobber (match_scratch:SI 3 "=&r,&r"))
11974 (clobber (match_scratch:SI 4 "=X,&r"))]
11977 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11979 [(set_attr "type" "compare")
11980 (set_attr "length" "8,12")])
11983 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11985 (plus:SI (lshiftrt:SI
11986 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11988 (match_operand:SI 2 "gpc_reg_operand" ""))
11990 (clobber (match_scratch:SI 3 ""))
11991 (clobber (match_scratch:SI 4 ""))]
11992 "TARGET_32BIT && reload_completed"
11993 [(parallel [(set (match_dup 3)
11994 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11997 (clobber (match_dup 4))])
11999 (compare:CC (match_dup 3)
12004 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12006 (plus:DI (lshiftrt:DI
12007 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12009 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12011 (clobber (match_scratch:DI 3 "=&r,&r"))]
12014 addic %3,%1,-1\;addze. %3,%2
12016 [(set_attr "type" "compare")
12017 (set_attr "length" "8,12")])
12020 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12022 (plus:DI (lshiftrt:DI
12023 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12025 (match_operand:DI 2 "gpc_reg_operand" ""))
12027 (clobber (match_scratch:DI 3 ""))]
12028 "TARGET_64BIT && reload_completed"
12029 [(set (match_dup 3)
12030 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12034 (compare:CC (match_dup 3)
12039 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12041 (plus:SI (lshiftrt:SI
12042 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12044 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12046 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12047 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12049 (clobber (match_scratch:SI 3 "=&r,&r"))]
12052 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12054 [(set_attr "type" "compare")
12055 (set_attr "length" "8,12")])
12058 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12060 (plus:SI (lshiftrt:SI
12061 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12063 (match_operand:SI 2 "gpc_reg_operand" ""))
12065 (set (match_operand:SI 0 "gpc_reg_operand" "")
12066 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12068 (clobber (match_scratch:SI 3 ""))]
12069 "TARGET_32BIT && reload_completed"
12070 [(parallel [(set (match_dup 0)
12071 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12073 (clobber (match_dup 3))])
12075 (compare:CC (match_dup 0)
12080 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12082 (plus:DI (lshiftrt:DI
12083 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12085 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12087 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12088 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12090 (clobber (match_scratch:DI 3 "=&r,&r"))]
12093 addic %3,%1,-1\;addze. %0,%2
12095 [(set_attr "type" "compare")
12096 (set_attr "length" "8,12")])
12099 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12101 (plus:DI (lshiftrt:DI
12102 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12104 (match_operand:DI 2 "gpc_reg_operand" ""))
12106 (set (match_operand:DI 0 "gpc_reg_operand" "")
12107 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12109 (clobber (match_scratch:DI 3 ""))]
12110 "TARGET_64BIT && reload_completed"
12111 [(parallel [(set (match_dup 0)
12112 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12114 (clobber (match_dup 3))])
12116 (compare:CC (match_dup 0)
12121 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12122 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12123 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12124 (clobber (match_scratch:SI 3 "=r,X"))]
12127 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12128 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12129 [(set_attr "length" "12")])
12132 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12134 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12135 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12137 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12138 (le:SI (match_dup 1) (match_dup 2)))
12139 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12142 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12143 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12146 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12147 (set_attr "length" "12,12,16,16")])
12150 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12152 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12153 (match_operand:SI 2 "reg_or_short_operand" ""))
12155 (set (match_operand:SI 0 "gpc_reg_operand" "")
12156 (le:SI (match_dup 1) (match_dup 2)))
12157 (clobber (match_scratch:SI 3 ""))]
12158 "TARGET_POWER && reload_completed"
12159 [(parallel [(set (match_dup 0)
12160 (le:SI (match_dup 1) (match_dup 2)))
12161 (clobber (match_dup 3))])
12163 (compare:CC (match_dup 0)
12168 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12169 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12170 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12171 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12174 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12175 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12176 [(set_attr "length" "12")])
12179 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12181 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12182 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12183 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12185 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12188 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12189 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12192 [(set_attr "type" "compare")
12193 (set_attr "length" "12,12,16,16")])
12196 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12198 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12199 (match_operand:SI 2 "reg_or_short_operand" ""))
12200 (match_operand:SI 3 "gpc_reg_operand" ""))
12202 (clobber (match_scratch:SI 4 ""))]
12203 "TARGET_POWER && reload_completed"
12204 [(set (match_dup 4)
12205 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12208 (compare:CC (match_dup 4)
12213 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12215 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12216 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12217 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12219 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12220 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12223 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12224 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12227 [(set_attr "type" "compare")
12228 (set_attr "length" "12,12,16,16")])
12231 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12233 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12234 (match_operand:SI 2 "reg_or_short_operand" ""))
12235 (match_operand:SI 3 "gpc_reg_operand" ""))
12237 (set (match_operand:SI 0 "gpc_reg_operand" "")
12238 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12239 "TARGET_POWER && reload_completed"
12240 [(set (match_dup 0)
12241 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12243 (compare:CC (match_dup 0)
12248 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12249 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12250 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12253 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12254 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12255 [(set_attr "length" "12")])
12258 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12259 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12260 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12262 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12263 [(set_attr "type" "three")
12264 (set_attr "length" "12")])
12267 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12268 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12269 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12271 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12272 [(set_attr "type" "three")
12273 (set_attr "length" "12")])
12276 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12278 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12279 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12281 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12282 (leu:DI (match_dup 1) (match_dup 2)))]
12285 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12287 [(set_attr "type" "compare")
12288 (set_attr "length" "12,16")])
12291 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12293 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12294 (match_operand:DI 2 "reg_or_short_operand" ""))
12296 (set (match_operand:DI 0 "gpc_reg_operand" "")
12297 (leu:DI (match_dup 1) (match_dup 2)))]
12298 "TARGET_64BIT && reload_completed"
12299 [(set (match_dup 0)
12300 (leu:DI (match_dup 1) (match_dup 2)))
12302 (compare:CC (match_dup 0)
12307 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12309 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12310 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12312 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12313 (leu:SI (match_dup 1) (match_dup 2)))]
12316 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12318 [(set_attr "type" "compare")
12319 (set_attr "length" "12,16")])
12322 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12324 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12325 (match_operand:SI 2 "reg_or_short_operand" ""))
12327 (set (match_operand:SI 0 "gpc_reg_operand" "")
12328 (leu:SI (match_dup 1) (match_dup 2)))]
12329 "TARGET_32BIT && reload_completed"
12330 [(set (match_dup 0)
12331 (leu:SI (match_dup 1) (match_dup 2)))
12333 (compare:CC (match_dup 0)
12338 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12339 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12340 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12341 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12343 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12344 [(set_attr "type" "two")
12345 (set_attr "length" "8")])
12348 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12350 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12351 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12352 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12354 (clobber (match_scratch:SI 4 "=&r,&r"))]
12357 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12359 [(set_attr "type" "compare")
12360 (set_attr "length" "8,12")])
12363 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12365 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12366 (match_operand:SI 2 "reg_or_short_operand" ""))
12367 (match_operand:SI 3 "gpc_reg_operand" ""))
12369 (clobber (match_scratch:SI 4 ""))]
12370 "TARGET_32BIT && reload_completed"
12371 [(set (match_dup 4)
12372 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12375 (compare:CC (match_dup 4)
12380 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12382 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12383 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12384 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12386 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12387 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12390 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12392 [(set_attr "type" "compare")
12393 (set_attr "length" "8,12")])
12396 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12398 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12399 (match_operand:SI 2 "reg_or_short_operand" ""))
12400 (match_operand:SI 3 "gpc_reg_operand" ""))
12402 (set (match_operand:SI 0 "gpc_reg_operand" "")
12403 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12404 "TARGET_32BIT && reload_completed"
12405 [(set (match_dup 0)
12406 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12408 (compare:CC (match_dup 0)
12413 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12414 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12415 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12417 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12418 [(set_attr "type" "three")
12419 (set_attr "length" "12")])
12422 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12424 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12425 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12426 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12428 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12429 [(set_attr "type" "three")
12430 (set_attr "length" "12")])
12433 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12436 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12437 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12438 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12440 (clobber (match_scratch:SI 4 "=&r,&r"))]
12443 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12445 [(set_attr "type" "compare")
12446 (set_attr "length" "12,16")])
12449 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12452 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12453 (match_operand:SI 2 "reg_or_short_operand" "")))
12454 (match_operand:SI 3 "gpc_reg_operand" ""))
12456 (clobber (match_scratch:SI 4 ""))]
12457 "TARGET_32BIT && reload_completed"
12458 [(set (match_dup 4)
12459 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12462 (compare:CC (match_dup 4)
12467 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12470 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12471 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12472 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12474 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12475 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12478 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12480 [(set_attr "type" "compare")
12481 (set_attr "length" "12,16")])
12484 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12487 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12488 (match_operand:SI 2 "reg_or_short_operand" "")))
12489 (match_operand:SI 3 "gpc_reg_operand" ""))
12491 (set (match_operand:SI 0 "gpc_reg_operand" "")
12492 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12493 "TARGET_32BIT && reload_completed"
12494 [(set (match_dup 0)
12495 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12498 (compare:CC (match_dup 0)
12503 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12504 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12505 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12507 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12508 [(set_attr "length" "12")])
12511 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12513 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12514 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12516 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12517 (lt:SI (match_dup 1) (match_dup 2)))]
12520 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12522 [(set_attr "type" "delayed_compare")
12523 (set_attr "length" "12,16")])
12526 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12528 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12529 (match_operand:SI 2 "reg_or_short_operand" ""))
12531 (set (match_operand:SI 0 "gpc_reg_operand" "")
12532 (lt:SI (match_dup 1) (match_dup 2)))]
12533 "TARGET_POWER && reload_completed"
12534 [(set (match_dup 0)
12535 (lt:SI (match_dup 1) (match_dup 2)))
12537 (compare:CC (match_dup 0)
12542 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12543 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12544 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12545 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12547 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12548 [(set_attr "length" "12")])
12551 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12553 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12554 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12555 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12557 (clobber (match_scratch:SI 4 "=&r,&r"))]
12560 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12562 [(set_attr "type" "compare")
12563 (set_attr "length" "12,16")])
12566 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12568 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12569 (match_operand:SI 2 "reg_or_short_operand" ""))
12570 (match_operand:SI 3 "gpc_reg_operand" ""))
12572 (clobber (match_scratch:SI 4 ""))]
12573 "TARGET_POWER && reload_completed"
12574 [(set (match_dup 4)
12575 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12578 (compare:CC (match_dup 4)
12583 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12585 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12586 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12587 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12589 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12590 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12593 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12595 [(set_attr "type" "compare")
12596 (set_attr "length" "12,16")])
12599 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12601 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12602 (match_operand:SI 2 "reg_or_short_operand" ""))
12603 (match_operand:SI 3 "gpc_reg_operand" ""))
12605 (set (match_operand:SI 0 "gpc_reg_operand" "")
12606 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12607 "TARGET_POWER && reload_completed"
12608 [(set (match_dup 0)
12609 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12611 (compare:CC (match_dup 0)
12616 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12617 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12618 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12620 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12621 [(set_attr "length" "12")])
12623 (define_insn_and_split ""
12624 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12625 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12626 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12630 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12631 (set (match_dup 0) (neg:SI (match_dup 0)))]
12634 (define_insn_and_split ""
12635 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12636 (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12637 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12641 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12642 (set (match_dup 0) (neg:DI (match_dup 0)))]
12646 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12648 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12649 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12651 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12652 (ltu:SI (match_dup 1) (match_dup 2)))]
12655 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12656 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12659 [(set_attr "type" "compare")
12660 (set_attr "length" "12,12,16,16")])
12663 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12665 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12666 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12668 (set (match_operand:SI 0 "gpc_reg_operand" "")
12669 (ltu:SI (match_dup 1) (match_dup 2)))]
12670 "TARGET_32BIT && reload_completed"
12671 [(set (match_dup 0)
12672 (ltu:SI (match_dup 1) (match_dup 2)))
12674 (compare:CC (match_dup 0)
12678 (define_insn_and_split ""
12679 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
12680 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12681 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12682 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12685 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12686 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12687 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
12690 (define_insn_and_split ""
12691 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
12692 (plus:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12693 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))
12694 (match_operand:DI 3 "reg_or_short_operand" "rI,rI")))]
12697 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12698 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12699 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
12703 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12705 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12706 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12707 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12709 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12712 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12713 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12716 [(set_attr "type" "compare")
12717 (set_attr "length" "12,12,16,16")])
12720 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12722 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12723 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12724 (match_operand:SI 3 "gpc_reg_operand" ""))
12726 (clobber (match_scratch:SI 4 ""))]
12727 "TARGET_32BIT && reload_completed"
12728 [(set (match_dup 4)
12729 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12732 (compare:CC (match_dup 4)
12737 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12739 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12740 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12741 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12743 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12744 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12747 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12748 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12751 [(set_attr "type" "compare")
12752 (set_attr "length" "12,12,16,16")])
12755 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12757 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12758 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12759 (match_operand:SI 3 "gpc_reg_operand" ""))
12761 (set (match_operand:SI 0 "gpc_reg_operand" "")
12762 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12763 "TARGET_32BIT && reload_completed"
12764 [(set (match_dup 0)
12765 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12767 (compare:CC (match_dup 0)
12772 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12773 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12774 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12777 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12778 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12779 [(set_attr "type" "two")
12780 (set_attr "length" "8")])
12783 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12784 (neg:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12785 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))))]
12788 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12789 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12790 [(set_attr "type" "two")
12791 (set_attr "length" "8")])
12794 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12795 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12796 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12797 (clobber (match_scratch:SI 3 "=r"))]
12799 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12800 [(set_attr "length" "12")])
12803 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12805 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12806 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12808 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12809 (ge:SI (match_dup 1) (match_dup 2)))
12810 (clobber (match_scratch:SI 3 "=r,r"))]
12813 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12815 [(set_attr "type" "compare")
12816 (set_attr "length" "12,16")])
12819 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12821 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12822 (match_operand:SI 2 "reg_or_short_operand" ""))
12824 (set (match_operand:SI 0 "gpc_reg_operand" "")
12825 (ge:SI (match_dup 1) (match_dup 2)))
12826 (clobber (match_scratch:SI 3 ""))]
12827 "TARGET_POWER && reload_completed"
12828 [(parallel [(set (match_dup 0)
12829 (ge:SI (match_dup 1) (match_dup 2)))
12830 (clobber (match_dup 3))])
12832 (compare:CC (match_dup 0)
12837 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12838 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12839 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12840 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12842 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12843 [(set_attr "length" "12")])
12846 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12848 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12849 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12850 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12852 (clobber (match_scratch:SI 4 "=&r,&r"))]
12855 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12857 [(set_attr "type" "compare")
12858 (set_attr "length" "12,16")])
12861 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12863 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12864 (match_operand:SI 2 "reg_or_short_operand" ""))
12865 (match_operand:SI 3 "gpc_reg_operand" ""))
12867 (clobber (match_scratch:SI 4 ""))]
12868 "TARGET_POWER && reload_completed"
12869 [(set (match_dup 4)
12870 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12873 (compare:CC (match_dup 4)
12878 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12880 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12881 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12882 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12884 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12885 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12888 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12890 [(set_attr "type" "compare")
12891 (set_attr "length" "12,16")])
12894 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12896 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12897 (match_operand:SI 2 "reg_or_short_operand" ""))
12898 (match_operand:SI 3 "gpc_reg_operand" ""))
12900 (set (match_operand:SI 0 "gpc_reg_operand" "")
12901 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12902 "TARGET_POWER && reload_completed"
12903 [(set (match_dup 0)
12904 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12906 (compare:CC (match_dup 0)
12911 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12912 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12913 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12915 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12916 [(set_attr "length" "12")])
12919 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12920 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12921 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12924 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12925 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12926 [(set_attr "type" "three")
12927 (set_attr "length" "12")])
12930 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12931 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12932 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12935 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12936 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12937 [(set_attr "type" "three")
12938 (set_attr "length" "12")])
12941 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12943 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12944 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12946 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12947 (geu:SI (match_dup 1) (match_dup 2)))]
12950 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12951 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12954 [(set_attr "type" "compare")
12955 (set_attr "length" "12,12,16,16")])
12958 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12960 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12961 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12963 (set (match_operand:SI 0 "gpc_reg_operand" "")
12964 (geu:SI (match_dup 1) (match_dup 2)))]
12965 "TARGET_32BIT && reload_completed"
12966 [(set (match_dup 0)
12967 (geu:SI (match_dup 1) (match_dup 2)))
12969 (compare:CC (match_dup 0)
12974 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12976 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12977 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12979 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12980 (geu:DI (match_dup 1) (match_dup 2)))]
12983 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12984 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12987 [(set_attr "type" "compare")
12988 (set_attr "length" "12,12,16,16")])
12991 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12993 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12994 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12996 (set (match_operand:DI 0 "gpc_reg_operand" "")
12997 (geu:DI (match_dup 1) (match_dup 2)))]
12998 "TARGET_64BIT && reload_completed"
12999 [(set (match_dup 0)
13000 (geu:DI (match_dup 1) (match_dup 2)))
13002 (compare:CC (match_dup 0)
13007 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13008 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13009 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
13010 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13013 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13014 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13015 [(set_attr "type" "two")
13016 (set_attr "length" "8")])
13019 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13021 (plus:SI (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\;{aze.|addze.} %4,%3
13029 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13032 [(set_attr "type" "compare")
13033 (set_attr "length" "8,8,12,12")])
13036 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13038 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13039 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13040 (match_operand:SI 3 "gpc_reg_operand" ""))
13042 (clobber (match_scratch:SI 4 ""))]
13043 "TARGET_32BIT && reload_completed"
13044 [(set (match_dup 4)
13045 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13048 (compare:CC (match_dup 4)
13053 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13055 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13056 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13057 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13059 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13060 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13063 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13064 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13067 [(set_attr "type" "compare")
13068 (set_attr "length" "8,8,12,12")])
13071 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13073 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13074 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13075 (match_operand:SI 3 "gpc_reg_operand" ""))
13077 (set (match_operand:SI 0 "gpc_reg_operand" "")
13078 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13079 "TARGET_32BIT && reload_completed"
13080 [(set (match_dup 0)
13081 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13083 (compare:CC (match_dup 0)
13088 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13089 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13090 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
13093 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13094 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13095 [(set_attr "type" "three")
13096 (set_attr "length" "12")])
13099 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13101 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13102 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
13103 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13106 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13107 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13108 [(set_attr "type" "three")
13109 (set_attr "length" "12")])
13112 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13115 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13116 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13117 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13119 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13122 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13123 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13126 [(set_attr "type" "compare")
13127 (set_attr "length" "12,12,16,16")])
13130 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13133 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13134 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13135 (match_operand:SI 3 "gpc_reg_operand" ""))
13137 (clobber (match_scratch:SI 4 ""))]
13138 "TARGET_32BIT && reload_completed"
13139 [(set (match_dup 4)
13140 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13143 (compare:CC (match_dup 4)
13148 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13151 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13152 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13153 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13155 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13156 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13159 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13160 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13163 [(set_attr "type" "compare")
13164 (set_attr "length" "12,12,16,16")])
13167 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13170 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13171 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13172 (match_operand:SI 3 "gpc_reg_operand" ""))
13174 (set (match_operand:SI 0 "gpc_reg_operand" "")
13175 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13176 "TARGET_32BIT && reload_completed"
13177 [(set (match_dup 0)
13178 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13180 (compare:CC (match_dup 0)
13185 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13186 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13189 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
13190 [(set_attr "type" "three")
13191 (set_attr "length" "12")])
13194 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13195 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13198 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
13199 [(set_attr "type" "three")
13200 (set_attr "length" "12")])
13203 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13205 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13208 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13209 (gt:SI (match_dup 1) (const_int 0)))]
13212 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
13214 [(set_attr "type" "delayed_compare")
13215 (set_attr "length" "12,16")])
13218 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13220 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13223 (set (match_operand:SI 0 "gpc_reg_operand" "")
13224 (gt:SI (match_dup 1) (const_int 0)))]
13225 "TARGET_32BIT && reload_completed"
13226 [(set (match_dup 0)
13227 (gt:SI (match_dup 1) (const_int 0)))
13229 (compare:CC (match_dup 0)
13234 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13236 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13239 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13240 (gt:DI (match_dup 1) (const_int 0)))]
13243 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
13245 [(set_attr "type" "delayed_compare")
13246 (set_attr "length" "12,16")])
13249 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13251 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13254 (set (match_operand:DI 0 "gpc_reg_operand" "")
13255 (gt:DI (match_dup 1) (const_int 0)))]
13256 "TARGET_64BIT && reload_completed"
13257 [(set (match_dup 0)
13258 (gt:DI (match_dup 1) (const_int 0)))
13260 (compare:CC (match_dup 0)
13265 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13266 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13267 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13269 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13270 [(set_attr "length" "12")])
13273 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13275 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13276 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13278 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13279 (gt:SI (match_dup 1) (match_dup 2)))]
13282 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13284 [(set_attr "type" "delayed_compare")
13285 (set_attr "length" "12,16")])
13288 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13290 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13291 (match_operand:SI 2 "reg_or_short_operand" ""))
13293 (set (match_operand:SI 0 "gpc_reg_operand" "")
13294 (gt:SI (match_dup 1) (match_dup 2)))]
13295 "TARGET_POWER && reload_completed"
13296 [(set (match_dup 0)
13297 (gt:SI (match_dup 1) (match_dup 2)))
13299 (compare:CC (match_dup 0)
13304 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13305 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13307 (match_operand:SI 2 "gpc_reg_operand" "r")))]
13309 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13310 [(set_attr "type" "three")
13311 (set_attr "length" "12")])
13314 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13315 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13317 (match_operand:DI 2 "gpc_reg_operand" "r")))]
13319 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13320 [(set_attr "type" "three")
13321 (set_attr "length" "12")])
13324 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13326 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13328 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13330 (clobber (match_scratch:SI 3 "=&r,&r"))]
13333 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13335 [(set_attr "type" "compare")
13336 (set_attr "length" "12,16")])
13339 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13341 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13343 (match_operand:SI 2 "gpc_reg_operand" ""))
13345 (clobber (match_scratch:SI 3 ""))]
13346 "TARGET_32BIT && reload_completed"
13347 [(set (match_dup 3)
13348 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13351 (compare:CC (match_dup 3)
13356 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13358 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13360 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13362 (clobber (match_scratch:DI 3 "=&r,&r"))]
13365 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13367 [(set_attr "type" "compare")
13368 (set_attr "length" "12,16")])
13371 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13373 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13375 (match_operand:DI 2 "gpc_reg_operand" ""))
13377 (clobber (match_scratch:DI 3 ""))]
13378 "TARGET_64BIT && reload_completed"
13379 [(set (match_dup 3)
13380 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13383 (compare:CC (match_dup 3)
13388 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13390 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13392 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13394 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13395 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13398 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13400 [(set_attr "type" "compare")
13401 (set_attr "length" "12,16")])
13404 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13406 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13408 (match_operand:SI 2 "gpc_reg_operand" ""))
13410 (set (match_operand:SI 0 "gpc_reg_operand" "")
13411 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13412 "TARGET_32BIT && reload_completed"
13413 [(set (match_dup 0)
13414 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13416 (compare:CC (match_dup 0)
13421 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13423 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13425 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13427 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13428 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13431 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13433 [(set_attr "type" "compare")
13434 (set_attr "length" "12,16")])
13437 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13439 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13441 (match_operand:DI 2 "gpc_reg_operand" ""))
13443 (set (match_operand:DI 0 "gpc_reg_operand" "")
13444 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13445 "TARGET_64BIT && reload_completed"
13446 [(set (match_dup 0)
13447 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13449 (compare:CC (match_dup 0)
13454 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13455 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13456 (match_operand:SI 2 "reg_or_short_operand" "r"))
13457 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13459 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13460 [(set_attr "length" "12")])
13463 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13465 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13466 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13467 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13469 (clobber (match_scratch:SI 4 "=&r,&r"))]
13472 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13474 [(set_attr "type" "compare")
13475 (set_attr "length" "12,16")])
13478 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13480 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13481 (match_operand:SI 2 "reg_or_short_operand" ""))
13482 (match_operand:SI 3 "gpc_reg_operand" ""))
13484 (clobber (match_scratch:SI 4 ""))]
13485 "TARGET_POWER && reload_completed"
13486 [(set (match_dup 4)
13487 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13489 (compare:CC (match_dup 4)
13494 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13496 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13497 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13498 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13500 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13501 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13504 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13506 [(set_attr "type" "compare")
13507 (set_attr "length" "12,16")])
13510 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13512 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13513 (match_operand:SI 2 "reg_or_short_operand" ""))
13514 (match_operand:SI 3 "gpc_reg_operand" ""))
13516 (set (match_operand:SI 0 "gpc_reg_operand" "")
13517 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13518 "TARGET_POWER && reload_completed"
13519 [(set (match_dup 0)
13520 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13522 (compare:CC (match_dup 0)
13527 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13528 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13531 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13532 [(set_attr "type" "three")
13533 (set_attr "length" "12")])
13536 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13537 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13540 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13541 [(set_attr "type" "three")
13542 (set_attr "length" "12")])
13545 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13546 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13547 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13549 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13550 [(set_attr "length" "12")])
13552 (define_insn_and_split ""
13553 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13554 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13555 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13559 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13560 (set (match_dup 0) (neg:SI (match_dup 0)))]
13563 (define_insn_and_split ""
13564 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13565 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13566 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13570 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13571 (set (match_dup 0) (neg:DI (match_dup 0)))]
13575 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13577 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13578 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13580 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13581 (gtu:SI (match_dup 1) (match_dup 2)))]
13584 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13586 [(set_attr "type" "compare")
13587 (set_attr "length" "12,16")])
13590 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13592 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13593 (match_operand:SI 2 "reg_or_short_operand" ""))
13595 (set (match_operand:SI 0 "gpc_reg_operand" "")
13596 (gtu:SI (match_dup 1) (match_dup 2)))]
13597 "TARGET_32BIT && reload_completed"
13598 [(set (match_dup 0)
13599 (gtu:SI (match_dup 1) (match_dup 2)))
13601 (compare:CC (match_dup 0)
13606 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13608 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13609 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13611 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13612 (gtu:DI (match_dup 1) (match_dup 2)))]
13615 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13617 [(set_attr "type" "compare")
13618 (set_attr "length" "12,16")])
13621 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13623 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13624 (match_operand:DI 2 "reg_or_short_operand" ""))
13626 (set (match_operand:DI 0 "gpc_reg_operand" "")
13627 (gtu:DI (match_dup 1) (match_dup 2)))]
13628 "TARGET_64BIT && reload_completed"
13629 [(set (match_dup 0)
13630 (gtu:DI (match_dup 1) (match_dup 2)))
13632 (compare:CC (match_dup 0)
13636 (define_insn_and_split ""
13637 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13638 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13639 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13640 (match_operand:SI 3 "reg_or_short_operand" "rI")))]
13643 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13644 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13645 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
13648 (define_insn_and_split ""
13649 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13650 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13651 (match_operand:DI 2 "reg_or_short_operand" "rI"))
13652 (match_operand:DI 3 "reg_or_short_operand" "rI")))]
13655 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13656 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13657 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
13661 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13663 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13664 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13665 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13667 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13670 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13671 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
13674 [(set_attr "type" "compare")
13675 (set_attr "length" "8,12,12,16")])
13678 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13680 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13681 (match_operand:SI 2 "reg_or_short_operand" ""))
13682 (match_operand:SI 3 "gpc_reg_operand" ""))
13684 (clobber (match_scratch:SI 4 ""))]
13685 "TARGET_32BIT && reload_completed"
13686 [(set (match_dup 4)
13687 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13690 (compare:CC (match_dup 4)
13695 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13697 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13698 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13699 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13701 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13704 addic %4,%1,%k2\;addze. %4,%3
13705 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subf. %4,%4,%3
13708 [(set_attr "type" "compare")
13709 (set_attr "length" "8,12,12,16")])
13712 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13714 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13715 (match_operand:DI 2 "reg_or_short_operand" ""))
13716 (match_operand:DI 3 "gpc_reg_operand" ""))
13718 (clobber (match_scratch:DI 4 ""))]
13719 "TARGET_64BIT && reload_completed"
13720 [(set (match_dup 4)
13721 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13724 (compare:CC (match_dup 4)
13729 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13731 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13732 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13733 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13735 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13736 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13739 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13740 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
13743 [(set_attr "type" "compare")
13744 (set_attr "length" "8,12,12,16")])
13747 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13749 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13750 (match_operand:SI 2 "reg_or_short_operand" ""))
13751 (match_operand:SI 3 "gpc_reg_operand" ""))
13753 (set (match_operand:SI 0 "gpc_reg_operand" "")
13754 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13755 "TARGET_32BIT && reload_completed"
13756 [(set (match_dup 0)
13757 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13759 (compare:CC (match_dup 0)
13764 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13766 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13767 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13768 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13770 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13771 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13774 addic %0,%1,%k2\;addze. %0,%3
13775 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf. %0,%0,%3
13778 [(set_attr "type" "compare")
13779 (set_attr "length" "8,12,12,16")])
13782 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13784 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13785 (match_operand:DI 2 "reg_or_short_operand" ""))
13786 (match_operand:DI 3 "gpc_reg_operand" ""))
13788 (set (match_operand:DI 0 "gpc_reg_operand" "")
13789 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13790 "TARGET_64BIT && reload_completed"
13791 [(set (match_dup 0)
13792 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13794 (compare:CC (match_dup 0)
13799 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13800 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13801 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13803 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13804 [(set_attr "type" "two")
13805 (set_attr "length" "8")])
13808 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13809 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13810 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13812 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13813 [(set_attr "type" "two")
13814 (set_attr "length" "8")])
13816 ;; Define both directions of branch and return. If we need a reload
13817 ;; register, we'd rather use CR0 since it is much easier to copy a
13818 ;; register CC value to there.
13822 (if_then_else (match_operator 1 "branch_comparison_operator"
13824 "cc_reg_operand" "y")
13826 (label_ref (match_operand 0 "" ""))
13831 return output_cbranch (operands[1], \"%l0\", 0, insn);
13833 [(set_attr "type" "branch")])
13837 (if_then_else (match_operator 0 "branch_comparison_operator"
13839 "cc_reg_operand" "y")
13846 return output_cbranch (operands[0], NULL, 0, insn);
13848 [(set_attr "type" "branch")
13849 (set_attr "length" "4")])
13853 (if_then_else (match_operator 1 "branch_comparison_operator"
13855 "cc_reg_operand" "y")
13858 (label_ref (match_operand 0 "" ""))))]
13862 return output_cbranch (operands[1], \"%l0\", 1, insn);
13864 [(set_attr "type" "branch")])
13868 (if_then_else (match_operator 0 "branch_comparison_operator"
13870 "cc_reg_operand" "y")
13877 return output_cbranch (operands[0], NULL, 1, insn);
13879 [(set_attr "type" "branch")
13880 (set_attr "length" "4")])
13882 ;; Logic on condition register values.
13884 ; This pattern matches things like
13885 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13886 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13888 ; which are generated by the branch logic.
13889 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13891 (define_insn "*cceq_ior_compare"
13892 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13893 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13894 [(match_operator:SI 2
13895 "branch_positive_comparison_operator"
13897 "cc_reg_operand" "y,y")
13899 (match_operator:SI 4
13900 "branch_positive_comparison_operator"
13902 "cc_reg_operand" "0,y")
13906 "cr%q1 %E0,%j2,%j4"
13907 [(set_attr "type" "cr_logical,delayed_cr")])
13909 ; Why is the constant -1 here, but 1 in the previous pattern?
13910 ; Because ~1 has all but the low bit set.
13912 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13913 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13914 [(not:SI (match_operator:SI 2
13915 "branch_positive_comparison_operator"
13917 "cc_reg_operand" "y,y")
13919 (match_operator:SI 4
13920 "branch_positive_comparison_operator"
13922 "cc_reg_operand" "0,y")
13926 "cr%q1 %E0,%j2,%j4"
13927 [(set_attr "type" "cr_logical,delayed_cr")])
13929 (define_insn "*cceq_rev_compare"
13930 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13931 (compare:CCEQ (match_operator:SI 1
13932 "branch_positive_comparison_operator"
13934 "cc_reg_operand" "0,y")
13938 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13939 [(set_attr "type" "cr_logical,delayed_cr")])
13941 ;; If we are comparing the result of two comparisons, this can be done
13942 ;; using creqv or crxor.
13944 (define_insn_and_split ""
13945 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13946 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13947 [(match_operand 2 "cc_reg_operand" "y")
13949 (match_operator 3 "branch_comparison_operator"
13950 [(match_operand 4 "cc_reg_operand" "y")
13955 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13959 int positive_1, positive_2;
13961 positive_1 = branch_positive_comparison_operator (operands[1],
13962 GET_MODE (operands[1]));
13963 positive_2 = branch_positive_comparison_operator (operands[3],
13964 GET_MODE (operands[3]));
13967 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13968 GET_CODE (operands[1])),
13970 operands[2], const0_rtx);
13971 else if (GET_MODE (operands[1]) != SImode)
13972 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13973 operands[2], const0_rtx);
13976 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13977 GET_CODE (operands[3])),
13979 operands[4], const0_rtx);
13980 else if (GET_MODE (operands[3]) != SImode)
13981 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13982 operands[4], const0_rtx);
13984 if (positive_1 == positive_2)
13986 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13987 operands[5] = constm1_rtx;
13991 operands[5] = const1_rtx;
13995 ;; Unconditional branch and return.
13997 (define_insn "jump"
13999 (label_ref (match_operand 0 "" "")))]
14002 [(set_attr "type" "branch")])
14004 (define_insn "return"
14008 [(set_attr "type" "jmpreg")])
14010 (define_expand "indirect_jump"
14011 [(set (pc) (match_operand 0 "register_operand" ""))]
14016 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
14018 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
14022 (define_insn "indirect_jumpsi"
14023 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
14028 [(set_attr "type" "jmpreg")])
14030 (define_insn "indirect_jumpdi"
14031 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
14036 [(set_attr "type" "jmpreg")])
14038 ;; Table jump for switch statements:
14039 (define_expand "tablejump"
14040 [(use (match_operand 0 "" ""))
14041 (use (label_ref (match_operand 1 "" "")))]
14046 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14048 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14052 (define_expand "tablejumpsi"
14053 [(set (match_dup 3)
14054 (plus:SI (match_operand:SI 0 "" "")
14056 (parallel [(set (pc) (match_dup 3))
14057 (use (label_ref (match_operand 1 "" "")))])]
14060 { operands[0] = force_reg (SImode, operands[0]);
14061 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14062 operands[3] = gen_reg_rtx (SImode);
14065 (define_expand "tablejumpdi"
14066 [(set (match_dup 4)
14067 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
14069 (plus:DI (match_dup 4)
14071 (parallel [(set (pc) (match_dup 3))
14072 (use (label_ref (match_operand 1 "" "")))])]
14075 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14076 operands[3] = gen_reg_rtx (DImode);
14077 operands[4] = gen_reg_rtx (DImode);
14082 (match_operand:SI 0 "register_operand" "c,*l"))
14083 (use (label_ref (match_operand 1 "" "")))]
14088 [(set_attr "type" "jmpreg")])
14092 (match_operand:DI 0 "register_operand" "c,*l"))
14093 (use (label_ref (match_operand 1 "" "")))]
14098 [(set_attr "type" "jmpreg")])
14103 "{cror 0,0,0|nop}")
14105 ;; Define the subtract-one-and-jump insns, starting with the template
14106 ;; so loop.c knows what to generate.
14108 (define_expand "doloop_end"
14109 [(use (match_operand 0 "" "")) ; loop pseudo
14110 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14111 (use (match_operand 2 "" "")) ; max iterations
14112 (use (match_operand 3 "" "")) ; loop level
14113 (use (match_operand 4 "" ""))] ; label
14117 /* Only use this on innermost loops. */
14118 if (INTVAL (operands[3]) > 1)
14122 if (GET_MODE (operands[0]) != DImode)
14124 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14128 if (GET_MODE (operands[0]) != SImode)
14130 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14135 (define_expand "ctrsi"
14136 [(parallel [(set (pc)
14137 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
14139 (label_ref (match_operand 1 "" ""))
14142 (plus:SI (match_dup 0)
14144 (clobber (match_scratch:CC 2 ""))
14145 (clobber (match_scratch:SI 3 ""))])]
14149 (define_expand "ctrdi"
14150 [(parallel [(set (pc)
14151 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
14153 (label_ref (match_operand 1 "" ""))
14156 (plus:DI (match_dup 0)
14158 (clobber (match_scratch:CC 2 ""))
14159 (clobber (match_scratch:DI 3 ""))])]
14163 ;; We need to be able to do this for any operand, including MEM, or we
14164 ;; will cause reload to blow up since we don't allow output reloads on
14166 ;; For the length attribute to be calculated correctly, the
14167 ;; label MUST be operand 0.
14169 (define_insn "*ctrsi_internal1"
14171 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14173 (label_ref (match_operand 0 "" ""))
14175 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14176 (plus:SI (match_dup 1)
14178 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14179 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14183 if (which_alternative != 0)
14185 else if (get_attr_length (insn) == 4)
14186 return \"{bdn|bdnz} %l0\";
14188 return \"bdz $+8\;b %l0\";
14190 [(set_attr "type" "branch")
14191 (set_attr "length" "*,12,16,16")])
14193 (define_insn "*ctrsi_internal2"
14195 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14198 (label_ref (match_operand 0 "" ""))))
14199 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14200 (plus:SI (match_dup 1)
14202 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14203 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14207 if (which_alternative != 0)
14209 else if (get_attr_length (insn) == 4)
14210 return \"bdz %l0\";
14212 return \"{bdn|bdnz} $+8\;b %l0\";
14214 [(set_attr "type" "branch")
14215 (set_attr "length" "*,12,16,16")])
14217 (define_insn "*ctrdi_internal1"
14219 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14221 (label_ref (match_operand 0 "" ""))
14223 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14224 (plus:DI (match_dup 1)
14226 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14227 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14231 if (which_alternative != 0)
14233 else if (get_attr_length (insn) == 4)
14234 return \"{bdn|bdnz} %l0\";
14236 return \"bdz $+8\;b %l0\";
14238 [(set_attr "type" "branch")
14239 (set_attr "length" "*,12,16,16")])
14241 (define_insn "*ctrdi_internal2"
14243 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14246 (label_ref (match_operand 0 "" ""))))
14247 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14248 (plus:DI (match_dup 1)
14250 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14251 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14255 if (which_alternative != 0)
14257 else if (get_attr_length (insn) == 4)
14258 return \"bdz %l0\";
14260 return \"{bdn|bdnz} $+8\;b %l0\";
14262 [(set_attr "type" "branch")
14263 (set_attr "length" "*,12,16,16")])
14265 ;; Similar but use EQ
14267 (define_insn "*ctrsi_internal5"
14269 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14271 (label_ref (match_operand 0 "" ""))
14273 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14274 (plus:SI (match_dup 1)
14276 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14277 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14281 if (which_alternative != 0)
14283 else if (get_attr_length (insn) == 4)
14284 return \"bdz %l0\";
14286 return \"{bdn|bdnz} $+8\;b %l0\";
14288 [(set_attr "type" "branch")
14289 (set_attr "length" "*,12,16,16")])
14291 (define_insn "*ctrsi_internal6"
14293 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14296 (label_ref (match_operand 0 "" ""))))
14297 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14298 (plus:SI (match_dup 1)
14300 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14301 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14305 if (which_alternative != 0)
14307 else if (get_attr_length (insn) == 4)
14308 return \"{bdn|bdnz} %l0\";
14310 return \"bdz $+8\;b %l0\";
14312 [(set_attr "type" "branch")
14313 (set_attr "length" "*,12,16,16")])
14315 (define_insn "*ctrdi_internal5"
14317 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14319 (label_ref (match_operand 0 "" ""))
14321 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14322 (plus:DI (match_dup 1)
14324 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14325 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14329 if (which_alternative != 0)
14331 else if (get_attr_length (insn) == 4)
14332 return \"bdz %l0\";
14334 return \"{bdn|bdnz} $+8\;b %l0\";
14336 [(set_attr "type" "branch")
14337 (set_attr "length" "*,12,16,16")])
14339 (define_insn "*ctrdi_internal6"
14341 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14344 (label_ref (match_operand 0 "" ""))))
14345 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14346 (plus:DI (match_dup 1)
14348 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14349 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14353 if (which_alternative != 0)
14355 else if (get_attr_length (insn) == 4)
14356 return \"{bdn|bdnz} %l0\";
14358 return \"bdz $+8\;b %l0\";
14360 [(set_attr "type" "branch")
14361 (set_attr "length" "*,12,16,16")])
14363 ;; Now the splitters if we could not allocate the CTR register
14367 (if_then_else (match_operator 2 "comparison_operator"
14368 [(match_operand:SI 1 "gpc_reg_operand" "")
14370 (match_operand 5 "" "")
14371 (match_operand 6 "" "")))
14372 (set (match_operand:SI 0 "gpc_reg_operand" "")
14373 (plus:SI (match_dup 1)
14375 (clobber (match_scratch:CC 3 ""))
14376 (clobber (match_scratch:SI 4 ""))]
14377 "TARGET_32BIT && reload_completed"
14378 [(parallel [(set (match_dup 3)
14379 (compare:CC (plus:SI (match_dup 1)
14383 (plus:SI (match_dup 1)
14385 (set (pc) (if_then_else (match_dup 7)
14389 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14390 operands[3], const0_rtx); }")
14394 (if_then_else (match_operator 2 "comparison_operator"
14395 [(match_operand:SI 1 "gpc_reg_operand" "")
14397 (match_operand 5 "" "")
14398 (match_operand 6 "" "")))
14399 (set (match_operand:SI 0 "nonimmediate_operand" "")
14400 (plus:SI (match_dup 1) (const_int -1)))
14401 (clobber (match_scratch:CC 3 ""))
14402 (clobber (match_scratch:SI 4 ""))]
14403 "TARGET_32BIT && reload_completed
14404 && ! gpc_reg_operand (operands[0], SImode)"
14405 [(parallel [(set (match_dup 3)
14406 (compare:CC (plus:SI (match_dup 1)
14410 (plus:SI (match_dup 1)
14414 (set (pc) (if_then_else (match_dup 7)
14418 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14419 operands[3], const0_rtx); }")
14422 (if_then_else (match_operator 2 "comparison_operator"
14423 [(match_operand:DI 1 "gpc_reg_operand" "")
14425 (match_operand 5 "" "")
14426 (match_operand 6 "" "")))
14427 (set (match_operand:DI 0 "gpc_reg_operand" "")
14428 (plus:DI (match_dup 1)
14430 (clobber (match_scratch:CC 3 ""))
14431 (clobber (match_scratch:DI 4 ""))]
14432 "TARGET_64BIT && reload_completed"
14433 [(parallel [(set (match_dup 3)
14434 (compare:CC (plus:DI (match_dup 1)
14438 (plus:DI (match_dup 1)
14440 (set (pc) (if_then_else (match_dup 7)
14444 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14445 operands[3], const0_rtx); }")
14449 (if_then_else (match_operator 2 "comparison_operator"
14450 [(match_operand:DI 1 "gpc_reg_operand" "")
14452 (match_operand 5 "" "")
14453 (match_operand 6 "" "")))
14454 (set (match_operand:DI 0 "nonimmediate_operand" "")
14455 (plus:DI (match_dup 1) (const_int -1)))
14456 (clobber (match_scratch:CC 3 ""))
14457 (clobber (match_scratch:DI 4 ""))]
14458 "TARGET_64BIT && reload_completed
14459 && ! gpc_reg_operand (operands[0], DImode)"
14460 [(parallel [(set (match_dup 3)
14461 (compare:CC (plus:DI (match_dup 1)
14465 (plus:DI (match_dup 1)
14469 (set (pc) (if_then_else (match_dup 7)
14473 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14474 operands[3], const0_rtx); }")
14476 (define_insn "trap"
14477 [(trap_if (const_int 1) (const_int 0))]
14481 (define_expand "conditional_trap"
14482 [(trap_if (match_operator 0 "trap_comparison_operator"
14483 [(match_dup 2) (match_dup 3)])
14484 (match_operand 1 "const_int_operand" ""))]
14486 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14487 operands[2] = rs6000_compare_op0;
14488 operands[3] = rs6000_compare_op1;")
14491 [(trap_if (match_operator 0 "trap_comparison_operator"
14492 [(match_operand:SI 1 "register_operand" "r")
14493 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14496 "{t|tw}%V0%I2 %1,%2")
14499 [(trap_if (match_operator 0 "trap_comparison_operator"
14500 [(match_operand:DI 1 "register_operand" "r")
14501 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14506 ;; Insns related to generating the function prologue and epilogue.
14508 (define_expand "prologue"
14509 [(use (const_int 0))]
14510 "TARGET_SCHED_PROLOG"
14513 rs6000_emit_prologue ();
14517 (define_insn "*movesi_from_cr_one"
14518 [(match_parallel 0 "mfcr_operation"
14519 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14520 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14521 (match_operand 3 "immediate_operand" "n")]
14522 UNSPEC_MOVESI_FROM_CR))])]
14528 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14530 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14531 operands[4] = GEN_INT (mask);
14532 output_asm_insn (\"mfcr %1,%4\", operands);
14536 [(set_attr "type" "mfcrf")])
14538 (define_insn "movesi_from_cr"
14539 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14540 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14541 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14542 UNSPEC_MOVESI_FROM_CR))]
14545 [(set_attr "type" "mfcr")])
14547 (define_insn "*stmw"
14548 [(match_parallel 0 "stmw_operation"
14549 [(set (match_operand:SI 1 "memory_operand" "=m")
14550 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14552 "{stm|stmw} %2,%1")
14554 (define_insn "*save_fpregs_si"
14555 [(match_parallel 0 "any_parallel_operand"
14556 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14557 (use (match_operand:SI 2 "call_operand" "s"))
14558 (set (match_operand:DF 3 "memory_operand" "=m")
14559 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14562 [(set_attr "type" "branch")
14563 (set_attr "length" "4")])
14565 (define_insn "*save_fpregs_di"
14566 [(match_parallel 0 "any_parallel_operand"
14567 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14568 (use (match_operand:DI 2 "call_operand" "s"))
14569 (set (match_operand:DF 3 "memory_operand" "=m")
14570 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14573 [(set_attr "type" "branch")
14574 (set_attr "length" "4")])
14576 ; These are to explain that changes to the stack pointer should
14577 ; not be moved over stores to stack memory.
14578 (define_insn "stack_tie"
14579 [(set (match_operand:BLK 0 "memory_operand" "+m")
14580 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14583 [(set_attr "length" "0")])
14586 (define_expand "epilogue"
14587 [(use (const_int 0))]
14588 "TARGET_SCHED_PROLOG"
14591 rs6000_emit_epilogue (FALSE);
14595 ; On some processors, doing the mtcrf one CC register at a time is
14596 ; faster (like on the 604e). On others, doing them all at once is
14597 ; faster; for instance, on the 601 and 750.
14599 (define_expand "movsi_to_cr_one"
14600 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14601 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14602 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14604 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14606 (define_insn "*movsi_to_cr"
14607 [(match_parallel 0 "mtcrf_operation"
14608 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14609 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14610 (match_operand 3 "immediate_operand" "n")]
14611 UNSPEC_MOVESI_TO_CR))])]
14617 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14618 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14619 operands[4] = GEN_INT (mask);
14620 return \"mtcrf %4,%2\";
14622 [(set_attr "type" "mtcr")])
14624 (define_insn "*mtcrfsi"
14625 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14626 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14627 (match_operand 2 "immediate_operand" "n")]
14628 UNSPEC_MOVESI_TO_CR))]
14629 "GET_CODE (operands[0]) == REG
14630 && CR_REGNO_P (REGNO (operands[0]))
14631 && GET_CODE (operands[2]) == CONST_INT
14632 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14634 [(set_attr "type" "mtcr")])
14636 ; The load-multiple instructions have similar properties.
14637 ; Note that "load_multiple" is a name known to the machine-independent
14638 ; code that actually corresponds to the powerpc load-string.
14640 (define_insn "*lmw"
14641 [(match_parallel 0 "lmw_operation"
14642 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14643 (match_operand:SI 2 "memory_operand" "m"))])]
14647 (define_insn "*return_internal_si"
14649 (use (match_operand:SI 0 "register_operand" "lc"))]
14652 [(set_attr "type" "jmpreg")])
14654 (define_insn "*return_internal_di"
14656 (use (match_operand:DI 0 "register_operand" "lc"))]
14659 [(set_attr "type" "jmpreg")])
14661 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14662 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14664 (define_insn "*return_and_restore_fpregs_si"
14665 [(match_parallel 0 "any_parallel_operand"
14667 (use (match_operand:SI 1 "register_operand" "l"))
14668 (use (match_operand:SI 2 "call_operand" "s"))
14669 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14670 (match_operand:DF 4 "memory_operand" "m"))])]
14674 (define_insn "*return_and_restore_fpregs_di"
14675 [(match_parallel 0 "any_parallel_operand"
14677 (use (match_operand:DI 1 "register_operand" "l"))
14678 (use (match_operand:DI 2 "call_operand" "s"))
14679 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14680 (match_operand:DF 4 "memory_operand" "m"))])]
14684 ; This is used in compiling the unwind routines.
14685 (define_expand "eh_return"
14686 [(use (match_operand 0 "general_operand" ""))]
14691 emit_insn (gen_eh_set_lr_si (operands[0]));
14693 emit_insn (gen_eh_set_lr_di (operands[0]));
14697 ; We can't expand this before we know where the link register is stored.
14698 (define_insn "eh_set_lr_si"
14699 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")]
14701 (clobber (match_scratch:SI 1 "=&b"))]
14705 (define_insn "eh_set_lr_di"
14706 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
14708 (clobber (match_scratch:DI 1 "=&b"))]
14713 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14714 (clobber (match_scratch 1 ""))]
14719 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14723 (define_insn "prefetch"
14724 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14725 (match_operand:SI 1 "const_int_operand" "n")
14726 (match_operand:SI 2 "const_int_operand" "n"))]
14730 if (GET_CODE (operands[0]) == REG)
14731 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14732 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14734 [(set_attr "type" "load")])
14736 (include "altivec.md")