1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 2, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 ;; MA 02110-1301, USA.
24 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
31 [(UNSPEC_FRSP 0) ; frsp for POWER machines
32 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
33 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
34 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
36 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
42 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
43 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
46 (UNSPEC_MOVESI_FROM_CR 19)
47 (UNSPEC_MOVESI_TO_CR 20)
49 (UNSPEC_TLSDTPRELHA 22)
50 (UNSPEC_TLSDTPRELLO 23)
51 (UNSPEC_TLSGOTDTPREL 24)
53 (UNSPEC_TLSTPRELHA 26)
54 (UNSPEC_TLSTPRELLO 27)
55 (UNSPEC_TLSGOTTPREL 28)
57 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
58 (UNSPEC_MV_CR_GT 31) ; move_from_CR_eq_bit
75 ;; UNSPEC_VOLATILE usage
80 (UNSPECV_LL 1) ; load-locked
81 (UNSPECV_SC 2) ; store-conditional
82 (UNSPECV_EH_RR 9) ; eh_reg_restore
85 ;; Define an insn type attribute. This is used in function unit delay
87 (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,isync,sync,load_l,store_c"
88 (const_string "integer"))
91 ; '(pc)' in the following doesn't include the instruction itself; it is
92 ; calculated as if the instruction had zero size.
93 (define_attr "length" ""
94 (if_then_else (eq_attr "type" "branch")
95 (if_then_else (and (ge (minus (match_dup 0) (pc))
97 (lt (minus (match_dup 0) (pc))
103 ;; Processor type -- this attribute must exactly match the processor_type
104 ;; enumeration in rs6000.h.
106 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
107 (const (symbol_ref "rs6000_cpu_attr")))
109 (automata_option "ndfa")
122 (include "power4.md")
123 (include "power5.md")
125 (include "predicates.md")
127 (include "darwin.md")
132 ; This mode macro allows :GPR to be used to indicate the allowable size
133 ; of whole values in GPRs.
134 (define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
136 ; Any supported integer mode.
137 (define_mode_macro INT [QI HI SI DI TI])
139 ; Any supported integer mode that fits in one register.
140 (define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
142 ; extend modes for DImode
143 (define_mode_macro QHSI [QI HI SI])
145 ; SImode or DImode, even if DImode doesn't fit in GPRs.
146 (define_mode_macro SDI [SI DI])
148 ; The size of a pointer. Also, the size of the value that a record-condition
149 ; (one with a '.') will compare.
150 (define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
152 ; Any hardware-supported floating-point mode
153 (define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
154 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
155 (TF "!TARGET_IEEEQUAD
156 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128")])
158 ; Various instructions that come in SI and DI forms.
159 ; A generic w/d attribute, for things like cmpw/cmpd.
160 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
163 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
166 ;; Start with fixed-point load and store insns. Here we put only the more
167 ;; complex forms. Basic data transfer is done later.
169 (define_expand "zero_extend<mode>di2"
170 [(set (match_operand:DI 0 "gpc_reg_operand" "")
171 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
175 (define_insn "*zero_extend<mode>di2_internal1"
176 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
177 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
181 rldicl %0,%1,0,<dbits>"
182 [(set_attr "type" "load,*")])
184 (define_insn "*zero_extend<mode>di2_internal2"
185 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
186 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
188 (clobber (match_scratch:DI 2 "=r,r"))]
191 rldicl. %2,%1,0,<dbits>
193 [(set_attr "type" "compare")
194 (set_attr "length" "4,8")])
197 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
198 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
200 (clobber (match_scratch:DI 2 ""))]
201 "TARGET_POWERPC64 && reload_completed"
203 (zero_extend:DI (match_dup 1)))
205 (compare:CC (match_dup 2)
209 (define_insn "*zero_extend<mode>di2_internal3"
210 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
211 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
213 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
214 (zero_extend:DI (match_dup 1)))]
217 rldicl. %0,%1,0,<dbits>
219 [(set_attr "type" "compare")
220 (set_attr "length" "4,8")])
223 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
224 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
226 (set (match_operand:DI 0 "gpc_reg_operand" "")
227 (zero_extend:DI (match_dup 1)))]
228 "TARGET_POWERPC64 && reload_completed"
230 (zero_extend:DI (match_dup 1)))
232 (compare:CC (match_dup 0)
236 (define_insn "extendqidi2"
237 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
238 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
243 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
244 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
246 (clobber (match_scratch:DI 2 "=r,r"))]
251 [(set_attr "type" "compare")
252 (set_attr "length" "4,8")])
255 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
256 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
258 (clobber (match_scratch:DI 2 ""))]
259 "TARGET_POWERPC64 && reload_completed"
261 (sign_extend:DI (match_dup 1)))
263 (compare:CC (match_dup 2)
268 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
269 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
271 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
272 (sign_extend:DI (match_dup 1)))]
277 [(set_attr "type" "compare")
278 (set_attr "length" "4,8")])
281 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
282 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
284 (set (match_operand:DI 0 "gpc_reg_operand" "")
285 (sign_extend:DI (match_dup 1)))]
286 "TARGET_POWERPC64 && reload_completed"
288 (sign_extend:DI (match_dup 1)))
290 (compare:CC (match_dup 0)
294 (define_expand "extendhidi2"
295 [(set (match_operand:DI 0 "gpc_reg_operand" "")
296 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
301 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
302 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
307 [(set_attr "type" "load_ext,*")])
310 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
311 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
313 (clobber (match_scratch:DI 2 "=r,r"))]
318 [(set_attr "type" "compare")
319 (set_attr "length" "4,8")])
322 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
323 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
325 (clobber (match_scratch:DI 2 ""))]
326 "TARGET_POWERPC64 && reload_completed"
328 (sign_extend:DI (match_dup 1)))
330 (compare:CC (match_dup 2)
335 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
336 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
338 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
339 (sign_extend:DI (match_dup 1)))]
344 [(set_attr "type" "compare")
345 (set_attr "length" "4,8")])
348 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
349 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
351 (set (match_operand:DI 0 "gpc_reg_operand" "")
352 (sign_extend:DI (match_dup 1)))]
353 "TARGET_POWERPC64 && reload_completed"
355 (sign_extend:DI (match_dup 1)))
357 (compare:CC (match_dup 0)
361 (define_expand "extendsidi2"
362 [(set (match_operand:DI 0 "gpc_reg_operand" "")
363 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
368 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
369 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
374 [(set_attr "type" "load_ext,*")])
377 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
378 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
380 (clobber (match_scratch:DI 2 "=r,r"))]
385 [(set_attr "type" "compare")
386 (set_attr "length" "4,8")])
389 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
390 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
392 (clobber (match_scratch:DI 2 ""))]
393 "TARGET_POWERPC64 && reload_completed"
395 (sign_extend:DI (match_dup 1)))
397 (compare:CC (match_dup 2)
402 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
403 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
405 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
406 (sign_extend:DI (match_dup 1)))]
411 [(set_attr "type" "compare")
412 (set_attr "length" "4,8")])
415 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
416 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
418 (set (match_operand:DI 0 "gpc_reg_operand" "")
419 (sign_extend:DI (match_dup 1)))]
420 "TARGET_POWERPC64 && reload_completed"
422 (sign_extend:DI (match_dup 1)))
424 (compare:CC (match_dup 0)
428 (define_expand "zero_extendqisi2"
429 [(set (match_operand:SI 0 "gpc_reg_operand" "")
430 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
435 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
436 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
440 {rlinm|rlwinm} %0,%1,0,0xff"
441 [(set_attr "type" "load,*")])
444 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
445 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
447 (clobber (match_scratch:SI 2 "=r,r"))]
450 {andil.|andi.} %2,%1,0xff
452 [(set_attr "type" "compare")
453 (set_attr "length" "4,8")])
456 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
457 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
459 (clobber (match_scratch:SI 2 ""))]
462 (zero_extend:SI (match_dup 1)))
464 (compare:CC (match_dup 2)
469 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
470 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
472 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
473 (zero_extend:SI (match_dup 1)))]
476 {andil.|andi.} %0,%1,0xff
478 [(set_attr "type" "compare")
479 (set_attr "length" "4,8")])
482 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
483 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
485 (set (match_operand:SI 0 "gpc_reg_operand" "")
486 (zero_extend:SI (match_dup 1)))]
489 (zero_extend:SI (match_dup 1)))
491 (compare:CC (match_dup 0)
495 (define_expand "extendqisi2"
496 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
497 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
502 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
503 else if (TARGET_POWER)
504 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
506 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
510 (define_insn "extendqisi2_ppc"
511 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
512 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
517 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
518 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
520 (clobber (match_scratch:SI 2 "=r,r"))]
525 [(set_attr "type" "compare")
526 (set_attr "length" "4,8")])
529 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
530 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
532 (clobber (match_scratch:SI 2 ""))]
533 "TARGET_POWERPC && reload_completed"
535 (sign_extend:SI (match_dup 1)))
537 (compare:CC (match_dup 2)
542 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
543 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
545 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
546 (sign_extend:SI (match_dup 1)))]
551 [(set_attr "type" "compare")
552 (set_attr "length" "4,8")])
555 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
556 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
558 (set (match_operand:SI 0 "gpc_reg_operand" "")
559 (sign_extend:SI (match_dup 1)))]
560 "TARGET_POWERPC && reload_completed"
562 (sign_extend:SI (match_dup 1)))
564 (compare:CC (match_dup 0)
568 (define_expand "extendqisi2_power"
569 [(parallel [(set (match_dup 2)
570 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
572 (clobber (scratch:SI))])
573 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
574 (ashiftrt:SI (match_dup 2)
576 (clobber (scratch:SI))])]
579 { operands[1] = gen_lowpart (SImode, operands[1]);
580 operands[2] = gen_reg_rtx (SImode); }")
582 (define_expand "extendqisi2_no_power"
584 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
586 (set (match_operand:SI 0 "gpc_reg_operand" "")
587 (ashiftrt:SI (match_dup 2)
589 "! TARGET_POWER && ! TARGET_POWERPC"
591 { operands[1] = gen_lowpart (SImode, operands[1]);
592 operands[2] = gen_reg_rtx (SImode); }")
594 (define_expand "zero_extendqihi2"
595 [(set (match_operand:HI 0 "gpc_reg_operand" "")
596 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
601 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
602 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
606 {rlinm|rlwinm} %0,%1,0,0xff"
607 [(set_attr "type" "load,*")])
610 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
611 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
613 (clobber (match_scratch:HI 2 "=r,r"))]
616 {andil.|andi.} %2,%1,0xff
618 [(set_attr "type" "compare")
619 (set_attr "length" "4,8")])
622 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
623 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
625 (clobber (match_scratch:HI 2 ""))]
628 (zero_extend:HI (match_dup 1)))
630 (compare:CC (match_dup 2)
635 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
636 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
638 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
639 (zero_extend:HI (match_dup 1)))]
642 {andil.|andi.} %0,%1,0xff
644 [(set_attr "type" "compare")
645 (set_attr "length" "4,8")])
648 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
649 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
651 (set (match_operand:HI 0 "gpc_reg_operand" "")
652 (zero_extend:HI (match_dup 1)))]
655 (zero_extend:HI (match_dup 1)))
657 (compare:CC (match_dup 0)
661 (define_expand "extendqihi2"
662 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
663 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
668 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
669 else if (TARGET_POWER)
670 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
672 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
676 (define_insn "extendqihi2_ppc"
677 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
678 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
683 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
684 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
686 (clobber (match_scratch:HI 2 "=r,r"))]
691 [(set_attr "type" "compare")
692 (set_attr "length" "4,8")])
695 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
696 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
698 (clobber (match_scratch:HI 2 ""))]
699 "TARGET_POWERPC && reload_completed"
701 (sign_extend:HI (match_dup 1)))
703 (compare:CC (match_dup 2)
708 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
709 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
711 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
712 (sign_extend:HI (match_dup 1)))]
717 [(set_attr "type" "compare")
718 (set_attr "length" "4,8")])
721 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
722 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
724 (set (match_operand:HI 0 "gpc_reg_operand" "")
725 (sign_extend:HI (match_dup 1)))]
726 "TARGET_POWERPC && reload_completed"
728 (sign_extend:HI (match_dup 1)))
730 (compare:CC (match_dup 0)
734 (define_expand "extendqihi2_power"
735 [(parallel [(set (match_dup 2)
736 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
738 (clobber (scratch:SI))])
739 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
740 (ashiftrt:SI (match_dup 2)
742 (clobber (scratch:SI))])]
745 { operands[0] = gen_lowpart (SImode, operands[0]);
746 operands[1] = gen_lowpart (SImode, operands[1]);
747 operands[2] = gen_reg_rtx (SImode); }")
749 (define_expand "extendqihi2_no_power"
751 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
753 (set (match_operand:HI 0 "gpc_reg_operand" "")
754 (ashiftrt:SI (match_dup 2)
756 "! TARGET_POWER && ! TARGET_POWERPC"
758 { operands[0] = gen_lowpart (SImode, operands[0]);
759 operands[1] = gen_lowpart (SImode, operands[1]);
760 operands[2] = gen_reg_rtx (SImode); }")
762 (define_expand "zero_extendhisi2"
763 [(set (match_operand:SI 0 "gpc_reg_operand" "")
764 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
769 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
770 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
774 {rlinm|rlwinm} %0,%1,0,0xffff"
775 [(set_attr "type" "load,*")])
778 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
779 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
781 (clobber (match_scratch:SI 2 "=r,r"))]
784 {andil.|andi.} %2,%1,0xffff
786 [(set_attr "type" "compare")
787 (set_attr "length" "4,8")])
790 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
791 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
793 (clobber (match_scratch:SI 2 ""))]
796 (zero_extend:SI (match_dup 1)))
798 (compare:CC (match_dup 2)
803 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
804 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
806 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
807 (zero_extend:SI (match_dup 1)))]
810 {andil.|andi.} %0,%1,0xffff
812 [(set_attr "type" "compare")
813 (set_attr "length" "4,8")])
816 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
817 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
819 (set (match_operand:SI 0 "gpc_reg_operand" "")
820 (zero_extend:SI (match_dup 1)))]
823 (zero_extend:SI (match_dup 1)))
825 (compare:CC (match_dup 0)
829 (define_expand "extendhisi2"
830 [(set (match_operand:SI 0 "gpc_reg_operand" "")
831 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
836 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
837 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
842 [(set_attr "type" "load_ext,*")])
845 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
846 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
848 (clobber (match_scratch:SI 2 "=r,r"))]
853 [(set_attr "type" "compare")
854 (set_attr "length" "4,8")])
857 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
858 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
860 (clobber (match_scratch:SI 2 ""))]
863 (sign_extend:SI (match_dup 1)))
865 (compare:CC (match_dup 2)
870 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
871 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
873 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
874 (sign_extend:SI (match_dup 1)))]
879 [(set_attr "type" "compare")
880 (set_attr "length" "4,8")])
882 ;; IBM 405 and 440 half-word multiplication operations.
884 (define_insn "*macchwc"
885 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
886 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
887 (match_operand:SI 2 "gpc_reg_operand" "r")
890 (match_operand:HI 1 "gpc_reg_operand" "r")))
891 (match_operand:SI 4 "gpc_reg_operand" "0"))
893 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
894 (plus:SI (mult:SI (ashiftrt:SI
902 [(set_attr "type" "imul3")])
904 (define_insn "*macchw"
905 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
906 (plus:SI (mult:SI (ashiftrt:SI
907 (match_operand:SI 2 "gpc_reg_operand" "r")
910 (match_operand:HI 1 "gpc_reg_operand" "r")))
911 (match_operand:SI 3 "gpc_reg_operand" "0")))]
914 [(set_attr "type" "imul3")])
916 (define_insn "*macchwuc"
917 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
918 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
919 (match_operand:SI 2 "gpc_reg_operand" "r")
922 (match_operand:HI 1 "gpc_reg_operand" "r")))
923 (match_operand:SI 4 "gpc_reg_operand" "0"))
925 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
926 (plus:SI (mult:SI (lshiftrt:SI
933 "macchwu. %0, %1, %2"
934 [(set_attr "type" "imul3")])
936 (define_insn "*macchwu"
937 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
938 (plus:SI (mult:SI (lshiftrt:SI
939 (match_operand:SI 2 "gpc_reg_operand" "r")
942 (match_operand:HI 1 "gpc_reg_operand" "r")))
943 (match_operand:SI 3 "gpc_reg_operand" "0")))]
946 [(set_attr "type" "imul3")])
948 (define_insn "*machhwc"
949 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
950 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
951 (match_operand:SI 1 "gpc_reg_operand" "%r")
954 (match_operand:SI 2 "gpc_reg_operand" "r")
956 (match_operand:SI 4 "gpc_reg_operand" "0"))
958 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
959 (plus:SI (mult:SI (ashiftrt:SI
968 [(set_attr "type" "imul3")])
970 (define_insn "*machhw"
971 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
972 (plus:SI (mult:SI (ashiftrt:SI
973 (match_operand:SI 1 "gpc_reg_operand" "%r")
976 (match_operand:SI 2 "gpc_reg_operand" "r")
978 (match_operand:SI 3 "gpc_reg_operand" "0")))]
981 [(set_attr "type" "imul3")])
983 (define_insn "*machhwuc"
984 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
985 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
986 (match_operand:SI 1 "gpc_reg_operand" "%r")
989 (match_operand:SI 2 "gpc_reg_operand" "r")
991 (match_operand:SI 4 "gpc_reg_operand" "0"))
993 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
994 (plus:SI (mult:SI (lshiftrt:SI
1002 "machhwu. %0, %1, %2"
1003 [(set_attr "type" "imul3")])
1005 (define_insn "*machhwu"
1006 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1007 (plus:SI (mult:SI (lshiftrt:SI
1008 (match_operand:SI 1 "gpc_reg_operand" "%r")
1011 (match_operand:SI 2 "gpc_reg_operand" "r")
1013 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1015 "machhwu %0, %1, %2"
1016 [(set_attr "type" "imul3")])
1018 (define_insn "*maclhwc"
1019 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1020 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1021 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1023 (match_operand:HI 2 "gpc_reg_operand" "r")))
1024 (match_operand:SI 4 "gpc_reg_operand" "0"))
1026 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1027 (plus:SI (mult:SI (sign_extend:SI
1033 "maclhw. %0, %1, %2"
1034 [(set_attr "type" "imul3")])
1036 (define_insn "*maclhw"
1037 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1038 (plus:SI (mult:SI (sign_extend:SI
1039 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1041 (match_operand:HI 2 "gpc_reg_operand" "r")))
1042 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1045 [(set_attr "type" "imul3")])
1047 (define_insn "*maclhwuc"
1048 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1049 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1050 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1052 (match_operand:HI 2 "gpc_reg_operand" "r")))
1053 (match_operand:SI 4 "gpc_reg_operand" "0"))
1055 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1056 (plus:SI (mult:SI (zero_extend:SI
1062 "maclhwu. %0, %1, %2"
1063 [(set_attr "type" "imul3")])
1065 (define_insn "*maclhwu"
1066 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1067 (plus:SI (mult:SI (zero_extend:SI
1068 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1070 (match_operand:HI 2 "gpc_reg_operand" "r")))
1071 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1073 "maclhwu %0, %1, %2"
1074 [(set_attr "type" "imul3")])
1076 (define_insn "*nmacchwc"
1077 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1078 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1079 (mult:SI (ashiftrt:SI
1080 (match_operand:SI 2 "gpc_reg_operand" "r")
1083 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1085 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1086 (minus:SI (match_dup 4)
1087 (mult:SI (ashiftrt:SI
1093 "nmacchw. %0, %1, %2"
1094 [(set_attr "type" "imul3")])
1096 (define_insn "*nmacchw"
1097 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1098 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1099 (mult:SI (ashiftrt:SI
1100 (match_operand:SI 2 "gpc_reg_operand" "r")
1103 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1105 "nmacchw %0, %1, %2"
1106 [(set_attr "type" "imul3")])
1108 (define_insn "*nmachhwc"
1109 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1110 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1111 (mult:SI (ashiftrt:SI
1112 (match_operand:SI 1 "gpc_reg_operand" "%r")
1115 (match_operand:SI 2 "gpc_reg_operand" "r")
1118 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1119 (minus:SI (match_dup 4)
1120 (mult:SI (ashiftrt:SI
1127 "nmachhw. %0, %1, %2"
1128 [(set_attr "type" "imul3")])
1130 (define_insn "*nmachhw"
1131 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1132 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1133 (mult:SI (ashiftrt:SI
1134 (match_operand:SI 1 "gpc_reg_operand" "%r")
1137 (match_operand:SI 2 "gpc_reg_operand" "r")
1140 "nmachhw %0, %1, %2"
1141 [(set_attr "type" "imul3")])
1143 (define_insn "*nmaclhwc"
1144 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1145 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1146 (mult:SI (sign_extend:SI
1147 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1149 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1151 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1152 (minus:SI (match_dup 4)
1153 (mult:SI (sign_extend:SI
1158 "nmaclhw. %0, %1, %2"
1159 [(set_attr "type" "imul3")])
1161 (define_insn "*nmaclhw"
1162 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1163 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1164 (mult:SI (sign_extend:SI
1165 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1167 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1169 "nmaclhw %0, %1, %2"
1170 [(set_attr "type" "imul3")])
1172 (define_insn "*mulchwc"
1173 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1174 (compare:CC (mult:SI (ashiftrt:SI
1175 (match_operand:SI 2 "gpc_reg_operand" "r")
1178 (match_operand:HI 1 "gpc_reg_operand" "r")))
1180 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1181 (mult:SI (ashiftrt:SI
1187 "mulchw. %0, %1, %2"
1188 [(set_attr "type" "imul3")])
1190 (define_insn "*mulchw"
1191 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1192 (mult:SI (ashiftrt:SI
1193 (match_operand:SI 2 "gpc_reg_operand" "r")
1196 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1199 [(set_attr "type" "imul3")])
1201 (define_insn "*mulchwuc"
1202 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1203 (compare:CC (mult:SI (lshiftrt:SI
1204 (match_operand:SI 2 "gpc_reg_operand" "r")
1207 (match_operand:HI 1 "gpc_reg_operand" "r")))
1209 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1210 (mult:SI (lshiftrt:SI
1216 "mulchwu. %0, %1, %2"
1217 [(set_attr "type" "imul3")])
1219 (define_insn "*mulchwu"
1220 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1221 (mult:SI (lshiftrt:SI
1222 (match_operand:SI 2 "gpc_reg_operand" "r")
1225 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1227 "mulchwu %0, %1, %2"
1228 [(set_attr "type" "imul3")])
1230 (define_insn "*mulhhwc"
1231 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1232 (compare:CC (mult:SI (ashiftrt:SI
1233 (match_operand:SI 1 "gpc_reg_operand" "%r")
1236 (match_operand:SI 2 "gpc_reg_operand" "r")
1239 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1240 (mult:SI (ashiftrt:SI
1247 "mulhhw. %0, %1, %2"
1248 [(set_attr "type" "imul3")])
1250 (define_insn "*mulhhw"
1251 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1252 (mult:SI (ashiftrt:SI
1253 (match_operand:SI 1 "gpc_reg_operand" "%r")
1256 (match_operand:SI 2 "gpc_reg_operand" "r")
1260 [(set_attr "type" "imul3")])
1262 (define_insn "*mulhhwuc"
1263 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1264 (compare:CC (mult:SI (lshiftrt:SI
1265 (match_operand:SI 1 "gpc_reg_operand" "%r")
1268 (match_operand:SI 2 "gpc_reg_operand" "r")
1271 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1272 (mult:SI (lshiftrt:SI
1279 "mulhhwu. %0, %1, %2"
1280 [(set_attr "type" "imul3")])
1282 (define_insn "*mulhhwu"
1283 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1284 (mult:SI (lshiftrt:SI
1285 (match_operand:SI 1 "gpc_reg_operand" "%r")
1288 (match_operand:SI 2 "gpc_reg_operand" "r")
1291 "mulhhwu %0, %1, %2"
1292 [(set_attr "type" "imul3")])
1294 (define_insn "*mullhwc"
1295 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1296 (compare:CC (mult:SI (sign_extend:SI
1297 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1299 (match_operand:HI 2 "gpc_reg_operand" "r")))
1301 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1302 (mult:SI (sign_extend:SI
1307 "mullhw. %0, %1, %2"
1308 [(set_attr "type" "imul3")])
1310 (define_insn "*mullhw"
1311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1312 (mult:SI (sign_extend:SI
1313 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1315 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1318 [(set_attr "type" "imul3")])
1320 (define_insn "*mullhwuc"
1321 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1322 (compare:CC (mult:SI (zero_extend:SI
1323 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1325 (match_operand:HI 2 "gpc_reg_operand" "r")))
1327 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1328 (mult:SI (zero_extend:SI
1333 "mullhwu. %0, %1, %2"
1334 [(set_attr "type" "imul3")])
1336 (define_insn "*mullhwu"
1337 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1338 (mult:SI (zero_extend:SI
1339 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1341 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1343 "mullhwu %0, %1, %2"
1344 [(set_attr "type" "imul3")])
1347 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1348 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1350 (set (match_operand:SI 0 "gpc_reg_operand" "")
1351 (sign_extend:SI (match_dup 1)))]
1354 (sign_extend:SI (match_dup 1)))
1356 (compare:CC (match_dup 0)
1360 ;; Fixed-point arithmetic insns.
1362 (define_expand "add<mode>3"
1363 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1364 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1365 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1369 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1371 if (non_short_cint_operand (operands[2], DImode))
1374 else if (GET_CODE (operands[2]) == CONST_INT
1375 && ! add_operand (operands[2], <MODE>mode))
1377 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1378 ? operands[0] : gen_reg_rtx (<MODE>mode));
1380 HOST_WIDE_INT val = INTVAL (operands[2]);
1381 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1382 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1384 if (<MODE>mode == DImode && !CONST_OK_FOR_LETTER_P (rest, 'L'))
1387 /* The ordering here is important for the prolog expander.
1388 When space is allocated from the stack, adding 'low' first may
1389 produce a temporary deallocation (which would be bad). */
1390 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1391 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1396 ;; Discourage ai/addic because of carry but provide it in an alternative
1397 ;; allowing register zero as source.
1398 (define_insn "*add<mode>3_internal1"
1399 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1400 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1401 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1405 {cal %0,%2(%1)|addi %0,%1,%2}
1407 {cau|addis} %0,%1,%v2"
1408 [(set_attr "length" "4,4,4,4")])
1410 (define_insn "addsi3_high"
1411 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1412 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1413 (high:SI (match_operand 2 "" ""))))]
1414 "TARGET_MACHO && !TARGET_64BIT"
1415 "{cau|addis} %0,%1,ha16(%2)"
1416 [(set_attr "length" "4")])
1418 (define_insn "*add<mode>3_internal2"
1419 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1420 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1421 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1423 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1426 {cax.|add.} %3,%1,%2
1427 {ai.|addic.} %3,%1,%2
1430 [(set_attr "type" "fast_compare,compare,compare,compare")
1431 (set_attr "length" "4,4,8,8")])
1434 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1435 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1436 (match_operand:GPR 2 "reg_or_short_operand" ""))
1438 (clobber (match_scratch:GPR 3 ""))]
1441 (plus:GPR (match_dup 1)
1444 (compare:CC (match_dup 3)
1448 (define_insn "*add<mode>3_internal3"
1449 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1450 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1451 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1453 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1454 (plus:P (match_dup 1)
1458 {cax.|add.} %0,%1,%2
1459 {ai.|addic.} %0,%1,%2
1462 [(set_attr "type" "fast_compare,compare,compare,compare")
1463 (set_attr "length" "4,4,8,8")])
1466 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1467 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1468 (match_operand:P 2 "reg_or_short_operand" ""))
1470 (set (match_operand:P 0 "gpc_reg_operand" "")
1471 (plus:P (match_dup 1) (match_dup 2)))]
1474 (plus:P (match_dup 1)
1477 (compare:CC (match_dup 0)
1481 ;; Split an add that we can't do in one insn into two insns, each of which
1482 ;; does one 16-bit part. This is used by combine. Note that the low-order
1483 ;; add should be last in case the result gets used in an address.
1486 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1487 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1488 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1490 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1491 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1494 HOST_WIDE_INT val = INTVAL (operands[2]);
1495 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1496 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1498 operands[4] = GEN_INT (low);
1499 if (<MODE>mode == SImode || CONST_OK_FOR_LETTER_P (rest, 'L'))
1500 operands[3] = GEN_INT (rest);
1501 else if (! no_new_pseudos)
1503 operands[3] = gen_reg_rtx (DImode);
1504 emit_move_insn (operands[3], operands[2]);
1505 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1512 (define_insn "one_cmpl<mode>2"
1513 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1514 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1519 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1520 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1522 (clobber (match_scratch:P 2 "=r,r"))]
1527 [(set_attr "type" "compare")
1528 (set_attr "length" "4,8")])
1531 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1532 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1534 (clobber (match_scratch:P 2 ""))]
1537 (not:P (match_dup 1)))
1539 (compare:CC (match_dup 2)
1544 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1545 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1547 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1548 (not:P (match_dup 1)))]
1553 [(set_attr "type" "compare")
1554 (set_attr "length" "4,8")])
1557 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1558 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1560 (set (match_operand:P 0 "gpc_reg_operand" "")
1561 (not:P (match_dup 1)))]
1564 (not:P (match_dup 1)))
1566 (compare:CC (match_dup 0)
1571 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1572 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1573 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1575 "{sf%I1|subf%I1c} %0,%2,%1")
1578 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1579 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1580 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1587 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1588 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1589 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1591 (clobber (match_scratch:SI 3 "=r,r"))]
1594 {sf.|subfc.} %3,%2,%1
1596 [(set_attr "type" "compare")
1597 (set_attr "length" "4,8")])
1600 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1601 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1602 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1604 (clobber (match_scratch:P 3 "=r,r"))]
1609 [(set_attr "type" "fast_compare")
1610 (set_attr "length" "4,8")])
1613 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1614 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1615 (match_operand:P 2 "gpc_reg_operand" ""))
1617 (clobber (match_scratch:P 3 ""))]
1620 (minus:P (match_dup 1)
1623 (compare:CC (match_dup 3)
1628 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1629 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1630 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1632 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1633 (minus:SI (match_dup 1) (match_dup 2)))]
1636 {sf.|subfc.} %0,%2,%1
1638 [(set_attr "type" "compare")
1639 (set_attr "length" "4,8")])
1642 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1643 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1644 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1646 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1647 (minus:P (match_dup 1)
1653 [(set_attr "type" "fast_compare")
1654 (set_attr "length" "4,8")])
1657 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1658 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1659 (match_operand:P 2 "gpc_reg_operand" ""))
1661 (set (match_operand:P 0 "gpc_reg_operand" "")
1662 (minus:P (match_dup 1)
1666 (minus:P (match_dup 1)
1669 (compare:CC (match_dup 0)
1673 (define_expand "sub<mode>3"
1674 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1675 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1676 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1680 if (GET_CODE (operands[2]) == CONST_INT)
1682 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1683 negate_rtx (<MODE>mode, operands[2])));
1688 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1689 ;; instruction and some auxiliary computations. Then we just have a single
1690 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1693 (define_expand "sminsi3"
1695 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1696 (match_operand:SI 2 "reg_or_short_operand" ""))
1698 (minus:SI (match_dup 2) (match_dup 1))))
1699 (set (match_operand:SI 0 "gpc_reg_operand" "")
1700 (minus:SI (match_dup 2) (match_dup 3)))]
1701 "TARGET_POWER || TARGET_ISEL"
1706 operands[2] = force_reg (SImode, operands[2]);
1707 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1711 operands[3] = gen_reg_rtx (SImode);
1715 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1716 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1717 (match_operand:SI 2 "reg_or_short_operand" "")))
1718 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1721 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1723 (minus:SI (match_dup 2) (match_dup 1))))
1724 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1727 (define_expand "smaxsi3"
1729 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1730 (match_operand:SI 2 "reg_or_short_operand" ""))
1732 (minus:SI (match_dup 2) (match_dup 1))))
1733 (set (match_operand:SI 0 "gpc_reg_operand" "")
1734 (plus:SI (match_dup 3) (match_dup 1)))]
1735 "TARGET_POWER || TARGET_ISEL"
1740 operands[2] = force_reg (SImode, operands[2]);
1741 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1744 operands[3] = gen_reg_rtx (SImode);
1748 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1749 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1750 (match_operand:SI 2 "reg_or_short_operand" "")))
1751 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1754 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1756 (minus:SI (match_dup 2) (match_dup 1))))
1757 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1760 (define_expand "uminsi3"
1761 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1763 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1765 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1767 (minus:SI (match_dup 4) (match_dup 3))))
1768 (set (match_operand:SI 0 "gpc_reg_operand" "")
1769 (minus:SI (match_dup 2) (match_dup 3)))]
1770 "TARGET_POWER || TARGET_ISEL"
1775 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1778 operands[3] = gen_reg_rtx (SImode);
1779 operands[4] = gen_reg_rtx (SImode);
1780 operands[5] = GEN_INT (-2147483647 - 1);
1783 (define_expand "umaxsi3"
1784 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1786 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1788 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1790 (minus:SI (match_dup 4) (match_dup 3))))
1791 (set (match_operand:SI 0 "gpc_reg_operand" "")
1792 (plus:SI (match_dup 3) (match_dup 1)))]
1793 "TARGET_POWER || TARGET_ISEL"
1798 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1801 operands[3] = gen_reg_rtx (SImode);
1802 operands[4] = gen_reg_rtx (SImode);
1803 operands[5] = GEN_INT (-2147483647 - 1);
1807 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1808 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1809 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1811 (minus:SI (match_dup 2) (match_dup 1))))]
1816 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1818 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1819 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1821 (minus:SI (match_dup 2) (match_dup 1)))
1823 (clobber (match_scratch:SI 3 "=r,r"))]
1828 [(set_attr "type" "delayed_compare")
1829 (set_attr "length" "4,8")])
1832 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1834 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1835 (match_operand:SI 2 "reg_or_short_operand" ""))
1837 (minus:SI (match_dup 2) (match_dup 1)))
1839 (clobber (match_scratch:SI 3 ""))]
1840 "TARGET_POWER && reload_completed"
1842 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1844 (minus:SI (match_dup 2) (match_dup 1))))
1846 (compare:CC (match_dup 3)
1851 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1853 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1854 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1856 (minus:SI (match_dup 2) (match_dup 1)))
1858 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1859 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1861 (minus:SI (match_dup 2) (match_dup 1))))]
1866 [(set_attr "type" "delayed_compare")
1867 (set_attr "length" "4,8")])
1870 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1872 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1873 (match_operand:SI 2 "reg_or_short_operand" ""))
1875 (minus:SI (match_dup 2) (match_dup 1)))
1877 (set (match_operand:SI 0 "gpc_reg_operand" "")
1878 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1880 (minus:SI (match_dup 2) (match_dup 1))))]
1881 "TARGET_POWER && reload_completed"
1883 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1885 (minus:SI (match_dup 2) (match_dup 1))))
1887 (compare:CC (match_dup 0)
1891 ;; We don't need abs with condition code because such comparisons should
1893 (define_expand "abssi2"
1894 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1895 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1901 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1904 else if (! TARGET_POWER)
1906 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1911 (define_insn "*abssi2_power"
1912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1913 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1917 (define_insn_and_split "abssi2_isel"
1918 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1919 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1920 (clobber (match_scratch:SI 2 "=&b"))
1921 (clobber (match_scratch:CC 3 "=y"))]
1924 "&& reload_completed"
1925 [(set (match_dup 2) (neg:SI (match_dup 1)))
1927 (compare:CC (match_dup 1)
1930 (if_then_else:SI (ge (match_dup 3)
1936 (define_insn_and_split "abssi2_nopower"
1937 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1938 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1939 (clobber (match_scratch:SI 2 "=&r,&r"))]
1940 "! TARGET_POWER && ! TARGET_ISEL"
1942 "&& reload_completed"
1943 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1944 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1945 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1948 (define_insn "*nabs_power"
1949 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1950 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1954 (define_insn_and_split "*nabs_nopower"
1955 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1956 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1957 (clobber (match_scratch:SI 2 "=&r,&r"))]
1960 "&& reload_completed"
1961 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1962 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1963 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1966 (define_expand "neg<mode>2"
1967 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1968 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1972 (define_insn "*neg<mode>2_internal"
1973 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1974 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1979 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1980 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1982 (clobber (match_scratch:P 2 "=r,r"))]
1987 [(set_attr "type" "fast_compare")
1988 (set_attr "length" "4,8")])
1991 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1992 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1994 (clobber (match_scratch:P 2 ""))]
1997 (neg:P (match_dup 1)))
1999 (compare:CC (match_dup 2)
2004 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2005 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2007 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2008 (neg:P (match_dup 1)))]
2013 [(set_attr "type" "fast_compare")
2014 (set_attr "length" "4,8")])
2017 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2018 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2020 (set (match_operand:P 0 "gpc_reg_operand" "")
2021 (neg:P (match_dup 1)))]
2024 (neg:P (match_dup 1)))
2026 (compare:CC (match_dup 0)
2030 (define_insn "clz<mode>2"
2031 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2032 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2034 "{cntlz|cntlz<wd>} %0,%1")
2036 (define_expand "ctz<mode>2"
2038 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2039 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2041 (clobber (scratch:CC))])
2042 (set (match_dup 4) (clz:GPR (match_dup 3)))
2043 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2044 (minus:GPR (match_dup 5) (match_dup 4)))]
2047 operands[2] = gen_reg_rtx (<MODE>mode);
2048 operands[3] = gen_reg_rtx (<MODE>mode);
2049 operands[4] = gen_reg_rtx (<MODE>mode);
2050 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2053 (define_expand "ffs<mode>2"
2055 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2056 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2058 (clobber (scratch:CC))])
2059 (set (match_dup 4) (clz:GPR (match_dup 3)))
2060 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2061 (minus:GPR (match_dup 5) (match_dup 4)))]
2064 operands[2] = gen_reg_rtx (<MODE>mode);
2065 operands[3] = gen_reg_rtx (<MODE>mode);
2066 operands[4] = gen_reg_rtx (<MODE>mode);
2067 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2070 (define_expand "popcount<mode>2"
2072 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2075 (mult:GPR (match_dup 2) (match_dup 4)))
2076 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2077 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
2080 operands[2] = gen_reg_rtx (<MODE>mode);
2081 operands[3] = gen_reg_rtx (<MODE>mode);
2082 operands[4] = force_reg (<MODE>mode,
2083 <MODE>mode == SImode
2084 ? GEN_INT (0x01010101)
2085 : GEN_INT ((HOST_WIDE_INT)
2086 0x01010101 << 32 | 0x01010101));
2087 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 8);
2090 (define_insn "popcntb<mode>2"
2091 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2092 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2097 (define_expand "mulsi3"
2098 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2099 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2100 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2105 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2107 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2111 (define_insn "mulsi3_mq"
2112 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2113 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2114 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2115 (clobber (match_scratch:SI 3 "=q,q"))]
2118 {muls|mullw} %0,%1,%2
2119 {muli|mulli} %0,%1,%2"
2121 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2122 (const_string "imul3")
2123 (match_operand:SI 2 "short_cint_operand" "")
2124 (const_string "imul2")]
2125 (const_string "imul")))])
2127 (define_insn "mulsi3_no_mq"
2128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2129 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2130 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2133 {muls|mullw} %0,%1,%2
2134 {muli|mulli} %0,%1,%2"
2136 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2137 (const_string "imul3")
2138 (match_operand:SI 2 "short_cint_operand" "")
2139 (const_string "imul2")]
2140 (const_string "imul")))])
2142 (define_insn "*mulsi3_mq_internal1"
2143 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2144 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2145 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2147 (clobber (match_scratch:SI 3 "=r,r"))
2148 (clobber (match_scratch:SI 4 "=q,q"))]
2151 {muls.|mullw.} %3,%1,%2
2153 [(set_attr "type" "imul_compare")
2154 (set_attr "length" "4,8")])
2157 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2158 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2159 (match_operand:SI 2 "gpc_reg_operand" ""))
2161 (clobber (match_scratch:SI 3 ""))
2162 (clobber (match_scratch:SI 4 ""))]
2163 "TARGET_POWER && reload_completed"
2164 [(parallel [(set (match_dup 3)
2165 (mult:SI (match_dup 1) (match_dup 2)))
2166 (clobber (match_dup 4))])
2168 (compare:CC (match_dup 3)
2172 (define_insn "*mulsi3_no_mq_internal1"
2173 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2174 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2175 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2177 (clobber (match_scratch:SI 3 "=r,r"))]
2180 {muls.|mullw.} %3,%1,%2
2182 [(set_attr "type" "imul_compare")
2183 (set_attr "length" "4,8")])
2186 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2187 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2188 (match_operand:SI 2 "gpc_reg_operand" ""))
2190 (clobber (match_scratch:SI 3 ""))]
2191 "! TARGET_POWER && reload_completed"
2193 (mult:SI (match_dup 1) (match_dup 2)))
2195 (compare:CC (match_dup 3)
2199 (define_insn "*mulsi3_mq_internal2"
2200 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2201 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2202 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2204 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2205 (mult:SI (match_dup 1) (match_dup 2)))
2206 (clobber (match_scratch:SI 4 "=q,q"))]
2209 {muls.|mullw.} %0,%1,%2
2211 [(set_attr "type" "imul_compare")
2212 (set_attr "length" "4,8")])
2215 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2216 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2217 (match_operand:SI 2 "gpc_reg_operand" ""))
2219 (set (match_operand:SI 0 "gpc_reg_operand" "")
2220 (mult:SI (match_dup 1) (match_dup 2)))
2221 (clobber (match_scratch:SI 4 ""))]
2222 "TARGET_POWER && reload_completed"
2223 [(parallel [(set (match_dup 0)
2224 (mult:SI (match_dup 1) (match_dup 2)))
2225 (clobber (match_dup 4))])
2227 (compare:CC (match_dup 0)
2231 (define_insn "*mulsi3_no_mq_internal2"
2232 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2233 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2234 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2236 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2237 (mult:SI (match_dup 1) (match_dup 2)))]
2240 {muls.|mullw.} %0,%1,%2
2242 [(set_attr "type" "imul_compare")
2243 (set_attr "length" "4,8")])
2246 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2247 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2248 (match_operand:SI 2 "gpc_reg_operand" ""))
2250 (set (match_operand:SI 0 "gpc_reg_operand" "")
2251 (mult:SI (match_dup 1) (match_dup 2)))]
2252 "! TARGET_POWER && reload_completed"
2254 (mult:SI (match_dup 1) (match_dup 2)))
2256 (compare:CC (match_dup 0)
2260 ;; Operand 1 is divided by operand 2; quotient goes to operand
2261 ;; 0 and remainder to operand 3.
2262 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2264 (define_expand "divmodsi4"
2265 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2266 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2267 (match_operand:SI 2 "gpc_reg_operand" "")))
2268 (set (match_operand:SI 3 "register_operand" "")
2269 (mod:SI (match_dup 1) (match_dup 2)))])]
2270 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2273 if (! TARGET_POWER && ! TARGET_POWERPC)
2275 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2276 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2277 emit_insn (gen_divss_call ());
2278 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2279 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2284 (define_insn "*divmodsi4_internal"
2285 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2286 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2287 (match_operand:SI 2 "gpc_reg_operand" "r")))
2288 (set (match_operand:SI 3 "register_operand" "=q")
2289 (mod:SI (match_dup 1) (match_dup 2)))]
2292 [(set_attr "type" "idiv")])
2294 (define_expand "udiv<mode>3"
2295 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2296 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2297 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2298 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2301 if (! TARGET_POWER && ! TARGET_POWERPC)
2303 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2304 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2305 emit_insn (gen_quous_call ());
2306 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2309 else if (TARGET_POWER)
2311 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2316 (define_insn "udivsi3_mq"
2317 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2318 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2319 (match_operand:SI 2 "gpc_reg_operand" "r")))
2320 (clobber (match_scratch:SI 3 "=q"))]
2321 "TARGET_POWERPC && TARGET_POWER"
2323 [(set_attr "type" "idiv")])
2325 (define_insn "*udivsi3_no_mq"
2326 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2327 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2328 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2329 "TARGET_POWERPC && ! TARGET_POWER"
2331 [(set_attr "type" "idiv")])
2333 ;; For powers of two we can do srai/aze for divide and then adjust for
2334 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2335 ;; used; for PowerPC, force operands into register and do a normal divide;
2336 ;; for AIX common-mode, use quoss call on register operands.
2337 (define_expand "div<mode>3"
2338 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2339 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2340 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2344 if (GET_CODE (operands[2]) == CONST_INT
2345 && INTVAL (operands[2]) > 0
2346 && exact_log2 (INTVAL (operands[2])) >= 0)
2348 else if (TARGET_POWERPC)
2350 operands[2] = force_reg (SImode, operands[2]);
2353 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2357 else if (TARGET_POWER)
2361 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2362 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2363 emit_insn (gen_quoss_call ());
2364 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2369 (define_insn "divsi3_mq"
2370 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2371 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2372 (match_operand:SI 2 "gpc_reg_operand" "r")))
2373 (clobber (match_scratch:SI 3 "=q"))]
2374 "TARGET_POWERPC && TARGET_POWER"
2376 [(set_attr "type" "idiv")])
2378 (define_insn "*div<mode>3_no_mq"
2379 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2380 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2381 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2382 "TARGET_POWERPC && ! TARGET_POWER"
2384 [(set_attr "type" "idiv")])
2386 (define_expand "mod<mode>3"
2387 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2388 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2389 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2397 if (GET_CODE (operands[2]) != CONST_INT
2398 || INTVAL (operands[2]) <= 0
2399 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2402 temp1 = gen_reg_rtx (<MODE>mode);
2403 temp2 = gen_reg_rtx (<MODE>mode);
2405 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2406 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2407 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2412 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2413 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2414 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2416 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2417 [(set_attr "type" "two")
2418 (set_attr "length" "8")])
2421 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2422 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2423 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2425 (clobber (match_scratch:P 3 "=r,r"))]
2428 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2430 [(set_attr "type" "compare")
2431 (set_attr "length" "8,12")])
2434 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2435 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2436 (match_operand:GPR 2 "exact_log2_cint_operand"
2439 (clobber (match_scratch:GPR 3 ""))]
2442 (div:<MODE> (match_dup 1) (match_dup 2)))
2444 (compare:CC (match_dup 3)
2449 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2450 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2451 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2453 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2454 (div:P (match_dup 1) (match_dup 2)))]
2457 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2459 [(set_attr "type" "compare")
2460 (set_attr "length" "8,12")])
2463 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2464 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2465 (match_operand:GPR 2 "exact_log2_cint_operand"
2468 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2469 (div:GPR (match_dup 1) (match_dup 2)))]
2472 (div:<MODE> (match_dup 1) (match_dup 2)))
2474 (compare:CC (match_dup 0)
2479 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2482 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2484 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2485 (match_operand:SI 3 "gpc_reg_operand" "r")))
2486 (set (match_operand:SI 2 "register_operand" "=*q")
2489 (zero_extend:DI (match_dup 1)) (const_int 32))
2490 (zero_extend:DI (match_dup 4)))
2494 [(set_attr "type" "idiv")])
2496 ;; To do unsigned divide we handle the cases of the divisor looking like a
2497 ;; negative number. If it is a constant that is less than 2**31, we don't
2498 ;; have to worry about the branches. So make a few subroutines here.
2500 ;; First comes the normal case.
2501 (define_expand "udivmodsi4_normal"
2502 [(set (match_dup 4) (const_int 0))
2503 (parallel [(set (match_operand:SI 0 "" "")
2504 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2506 (zero_extend:DI (match_operand:SI 1 "" "")))
2507 (match_operand:SI 2 "" "")))
2508 (set (match_operand:SI 3 "" "")
2509 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2511 (zero_extend:DI (match_dup 1)))
2515 { operands[4] = gen_reg_rtx (SImode); }")
2517 ;; This handles the branches.
2518 (define_expand "udivmodsi4_tests"
2519 [(set (match_operand:SI 0 "" "") (const_int 0))
2520 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2521 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2522 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2523 (label_ref (match_operand:SI 4 "" "")) (pc)))
2524 (set (match_dup 0) (const_int 1))
2525 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2526 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2527 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2528 (label_ref (match_dup 4)) (pc)))]
2531 { operands[5] = gen_reg_rtx (CCUNSmode);
2532 operands[6] = gen_reg_rtx (CCmode);
2535 (define_expand "udivmodsi4"
2536 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2537 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2538 (match_operand:SI 2 "reg_or_cint_operand" "")))
2539 (set (match_operand:SI 3 "gpc_reg_operand" "")
2540 (umod:SI (match_dup 1) (match_dup 2)))])]
2548 if (! TARGET_POWERPC)
2550 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2551 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2552 emit_insn (gen_divus_call ());
2553 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2554 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2561 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2563 operands[2] = force_reg (SImode, operands[2]);
2564 label = gen_label_rtx ();
2565 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2566 operands[3], label));
2569 operands[2] = force_reg (SImode, operands[2]);
2571 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2579 ;; AIX architecture-independent common-mode multiply (DImode),
2580 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2581 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2582 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2583 ;; assumed unused if generating common-mode, so ignore.
2584 (define_insn "mulh_call"
2587 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2588 (sign_extend:DI (reg:SI 4)))
2590 (clobber (match_scratch:SI 0 "=l"))]
2591 "! TARGET_POWER && ! TARGET_POWERPC"
2593 [(set_attr "type" "imul")])
2595 (define_insn "mull_call"
2597 (mult:DI (sign_extend:DI (reg:SI 3))
2598 (sign_extend:DI (reg:SI 4))))
2599 (clobber (match_scratch:SI 0 "=l"))
2600 (clobber (reg:SI 0))]
2601 "! TARGET_POWER && ! TARGET_POWERPC"
2603 [(set_attr "type" "imul")])
2605 (define_insn "divss_call"
2607 (div:SI (reg:SI 3) (reg:SI 4)))
2609 (mod:SI (reg:SI 3) (reg:SI 4)))
2610 (clobber (match_scratch:SI 0 "=l"))
2611 (clobber (reg:SI 0))]
2612 "! TARGET_POWER && ! TARGET_POWERPC"
2614 [(set_attr "type" "idiv")])
2616 (define_insn "divus_call"
2618 (udiv:SI (reg:SI 3) (reg:SI 4)))
2620 (umod:SI (reg:SI 3) (reg:SI 4)))
2621 (clobber (match_scratch:SI 0 "=l"))
2622 (clobber (reg:SI 0))
2623 (clobber (match_scratch:CC 1 "=x"))
2624 (clobber (reg:CC 69))]
2625 "! TARGET_POWER && ! TARGET_POWERPC"
2627 [(set_attr "type" "idiv")])
2629 (define_insn "quoss_call"
2631 (div:SI (reg:SI 3) (reg:SI 4)))
2632 (clobber (match_scratch:SI 0 "=l"))]
2633 "! TARGET_POWER && ! TARGET_POWERPC"
2635 [(set_attr "type" "idiv")])
2637 (define_insn "quous_call"
2639 (udiv:SI (reg:SI 3) (reg:SI 4)))
2640 (clobber (match_scratch:SI 0 "=l"))
2641 (clobber (reg:SI 0))
2642 (clobber (match_scratch:CC 1 "=x"))
2643 (clobber (reg:CC 69))]
2644 "! TARGET_POWER && ! TARGET_POWERPC"
2646 [(set_attr "type" "idiv")])
2648 ;; Logical instructions
2649 ;; The logical instructions are mostly combined by using match_operator,
2650 ;; but the plain AND insns are somewhat different because there is no
2651 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2652 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2654 (define_insn "andsi3"
2655 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2656 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2657 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2658 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2662 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2663 {andil.|andi.} %0,%1,%b2
2664 {andiu.|andis.} %0,%1,%u2"
2665 [(set_attr "type" "*,*,compare,compare")])
2667 ;; Note to set cr's other than cr0 we do the and immediate and then
2668 ;; the test again -- this avoids a mfcr which on the higher end
2669 ;; machines causes an execution serialization
2671 (define_insn "*andsi3_internal2"
2672 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2673 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2674 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2676 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2677 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2681 {andil.|andi.} %3,%1,%b2
2682 {andiu.|andis.} %3,%1,%u2
2683 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2688 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2689 (set_attr "length" "4,4,4,4,8,8,8,8")])
2691 (define_insn "*andsi3_internal3"
2692 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2693 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2694 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2696 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2697 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2701 {andil.|andi.} %3,%1,%b2
2702 {andiu.|andis.} %3,%1,%u2
2703 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2708 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2709 (set_attr "length" "8,4,4,4,8,8,8,8")])
2712 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2713 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2714 (match_operand:GPR 2 "and_operand" ""))
2716 (clobber (match_scratch:GPR 3 ""))
2717 (clobber (match_scratch:CC 4 ""))]
2719 [(parallel [(set (match_dup 3)
2720 (and:<MODE> (match_dup 1)
2722 (clobber (match_dup 4))])
2724 (compare:CC (match_dup 3)
2728 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2729 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2732 [(set (match_operand:CC 0 "cc_reg_operand" "")
2733 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2734 (match_operand:SI 2 "gpc_reg_operand" ""))
2736 (clobber (match_scratch:SI 3 ""))
2737 (clobber (match_scratch:CC 4 ""))]
2738 "TARGET_POWERPC64 && reload_completed"
2739 [(parallel [(set (match_dup 3)
2740 (and:SI (match_dup 1)
2742 (clobber (match_dup 4))])
2744 (compare:CC (match_dup 3)
2748 (define_insn "*andsi3_internal4"
2749 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2750 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2751 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2753 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2754 (and:SI (match_dup 1)
2756 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2760 {andil.|andi.} %0,%1,%b2
2761 {andiu.|andis.} %0,%1,%u2
2762 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2767 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2768 (set_attr "length" "4,4,4,4,8,8,8,8")])
2770 (define_insn "*andsi3_internal5"
2771 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2772 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2773 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2775 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2776 (and:SI (match_dup 1)
2778 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2782 {andil.|andi.} %0,%1,%b2
2783 {andiu.|andis.} %0,%1,%u2
2784 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2789 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2790 (set_attr "length" "8,4,4,4,8,8,8,8")])
2793 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2794 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2795 (match_operand:SI 2 "and_operand" ""))
2797 (set (match_operand:SI 0 "gpc_reg_operand" "")
2798 (and:SI (match_dup 1)
2800 (clobber (match_scratch:CC 4 ""))]
2802 [(parallel [(set (match_dup 0)
2803 (and:SI (match_dup 1)
2805 (clobber (match_dup 4))])
2807 (compare:CC (match_dup 0)
2812 [(set (match_operand:CC 3 "cc_reg_operand" "")
2813 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2814 (match_operand:SI 2 "gpc_reg_operand" ""))
2816 (set (match_operand:SI 0 "gpc_reg_operand" "")
2817 (and:SI (match_dup 1)
2819 (clobber (match_scratch:CC 4 ""))]
2820 "TARGET_POWERPC64 && reload_completed"
2821 [(parallel [(set (match_dup 0)
2822 (and:SI (match_dup 1)
2824 (clobber (match_dup 4))])
2826 (compare:CC (match_dup 0)
2830 ;; Handle the PowerPC64 rlwinm corner case
2832 (define_insn_and_split "*andsi3_internal6"
2833 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2834 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2835 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2840 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2843 (rotate:SI (match_dup 0) (match_dup 5)))]
2846 int mb = extract_MB (operands[2]);
2847 int me = extract_ME (operands[2]);
2848 operands[3] = GEN_INT (me + 1);
2849 operands[5] = GEN_INT (32 - (me + 1));
2850 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2852 [(set_attr "length" "8")])
2854 (define_expand "iorsi3"
2855 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2856 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2857 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2861 if (GET_CODE (operands[2]) == CONST_INT
2862 && ! logical_operand (operands[2], SImode))
2864 HOST_WIDE_INT value = INTVAL (operands[2]);
2865 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2866 ? operands[0] : gen_reg_rtx (SImode));
2868 emit_insn (gen_iorsi3 (tmp, operands[1],
2869 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2870 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2875 (define_expand "xorsi3"
2876 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2877 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2878 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2882 if (GET_CODE (operands[2]) == CONST_INT
2883 && ! logical_operand (operands[2], SImode))
2885 HOST_WIDE_INT value = INTVAL (operands[2]);
2886 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2887 ? operands[0] : gen_reg_rtx (SImode));
2889 emit_insn (gen_xorsi3 (tmp, operands[1],
2890 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2891 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2896 (define_insn "*boolsi3_internal1"
2897 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2898 (match_operator:SI 3 "boolean_or_operator"
2899 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2900 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2904 {%q3il|%q3i} %0,%1,%b2
2905 {%q3iu|%q3is} %0,%1,%u2")
2907 (define_insn "*boolsi3_internal2"
2908 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2909 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2910 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2911 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2913 (clobber (match_scratch:SI 3 "=r,r"))]
2918 [(set_attr "type" "compare")
2919 (set_attr "length" "4,8")])
2922 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2923 (compare:CC (match_operator:SI 4 "boolean_operator"
2924 [(match_operand:SI 1 "gpc_reg_operand" "")
2925 (match_operand:SI 2 "gpc_reg_operand" "")])
2927 (clobber (match_scratch:SI 3 ""))]
2928 "TARGET_32BIT && reload_completed"
2929 [(set (match_dup 3) (match_dup 4))
2931 (compare:CC (match_dup 3)
2935 (define_insn "*boolsi3_internal3"
2936 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2937 (compare:CC (match_operator:SI 4 "boolean_operator"
2938 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2939 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2941 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2947 [(set_attr "type" "compare")
2948 (set_attr "length" "4,8")])
2951 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2952 (compare:CC (match_operator:SI 4 "boolean_operator"
2953 [(match_operand:SI 1 "gpc_reg_operand" "")
2954 (match_operand:SI 2 "gpc_reg_operand" "")])
2956 (set (match_operand:SI 0 "gpc_reg_operand" "")
2958 "TARGET_32BIT && reload_completed"
2959 [(set (match_dup 0) (match_dup 4))
2961 (compare:CC (match_dup 0)
2965 ;; Split a logical operation that we can't do in one insn into two insns,
2966 ;; each of which does one 16-bit part. This is used by combine.
2969 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2970 (match_operator:SI 3 "boolean_or_operator"
2971 [(match_operand:SI 1 "gpc_reg_operand" "")
2972 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2974 [(set (match_dup 0) (match_dup 4))
2975 (set (match_dup 0) (match_dup 5))]
2979 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2980 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2982 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2983 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2987 (define_insn "*boolcsi3_internal1"
2988 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2989 (match_operator:SI 3 "boolean_operator"
2990 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2991 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2995 (define_insn "*boolcsi3_internal2"
2996 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2997 (compare:CC (match_operator:SI 4 "boolean_operator"
2998 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2999 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3001 (clobber (match_scratch:SI 3 "=r,r"))]
3006 [(set_attr "type" "compare")
3007 (set_attr "length" "4,8")])
3010 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3011 (compare:CC (match_operator:SI 4 "boolean_operator"
3012 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3013 (match_operand:SI 2 "gpc_reg_operand" "")])
3015 (clobber (match_scratch:SI 3 ""))]
3016 "TARGET_32BIT && reload_completed"
3017 [(set (match_dup 3) (match_dup 4))
3019 (compare:CC (match_dup 3)
3023 (define_insn "*boolcsi3_internal3"
3024 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3025 (compare:CC (match_operator:SI 4 "boolean_operator"
3026 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3027 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3029 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3035 [(set_attr "type" "compare")
3036 (set_attr "length" "4,8")])
3039 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3040 (compare:CC (match_operator:SI 4 "boolean_operator"
3041 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3042 (match_operand:SI 2 "gpc_reg_operand" "")])
3044 (set (match_operand:SI 0 "gpc_reg_operand" "")
3046 "TARGET_32BIT && reload_completed"
3047 [(set (match_dup 0) (match_dup 4))
3049 (compare:CC (match_dup 0)
3053 (define_insn "*boolccsi3_internal1"
3054 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3055 (match_operator:SI 3 "boolean_operator"
3056 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3057 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3061 (define_insn "*boolccsi3_internal2"
3062 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3063 (compare:CC (match_operator:SI 4 "boolean_operator"
3064 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3065 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3067 (clobber (match_scratch:SI 3 "=r,r"))]
3072 [(set_attr "type" "compare")
3073 (set_attr "length" "4,8")])
3076 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3077 (compare:CC (match_operator:SI 4 "boolean_operator"
3078 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3079 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3081 (clobber (match_scratch:SI 3 ""))]
3082 "TARGET_32BIT && reload_completed"
3083 [(set (match_dup 3) (match_dup 4))
3085 (compare:CC (match_dup 3)
3089 (define_insn "*boolccsi3_internal3"
3090 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3091 (compare:CC (match_operator:SI 4 "boolean_operator"
3092 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3093 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3095 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3101 [(set_attr "type" "compare")
3102 (set_attr "length" "4,8")])
3105 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3106 (compare:CC (match_operator:SI 4 "boolean_operator"
3107 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3108 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3110 (set (match_operand:SI 0 "gpc_reg_operand" "")
3112 "TARGET_32BIT && reload_completed"
3113 [(set (match_dup 0) (match_dup 4))
3115 (compare:CC (match_dup 0)
3119 ;; maskir insn. We need four forms because things might be in arbitrary
3120 ;; orders. Don't define forms that only set CR fields because these
3121 ;; would modify an input register.
3123 (define_insn "*maskir_internal1"
3124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3125 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3126 (match_operand:SI 1 "gpc_reg_operand" "0"))
3127 (and:SI (match_dup 2)
3128 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3132 (define_insn "*maskir_internal2"
3133 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3134 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3135 (match_operand:SI 1 "gpc_reg_operand" "0"))
3136 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3141 (define_insn "*maskir_internal3"
3142 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3143 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3144 (match_operand:SI 3 "gpc_reg_operand" "r"))
3145 (and:SI (not:SI (match_dup 2))
3146 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3150 (define_insn "*maskir_internal4"
3151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3152 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3153 (match_operand:SI 2 "gpc_reg_operand" "r"))
3154 (and:SI (not:SI (match_dup 2))
3155 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3159 (define_insn "*maskir_internal5"
3160 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3162 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3163 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3164 (and:SI (match_dup 2)
3165 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3167 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3168 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3169 (and:SI (match_dup 2) (match_dup 3))))]
3174 [(set_attr "type" "compare")
3175 (set_attr "length" "4,8")])
3178 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3180 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3181 (match_operand:SI 1 "gpc_reg_operand" ""))
3182 (and:SI (match_dup 2)
3183 (match_operand:SI 3 "gpc_reg_operand" "")))
3185 (set (match_operand:SI 0 "gpc_reg_operand" "")
3186 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3187 (and:SI (match_dup 2) (match_dup 3))))]
3188 "TARGET_POWER && reload_completed"
3190 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3191 (and:SI (match_dup 2) (match_dup 3))))
3193 (compare:CC (match_dup 0)
3197 (define_insn "*maskir_internal6"
3198 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3200 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3201 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3202 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3205 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3206 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3207 (and:SI (match_dup 3) (match_dup 2))))]
3212 [(set_attr "type" "compare")
3213 (set_attr "length" "4,8")])
3216 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3218 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3219 (match_operand:SI 1 "gpc_reg_operand" ""))
3220 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3223 (set (match_operand:SI 0 "gpc_reg_operand" "")
3224 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3225 (and:SI (match_dup 3) (match_dup 2))))]
3226 "TARGET_POWER && reload_completed"
3228 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3229 (and:SI (match_dup 3) (match_dup 2))))
3231 (compare:CC (match_dup 0)
3235 (define_insn "*maskir_internal7"
3236 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3238 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3239 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3240 (and:SI (not:SI (match_dup 2))
3241 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3243 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3244 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3245 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3250 [(set_attr "type" "compare")
3251 (set_attr "length" "4,8")])
3254 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3256 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3257 (match_operand:SI 3 "gpc_reg_operand" ""))
3258 (and:SI (not:SI (match_dup 2))
3259 (match_operand:SI 1 "gpc_reg_operand" "")))
3261 (set (match_operand:SI 0 "gpc_reg_operand" "")
3262 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3263 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3264 "TARGET_POWER && reload_completed"
3266 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3267 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3269 (compare:CC (match_dup 0)
3273 (define_insn "*maskir_internal8"
3274 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3276 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3277 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3278 (and:SI (not:SI (match_dup 2))
3279 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3281 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3282 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3283 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3288 [(set_attr "type" "compare")
3289 (set_attr "length" "4,8")])
3292 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3294 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3295 (match_operand:SI 2 "gpc_reg_operand" ""))
3296 (and:SI (not:SI (match_dup 2))
3297 (match_operand:SI 1 "gpc_reg_operand" "")))
3299 (set (match_operand:SI 0 "gpc_reg_operand" "")
3300 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3301 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3302 "TARGET_POWER && reload_completed"
3304 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3305 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3307 (compare:CC (match_dup 0)
3311 ;; Rotate and shift insns, in all their variants. These support shifts,
3312 ;; field inserts and extracts, and various combinations thereof.
3313 (define_expand "insv"
3314 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3315 (match_operand:SI 1 "const_int_operand" "")
3316 (match_operand:SI 2 "const_int_operand" ""))
3317 (match_operand 3 "gpc_reg_operand" ""))]
3321 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3322 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3323 compiler if the address of the structure is taken later. */
3324 if (GET_CODE (operands[0]) == SUBREG
3325 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3328 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3329 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3331 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3335 (define_insn "insvsi"
3336 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3337 (match_operand:SI 1 "const_int_operand" "i")
3338 (match_operand:SI 2 "const_int_operand" "i"))
3339 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3343 int start = INTVAL (operands[2]) & 31;
3344 int size = INTVAL (operands[1]) & 31;
3346 operands[4] = GEN_INT (32 - start - size);
3347 operands[1] = GEN_INT (start + size - 1);
3348 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3350 [(set_attr "type" "insert_word")])
3352 (define_insn "*insvsi_internal1"
3353 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3354 (match_operand:SI 1 "const_int_operand" "i")
3355 (match_operand:SI 2 "const_int_operand" "i"))
3356 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3357 (match_operand:SI 4 "const_int_operand" "i")))]
3358 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3361 int shift = INTVAL (operands[4]) & 31;
3362 int start = INTVAL (operands[2]) & 31;
3363 int size = INTVAL (operands[1]) & 31;
3365 operands[4] = GEN_INT (shift - start - size);
3366 operands[1] = GEN_INT (start + size - 1);
3367 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3369 [(set_attr "type" "insert_word")])
3371 (define_insn "*insvsi_internal2"
3372 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3373 (match_operand:SI 1 "const_int_operand" "i")
3374 (match_operand:SI 2 "const_int_operand" "i"))
3375 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3376 (match_operand:SI 4 "const_int_operand" "i")))]
3377 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3380 int shift = INTVAL (operands[4]) & 31;
3381 int start = INTVAL (operands[2]) & 31;
3382 int size = INTVAL (operands[1]) & 31;
3384 operands[4] = GEN_INT (32 - shift - start - size);
3385 operands[1] = GEN_INT (start + size - 1);
3386 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3388 [(set_attr "type" "insert_word")])
3390 (define_insn "*insvsi_internal3"
3391 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3392 (match_operand:SI 1 "const_int_operand" "i")
3393 (match_operand:SI 2 "const_int_operand" "i"))
3394 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3395 (match_operand:SI 4 "const_int_operand" "i")))]
3396 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3399 int shift = INTVAL (operands[4]) & 31;
3400 int start = INTVAL (operands[2]) & 31;
3401 int size = INTVAL (operands[1]) & 31;
3403 operands[4] = GEN_INT (32 - shift - start - size);
3404 operands[1] = GEN_INT (start + size - 1);
3405 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3407 [(set_attr "type" "insert_word")])
3409 (define_insn "*insvsi_internal4"
3410 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3411 (match_operand:SI 1 "const_int_operand" "i")
3412 (match_operand:SI 2 "const_int_operand" "i"))
3413 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3414 (match_operand:SI 4 "const_int_operand" "i")
3415 (match_operand:SI 5 "const_int_operand" "i")))]
3416 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3419 int extract_start = INTVAL (operands[5]) & 31;
3420 int extract_size = INTVAL (operands[4]) & 31;
3421 int insert_start = INTVAL (operands[2]) & 31;
3422 int insert_size = INTVAL (operands[1]) & 31;
3424 /* Align extract field with insert field */
3425 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3426 operands[1] = GEN_INT (insert_start + insert_size - 1);
3427 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3429 [(set_attr "type" "insert_word")])
3431 ;; combine patterns for rlwimi
3432 (define_insn "*insvsi_internal5"
3433 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3434 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3435 (match_operand:SI 1 "mask_operand" "i"))
3436 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3437 (match_operand:SI 2 "const_int_operand" "i"))
3438 (match_operand:SI 5 "mask_operand" "i"))))]
3439 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3442 int me = extract_ME(operands[5]);
3443 int mb = extract_MB(operands[5]);
3444 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3445 operands[2] = GEN_INT(mb);
3446 operands[1] = GEN_INT(me);
3447 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3449 [(set_attr "type" "insert_word")])
3451 (define_insn "*insvsi_internal6"
3452 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3453 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3454 (match_operand:SI 2 "const_int_operand" "i"))
3455 (match_operand:SI 5 "mask_operand" "i"))
3456 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3457 (match_operand:SI 1 "mask_operand" "i"))))]
3458 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3461 int me = extract_ME(operands[5]);
3462 int mb = extract_MB(operands[5]);
3463 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3464 operands[2] = GEN_INT(mb);
3465 operands[1] = GEN_INT(me);
3466 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3468 [(set_attr "type" "insert_word")])
3470 (define_insn "insvdi"
3471 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3472 (match_operand:SI 1 "const_int_operand" "i")
3473 (match_operand:SI 2 "const_int_operand" "i"))
3474 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3478 int start = INTVAL (operands[2]) & 63;
3479 int size = INTVAL (operands[1]) & 63;
3481 operands[1] = GEN_INT (64 - start - size);
3482 return \"rldimi %0,%3,%H1,%H2\";
3485 (define_insn "*insvdi_internal2"
3486 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3487 (match_operand:SI 1 "const_int_operand" "i")
3488 (match_operand:SI 2 "const_int_operand" "i"))
3489 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3490 (match_operand:SI 4 "const_int_operand" "i")))]
3492 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3495 int shift = INTVAL (operands[4]) & 63;
3496 int start = (INTVAL (operands[2]) & 63) - 32;
3497 int size = INTVAL (operands[1]) & 63;
3499 operands[4] = GEN_INT (64 - shift - start - size);
3500 operands[2] = GEN_INT (start);
3501 operands[1] = GEN_INT (start + size - 1);
3502 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3505 (define_insn "*insvdi_internal3"
3506 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3507 (match_operand:SI 1 "const_int_operand" "i")
3508 (match_operand:SI 2 "const_int_operand" "i"))
3509 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3510 (match_operand:SI 4 "const_int_operand" "i")))]
3512 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3515 int shift = INTVAL (operands[4]) & 63;
3516 int start = (INTVAL (operands[2]) & 63) - 32;
3517 int size = INTVAL (operands[1]) & 63;
3519 operands[4] = GEN_INT (64 - shift - start - size);
3520 operands[2] = GEN_INT (start);
3521 operands[1] = GEN_INT (start + size - 1);
3522 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3525 (define_expand "extzv"
3526 [(set (match_operand 0 "gpc_reg_operand" "")
3527 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3528 (match_operand:SI 2 "const_int_operand" "")
3529 (match_operand:SI 3 "const_int_operand" "")))]
3533 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3534 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3535 compiler if the address of the structure is taken later. */
3536 if (GET_CODE (operands[0]) == SUBREG
3537 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3540 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3541 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3543 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3547 (define_insn "extzvsi"
3548 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3549 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3550 (match_operand:SI 2 "const_int_operand" "i")
3551 (match_operand:SI 3 "const_int_operand" "i")))]
3555 int start = INTVAL (operands[3]) & 31;
3556 int size = INTVAL (operands[2]) & 31;
3558 if (start + size >= 32)
3559 operands[3] = const0_rtx;
3561 operands[3] = GEN_INT (start + size);
3562 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3565 (define_insn "*extzvsi_internal1"
3566 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3567 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3568 (match_operand:SI 2 "const_int_operand" "i,i")
3569 (match_operand:SI 3 "const_int_operand" "i,i"))
3571 (clobber (match_scratch:SI 4 "=r,r"))]
3575 int start = INTVAL (operands[3]) & 31;
3576 int size = INTVAL (operands[2]) & 31;
3578 /* Force split for non-cc0 compare. */
3579 if (which_alternative == 1)
3582 /* If the bit-field being tested fits in the upper or lower half of a
3583 word, it is possible to use andiu. or andil. to test it. This is
3584 useful because the condition register set-use delay is smaller for
3585 andi[ul]. than for rlinm. This doesn't work when the starting bit
3586 position is 0 because the LT and GT bits may be set wrong. */
3588 if ((start > 0 && start + size <= 16) || start >= 16)
3590 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3591 - (1 << (16 - (start & 15) - size))));
3593 return \"{andiu.|andis.} %4,%1,%3\";
3595 return \"{andil.|andi.} %4,%1,%3\";
3598 if (start + size >= 32)
3599 operands[3] = const0_rtx;
3601 operands[3] = GEN_INT (start + size);
3602 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3604 [(set_attr "type" "compare")
3605 (set_attr "length" "4,8")])
3608 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3609 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3610 (match_operand:SI 2 "const_int_operand" "")
3611 (match_operand:SI 3 "const_int_operand" ""))
3613 (clobber (match_scratch:SI 4 ""))]
3616 (zero_extract:SI (match_dup 1) (match_dup 2)
3619 (compare:CC (match_dup 4)
3623 (define_insn "*extzvsi_internal2"
3624 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3625 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3626 (match_operand:SI 2 "const_int_operand" "i,i")
3627 (match_operand:SI 3 "const_int_operand" "i,i"))
3629 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3630 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3634 int start = INTVAL (operands[3]) & 31;
3635 int size = INTVAL (operands[2]) & 31;
3637 /* Force split for non-cc0 compare. */
3638 if (which_alternative == 1)
3641 /* Since we are using the output value, we can't ignore any need for
3642 a shift. The bit-field must end at the LSB. */
3643 if (start >= 16 && start + size == 32)
3645 operands[3] = GEN_INT ((1 << size) - 1);
3646 return \"{andil.|andi.} %0,%1,%3\";
3649 if (start + size >= 32)
3650 operands[3] = const0_rtx;
3652 operands[3] = GEN_INT (start + size);
3653 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3655 [(set_attr "type" "compare")
3656 (set_attr "length" "4,8")])
3659 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3660 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3661 (match_operand:SI 2 "const_int_operand" "")
3662 (match_operand:SI 3 "const_int_operand" ""))
3664 (set (match_operand:SI 0 "gpc_reg_operand" "")
3665 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3668 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3670 (compare:CC (match_dup 0)
3674 (define_insn "extzvdi"
3675 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3676 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3677 (match_operand:SI 2 "const_int_operand" "i")
3678 (match_operand:SI 3 "const_int_operand" "i")))]
3682 int start = INTVAL (operands[3]) & 63;
3683 int size = INTVAL (operands[2]) & 63;
3685 if (start + size >= 64)
3686 operands[3] = const0_rtx;
3688 operands[3] = GEN_INT (start + size);
3689 operands[2] = GEN_INT (64 - size);
3690 return \"rldicl %0,%1,%3,%2\";
3693 (define_insn "*extzvdi_internal1"
3694 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3695 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3696 (match_operand:SI 2 "const_int_operand" "i")
3697 (match_operand:SI 3 "const_int_operand" "i"))
3699 (clobber (match_scratch:DI 4 "=r"))]
3703 int start = INTVAL (operands[3]) & 63;
3704 int size = INTVAL (operands[2]) & 63;
3706 if (start + size >= 64)
3707 operands[3] = const0_rtx;
3709 operands[3] = GEN_INT (start + size);
3710 operands[2] = GEN_INT (64 - size);
3711 return \"rldicl. %4,%1,%3,%2\";
3713 [(set_attr "type" "compare")])
3715 (define_insn "*extzvdi_internal2"
3716 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3717 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3718 (match_operand:SI 2 "const_int_operand" "i")
3719 (match_operand:SI 3 "const_int_operand" "i"))
3721 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3722 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3726 int start = INTVAL (operands[3]) & 63;
3727 int size = INTVAL (operands[2]) & 63;
3729 if (start + size >= 64)
3730 operands[3] = const0_rtx;
3732 operands[3] = GEN_INT (start + size);
3733 operands[2] = GEN_INT (64 - size);
3734 return \"rldicl. %0,%1,%3,%2\";
3736 [(set_attr "type" "compare")])
3738 (define_insn "rotlsi3"
3739 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3740 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3741 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3743 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3745 (define_insn "*rotlsi3_internal2"
3746 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3747 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3748 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3750 (clobber (match_scratch:SI 3 "=r,r"))]
3753 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3755 [(set_attr "type" "delayed_compare")
3756 (set_attr "length" "4,8")])
3759 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3760 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3761 (match_operand:SI 2 "reg_or_cint_operand" ""))
3763 (clobber (match_scratch:SI 3 ""))]
3766 (rotate:SI (match_dup 1) (match_dup 2)))
3768 (compare:CC (match_dup 3)
3772 (define_insn "*rotlsi3_internal3"
3773 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3774 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3775 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3777 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3778 (rotate:SI (match_dup 1) (match_dup 2)))]
3781 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3783 [(set_attr "type" "delayed_compare")
3784 (set_attr "length" "4,8")])
3787 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3788 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3789 (match_operand:SI 2 "reg_or_cint_operand" ""))
3791 (set (match_operand:SI 0 "gpc_reg_operand" "")
3792 (rotate:SI (match_dup 1) (match_dup 2)))]
3795 (rotate:SI (match_dup 1) (match_dup 2)))
3797 (compare:CC (match_dup 0)
3801 (define_insn "*rotlsi3_internal4"
3802 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3803 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3804 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3805 (match_operand:SI 3 "mask_operand" "n")))]
3807 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3809 (define_insn "*rotlsi3_internal5"
3810 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3812 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3813 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3814 (match_operand:SI 3 "mask_operand" "n,n"))
3816 (clobber (match_scratch:SI 4 "=r,r"))]
3819 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3821 [(set_attr "type" "delayed_compare")
3822 (set_attr "length" "4,8")])
3825 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3827 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3828 (match_operand:SI 2 "reg_or_cint_operand" ""))
3829 (match_operand:SI 3 "mask_operand" ""))
3831 (clobber (match_scratch:SI 4 ""))]
3834 (and:SI (rotate:SI (match_dup 1)
3838 (compare:CC (match_dup 4)
3842 (define_insn "*rotlsi3_internal6"
3843 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3845 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3846 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3847 (match_operand:SI 3 "mask_operand" "n,n"))
3849 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3850 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3853 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3855 [(set_attr "type" "delayed_compare")
3856 (set_attr "length" "4,8")])
3859 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3861 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3862 (match_operand:SI 2 "reg_or_cint_operand" ""))
3863 (match_operand:SI 3 "mask_operand" ""))
3865 (set (match_operand:SI 0 "gpc_reg_operand" "")
3866 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3869 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3871 (compare:CC (match_dup 0)
3875 (define_insn "*rotlsi3_internal7"
3876 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3879 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3880 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3882 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3884 (define_insn "*rotlsi3_internal8"
3885 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3886 (compare:CC (zero_extend:SI
3888 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3889 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3891 (clobber (match_scratch:SI 3 "=r,r"))]
3894 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3896 [(set_attr "type" "delayed_compare")
3897 (set_attr "length" "4,8")])
3900 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3901 (compare:CC (zero_extend:SI
3903 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3904 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3906 (clobber (match_scratch:SI 3 ""))]
3909 (zero_extend:SI (subreg:QI
3910 (rotate:SI (match_dup 1)
3913 (compare:CC (match_dup 3)
3917 (define_insn "*rotlsi3_internal9"
3918 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3919 (compare:CC (zero_extend:SI
3921 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3922 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3924 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3925 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3928 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3930 [(set_attr "type" "delayed_compare")
3931 (set_attr "length" "4,8")])
3934 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3935 (compare:CC (zero_extend:SI
3937 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3938 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3940 (set (match_operand:SI 0 "gpc_reg_operand" "")
3941 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3944 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3946 (compare:CC (match_dup 0)
3950 (define_insn "*rotlsi3_internal10"
3951 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3954 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3955 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3957 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3959 (define_insn "*rotlsi3_internal11"
3960 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3961 (compare:CC (zero_extend:SI
3963 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3964 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3966 (clobber (match_scratch:SI 3 "=r,r"))]
3969 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3971 [(set_attr "type" "delayed_compare")
3972 (set_attr "length" "4,8")])
3975 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3976 (compare:CC (zero_extend:SI
3978 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3979 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3981 (clobber (match_scratch:SI 3 ""))]
3984 (zero_extend:SI (subreg:HI
3985 (rotate:SI (match_dup 1)
3988 (compare:CC (match_dup 3)
3992 (define_insn "*rotlsi3_internal12"
3993 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3994 (compare:CC (zero_extend:SI
3996 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3997 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3999 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4000 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4003 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
4005 [(set_attr "type" "delayed_compare")
4006 (set_attr "length" "4,8")])
4009 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4010 (compare:CC (zero_extend:SI
4012 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4013 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4015 (set (match_operand:SI 0 "gpc_reg_operand" "")
4016 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4019 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4021 (compare:CC (match_dup 0)
4025 ;; Note that we use "sle." instead of "sl." so that we can set
4026 ;; SHIFT_COUNT_TRUNCATED.
4028 (define_expand "ashlsi3"
4029 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4030 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4031 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4036 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4038 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4042 (define_insn "ashlsi3_power"
4043 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4044 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4045 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4046 (clobber (match_scratch:SI 3 "=q,X"))]
4050 {sli|slwi} %0,%1,%h2")
4052 (define_insn "ashlsi3_no_power"
4053 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4054 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4055 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4057 "{sl|slw}%I2 %0,%1,%h2")
4060 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4061 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4062 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4064 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4065 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4069 {sli.|slwi.} %3,%1,%h2
4072 [(set_attr "type" "delayed_compare")
4073 (set_attr "length" "4,4,8,8")])
4076 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4077 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4078 (match_operand:SI 2 "reg_or_cint_operand" ""))
4080 (clobber (match_scratch:SI 3 ""))
4081 (clobber (match_scratch:SI 4 ""))]
4082 "TARGET_POWER && reload_completed"
4083 [(parallel [(set (match_dup 3)
4084 (ashift:SI (match_dup 1) (match_dup 2)))
4085 (clobber (match_dup 4))])
4087 (compare:CC (match_dup 3)
4092 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4093 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4094 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4096 (clobber (match_scratch:SI 3 "=r,r"))]
4097 "! TARGET_POWER && TARGET_32BIT"
4099 {sl|slw}%I2. %3,%1,%h2
4101 [(set_attr "type" "delayed_compare")
4102 (set_attr "length" "4,8")])
4105 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4106 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4107 (match_operand:SI 2 "reg_or_cint_operand" ""))
4109 (clobber (match_scratch:SI 3 ""))]
4110 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4112 (ashift:SI (match_dup 1) (match_dup 2)))
4114 (compare:CC (match_dup 3)
4119 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4120 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4121 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4123 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4124 (ashift:SI (match_dup 1) (match_dup 2)))
4125 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4129 {sli.|slwi.} %0,%1,%h2
4132 [(set_attr "type" "delayed_compare")
4133 (set_attr "length" "4,4,8,8")])
4136 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4137 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4138 (match_operand:SI 2 "reg_or_cint_operand" ""))
4140 (set (match_operand:SI 0 "gpc_reg_operand" "")
4141 (ashift:SI (match_dup 1) (match_dup 2)))
4142 (clobber (match_scratch:SI 4 ""))]
4143 "TARGET_POWER && reload_completed"
4144 [(parallel [(set (match_dup 0)
4145 (ashift:SI (match_dup 1) (match_dup 2)))
4146 (clobber (match_dup 4))])
4148 (compare:CC (match_dup 0)
4153 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4154 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4155 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4157 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4158 (ashift:SI (match_dup 1) (match_dup 2)))]
4159 "! TARGET_POWER && TARGET_32BIT"
4161 {sl|slw}%I2. %0,%1,%h2
4163 [(set_attr "type" "delayed_compare")
4164 (set_attr "length" "4,8")])
4167 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4168 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4169 (match_operand:SI 2 "reg_or_cint_operand" ""))
4171 (set (match_operand:SI 0 "gpc_reg_operand" "")
4172 (ashift:SI (match_dup 1) (match_dup 2)))]
4173 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4175 (ashift:SI (match_dup 1) (match_dup 2)))
4177 (compare:CC (match_dup 0)
4181 (define_insn "rlwinm"
4182 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4183 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4184 (match_operand:SI 2 "const_int_operand" "i"))
4185 (match_operand:SI 3 "mask_operand" "n")))]
4186 "includes_lshift_p (operands[2], operands[3])"
4187 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4190 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4192 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4193 (match_operand:SI 2 "const_int_operand" "i,i"))
4194 (match_operand:SI 3 "mask_operand" "n,n"))
4196 (clobber (match_scratch:SI 4 "=r,r"))]
4197 "includes_lshift_p (operands[2], operands[3])"
4199 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4201 [(set_attr "type" "delayed_compare")
4202 (set_attr "length" "4,8")])
4205 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4207 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4208 (match_operand:SI 2 "const_int_operand" ""))
4209 (match_operand:SI 3 "mask_operand" ""))
4211 (clobber (match_scratch:SI 4 ""))]
4212 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4214 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4217 (compare:CC (match_dup 4)
4222 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4224 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4225 (match_operand:SI 2 "const_int_operand" "i,i"))
4226 (match_operand:SI 3 "mask_operand" "n,n"))
4228 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4229 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4230 "includes_lshift_p (operands[2], operands[3])"
4232 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4234 [(set_attr "type" "delayed_compare")
4235 (set_attr "length" "4,8")])
4238 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4240 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4241 (match_operand:SI 2 "const_int_operand" ""))
4242 (match_operand:SI 3 "mask_operand" ""))
4244 (set (match_operand:SI 0 "gpc_reg_operand" "")
4245 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4246 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4248 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4250 (compare:CC (match_dup 0)
4254 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4256 (define_expand "lshrsi3"
4257 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4258 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4259 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4264 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4266 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4270 (define_insn "lshrsi3_power"
4271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4272 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4273 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4274 (clobber (match_scratch:SI 3 "=q,X,X"))]
4279 {s%A2i|s%A2wi} %0,%1,%h2")
4281 (define_insn "lshrsi3_no_power"
4282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4283 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4284 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
4288 {sr|srw}%I2 %0,%1,%h2")
4291 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4292 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4293 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4295 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4296 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4301 {s%A2i.|s%A2wi.} %3,%1,%h2
4305 [(set_attr "type" "delayed_compare")
4306 (set_attr "length" "4,4,4,8,8,8")])
4309 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4310 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4311 (match_operand:SI 2 "reg_or_cint_operand" ""))
4313 (clobber (match_scratch:SI 3 ""))
4314 (clobber (match_scratch:SI 4 ""))]
4315 "TARGET_POWER && reload_completed"
4316 [(parallel [(set (match_dup 3)
4317 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4318 (clobber (match_dup 4))])
4320 (compare:CC (match_dup 3)
4325 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4326 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4327 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4329 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
4330 "! TARGET_POWER && TARGET_32BIT"
4333 {sr|srw}%I2. %3,%1,%h2
4336 [(set_attr "type" "delayed_compare")
4337 (set_attr "length" "4,4,8,8")])
4340 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4341 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4342 (match_operand:SI 2 "reg_or_cint_operand" ""))
4344 (clobber (match_scratch:SI 3 ""))]
4345 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4347 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4349 (compare:CC (match_dup 3)
4354 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4355 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4356 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4358 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4359 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4360 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4365 {s%A2i.|s%A2wi.} %0,%1,%h2
4369 [(set_attr "type" "delayed_compare")
4370 (set_attr "length" "4,4,4,8,8,8")])
4373 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4374 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4375 (match_operand:SI 2 "reg_or_cint_operand" ""))
4377 (set (match_operand:SI 0 "gpc_reg_operand" "")
4378 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4379 (clobber (match_scratch:SI 4 ""))]
4380 "TARGET_POWER && reload_completed"
4381 [(parallel [(set (match_dup 0)
4382 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4383 (clobber (match_dup 4))])
4385 (compare:CC (match_dup 0)
4390 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4391 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4392 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4394 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4395 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4396 "! TARGET_POWER && TARGET_32BIT"
4399 {sr|srw}%I2. %0,%1,%h2
4402 [(set_attr "type" "delayed_compare")
4403 (set_attr "length" "4,4,8,8")])
4406 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4407 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4408 (match_operand:SI 2 "reg_or_cint_operand" ""))
4410 (set (match_operand:SI 0 "gpc_reg_operand" "")
4411 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4412 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4414 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4416 (compare:CC (match_dup 0)
4421 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4422 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4423 (match_operand:SI 2 "const_int_operand" "i"))
4424 (match_operand:SI 3 "mask_operand" "n")))]
4425 "includes_rshift_p (operands[2], operands[3])"
4426 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4429 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4431 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4432 (match_operand:SI 2 "const_int_operand" "i,i"))
4433 (match_operand:SI 3 "mask_operand" "n,n"))
4435 (clobber (match_scratch:SI 4 "=r,r"))]
4436 "includes_rshift_p (operands[2], operands[3])"
4438 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4440 [(set_attr "type" "delayed_compare")
4441 (set_attr "length" "4,8")])
4444 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4446 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4447 (match_operand:SI 2 "const_int_operand" ""))
4448 (match_operand:SI 3 "mask_operand" ""))
4450 (clobber (match_scratch:SI 4 ""))]
4451 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4453 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4456 (compare:CC (match_dup 4)
4461 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4463 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4464 (match_operand:SI 2 "const_int_operand" "i,i"))
4465 (match_operand:SI 3 "mask_operand" "n,n"))
4467 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4468 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4469 "includes_rshift_p (operands[2], operands[3])"
4471 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4473 [(set_attr "type" "delayed_compare")
4474 (set_attr "length" "4,8")])
4477 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4479 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4480 (match_operand:SI 2 "const_int_operand" ""))
4481 (match_operand:SI 3 "mask_operand" ""))
4483 (set (match_operand:SI 0 "gpc_reg_operand" "")
4484 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4485 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4487 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4489 (compare:CC (match_dup 0)
4494 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4497 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4498 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4499 "includes_rshift_p (operands[2], GEN_INT (255))"
4500 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4503 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4507 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4508 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4510 (clobber (match_scratch:SI 3 "=r,r"))]
4511 "includes_rshift_p (operands[2], GEN_INT (255))"
4513 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4515 [(set_attr "type" "delayed_compare")
4516 (set_attr "length" "4,8")])
4519 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4523 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4524 (match_operand:SI 2 "const_int_operand" "")) 0))
4526 (clobber (match_scratch:SI 3 ""))]
4527 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4529 (zero_extend:SI (subreg:QI
4530 (lshiftrt:SI (match_dup 1)
4533 (compare:CC (match_dup 3)
4538 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4542 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4543 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4545 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4546 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4547 "includes_rshift_p (operands[2], GEN_INT (255))"
4549 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4551 [(set_attr "type" "delayed_compare")
4552 (set_attr "length" "4,8")])
4555 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4559 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4560 (match_operand:SI 2 "const_int_operand" "")) 0))
4562 (set (match_operand:SI 0 "gpc_reg_operand" "")
4563 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4564 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4566 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4568 (compare:CC (match_dup 0)
4573 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4576 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4577 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4578 "includes_rshift_p (operands[2], GEN_INT (65535))"
4579 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4582 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4586 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4587 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4589 (clobber (match_scratch:SI 3 "=r,r"))]
4590 "includes_rshift_p (operands[2], GEN_INT (65535))"
4592 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4594 [(set_attr "type" "delayed_compare")
4595 (set_attr "length" "4,8")])
4598 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4602 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4603 (match_operand:SI 2 "const_int_operand" "")) 0))
4605 (clobber (match_scratch:SI 3 ""))]
4606 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4608 (zero_extend:SI (subreg:HI
4609 (lshiftrt:SI (match_dup 1)
4612 (compare:CC (match_dup 3)
4617 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4621 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4622 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4624 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4625 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4626 "includes_rshift_p (operands[2], GEN_INT (65535))"
4628 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4630 [(set_attr "type" "delayed_compare")
4631 (set_attr "length" "4,8")])
4634 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4638 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4639 (match_operand:SI 2 "const_int_operand" "")) 0))
4641 (set (match_operand:SI 0 "gpc_reg_operand" "")
4642 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4643 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4645 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4647 (compare:CC (match_dup 0)
4652 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4654 (match_operand:SI 1 "gpc_reg_operand" "r"))
4655 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4661 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4663 (match_operand:SI 1 "gpc_reg_operand" "r"))
4664 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4670 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4672 (match_operand:SI 1 "gpc_reg_operand" "r"))
4673 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4679 (define_expand "ashrsi3"
4680 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4681 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4682 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4687 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4689 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4693 (define_insn "ashrsi3_power"
4694 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4695 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4696 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4697 (clobber (match_scratch:SI 3 "=q,X"))]
4701 {srai|srawi} %0,%1,%h2")
4703 (define_insn "ashrsi3_no_power"
4704 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4705 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4706 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4708 "{sra|sraw}%I2 %0,%1,%h2")
4711 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4712 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4713 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4715 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4716 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4720 {srai.|srawi.} %3,%1,%h2
4723 [(set_attr "type" "delayed_compare")
4724 (set_attr "length" "4,4,8,8")])
4727 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4728 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4729 (match_operand:SI 2 "reg_or_cint_operand" ""))
4731 (clobber (match_scratch:SI 3 ""))
4732 (clobber (match_scratch:SI 4 ""))]
4733 "TARGET_POWER && reload_completed"
4734 [(parallel [(set (match_dup 3)
4735 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4736 (clobber (match_dup 4))])
4738 (compare:CC (match_dup 3)
4743 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4744 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4745 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4747 (clobber (match_scratch:SI 3 "=r,r"))]
4750 {sra|sraw}%I2. %3,%1,%h2
4752 [(set_attr "type" "delayed_compare")
4753 (set_attr "length" "4,8")])
4756 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4757 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4758 (match_operand:SI 2 "reg_or_cint_operand" ""))
4760 (clobber (match_scratch:SI 3 ""))]
4761 "! TARGET_POWER && reload_completed"
4763 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4765 (compare:CC (match_dup 3)
4770 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4771 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4772 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4774 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4775 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4776 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4780 {srai.|srawi.} %0,%1,%h2
4783 [(set_attr "type" "delayed_compare")
4784 (set_attr "length" "4,4,8,8")])
4787 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4788 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4789 (match_operand:SI 2 "reg_or_cint_operand" ""))
4791 (set (match_operand:SI 0 "gpc_reg_operand" "")
4792 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4793 (clobber (match_scratch:SI 4 ""))]
4794 "TARGET_POWER && reload_completed"
4795 [(parallel [(set (match_dup 0)
4796 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4797 (clobber (match_dup 4))])
4799 (compare:CC (match_dup 0)
4804 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4805 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4806 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4808 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4809 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4812 {sra|sraw}%I2. %0,%1,%h2
4814 [(set_attr "type" "delayed_compare")
4815 (set_attr "length" "4,8")])
4818 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4819 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4820 (match_operand:SI 2 "reg_or_cint_operand" ""))
4822 (set (match_operand:SI 0 "gpc_reg_operand" "")
4823 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4824 "! TARGET_POWER && reload_completed"
4826 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4828 (compare:CC (match_dup 0)
4832 ;; Floating-point insns, excluding normal data motion.
4834 ;; PowerPC has a full set of single-precision floating point instructions.
4836 ;; For the POWER architecture, we pretend that we have both SFmode and
4837 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4838 ;; The only conversions we will do will be when storing to memory. In that
4839 ;; case, we will use the "frsp" instruction before storing.
4841 ;; Note that when we store into a single-precision memory location, we need to
4842 ;; use the frsp insn first. If the register being stored isn't dead, we
4843 ;; need a scratch register for the frsp. But this is difficult when the store
4844 ;; is done by reload. It is not incorrect to do the frsp on the register in
4845 ;; this case, we just lose precision that we would have otherwise gotten but
4846 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4848 (define_expand "extendsfdf2"
4849 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4850 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4851 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4854 (define_insn_and_split "*extendsfdf2_fpr"
4855 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4856 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4857 "TARGET_HARD_FLOAT && TARGET_FPRS"
4862 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4865 emit_note (NOTE_INSN_DELETED);
4868 [(set_attr "type" "fp,fp,fpload")])
4870 (define_expand "truncdfsf2"
4871 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4872 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4873 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4876 (define_insn "*truncdfsf2_fpr"
4877 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4878 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4879 "TARGET_HARD_FLOAT && TARGET_FPRS"
4881 [(set_attr "type" "fp")])
4883 (define_insn "aux_truncdfsf2"
4884 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4885 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4886 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4888 [(set_attr "type" "fp")])
4890 (define_expand "negsf2"
4891 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4892 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4896 (define_insn "*negsf2"
4897 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4898 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4899 "TARGET_HARD_FLOAT && TARGET_FPRS"
4901 [(set_attr "type" "fp")])
4903 (define_expand "abssf2"
4904 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4905 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4909 (define_insn "*abssf2"
4910 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4911 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4912 "TARGET_HARD_FLOAT && TARGET_FPRS"
4914 [(set_attr "type" "fp")])
4917 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4918 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4919 "TARGET_HARD_FLOAT && TARGET_FPRS"
4921 [(set_attr "type" "fp")])
4923 (define_expand "addsf3"
4924 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4925 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4926 (match_operand:SF 2 "gpc_reg_operand" "")))]
4931 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4932 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4933 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4934 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4936 [(set_attr "type" "fp")])
4939 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4940 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4941 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4942 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4943 "{fa|fadd} %0,%1,%2"
4944 [(set_attr "type" "fp")])
4946 (define_expand "subsf3"
4947 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4948 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4949 (match_operand:SF 2 "gpc_reg_operand" "")))]
4954 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4955 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4956 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4957 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4959 [(set_attr "type" "fp")])
4962 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4963 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4964 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4965 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4966 "{fs|fsub} %0,%1,%2"
4967 [(set_attr "type" "fp")])
4969 (define_expand "mulsf3"
4970 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4971 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4972 (match_operand:SF 2 "gpc_reg_operand" "")))]
4977 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4978 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4979 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4980 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4982 [(set_attr "type" "fp")])
4985 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4986 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4987 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4988 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4989 "{fm|fmul} %0,%1,%2"
4990 [(set_attr "type" "dmul")])
4993 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4994 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
4995 "TARGET_PPC_GFXOPT && flag_finite_math_only"
4997 [(set_attr "type" "fp")])
4999 (define_expand "divsf3"
5000 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5001 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5002 (match_operand:SF 2 "gpc_reg_operand" "")))]
5005 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
5006 && flag_finite_math_only && !flag_trapping_math)
5008 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5014 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5015 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5016 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5017 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5019 [(set_attr "type" "sdiv")])
5022 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5023 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5024 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5025 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5026 "{fd|fdiv} %0,%1,%2"
5027 [(set_attr "type" "ddiv")])
5030 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5031 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5032 (match_operand:SF 2 "gpc_reg_operand" "f"))
5033 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5034 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5035 "fmadds %0,%1,%2,%3"
5036 [(set_attr "type" "fp")])
5039 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5040 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5041 (match_operand:SF 2 "gpc_reg_operand" "f"))
5042 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5043 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5044 "{fma|fmadd} %0,%1,%2,%3"
5045 [(set_attr "type" "dmul")])
5048 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5049 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5050 (match_operand:SF 2 "gpc_reg_operand" "f"))
5051 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5052 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5053 "fmsubs %0,%1,%2,%3"
5054 [(set_attr "type" "fp")])
5057 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5058 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5059 (match_operand:SF 2 "gpc_reg_operand" "f"))
5060 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5061 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5062 "{fms|fmsub} %0,%1,%2,%3"
5063 [(set_attr "type" "dmul")])
5066 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5067 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5068 (match_operand:SF 2 "gpc_reg_operand" "f"))
5069 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5070 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5071 && HONOR_SIGNED_ZEROS (SFmode)"
5072 "fnmadds %0,%1,%2,%3"
5073 [(set_attr "type" "fp")])
5076 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5077 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5078 (match_operand:SF 2 "gpc_reg_operand" "f"))
5079 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5080 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5081 && ! HONOR_SIGNED_ZEROS (SFmode)"
5082 "fnmadds %0,%1,%2,%3"
5083 [(set_attr "type" "fp")])
5086 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5087 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5088 (match_operand:SF 2 "gpc_reg_operand" "f"))
5089 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5090 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5091 "{fnma|fnmadd} %0,%1,%2,%3"
5092 [(set_attr "type" "dmul")])
5095 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5096 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5097 (match_operand:SF 2 "gpc_reg_operand" "f"))
5098 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5099 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5100 && ! HONOR_SIGNED_ZEROS (SFmode)"
5101 "{fnma|fnmadd} %0,%1,%2,%3"
5102 [(set_attr "type" "dmul")])
5105 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5106 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5107 (match_operand:SF 2 "gpc_reg_operand" "f"))
5108 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5109 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5110 && HONOR_SIGNED_ZEROS (SFmode)"
5111 "fnmsubs %0,%1,%2,%3"
5112 [(set_attr "type" "fp")])
5115 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5116 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5117 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5118 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5119 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5120 && ! HONOR_SIGNED_ZEROS (SFmode)"
5121 "fnmsubs %0,%1,%2,%3"
5122 [(set_attr "type" "fp")])
5125 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5126 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5127 (match_operand:SF 2 "gpc_reg_operand" "f"))
5128 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5129 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5130 "{fnms|fnmsub} %0,%1,%2,%3"
5131 [(set_attr "type" "dmul")])
5134 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5135 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5136 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5137 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5138 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5139 && ! HONOR_SIGNED_ZEROS (SFmode)"
5140 "{fnms|fnmsub} %0,%1,%2,%3"
5141 [(set_attr "type" "dmul")])
5143 (define_expand "sqrtsf2"
5144 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5145 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5146 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5150 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5151 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5152 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5154 [(set_attr "type" "ssqrt")])
5157 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5158 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5159 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5161 [(set_attr "type" "dsqrt")])
5163 (define_expand "copysignsf3"
5165 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5167 (neg:SF (abs:SF (match_dup 1))))
5168 (set (match_operand:SF 0 "gpc_reg_operand" "")
5169 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5173 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5174 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5176 operands[3] = gen_reg_rtx (SFmode);
5177 operands[4] = gen_reg_rtx (SFmode);
5178 operands[5] = CONST0_RTX (SFmode);
5181 (define_expand "copysigndf3"
5183 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5185 (neg:DF (abs:DF (match_dup 1))))
5186 (set (match_operand:DF 0 "gpc_reg_operand" "")
5187 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5191 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5192 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5194 operands[3] = gen_reg_rtx (DFmode);
5195 operands[4] = gen_reg_rtx (DFmode);
5196 operands[5] = CONST0_RTX (DFmode);
5199 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5200 ;; fsel instruction and some auxiliary computations. Then we just have a
5201 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5203 (define_expand "smaxsf3"
5204 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5205 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5206 (match_operand:SF 2 "gpc_reg_operand" ""))
5209 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5210 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5212 (define_expand "sminsf3"
5213 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5214 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5215 (match_operand:SF 2 "gpc_reg_operand" ""))
5218 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5219 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5222 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5223 (match_operator:SF 3 "min_max_operator"
5224 [(match_operand:SF 1 "gpc_reg_operand" "")
5225 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5226 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5229 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5230 operands[1], operands[2]);
5234 (define_expand "movsicc"
5235 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5236 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5237 (match_operand:SI 2 "gpc_reg_operand" "")
5238 (match_operand:SI 3 "gpc_reg_operand" "")))]
5242 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5248 ;; We use the BASE_REGS for the isel input operands because, if rA is
5249 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5250 ;; because we may switch the operands and rB may end up being rA.
5252 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5253 ;; leave out the mode in operand 4 and use one pattern, but reload can
5254 ;; change the mode underneath our feet and then gets confused trying
5255 ;; to reload the value.
5256 (define_insn "isel_signed"
5257 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5259 (match_operator 1 "comparison_operator"
5260 [(match_operand:CC 4 "cc_reg_operand" "y")
5262 (match_operand:SI 2 "gpc_reg_operand" "b")
5263 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5266 { return output_isel (operands); }"
5267 [(set_attr "length" "4")])
5269 (define_insn "isel_unsigned"
5270 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5272 (match_operator 1 "comparison_operator"
5273 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5275 (match_operand:SI 2 "gpc_reg_operand" "b")
5276 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5279 { return output_isel (operands); }"
5280 [(set_attr "length" "4")])
5282 (define_expand "movsfcc"
5283 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5284 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5285 (match_operand:SF 2 "gpc_reg_operand" "")
5286 (match_operand:SF 3 "gpc_reg_operand" "")))]
5287 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5290 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5296 (define_insn "*fselsfsf4"
5297 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5298 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5299 (match_operand:SF 4 "zero_fp_constant" "F"))
5300 (match_operand:SF 2 "gpc_reg_operand" "f")
5301 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5302 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5304 [(set_attr "type" "fp")])
5306 (define_insn "*fseldfsf4"
5307 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5308 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5309 (match_operand:DF 4 "zero_fp_constant" "F"))
5310 (match_operand:SF 2 "gpc_reg_operand" "f")
5311 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5312 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5314 [(set_attr "type" "fp")])
5316 (define_expand "negdf2"
5317 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5318 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5319 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5322 (define_insn "*negdf2_fpr"
5323 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5324 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5325 "TARGET_HARD_FLOAT && TARGET_FPRS"
5327 [(set_attr "type" "fp")])
5329 (define_expand "absdf2"
5330 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5331 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5332 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5335 (define_insn "*absdf2_fpr"
5336 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5337 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5338 "TARGET_HARD_FLOAT && TARGET_FPRS"
5340 [(set_attr "type" "fp")])
5342 (define_insn "*nabsdf2_fpr"
5343 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5344 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5345 "TARGET_HARD_FLOAT && TARGET_FPRS"
5347 [(set_attr "type" "fp")])
5349 (define_expand "adddf3"
5350 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5351 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5352 (match_operand:DF 2 "gpc_reg_operand" "")))]
5353 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5356 (define_insn "*adddf3_fpr"
5357 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5358 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5359 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5360 "TARGET_HARD_FLOAT && TARGET_FPRS"
5361 "{fa|fadd} %0,%1,%2"
5362 [(set_attr "type" "fp")])
5364 (define_expand "subdf3"
5365 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5366 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5367 (match_operand:DF 2 "gpc_reg_operand" "")))]
5368 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5371 (define_insn "*subdf3_fpr"
5372 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5373 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5374 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5375 "TARGET_HARD_FLOAT && TARGET_FPRS"
5376 "{fs|fsub} %0,%1,%2"
5377 [(set_attr "type" "fp")])
5379 (define_expand "muldf3"
5380 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5381 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5382 (match_operand:DF 2 "gpc_reg_operand" "")))]
5383 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5386 (define_insn "*muldf3_fpr"
5387 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5388 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5389 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5390 "TARGET_HARD_FLOAT && TARGET_FPRS"
5391 "{fm|fmul} %0,%1,%2"
5392 [(set_attr "type" "dmul")])
5395 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5396 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5397 "TARGET_POPCNTB && flag_finite_math_only"
5399 [(set_attr "type" "fp")])
5401 (define_expand "divdf3"
5402 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5403 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5404 (match_operand:DF 2 "gpc_reg_operand" "")))]
5405 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5407 if (swdiv && !optimize_size && TARGET_POPCNTB
5408 && flag_finite_math_only && !flag_trapping_math)
5410 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5415 (define_insn "*divdf3_fpr"
5416 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5417 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5418 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5419 "TARGET_HARD_FLOAT && TARGET_FPRS"
5420 "{fd|fdiv} %0,%1,%2"
5421 [(set_attr "type" "ddiv")])
5424 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5425 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5426 (match_operand:DF 2 "gpc_reg_operand" "f"))
5427 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5428 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5429 "{fma|fmadd} %0,%1,%2,%3"
5430 [(set_attr "type" "dmul")])
5433 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5434 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5435 (match_operand:DF 2 "gpc_reg_operand" "f"))
5436 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5437 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5438 "{fms|fmsub} %0,%1,%2,%3"
5439 [(set_attr "type" "dmul")])
5442 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5443 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5444 (match_operand:DF 2 "gpc_reg_operand" "f"))
5445 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5446 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5447 && HONOR_SIGNED_ZEROS (DFmode)"
5448 "{fnma|fnmadd} %0,%1,%2,%3"
5449 [(set_attr "type" "dmul")])
5452 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5453 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5454 (match_operand:DF 2 "gpc_reg_operand" "f"))
5455 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5456 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5457 && ! HONOR_SIGNED_ZEROS (DFmode)"
5458 "{fnma|fnmadd} %0,%1,%2,%3"
5459 [(set_attr "type" "dmul")])
5462 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5463 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5464 (match_operand:DF 2 "gpc_reg_operand" "f"))
5465 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5466 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5467 && HONOR_SIGNED_ZEROS (DFmode)"
5468 "{fnms|fnmsub} %0,%1,%2,%3"
5469 [(set_attr "type" "dmul")])
5472 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5473 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5474 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5475 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5476 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5477 && ! HONOR_SIGNED_ZEROS (DFmode)"
5478 "{fnms|fnmsub} %0,%1,%2,%3"
5479 [(set_attr "type" "dmul")])
5481 (define_insn "sqrtdf2"
5482 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5483 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5484 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5486 [(set_attr "type" "dsqrt")])
5488 ;; The conditional move instructions allow us to perform max and min
5489 ;; operations even when
5491 (define_expand "smaxdf3"
5492 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5493 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5494 (match_operand:DF 2 "gpc_reg_operand" ""))
5497 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5498 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5500 (define_expand "smindf3"
5501 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5502 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5503 (match_operand:DF 2 "gpc_reg_operand" ""))
5506 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5507 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5510 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5511 (match_operator:DF 3 "min_max_operator"
5512 [(match_operand:DF 1 "gpc_reg_operand" "")
5513 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5514 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5517 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5518 operands[1], operands[2]);
5522 (define_expand "movdfcc"
5523 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5524 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5525 (match_operand:DF 2 "gpc_reg_operand" "")
5526 (match_operand:DF 3 "gpc_reg_operand" "")))]
5527 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5530 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5536 (define_insn "*fseldfdf4"
5537 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5538 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5539 (match_operand:DF 4 "zero_fp_constant" "F"))
5540 (match_operand:DF 2 "gpc_reg_operand" "f")
5541 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5542 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5544 [(set_attr "type" "fp")])
5546 (define_insn "*fselsfdf4"
5547 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5548 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5549 (match_operand:SF 4 "zero_fp_constant" "F"))
5550 (match_operand:DF 2 "gpc_reg_operand" "f")
5551 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5554 [(set_attr "type" "fp")])
5556 ;; Conversions to and from floating-point.
5558 (define_expand "fixuns_truncsfsi2"
5559 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5560 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5561 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5564 (define_expand "fix_truncsfsi2"
5565 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5566 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5567 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5570 ; For each of these conversions, there is a define_expand, a define_insn
5571 ; with a '#' template, and a define_split (with C code). The idea is
5572 ; to allow constant folding with the template of the define_insn,
5573 ; then to have the insns split later (between sched1 and final).
5575 (define_expand "floatsidf2"
5576 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5577 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5580 (clobber (match_dup 4))
5581 (clobber (match_dup 5))
5582 (clobber (match_dup 6))])]
5583 "TARGET_HARD_FLOAT && TARGET_FPRS"
5586 if (TARGET_E500_DOUBLE)
5588 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5591 if (TARGET_POWERPC64)
5593 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5594 rtx t1 = gen_reg_rtx (DImode);
5595 rtx t2 = gen_reg_rtx (DImode);
5596 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5600 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5601 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5602 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5603 operands[5] = gen_reg_rtx (DFmode);
5604 operands[6] = gen_reg_rtx (SImode);
5607 (define_insn_and_split "*floatsidf2_internal"
5608 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5609 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5610 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5611 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5612 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5613 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5614 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5615 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5617 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5621 rtx lowword, highword;
5622 gcc_assert (MEM_P (operands[4]));
5623 highword = adjust_address (operands[4], SImode, 0);
5624 lowword = adjust_address (operands[4], SImode, 4);
5625 if (! WORDS_BIG_ENDIAN)
5628 tmp = highword; highword = lowword; lowword = tmp;
5631 emit_insn (gen_xorsi3 (operands[6], operands[1],
5632 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5633 emit_move_insn (lowword, operands[6]);
5634 emit_move_insn (highword, operands[2]);
5635 emit_move_insn (operands[5], operands[4]);
5636 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5639 [(set_attr "length" "24")])
5641 (define_expand "floatunssisf2"
5642 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5643 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5644 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5647 (define_expand "floatunssidf2"
5648 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5649 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5652 (clobber (match_dup 4))
5653 (clobber (match_dup 5))])]
5654 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5657 if (TARGET_E500_DOUBLE)
5659 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5662 if (TARGET_POWERPC64)
5664 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5665 rtx t1 = gen_reg_rtx (DImode);
5666 rtx t2 = gen_reg_rtx (DImode);
5667 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5672 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5673 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5674 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5675 operands[5] = gen_reg_rtx (DFmode);
5678 (define_insn_and_split "*floatunssidf2_internal"
5679 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5680 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5681 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5682 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5683 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5684 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5685 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5687 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5691 rtx lowword, highword;
5692 gcc_assert (MEM_P (operands[4]));
5693 highword = adjust_address (operands[4], SImode, 0);
5694 lowword = adjust_address (operands[4], SImode, 4);
5695 if (! WORDS_BIG_ENDIAN)
5698 tmp = highword; highword = lowword; lowword = tmp;
5701 emit_move_insn (lowword, operands[1]);
5702 emit_move_insn (highword, operands[2]);
5703 emit_move_insn (operands[5], operands[4]);
5704 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5707 [(set_attr "length" "20")])
5709 (define_expand "fix_truncdfsi2"
5710 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5711 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5712 (clobber (match_dup 2))
5713 (clobber (match_dup 3))])]
5714 "(TARGET_POWER2 || TARGET_POWERPC)
5715 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5718 if (TARGET_E500_DOUBLE)
5720 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5723 operands[2] = gen_reg_rtx (DImode);
5724 if (TARGET_PPC_GFXOPT)
5726 rtx orig_dest = operands[0];
5727 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5728 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5729 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5731 if (operands[0] != orig_dest)
5732 emit_move_insn (orig_dest, operands[0]);
5735 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5738 (define_insn_and_split "*fix_truncdfsi2_internal"
5739 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5740 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5741 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5742 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5743 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5745 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[3]))"
5750 gcc_assert (MEM_P (operands[3]));
5751 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5753 emit_insn (gen_fctiwz (operands[2], operands[1]));
5754 emit_move_insn (operands[3], operands[2]);
5755 emit_move_insn (operands[0], lowword);
5758 [(set_attr "length" "16")])
5760 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5761 [(set (match_operand:SI 0 "memory_operand" "=Z")
5762 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5763 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5764 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5765 && TARGET_PPC_GFXOPT"
5771 emit_insn (gen_fctiwz (operands[2], operands[1]));
5772 emit_insn (gen_stfiwx (operands[0], operands[2]));
5775 [(set_attr "length" "16")])
5777 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5778 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5779 ; because the first makes it clear that operand 0 is not live
5780 ; before the instruction.
5781 (define_insn "fctiwz"
5782 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5783 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5785 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5786 "{fcirz|fctiwz} %0,%1"
5787 [(set_attr "type" "fp")])
5789 (define_insn "btruncdf2"
5790 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5791 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5792 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5794 [(set_attr "type" "fp")])
5796 (define_insn "btruncsf2"
5797 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5798 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5799 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5801 [(set_attr "type" "fp")])
5803 (define_insn "ceildf2"
5804 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5805 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5806 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5808 [(set_attr "type" "fp")])
5810 (define_insn "ceilsf2"
5811 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5812 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5813 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5815 [(set_attr "type" "fp")])
5817 (define_insn "floordf2"
5818 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5819 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5820 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5822 [(set_attr "type" "fp")])
5824 (define_insn "floorsf2"
5825 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5826 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5827 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5829 [(set_attr "type" "fp")])
5831 (define_insn "rounddf2"
5832 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5833 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
5834 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5836 [(set_attr "type" "fp")])
5838 (define_insn "roundsf2"
5839 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5840 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
5841 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5843 [(set_attr "type" "fp")])
5845 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5846 (define_insn "stfiwx"
5847 [(set (match_operand:SI 0 "memory_operand" "=Z")
5848 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
5852 [(set_attr "type" "fpstore")])
5854 (define_expand "floatsisf2"
5855 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5856 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5857 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5860 (define_insn "floatdidf2"
5861 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5862 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5863 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5865 [(set_attr "type" "fp")])
5867 (define_insn_and_split "floatsidf_ppc64"
5868 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5869 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5870 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5871 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5872 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5873 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5876 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5877 (set (match_dup 2) (match_dup 3))
5878 (set (match_dup 4) (match_dup 2))
5879 (set (match_dup 0) (float:DF (match_dup 4)))]
5882 (define_insn_and_split "floatunssidf_ppc64"
5883 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5884 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5885 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5886 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5887 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5888 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5891 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5892 (set (match_dup 2) (match_dup 3))
5893 (set (match_dup 4) (match_dup 2))
5894 (set (match_dup 0) (float:DF (match_dup 4)))]
5897 (define_insn "fix_truncdfdi2"
5898 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5899 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5900 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5902 [(set_attr "type" "fp")])
5904 (define_expand "floatdisf2"
5905 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5906 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5907 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5910 rtx val = operands[1];
5911 if (!flag_unsafe_math_optimizations)
5913 rtx label = gen_label_rtx ();
5914 val = gen_reg_rtx (DImode);
5915 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5918 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5922 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5923 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5924 ;; from double rounding.
5925 (define_insn_and_split "floatdisf2_internal1"
5926 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5927 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5928 (clobber (match_scratch:DF 2 "=f"))]
5929 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5931 "&& reload_completed"
5933 (float:DF (match_dup 1)))
5935 (float_truncate:SF (match_dup 2)))]
5938 ;; Twiddles bits to avoid double rounding.
5939 ;; Bits that might be truncated when converting to DFmode are replaced
5940 ;; by a bit that won't be lost at that stage, but is below the SFmode
5941 ;; rounding position.
5942 (define_expand "floatdisf2_internal2"
5943 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
5945 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
5947 (clobber (scratch:CC))])
5948 (set (match_dup 3) (plus:DI (match_dup 3)
5950 (set (match_dup 0) (plus:DI (match_dup 0)
5952 (set (match_dup 4) (compare:CCUNS (match_dup 3)
5954 (set (match_dup 0) (ior:DI (match_dup 0)
5956 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
5958 (clobber (scratch:CC))])
5959 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
5960 (label_ref (match_operand:DI 2 "" ""))
5962 (set (match_dup 0) (match_dup 1))]
5963 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5966 operands[3] = gen_reg_rtx (DImode);
5967 operands[4] = gen_reg_rtx (CCUNSmode);
5970 ;; Define the DImode operations that can be done in a small number
5971 ;; of instructions. The & constraints are to prevent the register
5972 ;; allocator from allocating registers that overlap with the inputs
5973 ;; (for example, having an input in 7,8 and an output in 6,7). We
5974 ;; also allow for the output being the same as one of the inputs.
5976 (define_insn "*adddi3_noppc64"
5977 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5978 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5979 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5980 "! TARGET_POWERPC64"
5983 if (WORDS_BIG_ENDIAN)
5984 return (GET_CODE (operands[2])) != CONST_INT
5985 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5986 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5988 return (GET_CODE (operands[2])) != CONST_INT
5989 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5990 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5992 [(set_attr "type" "two")
5993 (set_attr "length" "8")])
5995 (define_insn "*subdi3_noppc64"
5996 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5997 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5998 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5999 "! TARGET_POWERPC64"
6002 if (WORDS_BIG_ENDIAN)
6003 return (GET_CODE (operands[1]) != CONST_INT)
6004 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6005 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6007 return (GET_CODE (operands[1]) != CONST_INT)
6008 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6009 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6011 [(set_attr "type" "two")
6012 (set_attr "length" "8")])
6014 (define_insn "*negdi2_noppc64"
6015 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6016 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6017 "! TARGET_POWERPC64"
6020 return (WORDS_BIG_ENDIAN)
6021 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6022 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6024 [(set_attr "type" "two")
6025 (set_attr "length" "8")])
6027 (define_expand "mulsidi3"
6028 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6029 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6030 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6031 "! TARGET_POWERPC64"
6034 if (! TARGET_POWER && ! TARGET_POWERPC)
6036 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6037 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6038 emit_insn (gen_mull_call ());
6039 if (WORDS_BIG_ENDIAN)
6040 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6043 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6044 gen_rtx_REG (SImode, 3));
6045 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6046 gen_rtx_REG (SImode, 4));
6050 else if (TARGET_POWER)
6052 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6057 (define_insn "mulsidi3_mq"
6058 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6059 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6060 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6061 (clobber (match_scratch:SI 3 "=q"))]
6063 "mul %0,%1,%2\;mfmq %L0"
6064 [(set_attr "type" "imul")
6065 (set_attr "length" "8")])
6067 (define_insn "*mulsidi3_no_mq"
6068 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6069 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6070 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6071 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6074 return (WORDS_BIG_ENDIAN)
6075 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6076 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6078 [(set_attr "type" "imul")
6079 (set_attr "length" "8")])
6082 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6083 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6084 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6085 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6088 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6089 (sign_extend:DI (match_dup 2)))
6092 (mult:SI (match_dup 1)
6096 int endian = (WORDS_BIG_ENDIAN == 0);
6097 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6098 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6101 (define_expand "umulsidi3"
6102 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6103 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6104 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6105 "TARGET_POWERPC && ! TARGET_POWERPC64"
6110 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6115 (define_insn "umulsidi3_mq"
6116 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6117 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6118 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6119 (clobber (match_scratch:SI 3 "=q"))]
6120 "TARGET_POWERPC && TARGET_POWER"
6123 return (WORDS_BIG_ENDIAN)
6124 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6125 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6127 [(set_attr "type" "imul")
6128 (set_attr "length" "8")])
6130 (define_insn "*umulsidi3_no_mq"
6131 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6132 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6133 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6134 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6137 return (WORDS_BIG_ENDIAN)
6138 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6139 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6141 [(set_attr "type" "imul")
6142 (set_attr "length" "8")])
6145 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6146 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6147 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6148 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6151 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6152 (zero_extend:DI (match_dup 2)))
6155 (mult:SI (match_dup 1)
6159 int endian = (WORDS_BIG_ENDIAN == 0);
6160 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6161 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6164 (define_expand "smulsi3_highpart"
6165 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6167 (lshiftrt:DI (mult:DI (sign_extend:DI
6168 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6170 (match_operand:SI 2 "gpc_reg_operand" "r")))
6175 if (! TARGET_POWER && ! TARGET_POWERPC)
6177 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6178 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6179 emit_insn (gen_mulh_call ());
6180 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6183 else if (TARGET_POWER)
6185 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6190 (define_insn "smulsi3_highpart_mq"
6191 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6193 (lshiftrt:DI (mult:DI (sign_extend:DI
6194 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6196 (match_operand:SI 2 "gpc_reg_operand" "r")))
6198 (clobber (match_scratch:SI 3 "=q"))]
6201 [(set_attr "type" "imul")])
6203 (define_insn "*smulsi3_highpart_no_mq"
6204 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6206 (lshiftrt:DI (mult:DI (sign_extend:DI
6207 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6209 (match_operand:SI 2 "gpc_reg_operand" "r")))
6211 "TARGET_POWERPC && ! TARGET_POWER"
6213 [(set_attr "type" "imul")])
6215 (define_expand "umulsi3_highpart"
6216 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6218 (lshiftrt:DI (mult:DI (zero_extend:DI
6219 (match_operand:SI 1 "gpc_reg_operand" ""))
6221 (match_operand:SI 2 "gpc_reg_operand" "")))
6228 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6233 (define_insn "umulsi3_highpart_mq"
6234 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6236 (lshiftrt:DI (mult:DI (zero_extend:DI
6237 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6239 (match_operand:SI 2 "gpc_reg_operand" "r")))
6241 (clobber (match_scratch:SI 3 "=q"))]
6242 "TARGET_POWERPC && TARGET_POWER"
6244 [(set_attr "type" "imul")])
6246 (define_insn "*umulsi3_highpart_no_mq"
6247 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6249 (lshiftrt:DI (mult:DI (zero_extend:DI
6250 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6252 (match_operand:SI 2 "gpc_reg_operand" "r")))
6254 "TARGET_POWERPC && ! TARGET_POWER"
6256 [(set_attr "type" "imul")])
6258 ;; If operands 0 and 2 are in the same register, we have a problem. But
6259 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6260 ;; why we have the strange constraints below.
6261 (define_insn "ashldi3_power"
6262 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6263 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6264 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6265 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6268 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6269 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6270 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6271 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6272 [(set_attr "length" "8")])
6274 (define_insn "lshrdi3_power"
6275 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6276 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6277 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6278 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6281 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6282 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6283 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6284 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6285 [(set_attr "length" "8")])
6287 ;; Shift by a variable amount is too complex to be worth open-coding. We
6288 ;; just handle shifts by constants.
6289 (define_insn "ashrdi3_power"
6290 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6291 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6292 (match_operand:SI 2 "const_int_operand" "M,i")))
6293 (clobber (match_scratch:SI 3 "=X,q"))]
6296 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6297 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6298 [(set_attr "length" "8")])
6300 (define_insn "ashrdi3_no_power"
6301 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6302 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6303 (match_operand:SI 2 "const_int_operand" "M,i")))]
6304 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6306 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6307 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6308 [(set_attr "type" "two,three")
6309 (set_attr "length" "8,12")])
6311 (define_insn "*ashrdisi3_noppc64"
6312 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6313 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6314 (const_int 32)) 4))]
6315 "TARGET_32BIT && !TARGET_POWERPC64"
6318 if (REGNO (operands[0]) == REGNO (operands[1]))
6321 return \"mr %0,%1\";
6323 [(set_attr "length" "4")])
6326 ;; PowerPC64 DImode operations.
6328 (define_insn_and_split "absdi2"
6329 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6330 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6331 (clobber (match_scratch:DI 2 "=&r,&r"))]
6334 "&& reload_completed"
6335 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6336 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6337 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6340 (define_insn_and_split "*nabsdi2"
6341 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6342 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6343 (clobber (match_scratch:DI 2 "=&r,&r"))]
6346 "&& reload_completed"
6347 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6348 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6349 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6352 (define_insn "muldi3"
6353 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6354 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6355 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6361 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6362 (const_string "imul3")
6363 (match_operand:SI 2 "short_cint_operand" "")
6364 (const_string "imul2")]
6365 (const_string "lmul")))])
6367 (define_insn "*muldi3_internal1"
6368 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6369 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6370 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6372 (clobber (match_scratch:DI 3 "=r,r"))]
6377 [(set_attr "type" "lmul_compare")
6378 (set_attr "length" "4,8")])
6381 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6382 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6383 (match_operand:DI 2 "gpc_reg_operand" ""))
6385 (clobber (match_scratch:DI 3 ""))]
6386 "TARGET_POWERPC64 && reload_completed"
6388 (mult:DI (match_dup 1) (match_dup 2)))
6390 (compare:CC (match_dup 3)
6394 (define_insn "*muldi3_internal2"
6395 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6396 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6397 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6399 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6400 (mult:DI (match_dup 1) (match_dup 2)))]
6405 [(set_attr "type" "lmul_compare")
6406 (set_attr "length" "4,8")])
6409 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6410 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6411 (match_operand:DI 2 "gpc_reg_operand" ""))
6413 (set (match_operand:DI 0 "gpc_reg_operand" "")
6414 (mult:DI (match_dup 1) (match_dup 2)))]
6415 "TARGET_POWERPC64 && reload_completed"
6417 (mult:DI (match_dup 1) (match_dup 2)))
6419 (compare:CC (match_dup 0)
6423 (define_insn "smuldi3_highpart"
6424 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6426 (lshiftrt:TI (mult:TI (sign_extend:TI
6427 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6429 (match_operand:DI 2 "gpc_reg_operand" "r")))
6433 [(set_attr "type" "lmul")])
6435 (define_insn "umuldi3_highpart"
6436 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6438 (lshiftrt:TI (mult:TI (zero_extend:TI
6439 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6441 (match_operand:DI 2 "gpc_reg_operand" "r")))
6445 [(set_attr "type" "lmul")])
6447 (define_insn "rotldi3"
6448 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6449 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6450 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6452 "rld%I2cl %0,%1,%H2,0")
6454 (define_insn "*rotldi3_internal2"
6455 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6456 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6457 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6459 (clobber (match_scratch:DI 3 "=r,r"))]
6462 rld%I2cl. %3,%1,%H2,0
6464 [(set_attr "type" "delayed_compare")
6465 (set_attr "length" "4,8")])
6468 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6469 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6470 (match_operand:DI 2 "reg_or_cint_operand" ""))
6472 (clobber (match_scratch:DI 3 ""))]
6473 "TARGET_POWERPC64 && reload_completed"
6475 (rotate:DI (match_dup 1) (match_dup 2)))
6477 (compare:CC (match_dup 3)
6481 (define_insn "*rotldi3_internal3"
6482 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6483 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6484 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6486 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6487 (rotate:DI (match_dup 1) (match_dup 2)))]
6490 rld%I2cl. %0,%1,%H2,0
6492 [(set_attr "type" "delayed_compare")
6493 (set_attr "length" "4,8")])
6496 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6497 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6498 (match_operand:DI 2 "reg_or_cint_operand" ""))
6500 (set (match_operand:DI 0 "gpc_reg_operand" "")
6501 (rotate:DI (match_dup 1) (match_dup 2)))]
6502 "TARGET_POWERPC64 && reload_completed"
6504 (rotate:DI (match_dup 1) (match_dup 2)))
6506 (compare:CC (match_dup 0)
6510 (define_insn "*rotldi3_internal4"
6511 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6512 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6513 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6514 (match_operand:DI 3 "mask64_operand" "n")))]
6516 "rld%I2c%B3 %0,%1,%H2,%S3")
6518 (define_insn "*rotldi3_internal5"
6519 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6521 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6522 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6523 (match_operand:DI 3 "mask64_operand" "n,n"))
6525 (clobber (match_scratch:DI 4 "=r,r"))]
6528 rld%I2c%B3. %4,%1,%H2,%S3
6530 [(set_attr "type" "delayed_compare")
6531 (set_attr "length" "4,8")])
6534 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6536 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6537 (match_operand:DI 2 "reg_or_cint_operand" ""))
6538 (match_operand:DI 3 "mask64_operand" ""))
6540 (clobber (match_scratch:DI 4 ""))]
6541 "TARGET_POWERPC64 && reload_completed"
6543 (and:DI (rotate:DI (match_dup 1)
6547 (compare:CC (match_dup 4)
6551 (define_insn "*rotldi3_internal6"
6552 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6554 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6555 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6556 (match_operand:DI 3 "mask64_operand" "n,n"))
6558 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6559 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6562 rld%I2c%B3. %0,%1,%H2,%S3
6564 [(set_attr "type" "delayed_compare")
6565 (set_attr "length" "4,8")])
6568 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6570 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6571 (match_operand:DI 2 "reg_or_cint_operand" ""))
6572 (match_operand:DI 3 "mask64_operand" ""))
6574 (set (match_operand:DI 0 "gpc_reg_operand" "")
6575 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6576 "TARGET_POWERPC64 && reload_completed"
6578 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6580 (compare:CC (match_dup 0)
6584 (define_insn "*rotldi3_internal7"
6585 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6588 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6589 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6591 "rld%I2cl %0,%1,%H2,56")
6593 (define_insn "*rotldi3_internal8"
6594 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6595 (compare:CC (zero_extend:DI
6597 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6598 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6600 (clobber (match_scratch:DI 3 "=r,r"))]
6603 rld%I2cl. %3,%1,%H2,56
6605 [(set_attr "type" "delayed_compare")
6606 (set_attr "length" "4,8")])
6609 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6610 (compare:CC (zero_extend:DI
6612 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6613 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6615 (clobber (match_scratch:DI 3 ""))]
6616 "TARGET_POWERPC64 && reload_completed"
6618 (zero_extend:DI (subreg:QI
6619 (rotate:DI (match_dup 1)
6622 (compare:CC (match_dup 3)
6626 (define_insn "*rotldi3_internal9"
6627 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6628 (compare:CC (zero_extend:DI
6630 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6631 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6633 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6634 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6637 rld%I2cl. %0,%1,%H2,56
6639 [(set_attr "type" "delayed_compare")
6640 (set_attr "length" "4,8")])
6643 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6644 (compare:CC (zero_extend:DI
6646 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6647 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6649 (set (match_operand:DI 0 "gpc_reg_operand" "")
6650 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6651 "TARGET_POWERPC64 && reload_completed"
6653 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6655 (compare:CC (match_dup 0)
6659 (define_insn "*rotldi3_internal10"
6660 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6663 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6664 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6666 "rld%I2cl %0,%1,%H2,48")
6668 (define_insn "*rotldi3_internal11"
6669 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6670 (compare:CC (zero_extend:DI
6672 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6673 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6675 (clobber (match_scratch:DI 3 "=r,r"))]
6678 rld%I2cl. %3,%1,%H2,48
6680 [(set_attr "type" "delayed_compare")
6681 (set_attr "length" "4,8")])
6684 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6685 (compare:CC (zero_extend:DI
6687 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6688 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6690 (clobber (match_scratch:DI 3 ""))]
6691 "TARGET_POWERPC64 && reload_completed"
6693 (zero_extend:DI (subreg:HI
6694 (rotate:DI (match_dup 1)
6697 (compare:CC (match_dup 3)
6701 (define_insn "*rotldi3_internal12"
6702 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6703 (compare:CC (zero_extend:DI
6705 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6706 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6708 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6709 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6712 rld%I2cl. %0,%1,%H2,48
6714 [(set_attr "type" "delayed_compare")
6715 (set_attr "length" "4,8")])
6718 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6719 (compare:CC (zero_extend:DI
6721 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6722 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6724 (set (match_operand:DI 0 "gpc_reg_operand" "")
6725 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6726 "TARGET_POWERPC64 && reload_completed"
6728 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6730 (compare:CC (match_dup 0)
6734 (define_insn "*rotldi3_internal13"
6735 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6738 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6739 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6741 "rld%I2cl %0,%1,%H2,32")
6743 (define_insn "*rotldi3_internal14"
6744 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6745 (compare:CC (zero_extend:DI
6747 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6748 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6750 (clobber (match_scratch:DI 3 "=r,r"))]
6753 rld%I2cl. %3,%1,%H2,32
6755 [(set_attr "type" "delayed_compare")
6756 (set_attr "length" "4,8")])
6759 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6760 (compare:CC (zero_extend:DI
6762 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6763 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6765 (clobber (match_scratch:DI 3 ""))]
6766 "TARGET_POWERPC64 && reload_completed"
6768 (zero_extend:DI (subreg:SI
6769 (rotate:DI (match_dup 1)
6772 (compare:CC (match_dup 3)
6776 (define_insn "*rotldi3_internal15"
6777 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6778 (compare:CC (zero_extend:DI
6780 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6781 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6783 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6784 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6787 rld%I2cl. %0,%1,%H2,32
6789 [(set_attr "type" "delayed_compare")
6790 (set_attr "length" "4,8")])
6793 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6794 (compare:CC (zero_extend:DI
6796 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6797 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6799 (set (match_operand:DI 0 "gpc_reg_operand" "")
6800 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6801 "TARGET_POWERPC64 && reload_completed"
6803 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6805 (compare:CC (match_dup 0)
6809 (define_expand "ashldi3"
6810 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6811 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6812 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6813 "TARGET_POWERPC64 || TARGET_POWER"
6816 if (TARGET_POWERPC64)
6818 else if (TARGET_POWER)
6820 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6827 (define_insn "*ashldi3_internal1"
6828 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6829 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6830 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6834 (define_insn "*ashldi3_internal2"
6835 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6836 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6837 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6839 (clobber (match_scratch:DI 3 "=r,r"))]
6844 [(set_attr "type" "delayed_compare")
6845 (set_attr "length" "4,8")])
6848 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6849 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6850 (match_operand:SI 2 "reg_or_cint_operand" ""))
6852 (clobber (match_scratch:DI 3 ""))]
6853 "TARGET_POWERPC64 && reload_completed"
6855 (ashift:DI (match_dup 1) (match_dup 2)))
6857 (compare:CC (match_dup 3)
6861 (define_insn "*ashldi3_internal3"
6862 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6863 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6864 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6866 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6867 (ashift:DI (match_dup 1) (match_dup 2)))]
6872 [(set_attr "type" "delayed_compare")
6873 (set_attr "length" "4,8")])
6876 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6877 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6878 (match_operand:SI 2 "reg_or_cint_operand" ""))
6880 (set (match_operand:DI 0 "gpc_reg_operand" "")
6881 (ashift:DI (match_dup 1) (match_dup 2)))]
6882 "TARGET_POWERPC64 && reload_completed"
6884 (ashift:DI (match_dup 1) (match_dup 2)))
6886 (compare:CC (match_dup 0)
6890 (define_insn "*ashldi3_internal4"
6891 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6892 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6893 (match_operand:SI 2 "const_int_operand" "i"))
6894 (match_operand:DI 3 "const_int_operand" "n")))]
6895 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6896 "rldic %0,%1,%H2,%W3")
6898 (define_insn "ashldi3_internal5"
6899 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6901 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6902 (match_operand:SI 2 "const_int_operand" "i,i"))
6903 (match_operand:DI 3 "const_int_operand" "n,n"))
6905 (clobber (match_scratch:DI 4 "=r,r"))]
6906 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6908 rldic. %4,%1,%H2,%W3
6910 [(set_attr "type" "compare")
6911 (set_attr "length" "4,8")])
6914 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6916 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6917 (match_operand:SI 2 "const_int_operand" ""))
6918 (match_operand:DI 3 "const_int_operand" ""))
6920 (clobber (match_scratch:DI 4 ""))]
6921 "TARGET_POWERPC64 && reload_completed
6922 && includes_rldic_lshift_p (operands[2], operands[3])"
6924 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6927 (compare:CC (match_dup 4)
6931 (define_insn "*ashldi3_internal6"
6932 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6934 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6935 (match_operand:SI 2 "const_int_operand" "i,i"))
6936 (match_operand:DI 3 "const_int_operand" "n,n"))
6938 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6939 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6940 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6942 rldic. %0,%1,%H2,%W3
6944 [(set_attr "type" "compare")
6945 (set_attr "length" "4,8")])
6948 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6950 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6951 (match_operand:SI 2 "const_int_operand" ""))
6952 (match_operand:DI 3 "const_int_operand" ""))
6954 (set (match_operand:DI 0 "gpc_reg_operand" "")
6955 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6956 "TARGET_POWERPC64 && reload_completed
6957 && includes_rldic_lshift_p (operands[2], operands[3])"
6959 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6962 (compare:CC (match_dup 0)
6966 (define_insn "*ashldi3_internal7"
6967 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6968 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6969 (match_operand:SI 2 "const_int_operand" "i"))
6970 (match_operand:DI 3 "mask64_operand" "n")))]
6971 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6972 "rldicr %0,%1,%H2,%S3")
6974 (define_insn "ashldi3_internal8"
6975 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6977 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6978 (match_operand:SI 2 "const_int_operand" "i,i"))
6979 (match_operand:DI 3 "mask64_operand" "n,n"))
6981 (clobber (match_scratch:DI 4 "=r,r"))]
6982 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6984 rldicr. %4,%1,%H2,%S3
6986 [(set_attr "type" "compare")
6987 (set_attr "length" "4,8")])
6990 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6992 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6993 (match_operand:SI 2 "const_int_operand" ""))
6994 (match_operand:DI 3 "mask64_operand" ""))
6996 (clobber (match_scratch:DI 4 ""))]
6997 "TARGET_POWERPC64 && reload_completed
6998 && includes_rldicr_lshift_p (operands[2], operands[3])"
7000 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7003 (compare:CC (match_dup 4)
7007 (define_insn "*ashldi3_internal9"
7008 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7010 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7011 (match_operand:SI 2 "const_int_operand" "i,i"))
7012 (match_operand:DI 3 "mask64_operand" "n,n"))
7014 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7015 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7016 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7018 rldicr. %0,%1,%H2,%S3
7020 [(set_attr "type" "compare")
7021 (set_attr "length" "4,8")])
7024 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7026 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7027 (match_operand:SI 2 "const_int_operand" ""))
7028 (match_operand:DI 3 "mask64_operand" ""))
7030 (set (match_operand:DI 0 "gpc_reg_operand" "")
7031 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7032 "TARGET_POWERPC64 && reload_completed
7033 && includes_rldicr_lshift_p (operands[2], operands[3])"
7035 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7038 (compare:CC (match_dup 0)
7042 (define_expand "lshrdi3"
7043 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7044 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7045 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7046 "TARGET_POWERPC64 || TARGET_POWER"
7049 if (TARGET_POWERPC64)
7051 else if (TARGET_POWER)
7053 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7060 (define_insn "*lshrdi3_internal1"
7061 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7062 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7063 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7067 (define_insn "*lshrdi3_internal2"
7068 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7069 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7070 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7072 (clobber (match_scratch:DI 3 "=r,r"))]
7077 [(set_attr "type" "delayed_compare")
7078 (set_attr "length" "4,8")])
7081 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7082 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7083 (match_operand:SI 2 "reg_or_cint_operand" ""))
7085 (clobber (match_scratch:DI 3 ""))]
7086 "TARGET_POWERPC64 && reload_completed"
7088 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7090 (compare:CC (match_dup 3)
7094 (define_insn "*lshrdi3_internal3"
7095 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7096 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7097 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7099 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7100 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7105 [(set_attr "type" "delayed_compare")
7106 (set_attr "length" "4,8")])
7109 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7110 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7111 (match_operand:SI 2 "reg_or_cint_operand" ""))
7113 (set (match_operand:DI 0 "gpc_reg_operand" "")
7114 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7115 "TARGET_POWERPC64 && reload_completed"
7117 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7119 (compare:CC (match_dup 0)
7123 (define_expand "ashrdi3"
7124 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7125 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7126 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7130 if (TARGET_POWERPC64)
7132 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7134 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7137 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7138 && WORDS_BIG_ENDIAN)
7140 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7147 (define_insn "*ashrdi3_internal1"
7148 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7149 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7150 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7152 "srad%I2 %0,%1,%H2")
7154 (define_insn "*ashrdi3_internal2"
7155 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7156 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7157 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7159 (clobber (match_scratch:DI 3 "=r,r"))]
7164 [(set_attr "type" "delayed_compare")
7165 (set_attr "length" "4,8")])
7168 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7169 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7170 (match_operand:SI 2 "reg_or_cint_operand" ""))
7172 (clobber (match_scratch:DI 3 ""))]
7173 "TARGET_POWERPC64 && reload_completed"
7175 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7177 (compare:CC (match_dup 3)
7181 (define_insn "*ashrdi3_internal3"
7182 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7183 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7184 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7186 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7187 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7192 [(set_attr "type" "delayed_compare")
7193 (set_attr "length" "4,8")])
7196 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7197 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7198 (match_operand:SI 2 "reg_or_cint_operand" ""))
7200 (set (match_operand:DI 0 "gpc_reg_operand" "")
7201 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7202 "TARGET_POWERPC64 && reload_completed"
7204 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7206 (compare:CC (match_dup 0)
7210 (define_insn "anddi3"
7211 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7212 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7213 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7214 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7218 rldic%B2 %0,%1,0,%S2
7219 rlwinm %0,%1,0,%m2,%M2
7223 [(set_attr "type" "*,*,*,compare,compare,*")
7224 (set_attr "length" "4,4,4,4,4,8")])
7227 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7228 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7229 (match_operand:DI 2 "mask64_2_operand" "")))
7230 (clobber (match_scratch:CC 3 ""))]
7232 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7233 && !mask_operand (operands[2], DImode)
7234 && !mask64_operand (operands[2], DImode)"
7236 (and:DI (rotate:DI (match_dup 1)
7240 (and:DI (rotate:DI (match_dup 0)
7244 build_mask64_2_operands (operands[2], &operands[4]);
7247 (define_insn "*anddi3_internal2"
7248 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7249 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7250 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7252 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7253 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7257 rldic%B2. %3,%1,0,%S2
7258 rlwinm. %3,%1,0,%m2,%M2
7268 [(set_attr "type" "compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7269 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7272 [(set (match_operand:CC 0 "cc_reg_operand" "")
7273 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7274 (match_operand:DI 2 "mask64_2_operand" ""))
7276 (clobber (match_scratch:DI 3 ""))
7277 (clobber (match_scratch:CC 4 ""))]
7278 "TARGET_64BIT && reload_completed
7279 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7280 && !mask_operand (operands[2], DImode)
7281 && !mask64_operand (operands[2], DImode)"
7283 (and:DI (rotate:DI (match_dup 1)
7286 (parallel [(set (match_dup 0)
7287 (compare:CC (and:DI (rotate:DI (match_dup 3)
7291 (clobber (match_dup 3))])]
7294 build_mask64_2_operands (operands[2], &operands[5]);
7297 (define_insn "*anddi3_internal3"
7298 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7299 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7300 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7302 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7303 (and:DI (match_dup 1) (match_dup 2)))
7304 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7308 rldic%B2. %0,%1,0,%S2
7309 rlwinm. %0,%1,0,%m2,%M2
7319 [(set_attr "type" "compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7320 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7323 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7324 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7325 (match_operand:DI 2 "and64_2_operand" ""))
7327 (set (match_operand:DI 0 "gpc_reg_operand" "")
7328 (and:DI (match_dup 1) (match_dup 2)))
7329 (clobber (match_scratch:CC 4 ""))]
7330 "TARGET_64BIT && reload_completed"
7331 [(parallel [(set (match_dup 0)
7332 (and:DI (match_dup 1) (match_dup 2)))
7333 (clobber (match_dup 4))])
7335 (compare:CC (match_dup 0)
7340 [(set (match_operand:CC 3 "cc_reg_operand" "")
7341 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7342 (match_operand:DI 2 "mask64_2_operand" ""))
7344 (set (match_operand:DI 0 "gpc_reg_operand" "")
7345 (and:DI (match_dup 1) (match_dup 2)))
7346 (clobber (match_scratch:CC 4 ""))]
7347 "TARGET_64BIT && reload_completed
7348 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7349 && !mask_operand (operands[2], DImode)
7350 && !mask64_operand (operands[2], DImode)"
7352 (and:DI (rotate:DI (match_dup 1)
7355 (parallel [(set (match_dup 3)
7356 (compare:CC (and:DI (rotate:DI (match_dup 0)
7361 (and:DI (rotate:DI (match_dup 0)
7366 build_mask64_2_operands (operands[2], &operands[5]);
7369 (define_expand "iordi3"
7370 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7371 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7372 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7376 if (non_logical_cint_operand (operands[2], DImode))
7378 HOST_WIDE_INT value;
7379 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7380 ? operands[0] : gen_reg_rtx (DImode));
7382 if (GET_CODE (operands[2]) == CONST_INT)
7384 value = INTVAL (operands[2]);
7385 emit_insn (gen_iordi3 (tmp, operands[1],
7386 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7390 value = CONST_DOUBLE_LOW (operands[2]);
7391 emit_insn (gen_iordi3 (tmp, operands[1],
7392 immed_double_const (value
7393 & (~ (HOST_WIDE_INT) 0xffff),
7397 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7402 (define_expand "xordi3"
7403 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7404 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7405 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7409 if (non_logical_cint_operand (operands[2], DImode))
7411 HOST_WIDE_INT value;
7412 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7413 ? operands[0] : gen_reg_rtx (DImode));
7415 if (GET_CODE (operands[2]) == CONST_INT)
7417 value = INTVAL (operands[2]);
7418 emit_insn (gen_xordi3 (tmp, operands[1],
7419 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7423 value = CONST_DOUBLE_LOW (operands[2]);
7424 emit_insn (gen_xordi3 (tmp, operands[1],
7425 immed_double_const (value
7426 & (~ (HOST_WIDE_INT) 0xffff),
7430 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7435 (define_insn "*booldi3_internal1"
7436 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7437 (match_operator:DI 3 "boolean_or_operator"
7438 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7439 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7446 (define_insn "*booldi3_internal2"
7447 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7448 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7449 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7450 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7452 (clobber (match_scratch:DI 3 "=r,r"))]
7457 [(set_attr "type" "compare")
7458 (set_attr "length" "4,8")])
7461 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7462 (compare:CC (match_operator:DI 4 "boolean_operator"
7463 [(match_operand:DI 1 "gpc_reg_operand" "")
7464 (match_operand:DI 2 "gpc_reg_operand" "")])
7466 (clobber (match_scratch:DI 3 ""))]
7467 "TARGET_POWERPC64 && reload_completed"
7468 [(set (match_dup 3) (match_dup 4))
7470 (compare:CC (match_dup 3)
7474 (define_insn "*booldi3_internal3"
7475 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7476 (compare:CC (match_operator:DI 4 "boolean_operator"
7477 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7478 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7480 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7486 [(set_attr "type" "compare")
7487 (set_attr "length" "4,8")])
7490 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7491 (compare:CC (match_operator:DI 4 "boolean_operator"
7492 [(match_operand:DI 1 "gpc_reg_operand" "")
7493 (match_operand:DI 2 "gpc_reg_operand" "")])
7495 (set (match_operand:DI 0 "gpc_reg_operand" "")
7497 "TARGET_POWERPC64 && reload_completed"
7498 [(set (match_dup 0) (match_dup 4))
7500 (compare:CC (match_dup 0)
7504 ;; Split a logical operation that we can't do in one insn into two insns,
7505 ;; each of which does one 16-bit part. This is used by combine.
7508 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7509 (match_operator:DI 3 "boolean_or_operator"
7510 [(match_operand:DI 1 "gpc_reg_operand" "")
7511 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7513 [(set (match_dup 0) (match_dup 4))
7514 (set (match_dup 0) (match_dup 5))]
7519 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7521 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7522 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7524 i4 = GEN_INT (value & 0xffff);
7528 i3 = GEN_INT (INTVAL (operands[2])
7529 & (~ (HOST_WIDE_INT) 0xffff));
7530 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7532 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7534 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7538 (define_insn "*boolcdi3_internal1"
7539 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7540 (match_operator:DI 3 "boolean_operator"
7541 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7542 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7546 (define_insn "*boolcdi3_internal2"
7547 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7548 (compare:CC (match_operator:DI 4 "boolean_operator"
7549 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7550 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7552 (clobber (match_scratch:DI 3 "=r,r"))]
7557 [(set_attr "type" "compare")
7558 (set_attr "length" "4,8")])
7561 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7562 (compare:CC (match_operator:DI 4 "boolean_operator"
7563 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7564 (match_operand:DI 2 "gpc_reg_operand" "")])
7566 (clobber (match_scratch:DI 3 ""))]
7567 "TARGET_POWERPC64 && reload_completed"
7568 [(set (match_dup 3) (match_dup 4))
7570 (compare:CC (match_dup 3)
7574 (define_insn "*boolcdi3_internal3"
7575 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7576 (compare:CC (match_operator:DI 4 "boolean_operator"
7577 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7578 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7580 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7586 [(set_attr "type" "compare")
7587 (set_attr "length" "4,8")])
7590 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7591 (compare:CC (match_operator:DI 4 "boolean_operator"
7592 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7593 (match_operand:DI 2 "gpc_reg_operand" "")])
7595 (set (match_operand:DI 0 "gpc_reg_operand" "")
7597 "TARGET_POWERPC64 && reload_completed"
7598 [(set (match_dup 0) (match_dup 4))
7600 (compare:CC (match_dup 0)
7604 (define_insn "*boolccdi3_internal1"
7605 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7606 (match_operator:DI 3 "boolean_operator"
7607 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7608 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7612 (define_insn "*boolccdi3_internal2"
7613 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7614 (compare:CC (match_operator:DI 4 "boolean_operator"
7615 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7616 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7618 (clobber (match_scratch:DI 3 "=r,r"))]
7623 [(set_attr "type" "compare")
7624 (set_attr "length" "4,8")])
7627 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7628 (compare:CC (match_operator:DI 4 "boolean_operator"
7629 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7630 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7632 (clobber (match_scratch:DI 3 ""))]
7633 "TARGET_POWERPC64 && reload_completed"
7634 [(set (match_dup 3) (match_dup 4))
7636 (compare:CC (match_dup 3)
7640 (define_insn "*boolccdi3_internal3"
7641 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7642 (compare:CC (match_operator:DI 4 "boolean_operator"
7643 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7644 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7646 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7652 [(set_attr "type" "compare")
7653 (set_attr "length" "4,8")])
7656 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7657 (compare:CC (match_operator:DI 4 "boolean_operator"
7658 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7659 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7661 (set (match_operand:DI 0 "gpc_reg_operand" "")
7663 "TARGET_POWERPC64 && reload_completed"
7664 [(set (match_dup 0) (match_dup 4))
7666 (compare:CC (match_dup 0)
7670 ;; Now define ways of moving data around.
7672 ;; Set up a register with a value from the GOT table
7674 (define_expand "movsi_got"
7675 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7676 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7677 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7678 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7681 if (GET_CODE (operands[1]) == CONST)
7683 rtx offset = const0_rtx;
7684 HOST_WIDE_INT value;
7686 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7687 value = INTVAL (offset);
7690 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7691 emit_insn (gen_movsi_got (tmp, operands[1]));
7692 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7697 operands[2] = rs6000_got_register (operands[1]);
7700 (define_insn "*movsi_got_internal"
7701 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7702 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7703 (match_operand:SI 2 "gpc_reg_operand" "b")]
7705 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7706 "{l|lwz} %0,%a1@got(%2)"
7707 [(set_attr "type" "load")])
7709 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7710 ;; didn't get allocated to a hard register.
7712 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7713 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7714 (match_operand:SI 2 "memory_operand" "")]
7716 "DEFAULT_ABI == ABI_V4
7718 && (reload_in_progress || reload_completed)"
7719 [(set (match_dup 0) (match_dup 2))
7720 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7724 ;; For SI, we special-case integers that can't be loaded in one insn. We
7725 ;; do the load 16-bits at a time. We could do this by loading from memory,
7726 ;; and this is even supposed to be faster, but it is simpler not to get
7727 ;; integers in the TOC.
7728 (define_insn "movsi_low"
7729 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7730 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7731 (match_operand 2 "" ""))))]
7732 "TARGET_MACHO && ! TARGET_64BIT"
7733 "{l|lwz} %0,lo16(%2)(%1)"
7734 [(set_attr "type" "load")
7735 (set_attr "length" "4")])
7737 (define_insn "*movsi_internal1"
7738 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7739 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7740 "gpc_reg_operand (operands[0], SImode)
7741 || gpc_reg_operand (operands[1], SImode)"
7745 {l%U1%X1|lwz%U1%X1} %0,%1
7746 {st%U0%X0|stw%U0%X0} %1,%0
7756 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7757 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7759 ;; Split a load of a large constant into the appropriate two-insn
7763 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7764 (match_operand:SI 1 "const_int_operand" ""))]
7765 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7766 && (INTVAL (operands[1]) & 0xffff) != 0"
7770 (ior:SI (match_dup 0)
7773 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7775 if (tem == operands[0])
7781 (define_insn "*mov<mode>_internal2"
7782 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7783 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7785 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7788 {cmpi|cmp<wd>i} %2,%0,0
7791 [(set_attr "type" "cmp,compare,cmp")
7792 (set_attr "length" "4,4,8")])
7795 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7796 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7798 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7800 [(set (match_dup 0) (match_dup 1))
7802 (compare:CC (match_dup 0)
7806 (define_insn "*movhi_internal"
7807 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7808 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7809 "gpc_reg_operand (operands[0], HImode)
7810 || gpc_reg_operand (operands[1], HImode)"
7820 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7822 (define_expand "mov<mode>"
7823 [(set (match_operand:INT 0 "general_operand" "")
7824 (match_operand:INT 1 "any_operand" ""))]
7826 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7828 (define_insn "*movqi_internal"
7829 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7830 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7831 "gpc_reg_operand (operands[0], QImode)
7832 || gpc_reg_operand (operands[1], QImode)"
7842 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7844 ;; Here is how to move condition codes around. When we store CC data in
7845 ;; an integer register or memory, we store just the high-order 4 bits.
7846 ;; This lets us not shift in the most common case of CR0.
7847 (define_expand "movcc"
7848 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7849 (match_operand:CC 1 "nonimmediate_operand" ""))]
7853 (define_insn "*movcc_internal1"
7854 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7855 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7856 "register_operand (operands[0], CCmode)
7857 || register_operand (operands[1], CCmode)"
7861 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7863 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7868 {l%U1%X1|lwz%U1%X1} %0,%1
7869 {st%U0%U1|stw%U0%U1} %1,%0"
7871 (cond [(eq_attr "alternative" "0")
7872 (const_string "cr_logical")
7873 (eq_attr "alternative" "1,2")
7874 (const_string "mtcr")
7875 (eq_attr "alternative" "5,7")
7876 (const_string "integer")
7877 (eq_attr "alternative" "6")
7878 (const_string "mfjmpr")
7879 (eq_attr "alternative" "8")
7880 (const_string "mtjmpr")
7881 (eq_attr "alternative" "9")
7882 (const_string "load")
7883 (eq_attr "alternative" "10")
7884 (const_string "store")
7885 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7886 (const_string "mfcrf")
7888 (const_string "mfcr")))
7889 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7891 ;; For floating-point, we normally deal with the floating-point registers
7892 ;; unless -msoft-float is used. The sole exception is that parameter passing
7893 ;; can produce floating-point values in fixed-point registers. Unless the
7894 ;; value is a simple constant or already in memory, we deal with this by
7895 ;; allocating memory and copying the value explicitly via that memory location.
7896 (define_expand "movsf"
7897 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7898 (match_operand:SF 1 "any_operand" ""))]
7900 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7903 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7904 (match_operand:SF 1 "const_double_operand" ""))]
7906 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7907 || (GET_CODE (operands[0]) == SUBREG
7908 && GET_CODE (SUBREG_REG (operands[0])) == REG
7909 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7910 [(set (match_dup 2) (match_dup 3))]
7916 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7917 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7919 if (! TARGET_POWERPC64)
7920 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7922 operands[2] = gen_lowpart (SImode, operands[0]);
7924 operands[3] = gen_int_mode (l, SImode);
7927 (define_insn "*movsf_hardfloat"
7928 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
7929 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7930 "(gpc_reg_operand (operands[0], SFmode)
7931 || gpc_reg_operand (operands[1], SFmode))
7932 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7935 {l%U1%X1|lwz%U1%X1} %0,%1
7936 {st%U0%X0|stw%U0%X0} %1,%0
7946 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
7947 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7949 (define_insn "*movsf_softfloat"
7950 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7951 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7952 "(gpc_reg_operand (operands[0], SFmode)
7953 || gpc_reg_operand (operands[1], SFmode))
7954 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7960 {l%U1%X1|lwz%U1%X1} %0,%1
7961 {st%U0%X0|stw%U0%X0} %1,%0
7968 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
7969 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7972 (define_expand "movdf"
7973 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7974 (match_operand:DF 1 "any_operand" ""))]
7976 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7979 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7980 (match_operand:DF 1 "const_int_operand" ""))]
7981 "! TARGET_POWERPC64 && reload_completed
7982 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7983 || (GET_CODE (operands[0]) == SUBREG
7984 && GET_CODE (SUBREG_REG (operands[0])) == REG
7985 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7986 [(set (match_dup 2) (match_dup 4))
7987 (set (match_dup 3) (match_dup 1))]
7990 int endian = (WORDS_BIG_ENDIAN == 0);
7991 HOST_WIDE_INT value = INTVAL (operands[1]);
7993 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7994 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7995 #if HOST_BITS_PER_WIDE_INT == 32
7996 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7998 operands[4] = GEN_INT (value >> 32);
7999 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8004 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8005 (match_operand:DF 1 "const_double_operand" ""))]
8006 "! TARGET_POWERPC64 && reload_completed
8007 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8008 || (GET_CODE (operands[0]) == SUBREG
8009 && GET_CODE (SUBREG_REG (operands[0])) == REG
8010 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8011 [(set (match_dup 2) (match_dup 4))
8012 (set (match_dup 3) (match_dup 5))]
8015 int endian = (WORDS_BIG_ENDIAN == 0);
8019 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8020 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8022 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8023 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8024 operands[4] = gen_int_mode (l[endian], SImode);
8025 operands[5] = gen_int_mode (l[1 - endian], SImode);
8029 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8030 (match_operand:DF 1 "const_double_operand" ""))]
8031 "TARGET_POWERPC64 && reload_completed
8032 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8033 || (GET_CODE (operands[0]) == SUBREG
8034 && GET_CODE (SUBREG_REG (operands[0])) == REG
8035 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8036 [(set (match_dup 2) (match_dup 3))]
8039 int endian = (WORDS_BIG_ENDIAN == 0);
8042 #if HOST_BITS_PER_WIDE_INT >= 64
8046 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8047 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8049 operands[2] = gen_lowpart (DImode, operands[0]);
8050 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8051 #if HOST_BITS_PER_WIDE_INT >= 64
8052 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8053 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8055 operands[3] = gen_int_mode (val, DImode);
8057 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8061 ;; Don't have reload use general registers to load a constant. First,
8062 ;; it might not work if the output operand is the equivalent of
8063 ;; a non-offsettable memref, but also it is less efficient than loading
8064 ;; the constant into an FP register, since it will probably be used there.
8065 ;; The "??" is a kludge until we can figure out a more reasonable way
8066 ;; of handling these non-offsettable values.
8067 (define_insn "*movdf_hardfloat32"
8068 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8069 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8070 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8071 && (gpc_reg_operand (operands[0], DFmode)
8072 || gpc_reg_operand (operands[1], DFmode))"
8075 switch (which_alternative)
8080 /* We normally copy the low-numbered register first. However, if
8081 the first register operand 0 is the same as the second register
8082 of operand 1, we must copy in the opposite order. */
8083 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8084 return \"mr %L0,%L1\;mr %0,%1\";
8086 return \"mr %0,%1\;mr %L0,%L1\";
8088 if (GET_CODE (operands[1]) == MEM
8089 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[1], 0),
8090 reload_completed || reload_in_progress)
8091 || rs6000_legitimate_small_data_p (DFmode, XEXP (operands[1], 0))
8092 || GET_CODE (XEXP (operands[1], 0)) == REG
8093 || GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8094 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8095 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC))
8097 /* If the low-address word is used in the address, we must load
8098 it last. Otherwise, load it first. Note that we cannot have
8099 auto-increment in that case since the address register is
8100 known to be dead. */
8101 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8103 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8105 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8111 addreg = find_addr_reg (XEXP (operands[1], 0));
8112 if (refers_to_regno_p (REGNO (operands[0]),
8113 REGNO (operands[0]) + 1,
8116 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8117 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8118 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8119 return \"{lx|lwzx} %0,%1\";
8123 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8124 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8125 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8126 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8131 if (GET_CODE (operands[0]) == MEM
8132 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[0], 0),
8133 reload_completed || reload_in_progress)
8134 || rs6000_legitimate_small_data_p (DFmode, XEXP (operands[0], 0))
8135 || GET_CODE (XEXP (operands[0], 0)) == REG
8136 || GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8137 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8138 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))
8139 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8144 addreg = find_addr_reg (XEXP (operands[0], 0));
8145 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8146 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8147 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8148 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8152 return \"fmr %0,%1\";
8154 return \"lfd%U1%X1 %0,%1\";
8156 return \"stfd%U0%X0 %1,%0\";
8163 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8164 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8166 (define_insn "*movdf_softfloat32"
8167 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8168 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8169 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8170 && (gpc_reg_operand (operands[0], DFmode)
8171 || gpc_reg_operand (operands[1], DFmode))"
8174 switch (which_alternative)
8179 /* We normally copy the low-numbered register first. However, if
8180 the first register operand 0 is the same as the second register of
8181 operand 1, we must copy in the opposite order. */
8182 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8183 return \"mr %L0,%L1\;mr %0,%1\";
8185 return \"mr %0,%1\;mr %L0,%L1\";
8187 /* If the low-address word is used in the address, we must load
8188 it last. Otherwise, load it first. Note that we cannot have
8189 auto-increment in that case since the address register is
8190 known to be dead. */
8191 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8193 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8195 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8197 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8204 [(set_attr "type" "two,load,store,*,*,*")
8205 (set_attr "length" "8,8,8,8,12,16")])
8207 ; ld/std require word-aligned displacements -> 'Y' constraint.
8208 ; List Y->r and r->Y before r->r for reload.
8209 (define_insn "*movdf_hardfloat64"
8210 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8211 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8212 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8213 && (gpc_reg_operand (operands[0], DFmode)
8214 || gpc_reg_operand (operands[1], DFmode))"
8228 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8229 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8231 (define_insn "*movdf_softfloat64"
8232 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8233 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8234 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8235 && (gpc_reg_operand (operands[0], DFmode)
8236 || gpc_reg_operand (operands[1], DFmode))"
8247 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8248 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8250 (define_expand "movtf"
8251 [(set (match_operand:TF 0 "general_operand" "")
8252 (match_operand:TF 1 "any_operand" ""))]
8254 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8255 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8257 ; It's important to list the o->f and f->o moves before f->f because
8258 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8259 ; which doesn't make progress. Likewise r->Y must be before r->r.
8260 (define_insn_and_split "*movtf_internal"
8261 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8262 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8264 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8265 && (gpc_reg_operand (operands[0], TFmode)
8266 || gpc_reg_operand (operands[1], TFmode))"
8268 "&& reload_completed"
8270 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8271 [(set_attr "length" "8,8,8,20,20,16")])
8273 (define_expand "extenddftf2"
8274 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8275 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8276 (use (match_dup 2))])]
8278 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8280 operands[2] = CONST0_RTX (DFmode);
8283 (define_insn_and_split "*extenddftf2_internal"
8284 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8285 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8286 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8288 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8290 "&& reload_completed"
8293 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8294 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8295 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8297 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8302 (define_expand "extendsftf2"
8303 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8304 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8306 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8308 rtx tmp = gen_reg_rtx (DFmode);
8309 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8310 emit_insn (gen_extenddftf2 (operands[0], tmp));
8314 (define_expand "trunctfdf2"
8315 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8316 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8318 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8321 (define_insn_and_split "trunctfdf2_internal1"
8322 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8323 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8324 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8325 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8329 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8332 emit_note (NOTE_INSN_DELETED);
8335 [(set_attr "type" "fp")])
8337 (define_insn "trunctfdf2_internal2"
8338 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8339 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8340 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8341 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8343 [(set_attr "type" "fp")])
8345 (define_insn_and_split "trunctfsf2"
8346 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8347 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8348 (clobber (match_scratch:DF 2 "=f"))]
8350 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8352 "&& reload_completed"
8354 (float_truncate:DF (match_dup 1)))
8356 (float_truncate:SF (match_dup 2)))]
8359 (define_expand "floatsitf2"
8360 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8361 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8363 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8365 rtx tmp = gen_reg_rtx (DFmode);
8366 expand_float (tmp, operands[1], false);
8367 emit_insn (gen_extenddftf2 (operands[0], tmp));
8371 ; fadd, but rounding towards zero.
8372 ; This is probably not the optimal code sequence.
8373 (define_insn "fix_trunc_helper"
8374 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8375 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8376 UNSPEC_FIX_TRUNC_TF))
8377 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8378 "TARGET_HARD_FLOAT && TARGET_FPRS"
8379 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8380 [(set_attr "type" "fp")
8381 (set_attr "length" "20")])
8383 (define_expand "fix_trunctfsi2"
8384 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8385 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8386 (clobber (match_dup 2))
8387 (clobber (match_dup 3))
8388 (clobber (match_dup 4))
8389 (clobber (match_dup 5))])]
8391 && (TARGET_POWER2 || TARGET_POWERPC)
8392 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8394 operands[2] = gen_reg_rtx (DFmode);
8395 operands[3] = gen_reg_rtx (DFmode);
8396 operands[4] = gen_reg_rtx (DImode);
8397 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8400 (define_insn_and_split "*fix_trunctfsi2_internal"
8401 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8402 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8403 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8404 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8405 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8406 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8408 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8410 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[5]))"
8414 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8416 gcc_assert (MEM_P (operands[5]));
8417 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8419 emit_insn (gen_fctiwz (operands[4], operands[2]));
8420 emit_move_insn (operands[5], operands[4]);
8421 emit_move_insn (operands[0], lowword);
8425 (define_insn "negtf2"
8426 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8427 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8429 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8432 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8433 return \"fneg %L0,%L1\;fneg %0,%1\";
8435 return \"fneg %0,%1\;fneg %L0,%L1\";
8437 [(set_attr "type" "fp")
8438 (set_attr "length" "8")])
8440 (define_expand "abstf2"
8441 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8442 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8444 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8447 rtx label = gen_label_rtx ();
8448 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8453 (define_expand "abstf2_internal"
8454 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8455 (match_operand:TF 1 "gpc_reg_operand" "f"))
8456 (set (match_dup 3) (match_dup 5))
8457 (set (match_dup 5) (abs:DF (match_dup 5)))
8458 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8459 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8460 (label_ref (match_operand 2 "" ""))
8462 (set (match_dup 6) (neg:DF (match_dup 6)))]
8464 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8467 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8468 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8469 operands[3] = gen_reg_rtx (DFmode);
8470 operands[4] = gen_reg_rtx (CCFPmode);
8471 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8472 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8475 ;; Next come the multi-word integer load and store and the load and store
8478 ; List r->r after r->"o<>", otherwise reload will try to reload a
8479 ; non-offsettable address by using r->r which won't make progress.
8480 (define_insn "*movdi_internal32"
8481 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8482 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8484 && (gpc_reg_operand (operands[0], DImode)
8485 || gpc_reg_operand (operands[1], DImode))"
8494 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8497 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8498 (match_operand:DI 1 "const_int_operand" ""))]
8499 "! TARGET_POWERPC64 && reload_completed"
8500 [(set (match_dup 2) (match_dup 4))
8501 (set (match_dup 3) (match_dup 1))]
8504 HOST_WIDE_INT value = INTVAL (operands[1]);
8505 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8507 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8509 #if HOST_BITS_PER_WIDE_INT == 32
8510 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8512 operands[4] = GEN_INT (value >> 32);
8513 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8518 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8519 (match_operand:DI 1 "input_operand" ""))]
8520 "reload_completed && !TARGET_POWERPC64
8521 && gpr_or_gpr_p (operands[0], operands[1])"
8523 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8525 (define_insn "*movdi_internal64"
8526 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8527 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8529 && (gpc_reg_operand (operands[0], DImode)
8530 || gpc_reg_operand (operands[1], DImode))"
8545 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8546 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8548 ;; immediate value valid for a single instruction hiding in a const_double
8550 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8551 (match_operand:DI 1 "const_double_operand" "F"))]
8552 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8553 && GET_CODE (operands[1]) == CONST_DOUBLE
8554 && num_insns_constant (operands[1], DImode) == 1"
8557 return ((unsigned HOST_WIDE_INT)
8558 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8559 ? \"li %0,%1\" : \"lis %0,%v1\";
8562 ;; Generate all one-bits and clear left or right.
8563 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8565 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8566 (match_operand:DI 1 "mask64_operand" ""))]
8567 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8568 [(set (match_dup 0) (const_int -1))
8570 (and:DI (rotate:DI (match_dup 0)
8575 ;; Split a load of a large constant into the appropriate five-instruction
8576 ;; sequence. Handle anything in a constant number of insns.
8577 ;; When non-easy constants can go in the TOC, this should use
8578 ;; easy_fp_constant predicate.
8580 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8581 (match_operand:DI 1 "const_int_operand" ""))]
8582 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8583 [(set (match_dup 0) (match_dup 2))
8584 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8586 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8588 if (tem == operands[0])
8595 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8596 (match_operand:DI 1 "const_double_operand" ""))]
8597 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8598 [(set (match_dup 0) (match_dup 2))
8599 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8601 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8603 if (tem == operands[0])
8609 ;; TImode is similar, except that we usually want to compute the address into
8610 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8611 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8613 ;; We say that MQ is clobbered in the last alternative because the first
8614 ;; alternative would never get used otherwise since it would need a reload
8615 ;; while the 2nd alternative would not. We put memory cases first so they
8616 ;; are preferred. Otherwise, we'd try to reload the output instead of
8617 ;; giving the SCRATCH mq.
8619 (define_insn "*movti_power"
8620 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8621 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8622 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8623 "TARGET_POWER && ! TARGET_POWERPC64
8624 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8627 switch (which_alternative)
8634 return \"{stsi|stswi} %1,%P0,16\";
8639 /* If the address is not used in the output, we can use lsi. Otherwise,
8640 fall through to generating four loads. */
8642 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8643 return \"{lsi|lswi} %0,%P1,16\";
8644 /* ... fall through ... */
8650 [(set_attr "type" "store,store,*,load,load,*")])
8652 (define_insn "*movti_string"
8653 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8654 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8655 "! TARGET_POWER && ! TARGET_POWERPC64
8656 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8659 switch (which_alternative)
8665 return \"{stsi|stswi} %1,%P0,16\";
8670 /* If the address is not used in the output, we can use lsi. Otherwise,
8671 fall through to generating four loads. */
8673 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8674 return \"{lsi|lswi} %0,%P1,16\";
8675 /* ... fall through ... */
8681 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
8683 (define_insn "*movti_ppc64"
8684 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8685 (match_operand:TI 1 "input_operand" "r,r,m"))]
8686 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8687 || gpc_reg_operand (operands[1], TImode))"
8689 [(set_attr "type" "*,load,store")])
8692 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8693 (match_operand:TI 1 "const_double_operand" ""))]
8695 [(set (match_dup 2) (match_dup 4))
8696 (set (match_dup 3) (match_dup 5))]
8699 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8701 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8703 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8705 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8706 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8708 else if (GET_CODE (operands[1]) == CONST_INT)
8710 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8711 operands[5] = operands[1];
8718 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8719 (match_operand:TI 1 "input_operand" ""))]
8721 && gpr_or_gpr_p (operands[0], operands[1])"
8723 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8725 (define_expand "load_multiple"
8726 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8727 (match_operand:SI 1 "" ""))
8728 (use (match_operand:SI 2 "" ""))])]
8729 "TARGET_STRING && !TARGET_POWERPC64"
8737 /* Support only loading a constant number of fixed-point registers from
8738 memory and only bother with this if more than two; the machine
8739 doesn't support more than eight. */
8740 if (GET_CODE (operands[2]) != CONST_INT
8741 || INTVAL (operands[2]) <= 2
8742 || INTVAL (operands[2]) > 8
8743 || GET_CODE (operands[1]) != MEM
8744 || GET_CODE (operands[0]) != REG
8745 || REGNO (operands[0]) >= 32)
8748 count = INTVAL (operands[2]);
8749 regno = REGNO (operands[0]);
8751 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8752 op1 = replace_equiv_address (operands[1],
8753 force_reg (SImode, XEXP (operands[1], 0)));
8755 for (i = 0; i < count; i++)
8756 XVECEXP (operands[3], 0, i)
8757 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8758 adjust_address_nv (op1, SImode, i * 4));
8761 (define_insn "*ldmsi8"
8762 [(match_parallel 0 "load_multiple_operation"
8763 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8764 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8765 (set (match_operand:SI 3 "gpc_reg_operand" "")
8766 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8767 (set (match_operand:SI 4 "gpc_reg_operand" "")
8768 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8769 (set (match_operand:SI 5 "gpc_reg_operand" "")
8770 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8771 (set (match_operand:SI 6 "gpc_reg_operand" "")
8772 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8773 (set (match_operand:SI 7 "gpc_reg_operand" "")
8774 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8775 (set (match_operand:SI 8 "gpc_reg_operand" "")
8776 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8777 (set (match_operand:SI 9 "gpc_reg_operand" "")
8778 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8779 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8781 { return rs6000_output_load_multiple (operands); }"
8782 [(set_attr "type" "load_ux")
8783 (set_attr "length" "32")])
8785 (define_insn "*ldmsi7"
8786 [(match_parallel 0 "load_multiple_operation"
8787 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8788 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8789 (set (match_operand:SI 3 "gpc_reg_operand" "")
8790 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8791 (set (match_operand:SI 4 "gpc_reg_operand" "")
8792 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8793 (set (match_operand:SI 5 "gpc_reg_operand" "")
8794 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8795 (set (match_operand:SI 6 "gpc_reg_operand" "")
8796 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8797 (set (match_operand:SI 7 "gpc_reg_operand" "")
8798 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8799 (set (match_operand:SI 8 "gpc_reg_operand" "")
8800 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8801 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8803 { return rs6000_output_load_multiple (operands); }"
8804 [(set_attr "type" "load_ux")
8805 (set_attr "length" "32")])
8807 (define_insn "*ldmsi6"
8808 [(match_parallel 0 "load_multiple_operation"
8809 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8810 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8811 (set (match_operand:SI 3 "gpc_reg_operand" "")
8812 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8813 (set (match_operand:SI 4 "gpc_reg_operand" "")
8814 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8815 (set (match_operand:SI 5 "gpc_reg_operand" "")
8816 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8817 (set (match_operand:SI 6 "gpc_reg_operand" "")
8818 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8819 (set (match_operand:SI 7 "gpc_reg_operand" "")
8820 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8821 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8823 { return rs6000_output_load_multiple (operands); }"
8824 [(set_attr "type" "load_ux")
8825 (set_attr "length" "32")])
8827 (define_insn "*ldmsi5"
8828 [(match_parallel 0 "load_multiple_operation"
8829 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8830 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8831 (set (match_operand:SI 3 "gpc_reg_operand" "")
8832 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8833 (set (match_operand:SI 4 "gpc_reg_operand" "")
8834 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8835 (set (match_operand:SI 5 "gpc_reg_operand" "")
8836 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8837 (set (match_operand:SI 6 "gpc_reg_operand" "")
8838 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8839 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8841 { return rs6000_output_load_multiple (operands); }"
8842 [(set_attr "type" "load_ux")
8843 (set_attr "length" "32")])
8845 (define_insn "*ldmsi4"
8846 [(match_parallel 0 "load_multiple_operation"
8847 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8848 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8849 (set (match_operand:SI 3 "gpc_reg_operand" "")
8850 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8851 (set (match_operand:SI 4 "gpc_reg_operand" "")
8852 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8853 (set (match_operand:SI 5 "gpc_reg_operand" "")
8854 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8855 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8857 { return rs6000_output_load_multiple (operands); }"
8858 [(set_attr "type" "load_ux")
8859 (set_attr "length" "32")])
8861 (define_insn "*ldmsi3"
8862 [(match_parallel 0 "load_multiple_operation"
8863 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8864 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8865 (set (match_operand:SI 3 "gpc_reg_operand" "")
8866 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8867 (set (match_operand:SI 4 "gpc_reg_operand" "")
8868 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8869 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8871 { return rs6000_output_load_multiple (operands); }"
8872 [(set_attr "type" "load_ux")
8873 (set_attr "length" "32")])
8875 (define_expand "store_multiple"
8876 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8877 (match_operand:SI 1 "" ""))
8878 (clobber (scratch:SI))
8879 (use (match_operand:SI 2 "" ""))])]
8880 "TARGET_STRING && !TARGET_POWERPC64"
8889 /* Support only storing a constant number of fixed-point registers to
8890 memory and only bother with this if more than two; the machine
8891 doesn't support more than eight. */
8892 if (GET_CODE (operands[2]) != CONST_INT
8893 || INTVAL (operands[2]) <= 2
8894 || INTVAL (operands[2]) > 8
8895 || GET_CODE (operands[0]) != MEM
8896 || GET_CODE (operands[1]) != REG
8897 || REGNO (operands[1]) >= 32)
8900 count = INTVAL (operands[2]);
8901 regno = REGNO (operands[1]);
8903 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8904 to = force_reg (SImode, XEXP (operands[0], 0));
8905 op0 = replace_equiv_address (operands[0], to);
8907 XVECEXP (operands[3], 0, 0)
8908 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8909 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8910 gen_rtx_SCRATCH (SImode));
8912 for (i = 1; i < count; i++)
8913 XVECEXP (operands[3], 0, i + 1)
8914 = gen_rtx_SET (VOIDmode,
8915 adjust_address_nv (op0, SImode, i * 4),
8916 gen_rtx_REG (SImode, regno + i));
8919 (define_insn "*store_multiple_power"
8920 [(match_parallel 0 "store_multiple_operation"
8921 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8922 (match_operand:SI 2 "gpc_reg_operand" "r"))
8923 (clobber (match_scratch:SI 3 "=q"))])]
8924 "TARGET_STRING && TARGET_POWER"
8925 "{stsi|stswi} %2,%P1,%O0"
8926 [(set_attr "type" "store")])
8928 (define_insn "*stmsi8"
8929 [(match_parallel 0 "store_multiple_operation"
8930 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8931 (match_operand:SI 2 "gpc_reg_operand" "r"))
8932 (clobber (match_scratch:SI 3 "X"))
8933 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8934 (match_operand:SI 4 "gpc_reg_operand" "r"))
8935 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8936 (match_operand:SI 5 "gpc_reg_operand" "r"))
8937 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8938 (match_operand:SI 6 "gpc_reg_operand" "r"))
8939 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8940 (match_operand:SI 7 "gpc_reg_operand" "r"))
8941 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8942 (match_operand:SI 8 "gpc_reg_operand" "r"))
8943 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8944 (match_operand:SI 9 "gpc_reg_operand" "r"))
8945 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8946 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8947 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8948 "{stsi|stswi} %2,%1,%O0"
8949 [(set_attr "type" "store_ux")])
8951 (define_insn "*stmsi7"
8952 [(match_parallel 0 "store_multiple_operation"
8953 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8954 (match_operand:SI 2 "gpc_reg_operand" "r"))
8955 (clobber (match_scratch:SI 3 "X"))
8956 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8957 (match_operand:SI 4 "gpc_reg_operand" "r"))
8958 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8959 (match_operand:SI 5 "gpc_reg_operand" "r"))
8960 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8961 (match_operand:SI 6 "gpc_reg_operand" "r"))
8962 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8963 (match_operand:SI 7 "gpc_reg_operand" "r"))
8964 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8965 (match_operand:SI 8 "gpc_reg_operand" "r"))
8966 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8967 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8968 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
8969 "{stsi|stswi} %2,%1,%O0"
8970 [(set_attr "type" "store_ux")])
8972 (define_insn "*stmsi6"
8973 [(match_parallel 0 "store_multiple_operation"
8974 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8975 (match_operand:SI 2 "gpc_reg_operand" "r"))
8976 (clobber (match_scratch:SI 3 "X"))
8977 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8978 (match_operand:SI 4 "gpc_reg_operand" "r"))
8979 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8980 (match_operand:SI 5 "gpc_reg_operand" "r"))
8981 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8982 (match_operand:SI 6 "gpc_reg_operand" "r"))
8983 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8984 (match_operand:SI 7 "gpc_reg_operand" "r"))
8985 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8986 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
8987 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
8988 "{stsi|stswi} %2,%1,%O0"
8989 [(set_attr "type" "store_ux")])
8991 (define_insn "*stmsi5"
8992 [(match_parallel 0 "store_multiple_operation"
8993 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8994 (match_operand:SI 2 "gpc_reg_operand" "r"))
8995 (clobber (match_scratch:SI 3 "X"))
8996 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8997 (match_operand:SI 4 "gpc_reg_operand" "r"))
8998 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8999 (match_operand:SI 5 "gpc_reg_operand" "r"))
9000 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9001 (match_operand:SI 6 "gpc_reg_operand" "r"))
9002 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9003 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9004 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9005 "{stsi|stswi} %2,%1,%O0"
9006 [(set_attr "type" "store_ux")])
9008 (define_insn "*stmsi4"
9009 [(match_parallel 0 "store_multiple_operation"
9010 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9011 (match_operand:SI 2 "gpc_reg_operand" "r"))
9012 (clobber (match_scratch:SI 3 "X"))
9013 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9014 (match_operand:SI 4 "gpc_reg_operand" "r"))
9015 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9016 (match_operand:SI 5 "gpc_reg_operand" "r"))
9017 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9018 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9019 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9020 "{stsi|stswi} %2,%1,%O0"
9021 [(set_attr "type" "store_ux")])
9023 (define_insn "*stmsi3"
9024 [(match_parallel 0 "store_multiple_operation"
9025 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9026 (match_operand:SI 2 "gpc_reg_operand" "r"))
9027 (clobber (match_scratch:SI 3 "X"))
9028 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9029 (match_operand:SI 4 "gpc_reg_operand" "r"))
9030 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9031 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9032 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9033 "{stsi|stswi} %2,%1,%O0"
9034 [(set_attr "type" "store_ux")])
9036 (define_expand "setmemsi"
9037 [(parallel [(set (match_operand:BLK 0 "" "")
9038 (match_operand 2 "const_int_operand" ""))
9039 (use (match_operand:SI 1 "" ""))
9040 (use (match_operand:SI 3 "" ""))])]
9044 /* If value to set is not zero, use the library routine. */
9045 if (operands[2] != const0_rtx)
9048 if (expand_block_clear (operands))
9054 ;; String/block move insn.
9055 ;; Argument 0 is the destination
9056 ;; Argument 1 is the source
9057 ;; Argument 2 is the length
9058 ;; Argument 3 is the alignment
9060 (define_expand "movmemsi"
9061 [(parallel [(set (match_operand:BLK 0 "" "")
9062 (match_operand:BLK 1 "" ""))
9063 (use (match_operand:SI 2 "" ""))
9064 (use (match_operand:SI 3 "" ""))])]
9068 if (expand_block_move (operands))
9074 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9075 ;; register allocator doesn't have a clue about allocating 8 word registers.
9076 ;; rD/rS = r5 is preferred, efficient form.
9077 (define_expand "movmemsi_8reg"
9078 [(parallel [(set (match_operand 0 "" "")
9079 (match_operand 1 "" ""))
9080 (use (match_operand 2 "" ""))
9081 (use (match_operand 3 "" ""))
9082 (clobber (reg:SI 5))
9083 (clobber (reg:SI 6))
9084 (clobber (reg:SI 7))
9085 (clobber (reg:SI 8))
9086 (clobber (reg:SI 9))
9087 (clobber (reg:SI 10))
9088 (clobber (reg:SI 11))
9089 (clobber (reg:SI 12))
9090 (clobber (match_scratch:SI 4 ""))])]
9095 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9096 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9097 (use (match_operand:SI 2 "immediate_operand" "i"))
9098 (use (match_operand:SI 3 "immediate_operand" "i"))
9099 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9100 (clobber (reg:SI 6))
9101 (clobber (reg:SI 7))
9102 (clobber (reg:SI 8))
9103 (clobber (reg:SI 9))
9104 (clobber (reg:SI 10))
9105 (clobber (reg:SI 11))
9106 (clobber (reg:SI 12))
9107 (clobber (match_scratch:SI 5 "=q"))]
9108 "TARGET_STRING && TARGET_POWER
9109 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9110 || INTVAL (operands[2]) == 0)
9111 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9112 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9113 && REGNO (operands[4]) == 5"
9114 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9115 [(set_attr "type" "store_ux")
9116 (set_attr "length" "8")])
9119 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9120 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9121 (use (match_operand:SI 2 "immediate_operand" "i"))
9122 (use (match_operand:SI 3 "immediate_operand" "i"))
9123 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9124 (clobber (reg:SI 6))
9125 (clobber (reg:SI 7))
9126 (clobber (reg:SI 8))
9127 (clobber (reg:SI 9))
9128 (clobber (reg:SI 10))
9129 (clobber (reg:SI 11))
9130 (clobber (reg:SI 12))
9131 (clobber (match_scratch:SI 5 "X"))]
9132 "TARGET_STRING && ! TARGET_POWER
9133 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9134 || INTVAL (operands[2]) == 0)
9135 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9136 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9137 && REGNO (operands[4]) == 5"
9138 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9139 [(set_attr "type" "store_ux")
9140 (set_attr "length" "8")])
9142 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9143 ;; register allocator doesn't have a clue about allocating 6 word registers.
9144 ;; rD/rS = r5 is preferred, efficient form.
9145 (define_expand "movmemsi_6reg"
9146 [(parallel [(set (match_operand 0 "" "")
9147 (match_operand 1 "" ""))
9148 (use (match_operand 2 "" ""))
9149 (use (match_operand 3 "" ""))
9150 (clobber (reg:SI 5))
9151 (clobber (reg:SI 6))
9152 (clobber (reg:SI 7))
9153 (clobber (reg:SI 8))
9154 (clobber (reg:SI 9))
9155 (clobber (reg:SI 10))
9156 (clobber (match_scratch:SI 4 ""))])]
9161 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9162 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9163 (use (match_operand:SI 2 "immediate_operand" "i"))
9164 (use (match_operand:SI 3 "immediate_operand" "i"))
9165 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9166 (clobber (reg:SI 6))
9167 (clobber (reg:SI 7))
9168 (clobber (reg:SI 8))
9169 (clobber (reg:SI 9))
9170 (clobber (reg:SI 10))
9171 (clobber (match_scratch:SI 5 "=q"))]
9172 "TARGET_STRING && TARGET_POWER
9173 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9174 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9175 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9176 && REGNO (operands[4]) == 5"
9177 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9178 [(set_attr "type" "store_ux")
9179 (set_attr "length" "8")])
9182 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9183 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9184 (use (match_operand:SI 2 "immediate_operand" "i"))
9185 (use (match_operand:SI 3 "immediate_operand" "i"))
9186 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9187 (clobber (reg:SI 6))
9188 (clobber (reg:SI 7))
9189 (clobber (reg:SI 8))
9190 (clobber (reg:SI 9))
9191 (clobber (reg:SI 10))
9192 (clobber (match_scratch:SI 5 "X"))]
9193 "TARGET_STRING && ! TARGET_POWER
9194 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9195 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9196 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9197 && REGNO (operands[4]) == 5"
9198 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9199 [(set_attr "type" "store_ux")
9200 (set_attr "length" "8")])
9202 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9203 ;; problems with TImode.
9204 ;; rD/rS = r5 is preferred, efficient form.
9205 (define_expand "movmemsi_4reg"
9206 [(parallel [(set (match_operand 0 "" "")
9207 (match_operand 1 "" ""))
9208 (use (match_operand 2 "" ""))
9209 (use (match_operand 3 "" ""))
9210 (clobber (reg:SI 5))
9211 (clobber (reg:SI 6))
9212 (clobber (reg:SI 7))
9213 (clobber (reg:SI 8))
9214 (clobber (match_scratch:SI 4 ""))])]
9219 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9220 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9221 (use (match_operand:SI 2 "immediate_operand" "i"))
9222 (use (match_operand:SI 3 "immediate_operand" "i"))
9223 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9224 (clobber (reg:SI 6))
9225 (clobber (reg:SI 7))
9226 (clobber (reg:SI 8))
9227 (clobber (match_scratch:SI 5 "=q"))]
9228 "TARGET_STRING && TARGET_POWER
9229 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9230 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9231 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9232 && REGNO (operands[4]) == 5"
9233 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9234 [(set_attr "type" "store_ux")
9235 (set_attr "length" "8")])
9238 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9239 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9240 (use (match_operand:SI 2 "immediate_operand" "i"))
9241 (use (match_operand:SI 3 "immediate_operand" "i"))
9242 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9243 (clobber (reg:SI 6))
9244 (clobber (reg:SI 7))
9245 (clobber (reg:SI 8))
9246 (clobber (match_scratch:SI 5 "X"))]
9247 "TARGET_STRING && ! TARGET_POWER
9248 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9249 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9250 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9251 && REGNO (operands[4]) == 5"
9252 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9253 [(set_attr "type" "store_ux")
9254 (set_attr "length" "8")])
9256 ;; Move up to 8 bytes at a time.
9257 (define_expand "movmemsi_2reg"
9258 [(parallel [(set (match_operand 0 "" "")
9259 (match_operand 1 "" ""))
9260 (use (match_operand 2 "" ""))
9261 (use (match_operand 3 "" ""))
9262 (clobber (match_scratch:DI 4 ""))
9263 (clobber (match_scratch:SI 5 ""))])]
9264 "TARGET_STRING && ! TARGET_POWERPC64"
9268 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9269 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9270 (use (match_operand:SI 2 "immediate_operand" "i"))
9271 (use (match_operand:SI 3 "immediate_operand" "i"))
9272 (clobber (match_scratch:DI 4 "=&r"))
9273 (clobber (match_scratch:SI 5 "=q"))]
9274 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9275 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9276 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9277 [(set_attr "type" "store_ux")
9278 (set_attr "length" "8")])
9281 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9282 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9283 (use (match_operand:SI 2 "immediate_operand" "i"))
9284 (use (match_operand:SI 3 "immediate_operand" "i"))
9285 (clobber (match_scratch:DI 4 "=&r"))
9286 (clobber (match_scratch:SI 5 "X"))]
9287 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9288 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9289 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9290 [(set_attr "type" "store_ux")
9291 (set_attr "length" "8")])
9293 ;; Move up to 4 bytes at a time.
9294 (define_expand "movmemsi_1reg"
9295 [(parallel [(set (match_operand 0 "" "")
9296 (match_operand 1 "" ""))
9297 (use (match_operand 2 "" ""))
9298 (use (match_operand 3 "" ""))
9299 (clobber (match_scratch:SI 4 ""))
9300 (clobber (match_scratch:SI 5 ""))])]
9305 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9306 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9307 (use (match_operand:SI 2 "immediate_operand" "i"))
9308 (use (match_operand:SI 3 "immediate_operand" "i"))
9309 (clobber (match_scratch:SI 4 "=&r"))
9310 (clobber (match_scratch:SI 5 "=q"))]
9311 "TARGET_STRING && TARGET_POWER
9312 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9313 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9314 [(set_attr "type" "store_ux")
9315 (set_attr "length" "8")])
9318 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9319 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9320 (use (match_operand:SI 2 "immediate_operand" "i"))
9321 (use (match_operand:SI 3 "immediate_operand" "i"))
9322 (clobber (match_scratch:SI 4 "=&r"))
9323 (clobber (match_scratch:SI 5 "X"))]
9324 "TARGET_STRING && ! TARGET_POWER
9325 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9326 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9327 [(set_attr "type" "store_ux")
9328 (set_attr "length" "8")])
9330 ;; Define insns that do load or store with update. Some of these we can
9331 ;; get by using pre-decrement or pre-increment, but the hardware can also
9332 ;; do cases where the increment is not the size of the object.
9334 ;; In all these cases, we use operands 0 and 1 for the register being
9335 ;; incremented because those are the operands that local-alloc will
9336 ;; tie and these are the pair most likely to be tieable (and the ones
9337 ;; that will benefit the most).
9339 (define_insn "*movdi_update1"
9340 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9341 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9342 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9343 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9344 (plus:DI (match_dup 1) (match_dup 2)))]
9345 "TARGET_POWERPC64 && TARGET_UPDATE"
9349 [(set_attr "type" "load_ux,load_u")])
9351 (define_insn "movdi_<mode>_update"
9352 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9353 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9354 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9355 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9356 (plus:P (match_dup 1) (match_dup 2)))]
9357 "TARGET_POWERPC64 && TARGET_UPDATE"
9361 [(set_attr "type" "store_ux,store_u")])
9363 (define_insn "*movsi_update1"
9364 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9365 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9366 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9367 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9368 (plus:SI (match_dup 1) (match_dup 2)))]
9371 {lux|lwzux} %3,%0,%2
9372 {lu|lwzu} %3,%2(%0)"
9373 [(set_attr "type" "load_ux,load_u")])
9375 (define_insn "*movsi_update2"
9376 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9378 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9379 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9380 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9381 (plus:DI (match_dup 1) (match_dup 2)))]
9384 [(set_attr "type" "load_ext_ux")])
9386 (define_insn "movsi_update"
9387 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9388 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9389 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9390 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9391 (plus:SI (match_dup 1) (match_dup 2)))]
9394 {stux|stwux} %3,%0,%2
9395 {stu|stwu} %3,%2(%0)"
9396 [(set_attr "type" "store_ux,store_u")])
9398 (define_insn "*movhi_update1"
9399 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9400 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9401 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9402 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9403 (plus:SI (match_dup 1) (match_dup 2)))]
9408 [(set_attr "type" "load_ux,load_u")])
9410 (define_insn "*movhi_update2"
9411 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9413 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9414 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9415 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9416 (plus:SI (match_dup 1) (match_dup 2)))]
9421 [(set_attr "type" "load_ux,load_u")])
9423 (define_insn "*movhi_update3"
9424 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9426 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9427 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9428 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9429 (plus:SI (match_dup 1) (match_dup 2)))]
9434 [(set_attr "type" "load_ext_ux,load_ext_u")])
9436 (define_insn "*movhi_update4"
9437 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9438 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9439 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9440 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9441 (plus:SI (match_dup 1) (match_dup 2)))]
9446 [(set_attr "type" "store_ux,store_u")])
9448 (define_insn "*movqi_update1"
9449 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9450 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9451 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9452 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9453 (plus:SI (match_dup 1) (match_dup 2)))]
9458 [(set_attr "type" "load_ux,load_u")])
9460 (define_insn "*movqi_update2"
9461 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9463 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9464 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9465 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9466 (plus:SI (match_dup 1) (match_dup 2)))]
9471 [(set_attr "type" "load_ux,load_u")])
9473 (define_insn "*movqi_update3"
9474 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9475 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9476 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9477 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9478 (plus:SI (match_dup 1) (match_dup 2)))]
9483 [(set_attr "type" "store_ux,store_u")])
9485 (define_insn "*movsf_update1"
9486 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9487 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9488 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9489 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9490 (plus:SI (match_dup 1) (match_dup 2)))]
9491 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9495 [(set_attr "type" "fpload_ux,fpload_u")])
9497 (define_insn "*movsf_update2"
9498 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9499 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9500 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9501 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9502 (plus:SI (match_dup 1) (match_dup 2)))]
9503 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9507 [(set_attr "type" "fpstore_ux,fpstore_u")])
9509 (define_insn "*movsf_update3"
9510 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9511 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9512 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9513 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9514 (plus:SI (match_dup 1) (match_dup 2)))]
9515 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9517 {lux|lwzux} %3,%0,%2
9518 {lu|lwzu} %3,%2(%0)"
9519 [(set_attr "type" "load_ux,load_u")])
9521 (define_insn "*movsf_update4"
9522 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9523 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9524 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9525 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9526 (plus:SI (match_dup 1) (match_dup 2)))]
9527 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9529 {stux|stwux} %3,%0,%2
9530 {stu|stwu} %3,%2(%0)"
9531 [(set_attr "type" "store_ux,store_u")])
9533 (define_insn "*movdf_update1"
9534 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9535 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9536 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9537 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9538 (plus:SI (match_dup 1) (match_dup 2)))]
9539 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9543 [(set_attr "type" "fpload_ux,fpload_u")])
9545 (define_insn "*movdf_update2"
9546 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9547 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9548 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9549 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9550 (plus:SI (match_dup 1) (match_dup 2)))]
9551 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9555 [(set_attr "type" "fpstore_ux,fpstore_u")])
9557 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9559 (define_insn "*lfq_power2"
9560 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
9561 (match_operand:V2DF 1 "memory_operand" ""))]
9563 && TARGET_HARD_FLOAT && TARGET_FPRS"
9567 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9568 (match_operand:DF 1 "memory_operand" ""))
9569 (set (match_operand:DF 2 "gpc_reg_operand" "")
9570 (match_operand:DF 3 "memory_operand" ""))]
9572 && TARGET_HARD_FLOAT && TARGET_FPRS
9573 && registers_ok_for_quad_peep (operands[0], operands[2])
9574 && mems_ok_for_quad_peep (operands[1], operands[3])"
9577 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
9578 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
9580 (define_insn "*stfq_power2"
9581 [(set (match_operand:V2DF 0 "memory_operand" "")
9582 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
9584 && TARGET_HARD_FLOAT && TARGET_FPRS"
9589 [(set (match_operand:DF 0 "memory_operand" "")
9590 (match_operand:DF 1 "gpc_reg_operand" ""))
9591 (set (match_operand:DF 2 "memory_operand" "")
9592 (match_operand:DF 3 "gpc_reg_operand" ""))]
9594 && TARGET_HARD_FLOAT && TARGET_FPRS
9595 && registers_ok_for_quad_peep (operands[1], operands[3])
9596 && mems_ok_for_quad_peep (operands[0], operands[2])"
9599 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
9600 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
9602 ;; after inserting conditional returns we can sometimes have
9603 ;; unnecessary register moves. Unfortunately we cannot have a
9604 ;; modeless peephole here, because some single SImode sets have early
9605 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9606 ;; sequences, using get_attr_length here will smash the operands
9607 ;; array. Neither is there an early_cobbler_p predicate.
9609 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9610 (match_operand:DF 1 "any_operand" ""))
9611 (set (match_operand:DF 2 "gpc_reg_operand" "")
9613 "peep2_reg_dead_p (2, operands[0])"
9614 [(set (match_dup 2) (match_dup 1))])
9617 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9618 (match_operand:SF 1 "any_operand" ""))
9619 (set (match_operand:SF 2 "gpc_reg_operand" "")
9621 "peep2_reg_dead_p (2, operands[0])"
9622 [(set (match_dup 2) (match_dup 1))])
9627 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9628 (define_insn "tls_gd_32"
9629 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9630 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9631 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9633 "HAVE_AS_TLS && !TARGET_64BIT"
9634 "addi %0,%1,%2@got@tlsgd")
9636 (define_insn "tls_gd_64"
9637 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9638 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9639 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9641 "HAVE_AS_TLS && TARGET_64BIT"
9642 "addi %0,%1,%2@got@tlsgd")
9644 (define_insn "tls_ld_32"
9645 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9646 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9648 "HAVE_AS_TLS && !TARGET_64BIT"
9649 "addi %0,%1,%&@got@tlsld")
9651 (define_insn "tls_ld_64"
9652 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9653 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9655 "HAVE_AS_TLS && TARGET_64BIT"
9656 "addi %0,%1,%&@got@tlsld")
9658 (define_insn "tls_dtprel_32"
9659 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9660 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9661 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9663 "HAVE_AS_TLS && !TARGET_64BIT"
9664 "addi %0,%1,%2@dtprel")
9666 (define_insn "tls_dtprel_64"
9667 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9668 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9669 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9671 "HAVE_AS_TLS && TARGET_64BIT"
9672 "addi %0,%1,%2@dtprel")
9674 (define_insn "tls_dtprel_ha_32"
9675 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9676 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9677 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9678 UNSPEC_TLSDTPRELHA))]
9679 "HAVE_AS_TLS && !TARGET_64BIT"
9680 "addis %0,%1,%2@dtprel@ha")
9682 (define_insn "tls_dtprel_ha_64"
9683 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9684 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9685 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9686 UNSPEC_TLSDTPRELHA))]
9687 "HAVE_AS_TLS && TARGET_64BIT"
9688 "addis %0,%1,%2@dtprel@ha")
9690 (define_insn "tls_dtprel_lo_32"
9691 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9692 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9693 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9694 UNSPEC_TLSDTPRELLO))]
9695 "HAVE_AS_TLS && !TARGET_64BIT"
9696 "addi %0,%1,%2@dtprel@l")
9698 (define_insn "tls_dtprel_lo_64"
9699 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9700 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9701 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9702 UNSPEC_TLSDTPRELLO))]
9703 "HAVE_AS_TLS && TARGET_64BIT"
9704 "addi %0,%1,%2@dtprel@l")
9706 (define_insn "tls_got_dtprel_32"
9707 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9708 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9709 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9710 UNSPEC_TLSGOTDTPREL))]
9711 "HAVE_AS_TLS && !TARGET_64BIT"
9712 "lwz %0,%2@got@dtprel(%1)")
9714 (define_insn "tls_got_dtprel_64"
9715 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9716 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9717 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9718 UNSPEC_TLSGOTDTPREL))]
9719 "HAVE_AS_TLS && TARGET_64BIT"
9720 "ld %0,%2@got@dtprel(%1)")
9722 (define_insn "tls_tprel_32"
9723 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9724 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9725 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9727 "HAVE_AS_TLS && !TARGET_64BIT"
9728 "addi %0,%1,%2@tprel")
9730 (define_insn "tls_tprel_64"
9731 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9732 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9733 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9735 "HAVE_AS_TLS && TARGET_64BIT"
9736 "addi %0,%1,%2@tprel")
9738 (define_insn "tls_tprel_ha_32"
9739 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9740 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9741 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9742 UNSPEC_TLSTPRELHA))]
9743 "HAVE_AS_TLS && !TARGET_64BIT"
9744 "addis %0,%1,%2@tprel@ha")
9746 (define_insn "tls_tprel_ha_64"
9747 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9748 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9749 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9750 UNSPEC_TLSTPRELHA))]
9751 "HAVE_AS_TLS && TARGET_64BIT"
9752 "addis %0,%1,%2@tprel@ha")
9754 (define_insn "tls_tprel_lo_32"
9755 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9756 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9757 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9758 UNSPEC_TLSTPRELLO))]
9759 "HAVE_AS_TLS && !TARGET_64BIT"
9760 "addi %0,%1,%2@tprel@l")
9762 (define_insn "tls_tprel_lo_64"
9763 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9764 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9765 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9766 UNSPEC_TLSTPRELLO))]
9767 "HAVE_AS_TLS && TARGET_64BIT"
9768 "addi %0,%1,%2@tprel@l")
9770 ;; "b" output constraint here and on tls_tls input to support linker tls
9771 ;; optimization. The linker may edit the instructions emitted by a
9772 ;; tls_got_tprel/tls_tls pair to addis,addi.
9773 (define_insn "tls_got_tprel_32"
9774 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9775 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9776 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9777 UNSPEC_TLSGOTTPREL))]
9778 "HAVE_AS_TLS && !TARGET_64BIT"
9779 "lwz %0,%2@got@tprel(%1)")
9781 (define_insn "tls_got_tprel_64"
9782 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9783 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9784 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9785 UNSPEC_TLSGOTTPREL))]
9786 "HAVE_AS_TLS && TARGET_64BIT"
9787 "ld %0,%2@got@tprel(%1)")
9789 (define_insn "tls_tls_32"
9790 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9791 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9792 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9794 "HAVE_AS_TLS && !TARGET_64BIT"
9797 (define_insn "tls_tls_64"
9798 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9799 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9800 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9802 "HAVE_AS_TLS && TARGET_64BIT"
9805 ;; Next come insns related to the calling sequence.
9807 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9808 ;; We move the back-chain and decrement the stack pointer.
9810 (define_expand "allocate_stack"
9811 [(set (match_operand 0 "gpc_reg_operand" "=r")
9812 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9814 (minus (reg 1) (match_dup 1)))]
9817 { rtx chain = gen_reg_rtx (Pmode);
9818 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9821 emit_move_insn (chain, stack_bot);
9823 /* Check stack bounds if necessary. */
9824 if (current_function_limit_stack)
9827 available = expand_binop (Pmode, sub_optab,
9828 stack_pointer_rtx, stack_limit_rtx,
9829 NULL_RTX, 1, OPTAB_WIDEN);
9830 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9833 if (GET_CODE (operands[1]) != CONST_INT
9834 || INTVAL (operands[1]) < -32767
9835 || INTVAL (operands[1]) > 32768)
9837 neg_op0 = gen_reg_rtx (Pmode);
9839 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9841 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9844 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9847 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
9848 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9852 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9853 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9854 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9857 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9861 ;; These patterns say how to save and restore the stack pointer. We need not
9862 ;; save the stack pointer at function level since we are careful to
9863 ;; preserve the backchain. At block level, we have to restore the backchain
9864 ;; when we restore the stack pointer.
9866 ;; For nonlocal gotos, we must save both the stack pointer and its
9867 ;; backchain and restore both. Note that in the nonlocal case, the
9868 ;; save area is a memory location.
9870 (define_expand "save_stack_function"
9871 [(match_operand 0 "any_operand" "")
9872 (match_operand 1 "any_operand" "")]
9876 (define_expand "restore_stack_function"
9877 [(match_operand 0 "any_operand" "")
9878 (match_operand 1 "any_operand" "")]
9882 ;; Adjust stack pointer (op0) to a new value (op1).
9883 ;; First copy old stack backchain to new location, and ensure that the
9884 ;; scheduler won't reorder the sp assignment before the backchain write.
9885 (define_expand "restore_stack_block"
9886 [(set (match_dup 2) (match_dup 3))
9887 (set (match_dup 4) (match_dup 2))
9888 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
9889 (set (match_operand 0 "register_operand" "")
9890 (match_operand 1 "register_operand" ""))]
9894 operands[2] = gen_reg_rtx (Pmode);
9895 operands[3] = gen_frame_mem (Pmode, operands[0]);
9896 operands[4] = gen_frame_mem (Pmode, operands[1]);
9897 operands[5] = gen_frame_mem (BLKmode, operands[0]);
9900 (define_expand "save_stack_nonlocal"
9901 [(set (match_dup 3) (match_dup 4))
9902 (set (match_operand 0 "memory_operand" "") (match_dup 3))
9903 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
9907 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9909 /* Copy the backchain to the first word, sp to the second. */
9910 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
9911 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
9912 operands[3] = gen_reg_rtx (Pmode);
9913 operands[4] = gen_frame_mem (Pmode, operands[1]);
9916 (define_expand "restore_stack_nonlocal"
9917 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
9918 (set (match_dup 3) (match_dup 4))
9919 (set (match_dup 5) (match_dup 2))
9920 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
9921 (set (match_operand 0 "register_operand" "") (match_dup 3))]
9925 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9927 /* Restore the backchain from the first word, sp from the second. */
9928 operands[2] = gen_reg_rtx (Pmode);
9929 operands[3] = gen_reg_rtx (Pmode);
9930 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
9931 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
9932 operands[5] = gen_frame_mem (Pmode, operands[3]);
9933 operands[6] = gen_frame_mem (BLKmode, operands[0]);
9936 ;; TOC register handling.
9938 ;; Code to initialize the TOC register...
9940 (define_insn "load_toc_aix_si"
9941 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9942 (unspec:SI [(const_int 0)] UNSPEC_TOC))
9944 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9948 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9949 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9950 operands[2] = gen_rtx_REG (Pmode, 2);
9951 return \"{l|lwz} %0,%1(%2)\";
9953 [(set_attr "type" "load")])
9955 (define_insn "load_toc_aix_di"
9956 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9957 (unspec:DI [(const_int 0)] UNSPEC_TOC))
9959 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9963 #ifdef TARGET_RELOCATABLE
9964 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9965 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9967 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9970 strcat (buf, \"@toc\");
9971 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9972 operands[2] = gen_rtx_REG (Pmode, 2);
9973 return \"ld %0,%1(%2)\";
9975 [(set_attr "type" "load")])
9977 (define_insn "load_toc_v4_pic_si"
9978 [(set (match_operand:SI 0 "register_operand" "=l")
9979 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
9980 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9981 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9982 [(set_attr "type" "branch")
9983 (set_attr "length" "4")])
9985 (define_insn "load_toc_v4_PIC_1"
9986 [(set (match_operand:SI 0 "register_operand" "=l")
9987 (match_operand:SI 1 "immediate_operand" "s"))
9988 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
9989 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
9990 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
9991 "bcl 20,31,%1\\n%1:"
9992 [(set_attr "type" "branch")
9993 (set_attr "length" "4")])
9995 (define_insn "load_toc_v4_PIC_1b"
9996 [(set (match_operand:SI 0 "register_operand" "=l")
9997 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
9999 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10000 "bcl 20,31,$+8\\n\\t.long %1-$"
10001 [(set_attr "type" "branch")
10002 (set_attr "length" "8")])
10004 (define_insn "load_toc_v4_PIC_2"
10005 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10006 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10007 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10008 (match_operand:SI 3 "immediate_operand" "s")))))]
10009 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10010 "{l|lwz} %0,%2-%3(%1)"
10011 [(set_attr "type" "load")])
10013 (define_insn "load_toc_v4_PIC_3b"
10014 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10015 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10017 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10018 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10019 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10020 "{cau|addis} %0,%1,%2-%3@ha")
10022 (define_insn "load_toc_v4_PIC_3c"
10023 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10024 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10025 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10026 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10027 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10028 "{cal|addi} %0,%1,%2-%3@l")
10030 ;; If the TOC is shared over a translation unit, as happens with all
10031 ;; the kinds of PIC that we support, we need to restore the TOC
10032 ;; pointer only when jumping over units of translation.
10033 ;; On Darwin, we need to reload the picbase.
10035 (define_expand "builtin_setjmp_receiver"
10036 [(use (label_ref (match_operand 0 "" "")))]
10037 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10038 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10039 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10043 if (DEFAULT_ABI == ABI_DARWIN)
10045 const char *picbase = machopic_function_base_name ();
10046 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10047 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10051 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10052 CODE_LABEL_NUMBER (operands[0]));
10053 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10055 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10056 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10060 rs6000_emit_load_toc_table (FALSE);
10064 ;; Elf specific ways of loading addresses for non-PIC code.
10065 ;; The output of this could be r0, but we make a very strong
10066 ;; preference for a base register because it will usually
10067 ;; be needed there.
10068 (define_insn "elf_high"
10069 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10070 (high:SI (match_operand 1 "" "")))]
10071 "TARGET_ELF && ! TARGET_64BIT"
10072 "{liu|lis} %0,%1@ha")
10074 (define_insn "elf_low"
10075 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10076 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10077 (match_operand 2 "" "")))]
10078 "TARGET_ELF && ! TARGET_64BIT"
10080 {cal|la} %0,%2@l(%1)
10081 {ai|addic} %0,%1,%K2")
10083 ;; A function pointer under AIX is a pointer to a data area whose first word
10084 ;; contains the actual address of the function, whose second word contains a
10085 ;; pointer to its TOC, and whose third word contains a value to place in the
10086 ;; static chain register (r11). Note that if we load the static chain, our
10087 ;; "trampoline" need not have any executable code.
10089 (define_expand "call_indirect_aix32"
10090 [(set (match_dup 2)
10091 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10092 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10095 (mem:SI (plus:SI (match_dup 0)
10098 (mem:SI (plus:SI (match_dup 0)
10100 (parallel [(call (mem:SI (match_dup 2))
10101 (match_operand 1 "" ""))
10105 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10106 (clobber (scratch:SI))])]
10109 { operands[2] = gen_reg_rtx (SImode); }")
10111 (define_expand "call_indirect_aix64"
10112 [(set (match_dup 2)
10113 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10114 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10117 (mem:DI (plus:DI (match_dup 0)
10120 (mem:DI (plus:DI (match_dup 0)
10122 (parallel [(call (mem:SI (match_dup 2))
10123 (match_operand 1 "" ""))
10127 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10128 (clobber (scratch:SI))])]
10131 { operands[2] = gen_reg_rtx (DImode); }")
10133 (define_expand "call_value_indirect_aix32"
10134 [(set (match_dup 3)
10135 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10136 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10139 (mem:SI (plus:SI (match_dup 1)
10142 (mem:SI (plus:SI (match_dup 1)
10144 (parallel [(set (match_operand 0 "" "")
10145 (call (mem:SI (match_dup 3))
10146 (match_operand 2 "" "")))
10150 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10151 (clobber (scratch:SI))])]
10154 { operands[3] = gen_reg_rtx (SImode); }")
10156 (define_expand "call_value_indirect_aix64"
10157 [(set (match_dup 3)
10158 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10159 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10162 (mem:DI (plus:DI (match_dup 1)
10165 (mem:DI (plus:DI (match_dup 1)
10167 (parallel [(set (match_operand 0 "" "")
10168 (call (mem:SI (match_dup 3))
10169 (match_operand 2 "" "")))
10173 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10174 (clobber (scratch:SI))])]
10177 { operands[3] = gen_reg_rtx (DImode); }")
10179 ;; Now the definitions for the call and call_value insns
10180 (define_expand "call"
10181 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10182 (match_operand 1 "" ""))
10183 (use (match_operand 2 "" ""))
10184 (clobber (scratch:SI))])]
10189 if (MACHOPIC_INDIRECT)
10190 operands[0] = machopic_indirect_call_target (operands[0]);
10193 gcc_assert (GET_CODE (operands[0]) == MEM);
10194 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10196 operands[0] = XEXP (operands[0], 0);
10198 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10200 && GET_CODE (operands[0]) == SYMBOL_REF
10201 && !SYMBOL_REF_LOCAL_P (operands[0]))
10206 tmp = gen_rtvec (3,
10207 gen_rtx_CALL (VOIDmode,
10208 gen_rtx_MEM (SImode, operands[0]),
10210 gen_rtx_USE (VOIDmode, operands[2]),
10211 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10212 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10213 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10217 if (GET_CODE (operands[0]) != SYMBOL_REF
10218 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10219 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10221 if (INTVAL (operands[2]) & CALL_LONG)
10222 operands[0] = rs6000_longcall_ref (operands[0]);
10224 switch (DEFAULT_ABI)
10228 operands[0] = force_reg (Pmode, operands[0]);
10232 /* AIX function pointers are really pointers to a three word
10234 emit_call_insn (TARGET_32BIT
10235 ? gen_call_indirect_aix32 (force_reg (SImode,
10238 : gen_call_indirect_aix64 (force_reg (DImode,
10244 gcc_unreachable ();
10249 (define_expand "call_value"
10250 [(parallel [(set (match_operand 0 "" "")
10251 (call (mem:SI (match_operand 1 "address_operand" ""))
10252 (match_operand 2 "" "")))
10253 (use (match_operand 3 "" ""))
10254 (clobber (scratch:SI))])]
10259 if (MACHOPIC_INDIRECT)
10260 operands[1] = machopic_indirect_call_target (operands[1]);
10263 gcc_assert (GET_CODE (operands[1]) == MEM);
10264 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10266 operands[1] = XEXP (operands[1], 0);
10268 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10270 && GET_CODE (operands[1]) == SYMBOL_REF
10271 && !SYMBOL_REF_LOCAL_P (operands[1]))
10276 tmp = gen_rtvec (3,
10277 gen_rtx_SET (VOIDmode,
10279 gen_rtx_CALL (VOIDmode,
10280 gen_rtx_MEM (SImode,
10283 gen_rtx_USE (VOIDmode, operands[3]),
10284 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10285 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10286 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10290 if (GET_CODE (operands[1]) != SYMBOL_REF
10291 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10292 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10294 if (INTVAL (operands[3]) & CALL_LONG)
10295 operands[1] = rs6000_longcall_ref (operands[1]);
10297 switch (DEFAULT_ABI)
10301 operands[1] = force_reg (Pmode, operands[1]);
10305 /* AIX function pointers are really pointers to a three word
10307 emit_call_insn (TARGET_32BIT
10308 ? gen_call_value_indirect_aix32 (operands[0],
10312 : gen_call_value_indirect_aix64 (operands[0],
10319 gcc_unreachable ();
10324 ;; Call to function in current module. No TOC pointer reload needed.
10325 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10326 ;; either the function was not prototyped, or it was prototyped as a
10327 ;; variable argument function. It is > 0 if FP registers were passed
10328 ;; and < 0 if they were not.
10330 (define_insn "*call_local32"
10331 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10332 (match_operand 1 "" "g,g"))
10333 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10334 (clobber (match_scratch:SI 3 "=l,l"))]
10335 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10338 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10339 output_asm_insn (\"crxor 6,6,6\", operands);
10341 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10342 output_asm_insn (\"creqv 6,6,6\", operands);
10344 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10346 [(set_attr "type" "branch")
10347 (set_attr "length" "4,8")])
10349 (define_insn "*call_local64"
10350 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10351 (match_operand 1 "" "g,g"))
10352 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10353 (clobber (match_scratch:SI 3 "=l,l"))]
10354 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10357 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10358 output_asm_insn (\"crxor 6,6,6\", operands);
10360 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10361 output_asm_insn (\"creqv 6,6,6\", operands);
10363 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10365 [(set_attr "type" "branch")
10366 (set_attr "length" "4,8")])
10368 (define_insn "*call_value_local32"
10369 [(set (match_operand 0 "" "")
10370 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10371 (match_operand 2 "" "g,g")))
10372 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10373 (clobber (match_scratch:SI 4 "=l,l"))]
10374 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10377 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10378 output_asm_insn (\"crxor 6,6,6\", operands);
10380 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10381 output_asm_insn (\"creqv 6,6,6\", operands);
10383 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10385 [(set_attr "type" "branch")
10386 (set_attr "length" "4,8")])
10389 (define_insn "*call_value_local64"
10390 [(set (match_operand 0 "" "")
10391 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10392 (match_operand 2 "" "g,g")))
10393 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10394 (clobber (match_scratch:SI 4 "=l,l"))]
10395 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10398 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10399 output_asm_insn (\"crxor 6,6,6\", operands);
10401 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10402 output_asm_insn (\"creqv 6,6,6\", operands);
10404 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10406 [(set_attr "type" "branch")
10407 (set_attr "length" "4,8")])
10409 ;; Call to function which may be in another module. Restore the TOC
10410 ;; pointer (r2) after the call unless this is System V.
10411 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10412 ;; either the function was not prototyped, or it was prototyped as a
10413 ;; variable argument function. It is > 0 if FP registers were passed
10414 ;; and < 0 if they were not.
10416 (define_insn "*call_indirect_nonlocal_aix32"
10417 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10418 (match_operand 1 "" "g,g"))
10422 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10423 (clobber (match_scratch:SI 2 "=l,l"))]
10424 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10425 "b%T0l\;{l|lwz} 2,20(1)"
10426 [(set_attr "type" "jmpreg")
10427 (set_attr "length" "8")])
10429 (define_insn "*call_nonlocal_aix32"
10430 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10431 (match_operand 1 "" "g"))
10432 (use (match_operand:SI 2 "immediate_operand" "O"))
10433 (clobber (match_scratch:SI 3 "=l"))]
10435 && DEFAULT_ABI == ABI_AIX
10436 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10438 [(set_attr "type" "branch")
10439 (set_attr "length" "8")])
10441 (define_insn "*call_indirect_nonlocal_aix64"
10442 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10443 (match_operand 1 "" "g,g"))
10447 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10448 (clobber (match_scratch:SI 2 "=l,l"))]
10449 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10450 "b%T0l\;ld 2,40(1)"
10451 [(set_attr "type" "jmpreg")
10452 (set_attr "length" "8")])
10454 (define_insn "*call_nonlocal_aix64"
10455 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10456 (match_operand 1 "" "g"))
10457 (use (match_operand:SI 2 "immediate_operand" "O"))
10458 (clobber (match_scratch:SI 3 "=l"))]
10460 && DEFAULT_ABI == ABI_AIX
10461 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10463 [(set_attr "type" "branch")
10464 (set_attr "length" "8")])
10466 (define_insn "*call_value_indirect_nonlocal_aix32"
10467 [(set (match_operand 0 "" "")
10468 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10469 (match_operand 2 "" "g,g")))
10473 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10474 (clobber (match_scratch:SI 3 "=l,l"))]
10475 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10476 "b%T1l\;{l|lwz} 2,20(1)"
10477 [(set_attr "type" "jmpreg")
10478 (set_attr "length" "8")])
10480 (define_insn "*call_value_nonlocal_aix32"
10481 [(set (match_operand 0 "" "")
10482 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10483 (match_operand 2 "" "g")))
10484 (use (match_operand:SI 3 "immediate_operand" "O"))
10485 (clobber (match_scratch:SI 4 "=l"))]
10487 && DEFAULT_ABI == ABI_AIX
10488 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10490 [(set_attr "type" "branch")
10491 (set_attr "length" "8")])
10493 (define_insn "*call_value_indirect_nonlocal_aix64"
10494 [(set (match_operand 0 "" "")
10495 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10496 (match_operand 2 "" "g,g")))
10500 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10501 (clobber (match_scratch:SI 3 "=l,l"))]
10502 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10503 "b%T1l\;ld 2,40(1)"
10504 [(set_attr "type" "jmpreg")
10505 (set_attr "length" "8")])
10507 (define_insn "*call_value_nonlocal_aix64"
10508 [(set (match_operand 0 "" "")
10509 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10510 (match_operand 2 "" "g")))
10511 (use (match_operand:SI 3 "immediate_operand" "O"))
10512 (clobber (match_scratch:SI 4 "=l"))]
10514 && DEFAULT_ABI == ABI_AIX
10515 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10517 [(set_attr "type" "branch")
10518 (set_attr "length" "8")])
10520 ;; A function pointer under System V is just a normal pointer
10521 ;; operands[0] is the function pointer
10522 ;; operands[1] is the stack size to clean up
10523 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10524 ;; which indicates how to set cr1
10526 (define_insn "*call_indirect_nonlocal_sysv"
10527 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
10528 (match_operand 1 "" "g,g,g,g"))
10529 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10530 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10531 "DEFAULT_ABI == ABI_V4
10532 || DEFAULT_ABI == ABI_DARWIN"
10534 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10535 output_asm_insn ("crxor 6,6,6", operands);
10537 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10538 output_asm_insn ("creqv 6,6,6", operands);
10542 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10543 (set_attr "length" "4,4,8,8")])
10545 (define_insn "*call_nonlocal_sysv"
10546 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10547 (match_operand 1 "" "g,g"))
10548 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10549 (clobber (match_scratch:SI 3 "=l,l"))]
10550 "(DEFAULT_ABI == ABI_DARWIN
10551 || (DEFAULT_ABI == ABI_V4
10552 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10554 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10555 output_asm_insn ("crxor 6,6,6", operands);
10557 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10558 output_asm_insn ("creqv 6,6,6", operands);
10561 return output_call(insn, operands, 0, 2);
10563 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10565 if (TARGET_SECURE_PLT && flag_pic == 2)
10566 /* The magic 32768 offset here and in the other sysv call insns
10567 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10568 See sysv4.h:toc_section. */
10569 return "bl %z0+32768@plt";
10571 return "bl %z0@plt";
10577 [(set_attr "type" "branch,branch")
10578 (set_attr "length" "4,8")])
10580 (define_insn "*call_value_indirect_nonlocal_sysv"
10581 [(set (match_operand 0 "" "")
10582 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
10583 (match_operand 2 "" "g,g,g,g")))
10584 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10585 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10586 "DEFAULT_ABI == ABI_V4
10587 || DEFAULT_ABI == ABI_DARWIN"
10589 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10590 output_asm_insn ("crxor 6,6,6", operands);
10592 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10593 output_asm_insn ("creqv 6,6,6", operands);
10597 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10598 (set_attr "length" "4,4,8,8")])
10600 (define_insn "*call_value_nonlocal_sysv"
10601 [(set (match_operand 0 "" "")
10602 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10603 (match_operand 2 "" "g,g")))
10604 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10605 (clobber (match_scratch:SI 4 "=l,l"))]
10606 "(DEFAULT_ABI == ABI_DARWIN
10607 || (DEFAULT_ABI == ABI_V4
10608 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10610 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10611 output_asm_insn ("crxor 6,6,6", operands);
10613 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10614 output_asm_insn ("creqv 6,6,6", operands);
10617 return output_call(insn, operands, 1, 3);
10619 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10621 if (TARGET_SECURE_PLT && flag_pic == 2)
10622 return "bl %z1+32768@plt";
10624 return "bl %z1@plt";
10630 [(set_attr "type" "branch,branch")
10631 (set_attr "length" "4,8")])
10633 ;; Call subroutine returning any type.
10634 (define_expand "untyped_call"
10635 [(parallel [(call (match_operand 0 "" "")
10637 (match_operand 1 "" "")
10638 (match_operand 2 "" "")])]
10644 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10646 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10648 rtx set = XVECEXP (operands[2], 0, i);
10649 emit_move_insn (SET_DEST (set), SET_SRC (set));
10652 /* The optimizer does not know that the call sets the function value
10653 registers we stored in the result block. We avoid problems by
10654 claiming that all hard registers are used and clobbered at this
10656 emit_insn (gen_blockage ());
10661 ;; sibling call patterns
10662 (define_expand "sibcall"
10663 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10664 (match_operand 1 "" ""))
10665 (use (match_operand 2 "" ""))
10666 (use (match_operand 3 "" ""))
10672 if (MACHOPIC_INDIRECT)
10673 operands[0] = machopic_indirect_call_target (operands[0]);
10676 gcc_assert (GET_CODE (operands[0]) == MEM);
10677 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10679 operands[0] = XEXP (operands[0], 0);
10680 operands[3] = gen_reg_rtx (SImode);
10684 ;; this and similar patterns must be marked as using LR, otherwise
10685 ;; dataflow will try to delete the store into it. This is true
10686 ;; even when the actual reg to jump to is in CTR, when LR was
10687 ;; saved and restored around the PIC-setting BCL.
10688 (define_insn "*sibcall_local32"
10689 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10690 (match_operand 1 "" "g,g"))
10691 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10692 (use (match_operand:SI 3 "register_operand" "l,l"))
10694 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10697 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10698 output_asm_insn (\"crxor 6,6,6\", operands);
10700 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10701 output_asm_insn (\"creqv 6,6,6\", operands);
10703 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10705 [(set_attr "type" "branch")
10706 (set_attr "length" "4,8")])
10708 (define_insn "*sibcall_local64"
10709 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10710 (match_operand 1 "" "g,g"))
10711 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10712 (use (match_operand:SI 3 "register_operand" "l,l"))
10714 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10717 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10718 output_asm_insn (\"crxor 6,6,6\", operands);
10720 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10721 output_asm_insn (\"creqv 6,6,6\", operands);
10723 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10725 [(set_attr "type" "branch")
10726 (set_attr "length" "4,8")])
10728 (define_insn "*sibcall_value_local32"
10729 [(set (match_operand 0 "" "")
10730 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10731 (match_operand 2 "" "g,g")))
10732 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10733 (use (match_operand:SI 4 "register_operand" "l,l"))
10735 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10738 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10739 output_asm_insn (\"crxor 6,6,6\", operands);
10741 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10742 output_asm_insn (\"creqv 6,6,6\", operands);
10744 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10746 [(set_attr "type" "branch")
10747 (set_attr "length" "4,8")])
10750 (define_insn "*sibcall_value_local64"
10751 [(set (match_operand 0 "" "")
10752 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10753 (match_operand 2 "" "g,g")))
10754 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10755 (use (match_operand:SI 4 "register_operand" "l,l"))
10757 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10760 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10761 output_asm_insn (\"crxor 6,6,6\", operands);
10763 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10764 output_asm_insn (\"creqv 6,6,6\", operands);
10766 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10768 [(set_attr "type" "branch")
10769 (set_attr "length" "4,8")])
10771 (define_insn "*sibcall_nonlocal_aix32"
10772 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10773 (match_operand 1 "" "g"))
10774 (use (match_operand:SI 2 "immediate_operand" "O"))
10775 (use (match_operand:SI 3 "register_operand" "l"))
10778 && DEFAULT_ABI == ABI_AIX
10779 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10781 [(set_attr "type" "branch")
10782 (set_attr "length" "4")])
10784 (define_insn "*sibcall_nonlocal_aix64"
10785 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10786 (match_operand 1 "" "g"))
10787 (use (match_operand:SI 2 "immediate_operand" "O"))
10788 (use (match_operand:SI 3 "register_operand" "l"))
10791 && DEFAULT_ABI == ABI_AIX
10792 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10794 [(set_attr "type" "branch")
10795 (set_attr "length" "4")])
10797 (define_insn "*sibcall_value_nonlocal_aix32"
10798 [(set (match_operand 0 "" "")
10799 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10800 (match_operand 2 "" "g")))
10801 (use (match_operand:SI 3 "immediate_operand" "O"))
10802 (use (match_operand:SI 4 "register_operand" "l"))
10805 && DEFAULT_ABI == ABI_AIX
10806 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10808 [(set_attr "type" "branch")
10809 (set_attr "length" "4")])
10811 (define_insn "*sibcall_value_nonlocal_aix64"
10812 [(set (match_operand 0 "" "")
10813 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10814 (match_operand 2 "" "g")))
10815 (use (match_operand:SI 3 "immediate_operand" "O"))
10816 (use (match_operand:SI 4 "register_operand" "l"))
10819 && DEFAULT_ABI == ABI_AIX
10820 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10822 [(set_attr "type" "branch")
10823 (set_attr "length" "4")])
10825 (define_insn "*sibcall_nonlocal_sysv"
10826 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10827 (match_operand 1 "" ""))
10828 (use (match_operand 2 "immediate_operand" "O,n"))
10829 (use (match_operand:SI 3 "register_operand" "l,l"))
10831 "(DEFAULT_ABI == ABI_DARWIN
10832 || DEFAULT_ABI == ABI_V4)
10833 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10836 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10837 output_asm_insn (\"crxor 6,6,6\", operands);
10839 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10840 output_asm_insn (\"creqv 6,6,6\", operands);
10842 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10844 if (TARGET_SECURE_PLT && flag_pic == 2)
10845 return \"b %z0+32768@plt\";
10847 return \"b %z0@plt\";
10852 [(set_attr "type" "branch,branch")
10853 (set_attr "length" "4,8")])
10855 (define_expand "sibcall_value"
10856 [(parallel [(set (match_operand 0 "register_operand" "")
10857 (call (mem:SI (match_operand 1 "address_operand" ""))
10858 (match_operand 2 "" "")))
10859 (use (match_operand 3 "" ""))
10860 (use (match_operand 4 "" ""))
10866 if (MACHOPIC_INDIRECT)
10867 operands[1] = machopic_indirect_call_target (operands[1]);
10870 gcc_assert (GET_CODE (operands[1]) == MEM);
10871 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10873 operands[1] = XEXP (operands[1], 0);
10874 operands[4] = gen_reg_rtx (SImode);
10878 (define_insn "*sibcall_value_nonlocal_sysv"
10879 [(set (match_operand 0 "" "")
10880 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10881 (match_operand 2 "" "")))
10882 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10883 (use (match_operand:SI 4 "register_operand" "l,l"))
10885 "(DEFAULT_ABI == ABI_DARWIN
10886 || DEFAULT_ABI == ABI_V4)
10887 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10890 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10891 output_asm_insn (\"crxor 6,6,6\", operands);
10893 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10894 output_asm_insn (\"creqv 6,6,6\", operands);
10896 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10898 if (TARGET_SECURE_PLT && flag_pic == 2)
10899 return \"b %z1+32768@plt\";
10901 return \"b %z1@plt\";
10906 [(set_attr "type" "branch,branch")
10907 (set_attr "length" "4,8")])
10909 (define_expand "sibcall_epilogue"
10910 [(use (const_int 0))]
10911 "TARGET_SCHED_PROLOG"
10914 rs6000_emit_epilogue (TRUE);
10918 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10919 ;; all of memory. This blocks insns from being moved across this point.
10921 (define_insn "blockage"
10922 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10926 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10927 ;; signed & unsigned, and one type of branch.
10929 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10930 ;; insns, and branches. We store the operands of compares until we see
10932 (define_expand "cmp<mode>"
10934 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
10935 (match_operand:GPR 1 "reg_or_short_operand" "")))]
10939 /* Take care of the possibility that operands[1] might be negative but
10940 this might be a logical operation. That insn doesn't exist. */
10941 if (GET_CODE (operands[1]) == CONST_INT
10942 && INTVAL (operands[1]) < 0)
10943 operands[1] = force_reg (<MODE>mode, operands[1]);
10945 rs6000_compare_op0 = operands[0];
10946 rs6000_compare_op1 = operands[1];
10947 rs6000_compare_fp_p = 0;
10951 (define_expand "cmp<mode>"
10952 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
10953 (match_operand:FP 1 "gpc_reg_operand" "")))]
10957 rs6000_compare_op0 = operands[0];
10958 rs6000_compare_op1 = operands[1];
10959 rs6000_compare_fp_p = 1;
10963 (define_expand "beq"
10964 [(use (match_operand 0 "" ""))]
10966 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10968 (define_expand "bne"
10969 [(use (match_operand 0 "" ""))]
10971 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10973 (define_expand "bge"
10974 [(use (match_operand 0 "" ""))]
10976 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10978 (define_expand "bgt"
10979 [(use (match_operand 0 "" ""))]
10981 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10983 (define_expand "ble"
10984 [(use (match_operand 0 "" ""))]
10986 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10988 (define_expand "blt"
10989 [(use (match_operand 0 "" ""))]
10991 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10993 (define_expand "bgeu"
10994 [(use (match_operand 0 "" ""))]
10996 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10998 (define_expand "bgtu"
10999 [(use (match_operand 0 "" ""))]
11001 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11003 (define_expand "bleu"
11004 [(use (match_operand 0 "" ""))]
11006 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11008 (define_expand "bltu"
11009 [(use (match_operand 0 "" ""))]
11011 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11013 (define_expand "bunordered"
11014 [(use (match_operand 0 "" ""))]
11015 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11016 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11018 (define_expand "bordered"
11019 [(use (match_operand 0 "" ""))]
11020 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11021 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11023 (define_expand "buneq"
11024 [(use (match_operand 0 "" ""))]
11026 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11028 (define_expand "bunge"
11029 [(use (match_operand 0 "" ""))]
11031 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11033 (define_expand "bungt"
11034 [(use (match_operand 0 "" ""))]
11036 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11038 (define_expand "bunle"
11039 [(use (match_operand 0 "" ""))]
11041 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11043 (define_expand "bunlt"
11044 [(use (match_operand 0 "" ""))]
11046 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11048 (define_expand "bltgt"
11049 [(use (match_operand 0 "" ""))]
11051 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11053 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11054 ;; For SEQ, likewise, except that comparisons with zero should be done
11055 ;; with an scc insns. However, due to the order that combine see the
11056 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11057 ;; the cases we don't want to handle.
11058 (define_expand "seq"
11059 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11061 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11063 (define_expand "sne"
11064 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11068 if (! rs6000_compare_fp_p)
11071 rs6000_emit_sCOND (NE, operands[0]);
11075 ;; A >= 0 is best done the portable way for A an integer.
11076 (define_expand "sge"
11077 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11081 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11084 rs6000_emit_sCOND (GE, operands[0]);
11088 ;; A > 0 is best done using the portable sequence, so fail in that case.
11089 (define_expand "sgt"
11090 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11094 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11097 rs6000_emit_sCOND (GT, operands[0]);
11101 ;; A <= 0 is best done the portable way for A an integer.
11102 (define_expand "sle"
11103 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11107 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11110 rs6000_emit_sCOND (LE, operands[0]);
11114 ;; A < 0 is best done in the portable way for A an integer.
11115 (define_expand "slt"
11116 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11120 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11123 rs6000_emit_sCOND (LT, operands[0]);
11127 (define_expand "sgeu"
11128 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11130 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11132 (define_expand "sgtu"
11133 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11135 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11137 (define_expand "sleu"
11138 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11140 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11142 (define_expand "sltu"
11143 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11145 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11147 (define_expand "sunordered"
11148 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11149 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11150 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11152 (define_expand "sordered"
11153 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11154 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11155 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11157 (define_expand "suneq"
11158 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11160 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11162 (define_expand "sunge"
11163 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11165 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11167 (define_expand "sungt"
11168 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11170 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11172 (define_expand "sunle"
11173 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11175 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11177 (define_expand "sunlt"
11178 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11180 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11182 (define_expand "sltgt"
11183 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11185 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11187 (define_expand "stack_protect_set"
11188 [(match_operand 0 "memory_operand" "")
11189 (match_operand 1 "memory_operand" "")]
11192 #ifdef TARGET_THREAD_SSP_OFFSET
11193 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11194 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11195 operands[1] = gen_rtx_MEM (Pmode, addr);
11198 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11200 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11204 (define_insn "stack_protect_setsi"
11205 [(set (match_operand:SI 0 "memory_operand" "=m")
11206 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11207 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11209 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11210 [(set_attr "type" "three")
11211 (set_attr "length" "12")])
11213 (define_insn "stack_protect_setdi"
11214 [(set (match_operand:DI 0 "memory_operand" "=m")
11215 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11216 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11218 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11219 [(set_attr "type" "three")
11220 (set_attr "length" "12")])
11222 (define_expand "stack_protect_test"
11223 [(match_operand 0 "memory_operand" "")
11224 (match_operand 1 "memory_operand" "")
11225 (match_operand 2 "" "")]
11228 #ifdef TARGET_THREAD_SSP_OFFSET
11229 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11230 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11231 operands[1] = gen_rtx_MEM (Pmode, addr);
11233 rs6000_compare_op0 = operands[0];
11234 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11236 rs6000_compare_fp_p = 0;
11237 emit_jump_insn (gen_beq (operands[2]));
11241 (define_insn "stack_protect_testsi"
11242 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11243 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11244 (match_operand:SI 2 "memory_operand" "m,m")]
11246 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11247 (clobber (match_scratch:SI 3 "=&r,&r"))]
11250 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11251 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;{cmpl|cmplw} %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11252 [(set_attr "length" "16,20")])
11254 (define_insn "stack_protect_testdi"
11255 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11256 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11257 (match_operand:DI 2 "memory_operand" "m,m")]
11259 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11260 (clobber (match_scratch:DI 3 "=&r,&r"))]
11263 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11264 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11265 [(set_attr "length" "16,20")])
11268 ;; Here are the actual compare insns.
11269 (define_insn "*cmp<mode>_internal1"
11270 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11271 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11272 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11274 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11275 [(set_attr "type" "cmp")])
11277 ;; If we are comparing a register for equality with a large constant,
11278 ;; we can do this with an XOR followed by a compare. But this is profitable
11279 ;; only if the large constant is only used for the comparison (and in this
11280 ;; case we already have a register to reuse as scratch).
11282 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11283 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11286 [(set (match_operand:SI 0 "register_operand")
11287 (match_operand:SI 1 "logical_const_operand" ""))
11288 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11290 (match_operand:SI 2 "logical_const_operand" "")]))
11291 (set (match_operand:CC 4 "cc_reg_operand" "")
11292 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11295 (if_then_else (match_operator 6 "equality_operator"
11296 [(match_dup 4) (const_int 0)])
11297 (match_operand 7 "" "")
11298 (match_operand 8 "" "")))]
11299 "peep2_reg_dead_p (3, operands[0])
11300 && peep2_reg_dead_p (4, operands[4])"
11301 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11302 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11303 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11306 /* Get the constant we are comparing against, and see what it looks like
11307 when sign-extended from 16 to 32 bits. Then see what constant we could
11308 XOR with SEXTC to get the sign-extended value. */
11309 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11311 operands[1], operands[2]);
11312 HOST_WIDE_INT c = INTVAL (cnst);
11313 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11314 HOST_WIDE_INT xorv = c ^ sextc;
11316 operands[9] = GEN_INT (xorv);
11317 operands[10] = GEN_INT (sextc);
11320 (define_insn "*cmpsi_internal2"
11321 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11322 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11323 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11325 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11326 [(set_attr "type" "cmp")])
11328 (define_insn "*cmpdi_internal2"
11329 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11330 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11331 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11333 "cmpld%I2 %0,%1,%b2"
11334 [(set_attr "type" "cmp")])
11336 ;; The following two insns don't exist as single insns, but if we provide
11337 ;; them, we can swap an add and compare, which will enable us to overlap more
11338 ;; of the required delay between a compare and branch. We generate code for
11339 ;; them by splitting.
11342 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11343 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11344 (match_operand:SI 2 "short_cint_operand" "i")))
11345 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11346 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11349 [(set_attr "length" "8")])
11352 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11353 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11354 (match_operand:SI 2 "u_short_cint_operand" "i")))
11355 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11356 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11359 [(set_attr "length" "8")])
11362 [(set (match_operand:CC 3 "cc_reg_operand" "")
11363 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11364 (match_operand:SI 2 "short_cint_operand" "")))
11365 (set (match_operand:SI 0 "gpc_reg_operand" "")
11366 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11368 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11369 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11372 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11373 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11374 (match_operand:SI 2 "u_short_cint_operand" "")))
11375 (set (match_operand:SI 0 "gpc_reg_operand" "")
11376 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11378 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11379 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11381 (define_insn "*cmpsf_internal1"
11382 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11383 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11384 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11385 "TARGET_HARD_FLOAT && TARGET_FPRS"
11387 [(set_attr "type" "fpcompare")])
11389 (define_insn "*cmpdf_internal1"
11390 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11391 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11392 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11393 "TARGET_HARD_FLOAT && TARGET_FPRS"
11395 [(set_attr "type" "fpcompare")])
11397 ;; Only need to compare second words if first words equal
11398 (define_insn "*cmptf_internal1"
11399 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11400 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11401 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11402 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11403 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11404 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11405 [(set_attr "type" "fpcompare")
11406 (set_attr "length" "12")])
11408 (define_insn_and_split "*cmptf_internal2"
11409 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11410 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11411 (match_operand:TF 2 "gpc_reg_operand" "f")))
11412 (clobber (match_scratch:DF 3 "=f"))
11413 (clobber (match_scratch:DF 4 "=f"))
11414 (clobber (match_scratch:DF 5 "=f"))
11415 (clobber (match_scratch:DF 6 "=f"))
11416 (clobber (match_scratch:DF 7 "=f"))
11417 (clobber (match_scratch:DF 8 "=f"))
11418 (clobber (match_scratch:DF 9 "=f"))
11419 (clobber (match_scratch:DF 10 "=f"))]
11420 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11421 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11423 "&& reload_completed"
11424 [(set (match_dup 3) (match_dup 13))
11425 (set (match_dup 4) (match_dup 14))
11426 (set (match_dup 9) (abs:DF (match_dup 5)))
11427 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11428 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11429 (label_ref (match_dup 11))
11431 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11432 (set (pc) (label_ref (match_dup 12)))
11434 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11435 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11436 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11437 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11440 REAL_VALUE_TYPE rv;
11441 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11442 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11444 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11445 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11446 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11447 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11448 operands[11] = gen_label_rtx ();
11449 operands[12] = gen_label_rtx ();
11451 operands[13] = force_const_mem (DFmode,
11452 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11453 operands[14] = force_const_mem (DFmode,
11454 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11458 operands[13] = gen_const_mem (DFmode,
11459 create_TOC_reference (XEXP (operands[13], 0)));
11460 operands[14] = gen_const_mem (DFmode,
11461 create_TOC_reference (XEXP (operands[14], 0)));
11462 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11463 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11467 ;; Now we have the scc insns. We can do some combinations because of the
11468 ;; way the machine works.
11470 ;; Note that this is probably faster if we can put an insn between the
11471 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11472 ;; cases the insns below which don't use an intermediate CR field will
11473 ;; be used instead.
11475 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11476 (match_operator:SI 1 "scc_comparison_operator"
11477 [(match_operand 2 "cc_reg_operand" "y")
11480 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11481 [(set (attr "type")
11482 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11483 (const_string "mfcrf")
11485 (const_string "mfcr")))
11486 (set_attr "length" "8")])
11488 ;; Same as above, but get the GT bit.
11489 (define_insn "move_from_CR_gt_bit"
11490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11491 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11493 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11494 [(set_attr "type" "mfcr")
11495 (set_attr "length" "8")])
11497 ;; Same as above, but get the OV/ORDERED bit.
11498 (define_insn "move_from_CR_ov_bit"
11499 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11500 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11502 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11503 [(set_attr "type" "mfcr")
11504 (set_attr "length" "8")])
11507 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11508 (match_operator:DI 1 "scc_comparison_operator"
11509 [(match_operand 2 "cc_reg_operand" "y")
11512 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11513 [(set (attr "type")
11514 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11515 (const_string "mfcrf")
11517 (const_string "mfcr")))
11518 (set_attr "length" "8")])
11521 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11522 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11523 [(match_operand 2 "cc_reg_operand" "y,y")
11526 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11527 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11530 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11532 [(set_attr "type" "delayed_compare")
11533 (set_attr "length" "8,16")])
11536 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11537 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11538 [(match_operand 2 "cc_reg_operand" "")
11541 (set (match_operand:SI 3 "gpc_reg_operand" "")
11542 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11543 "TARGET_32BIT && reload_completed"
11544 [(set (match_dup 3)
11545 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11547 (compare:CC (match_dup 3)
11552 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11553 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11554 [(match_operand 2 "cc_reg_operand" "y")
11556 (match_operand:SI 3 "const_int_operand" "n")))]
11560 int is_bit = ccr_bit (operands[1], 1);
11561 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11564 if (is_bit >= put_bit)
11565 count = is_bit - put_bit;
11567 count = 32 - (put_bit - is_bit);
11569 operands[4] = GEN_INT (count);
11570 operands[5] = GEN_INT (put_bit);
11572 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11574 [(set (attr "type")
11575 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11576 (const_string "mfcrf")
11578 (const_string "mfcr")))
11579 (set_attr "length" "8")])
11582 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11584 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11585 [(match_operand 2 "cc_reg_operand" "y,y")
11587 (match_operand:SI 3 "const_int_operand" "n,n"))
11589 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11590 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11595 int is_bit = ccr_bit (operands[1], 1);
11596 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11599 /* Force split for non-cc0 compare. */
11600 if (which_alternative == 1)
11603 if (is_bit >= put_bit)
11604 count = is_bit - put_bit;
11606 count = 32 - (put_bit - is_bit);
11608 operands[5] = GEN_INT (count);
11609 operands[6] = GEN_INT (put_bit);
11611 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11613 [(set_attr "type" "delayed_compare")
11614 (set_attr "length" "8,16")])
11617 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11619 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11620 [(match_operand 2 "cc_reg_operand" "")
11622 (match_operand:SI 3 "const_int_operand" ""))
11624 (set (match_operand:SI 4 "gpc_reg_operand" "")
11625 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11628 [(set (match_dup 4)
11629 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11632 (compare:CC (match_dup 4)
11636 ;; There is a 3 cycle delay between consecutive mfcr instructions
11637 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11640 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11641 (match_operator:SI 1 "scc_comparison_operator"
11642 [(match_operand 2 "cc_reg_operand" "y")
11644 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11645 (match_operator:SI 4 "scc_comparison_operator"
11646 [(match_operand 5 "cc_reg_operand" "y")
11648 "REGNO (operands[2]) != REGNO (operands[5])"
11649 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11650 [(set_attr "type" "mfcr")
11651 (set_attr "length" "12")])
11654 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11655 (match_operator:DI 1 "scc_comparison_operator"
11656 [(match_operand 2 "cc_reg_operand" "y")
11658 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11659 (match_operator:DI 4 "scc_comparison_operator"
11660 [(match_operand 5 "cc_reg_operand" "y")
11662 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11663 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11664 [(set_attr "type" "mfcr")
11665 (set_attr "length" "12")])
11667 ;; There are some scc insns that can be done directly, without a compare.
11668 ;; These are faster because they don't involve the communications between
11669 ;; the FXU and branch units. In fact, we will be replacing all of the
11670 ;; integer scc insns here or in the portable methods in emit_store_flag.
11672 ;; Also support (neg (scc ..)) since that construct is used to replace
11673 ;; branches, (plus (scc ..) ..) since that construct is common and
11674 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11675 ;; cases where it is no more expensive than (neg (scc ..)).
11677 ;; Have reload force a constant into a register for the simple insns that
11678 ;; otherwise won't accept constants. We do this because it is faster than
11679 ;; the cmp/mfcr sequence we would otherwise generate.
11681 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11684 (define_insn_and_split "*eq<mode>"
11685 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11686 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11687 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
11691 [(set (match_dup 0)
11692 (clz:GPR (match_dup 3)))
11694 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
11696 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11698 /* Use output operand as intermediate. */
11699 operands[3] = operands[0];
11701 if (logical_operand (operands[2], <MODE>mode))
11702 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11703 gen_rtx_XOR (<MODE>mode,
11704 operands[1], operands[2])));
11706 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11707 gen_rtx_PLUS (<MODE>mode, operands[1],
11708 negate_rtx (<MODE>mode,
11712 operands[3] = operands[1];
11714 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11717 (define_insn_and_split "*eq<mode>_compare"
11718 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11720 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11721 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11723 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11724 (eq:P (match_dup 1) (match_dup 2)))]
11725 "!TARGET_POWER && optimize_size"
11727 "!TARGET_POWER && optimize_size"
11728 [(set (match_dup 0)
11729 (clz:P (match_dup 4)))
11730 (parallel [(set (match_dup 3)
11731 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
11734 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
11736 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11738 /* Use output operand as intermediate. */
11739 operands[4] = operands[0];
11741 if (logical_operand (operands[2], <MODE>mode))
11742 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11743 gen_rtx_XOR (<MODE>mode,
11744 operands[1], operands[2])));
11746 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11747 gen_rtx_PLUS (<MODE>mode, operands[1],
11748 negate_rtx (<MODE>mode,
11752 operands[4] = operands[1];
11754 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11757 (define_insn "*eqsi_power"
11758 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11759 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11760 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11761 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11764 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11765 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11766 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11767 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11768 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11769 [(set_attr "type" "three,two,three,three,three")
11770 (set_attr "length" "12,8,12,12,12")])
11772 ;; We have insns of the form shown by the first define_insn below. If
11773 ;; there is something inside the comparison operation, we must split it.
11775 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11776 (plus:SI (match_operator 1 "comparison_operator"
11777 [(match_operand:SI 2 "" "")
11778 (match_operand:SI 3
11779 "reg_or_cint_operand" "")])
11780 (match_operand:SI 4 "gpc_reg_operand" "")))
11781 (clobber (match_operand:SI 5 "register_operand" ""))]
11782 "! gpc_reg_operand (operands[2], SImode)"
11783 [(set (match_dup 5) (match_dup 2))
11784 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11787 (define_insn "*plus_eqsi"
11788 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11789 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11790 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11791 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11794 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11795 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11796 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11797 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11798 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11799 [(set_attr "type" "three,two,three,three,three")
11800 (set_attr "length" "12,8,12,12,12")])
11802 (define_insn "*compare_plus_eqsi"
11803 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11806 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11807 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11808 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11810 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11811 "TARGET_32BIT && optimize_size"
11813 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11814 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11815 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11816 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11817 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11823 [(set_attr "type" "compare")
11824 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11827 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11830 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11831 (match_operand:SI 2 "scc_eq_operand" ""))
11832 (match_operand:SI 3 "gpc_reg_operand" ""))
11834 (clobber (match_scratch:SI 4 ""))]
11835 "TARGET_32BIT && optimize_size && reload_completed"
11836 [(set (match_dup 4)
11837 (plus:SI (eq:SI (match_dup 1)
11841 (compare:CC (match_dup 4)
11845 (define_insn "*plus_eqsi_compare"
11846 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11849 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11850 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11851 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11853 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11854 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11855 "TARGET_32BIT && optimize_size"
11857 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11858 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11859 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11860 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11861 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11867 [(set_attr "type" "compare")
11868 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11871 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11874 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11875 (match_operand:SI 2 "scc_eq_operand" ""))
11876 (match_operand:SI 3 "gpc_reg_operand" ""))
11878 (set (match_operand:SI 0 "gpc_reg_operand" "")
11879 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11880 "TARGET_32BIT && optimize_size && reload_completed"
11881 [(set (match_dup 0)
11882 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11884 (compare:CC (match_dup 0)
11888 (define_insn "*neg_eq0<mode>"
11889 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11890 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
11893 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
11894 [(set_attr "type" "two")
11895 (set_attr "length" "8")])
11897 (define_insn_and_split "*neg_eq<mode>"
11898 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11899 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
11900 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
11904 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
11906 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11908 /* Use output operand as intermediate. */
11909 operands[3] = operands[0];
11911 if (logical_operand (operands[2], <MODE>mode))
11912 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11913 gen_rtx_XOR (<MODE>mode,
11914 operands[1], operands[2])));
11916 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11917 gen_rtx_PLUS (<MODE>mode, operands[1],
11918 negate_rtx (<MODE>mode,
11922 operands[3] = operands[1];
11925 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11926 ;; since it nabs/sr is just as fast.
11927 (define_insn "*ne0si"
11928 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11929 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11931 (clobber (match_scratch:SI 2 "=&r"))]
11932 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11933 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11934 [(set_attr "type" "two")
11935 (set_attr "length" "8")])
11937 (define_insn "*ne0di"
11938 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11939 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11941 (clobber (match_scratch:DI 2 "=&r"))]
11943 "addic %2,%1,-1\;subfe %0,%2,%1"
11944 [(set_attr "type" "two")
11945 (set_attr "length" "8")])
11947 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11948 (define_insn "*plus_ne0si"
11949 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11950 (plus:SI (lshiftrt:SI
11951 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11953 (match_operand:SI 2 "gpc_reg_operand" "r")))
11954 (clobber (match_scratch:SI 3 "=&r"))]
11956 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11957 [(set_attr "type" "two")
11958 (set_attr "length" "8")])
11960 (define_insn "*plus_ne0di"
11961 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11962 (plus:DI (lshiftrt:DI
11963 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11965 (match_operand:DI 2 "gpc_reg_operand" "r")))
11966 (clobber (match_scratch:DI 3 "=&r"))]
11968 "addic %3,%1,-1\;addze %0,%2"
11969 [(set_attr "type" "two")
11970 (set_attr "length" "8")])
11972 (define_insn "*compare_plus_ne0si"
11973 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11975 (plus:SI (lshiftrt:SI
11976 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11978 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11980 (clobber (match_scratch:SI 3 "=&r,&r"))
11981 (clobber (match_scratch:SI 4 "=X,&r"))]
11984 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11986 [(set_attr "type" "compare")
11987 (set_attr "length" "8,12")])
11990 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11992 (plus:SI (lshiftrt:SI
11993 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11995 (match_operand:SI 2 "gpc_reg_operand" ""))
11997 (clobber (match_scratch:SI 3 ""))
11998 (clobber (match_scratch:SI 4 ""))]
11999 "TARGET_32BIT && reload_completed"
12000 [(parallel [(set (match_dup 3)
12001 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12004 (clobber (match_dup 4))])
12006 (compare:CC (match_dup 3)
12010 (define_insn "*compare_plus_ne0di"
12011 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12013 (plus:DI (lshiftrt:DI
12014 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12016 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12018 (clobber (match_scratch:DI 3 "=&r,&r"))]
12021 addic %3,%1,-1\;addze. %3,%2
12023 [(set_attr "type" "compare")
12024 (set_attr "length" "8,12")])
12027 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12029 (plus:DI (lshiftrt:DI
12030 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12032 (match_operand:DI 2 "gpc_reg_operand" ""))
12034 (clobber (match_scratch:DI 3 ""))]
12035 "TARGET_64BIT && reload_completed"
12036 [(set (match_dup 3)
12037 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12041 (compare:CC (match_dup 3)
12045 (define_insn "*plus_ne0si_compare"
12046 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12048 (plus:SI (lshiftrt:SI
12049 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12051 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12053 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12054 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12056 (clobber (match_scratch:SI 3 "=&r,&r"))]
12059 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12061 [(set_attr "type" "compare")
12062 (set_attr "length" "8,12")])
12065 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12067 (plus:SI (lshiftrt:SI
12068 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12070 (match_operand:SI 2 "gpc_reg_operand" ""))
12072 (set (match_operand:SI 0 "gpc_reg_operand" "")
12073 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12075 (clobber (match_scratch:SI 3 ""))]
12076 "TARGET_32BIT && reload_completed"
12077 [(parallel [(set (match_dup 0)
12078 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12080 (clobber (match_dup 3))])
12082 (compare:CC (match_dup 0)
12086 (define_insn "*plus_ne0di_compare"
12087 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12089 (plus:DI (lshiftrt:DI
12090 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12092 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12094 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12095 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12097 (clobber (match_scratch:DI 3 "=&r,&r"))]
12100 addic %3,%1,-1\;addze. %0,%2
12102 [(set_attr "type" "compare")
12103 (set_attr "length" "8,12")])
12106 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12108 (plus:DI (lshiftrt:DI
12109 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12111 (match_operand:DI 2 "gpc_reg_operand" ""))
12113 (set (match_operand:DI 0 "gpc_reg_operand" "")
12114 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12116 (clobber (match_scratch:DI 3 ""))]
12117 "TARGET_64BIT && reload_completed"
12118 [(parallel [(set (match_dup 0)
12119 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12121 (clobber (match_dup 3))])
12123 (compare:CC (match_dup 0)
12128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12129 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12130 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12131 (clobber (match_scratch:SI 3 "=r,X"))]
12134 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12135 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12136 [(set_attr "length" "12")])
12139 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12141 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12142 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12144 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12145 (le:SI (match_dup 1) (match_dup 2)))
12146 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12149 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12150 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12153 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12154 (set_attr "length" "12,12,16,16")])
12157 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12159 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12160 (match_operand:SI 2 "reg_or_short_operand" ""))
12162 (set (match_operand:SI 0 "gpc_reg_operand" "")
12163 (le:SI (match_dup 1) (match_dup 2)))
12164 (clobber (match_scratch:SI 3 ""))]
12165 "TARGET_POWER && reload_completed"
12166 [(parallel [(set (match_dup 0)
12167 (le:SI (match_dup 1) (match_dup 2)))
12168 (clobber (match_dup 3))])
12170 (compare:CC (match_dup 0)
12175 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12176 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12177 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12178 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12181 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12182 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12183 [(set_attr "length" "12")])
12186 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12188 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12189 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12190 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12192 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12195 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12196 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12199 [(set_attr "type" "compare")
12200 (set_attr "length" "12,12,16,16")])
12203 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12205 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12206 (match_operand:SI 2 "reg_or_short_operand" ""))
12207 (match_operand:SI 3 "gpc_reg_operand" ""))
12209 (clobber (match_scratch:SI 4 ""))]
12210 "TARGET_POWER && reload_completed"
12211 [(set (match_dup 4)
12212 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12215 (compare:CC (match_dup 4)
12220 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12222 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12223 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12224 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12226 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12227 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12230 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12231 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12234 [(set_attr "type" "compare")
12235 (set_attr "length" "12,12,16,16")])
12238 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12240 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12241 (match_operand:SI 2 "reg_or_short_operand" ""))
12242 (match_operand:SI 3 "gpc_reg_operand" ""))
12244 (set (match_operand:SI 0 "gpc_reg_operand" "")
12245 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12246 "TARGET_POWER && reload_completed"
12247 [(set (match_dup 0)
12248 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12250 (compare:CC (match_dup 0)
12255 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12256 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12257 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12260 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12261 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12262 [(set_attr "length" "12")])
12264 (define_insn "*leu<mode>"
12265 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12266 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12267 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12269 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12270 [(set_attr "type" "three")
12271 (set_attr "length" "12")])
12273 (define_insn "*leu<mode>_compare"
12274 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12276 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12277 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12279 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12280 (leu:P (match_dup 1) (match_dup 2)))]
12283 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12285 [(set_attr "type" "compare")
12286 (set_attr "length" "12,16")])
12289 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12291 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12292 (match_operand:P 2 "reg_or_short_operand" ""))
12294 (set (match_operand:P 0 "gpc_reg_operand" "")
12295 (leu:P (match_dup 1) (match_dup 2)))]
12297 [(set (match_dup 0)
12298 (leu:P (match_dup 1) (match_dup 2)))
12300 (compare:CC (match_dup 0)
12304 (define_insn "*plus_leu<mode>"
12305 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12306 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12307 (match_operand:P 2 "reg_or_short_operand" "rI"))
12308 (match_operand:P 3 "gpc_reg_operand" "r")))]
12310 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12311 [(set_attr "type" "two")
12312 (set_attr "length" "8")])
12315 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12317 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12318 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12319 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12321 (clobber (match_scratch:SI 4 "=&r,&r"))]
12324 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12326 [(set_attr "type" "compare")
12327 (set_attr "length" "8,12")])
12330 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12332 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12333 (match_operand:SI 2 "reg_or_short_operand" ""))
12334 (match_operand:SI 3 "gpc_reg_operand" ""))
12336 (clobber (match_scratch:SI 4 ""))]
12337 "TARGET_32BIT && reload_completed"
12338 [(set (match_dup 4)
12339 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12342 (compare:CC (match_dup 4)
12347 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12349 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12350 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12351 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12353 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12354 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12357 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12359 [(set_attr "type" "compare")
12360 (set_attr "length" "8,12")])
12363 [(set (match_operand:CC 4 "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 (set (match_operand:SI 0 "gpc_reg_operand" "")
12370 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12371 "TARGET_32BIT && reload_completed"
12372 [(set (match_dup 0)
12373 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12375 (compare:CC (match_dup 0)
12379 (define_insn "*neg_leu<mode>"
12380 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12381 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12382 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12384 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12385 [(set_attr "type" "three")
12386 (set_attr "length" "12")])
12388 (define_insn "*and_neg_leu<mode>"
12389 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12391 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12392 (match_operand:P 2 "reg_or_short_operand" "rI")))
12393 (match_operand:P 3 "gpc_reg_operand" "r")))]
12395 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12396 [(set_attr "type" "three")
12397 (set_attr "length" "12")])
12400 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12403 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12404 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12405 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12407 (clobber (match_scratch:SI 4 "=&r,&r"))]
12410 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12412 [(set_attr "type" "compare")
12413 (set_attr "length" "12,16")])
12416 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12419 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12420 (match_operand:SI 2 "reg_or_short_operand" "")))
12421 (match_operand:SI 3 "gpc_reg_operand" ""))
12423 (clobber (match_scratch:SI 4 ""))]
12424 "TARGET_32BIT && reload_completed"
12425 [(set (match_dup 4)
12426 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12429 (compare:CC (match_dup 4)
12434 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12437 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12438 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12439 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12441 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12442 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12445 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12447 [(set_attr "type" "compare")
12448 (set_attr "length" "12,16")])
12451 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12454 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12455 (match_operand:SI 2 "reg_or_short_operand" "")))
12456 (match_operand:SI 3 "gpc_reg_operand" ""))
12458 (set (match_operand:SI 0 "gpc_reg_operand" "")
12459 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12460 "TARGET_32BIT && reload_completed"
12461 [(set (match_dup 0)
12462 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12465 (compare:CC (match_dup 0)
12470 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12471 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12472 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12474 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12475 [(set_attr "length" "12")])
12478 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12480 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12481 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12483 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12484 (lt:SI (match_dup 1) (match_dup 2)))]
12487 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12489 [(set_attr "type" "delayed_compare")
12490 (set_attr "length" "12,16")])
12493 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12495 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12496 (match_operand:SI 2 "reg_or_short_operand" ""))
12498 (set (match_operand:SI 0 "gpc_reg_operand" "")
12499 (lt:SI (match_dup 1) (match_dup 2)))]
12500 "TARGET_POWER && reload_completed"
12501 [(set (match_dup 0)
12502 (lt:SI (match_dup 1) (match_dup 2)))
12504 (compare:CC (match_dup 0)
12509 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12510 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12511 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12512 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12514 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12515 [(set_attr "length" "12")])
12518 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12520 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12521 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12522 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12524 (clobber (match_scratch:SI 4 "=&r,&r"))]
12527 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12529 [(set_attr "type" "compare")
12530 (set_attr "length" "12,16")])
12533 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12535 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12536 (match_operand:SI 2 "reg_or_short_operand" ""))
12537 (match_operand:SI 3 "gpc_reg_operand" ""))
12539 (clobber (match_scratch:SI 4 ""))]
12540 "TARGET_POWER && reload_completed"
12541 [(set (match_dup 4)
12542 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12545 (compare:CC (match_dup 4)
12550 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12552 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12553 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12554 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12556 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12557 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12560 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12562 [(set_attr "type" "compare")
12563 (set_attr "length" "12,16")])
12566 [(set (match_operand:CC 4 "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 (set (match_operand:SI 0 "gpc_reg_operand" "")
12573 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12574 "TARGET_POWER && reload_completed"
12575 [(set (match_dup 0)
12576 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12578 (compare:CC (match_dup 0)
12583 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12584 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12585 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12587 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12588 [(set_attr "length" "12")])
12590 (define_insn_and_split "*ltu<mode>"
12591 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12592 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12593 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12597 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12598 (set (match_dup 0) (neg:P (match_dup 0)))]
12601 (define_insn_and_split "*ltu<mode>_compare"
12602 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12604 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12605 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12607 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12608 (ltu:P (match_dup 1) (match_dup 2)))]
12612 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12613 (parallel [(set (match_dup 3)
12614 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12615 (set (match_dup 0) (neg:P (match_dup 0)))])]
12618 (define_insn_and_split "*plus_ltu<mode>"
12619 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
12620 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12621 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12622 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
12625 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12626 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12627 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
12630 (define_insn_and_split "*plus_ltu<mode>_compare"
12631 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12633 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12634 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12635 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
12637 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12638 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
12641 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12642 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12643 (parallel [(set (match_dup 4)
12644 (compare:CC (minus:P (match_dup 3) (match_dup 0))
12646 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
12649 (define_insn "*neg_ltu<mode>"
12650 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12651 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12652 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
12655 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12656 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12657 [(set_attr "type" "two")
12658 (set_attr "length" "8")])
12661 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12662 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12663 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12664 (clobber (match_scratch:SI 3 "=r"))]
12666 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12667 [(set_attr "length" "12")])
12670 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12672 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12673 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12675 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12676 (ge:SI (match_dup 1) (match_dup 2)))
12677 (clobber (match_scratch:SI 3 "=r,r"))]
12680 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12682 [(set_attr "type" "compare")
12683 (set_attr "length" "12,16")])
12686 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12688 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12689 (match_operand:SI 2 "reg_or_short_operand" ""))
12691 (set (match_operand:SI 0 "gpc_reg_operand" "")
12692 (ge:SI (match_dup 1) (match_dup 2)))
12693 (clobber (match_scratch:SI 3 ""))]
12694 "TARGET_POWER && reload_completed"
12695 [(parallel [(set (match_dup 0)
12696 (ge:SI (match_dup 1) (match_dup 2)))
12697 (clobber (match_dup 3))])
12699 (compare:CC (match_dup 0)
12704 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12705 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12706 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12707 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12709 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12710 [(set_attr "length" "12")])
12713 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12715 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12716 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12717 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12719 (clobber (match_scratch:SI 4 "=&r,&r"))]
12722 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12724 [(set_attr "type" "compare")
12725 (set_attr "length" "12,16")])
12728 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12730 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12731 (match_operand:SI 2 "reg_or_short_operand" ""))
12732 (match_operand:SI 3 "gpc_reg_operand" ""))
12734 (clobber (match_scratch:SI 4 ""))]
12735 "TARGET_POWER && reload_completed"
12736 [(set (match_dup 4)
12737 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12740 (compare:CC (match_dup 4)
12745 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12747 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12748 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12749 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12751 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12752 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12755 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12757 [(set_attr "type" "compare")
12758 (set_attr "length" "12,16")])
12761 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12763 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12764 (match_operand:SI 2 "reg_or_short_operand" ""))
12765 (match_operand:SI 3 "gpc_reg_operand" ""))
12767 (set (match_operand:SI 0 "gpc_reg_operand" "")
12768 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12769 "TARGET_POWER && reload_completed"
12770 [(set (match_dup 0)
12771 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12773 (compare:CC (match_dup 0)
12778 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12779 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12780 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12782 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12783 [(set_attr "length" "12")])
12785 (define_insn "*geu<mode>"
12786 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12787 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12788 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12791 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12792 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12793 [(set_attr "type" "three")
12794 (set_attr "length" "12")])
12796 (define_insn "*geu<mode>_compare"
12797 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12799 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12800 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12802 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12803 (geu:P (match_dup 1) (match_dup 2)))]
12806 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12807 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12810 [(set_attr "type" "compare")
12811 (set_attr "length" "12,12,16,16")])
12814 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12816 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
12817 (match_operand:P 2 "reg_or_neg_short_operand" ""))
12819 (set (match_operand:P 0 "gpc_reg_operand" "")
12820 (geu:P (match_dup 1) (match_dup 2)))]
12822 [(set (match_dup 0)
12823 (geu:P (match_dup 1) (match_dup 2)))
12825 (compare:CC (match_dup 0)
12829 (define_insn "*plus_geu<mode>"
12830 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12831 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12832 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12833 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12836 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12837 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12838 [(set_attr "type" "two")
12839 (set_attr "length" "8")])
12842 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12844 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12845 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12846 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12848 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12851 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12852 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12855 [(set_attr "type" "compare")
12856 (set_attr "length" "8,8,12,12")])
12859 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12861 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12862 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12863 (match_operand:SI 3 "gpc_reg_operand" ""))
12865 (clobber (match_scratch:SI 4 ""))]
12866 "TARGET_32BIT && reload_completed"
12867 [(set (match_dup 4)
12868 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12871 (compare:CC (match_dup 4)
12876 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12878 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12879 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12880 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12882 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12883 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12886 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12887 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12890 [(set_attr "type" "compare")
12891 (set_attr "length" "8,8,12,12")])
12894 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12896 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12897 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12898 (match_operand:SI 3 "gpc_reg_operand" ""))
12900 (set (match_operand:SI 0 "gpc_reg_operand" "")
12901 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12902 "TARGET_32BIT && reload_completed"
12903 [(set (match_dup 0)
12904 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12906 (compare:CC (match_dup 0)
12910 (define_insn "*neg_geu<mode>"
12911 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12912 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12913 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
12916 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12917 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12918 [(set_attr "type" "three")
12919 (set_attr "length" "12")])
12921 (define_insn "*and_neg_geu<mode>"
12922 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12924 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12925 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
12926 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12929 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12930 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12931 [(set_attr "type" "three")
12932 (set_attr "length" "12")])
12935 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12938 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12939 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12940 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12942 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12945 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12946 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12949 [(set_attr "type" "compare")
12950 (set_attr "length" "12,12,16,16")])
12953 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12956 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12957 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12958 (match_operand:SI 3 "gpc_reg_operand" ""))
12960 (clobber (match_scratch:SI 4 ""))]
12961 "TARGET_32BIT && reload_completed"
12962 [(set (match_dup 4)
12963 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12966 (compare:CC (match_dup 4)
12971 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12974 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12975 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12976 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12978 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12979 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12982 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12983 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12986 [(set_attr "type" "compare")
12987 (set_attr "length" "12,12,16,16")])
12990 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12993 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12994 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12995 (match_operand:SI 3 "gpc_reg_operand" ""))
12997 (set (match_operand:SI 0 "gpc_reg_operand" "")
12998 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12999 "TARGET_32BIT && reload_completed"
13000 [(set (match_dup 0)
13001 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13003 (compare:CC (match_dup 0)
13008 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13009 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13010 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13012 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13013 [(set_attr "length" "12")])
13016 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13018 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13019 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13021 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13022 (gt:SI (match_dup 1) (match_dup 2)))]
13025 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13027 [(set_attr "type" "delayed_compare")
13028 (set_attr "length" "12,16")])
13031 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13033 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13034 (match_operand:SI 2 "reg_or_short_operand" ""))
13036 (set (match_operand:SI 0 "gpc_reg_operand" "")
13037 (gt:SI (match_dup 1) (match_dup 2)))]
13038 "TARGET_POWER && reload_completed"
13039 [(set (match_dup 0)
13040 (gt:SI (match_dup 1) (match_dup 2)))
13042 (compare:CC (match_dup 0)
13046 (define_insn "*plus_gt0<mode>"
13047 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13048 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13050 (match_operand:P 2 "gpc_reg_operand" "r")))]
13052 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13053 [(set_attr "type" "three")
13054 (set_attr "length" "12")])
13057 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13059 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13061 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13063 (clobber (match_scratch:SI 3 "=&r,&r"))]
13066 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13068 [(set_attr "type" "compare")
13069 (set_attr "length" "12,16")])
13072 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13074 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13076 (match_operand:SI 2 "gpc_reg_operand" ""))
13078 (clobber (match_scratch:SI 3 ""))]
13079 "TARGET_32BIT && reload_completed"
13080 [(set (match_dup 3)
13081 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13084 (compare:CC (match_dup 3)
13089 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13091 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13093 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13095 (clobber (match_scratch:DI 3 "=&r,&r"))]
13098 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13100 [(set_attr "type" "compare")
13101 (set_attr "length" "12,16")])
13104 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13106 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13108 (match_operand:DI 2 "gpc_reg_operand" ""))
13110 (clobber (match_scratch:DI 3 ""))]
13111 "TARGET_64BIT && reload_completed"
13112 [(set (match_dup 3)
13113 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13116 (compare:CC (match_dup 3)
13121 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13123 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13125 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13127 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13128 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13131 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13133 [(set_attr "type" "compare")
13134 (set_attr "length" "12,16")])
13137 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13139 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13141 (match_operand:SI 2 "gpc_reg_operand" ""))
13143 (set (match_operand:SI 0 "gpc_reg_operand" "")
13144 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13145 "TARGET_32BIT && reload_completed"
13146 [(set (match_dup 0)
13147 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13149 (compare:CC (match_dup 0)
13154 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13156 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13158 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13160 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13161 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13164 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13166 [(set_attr "type" "compare")
13167 (set_attr "length" "12,16")])
13170 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13172 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13174 (match_operand:DI 2 "gpc_reg_operand" ""))
13176 (set (match_operand:DI 0 "gpc_reg_operand" "")
13177 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13178 "TARGET_64BIT && reload_completed"
13179 [(set (match_dup 0)
13180 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13182 (compare:CC (match_dup 0)
13187 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13188 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13189 (match_operand:SI 2 "reg_or_short_operand" "r"))
13190 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13192 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13193 [(set_attr "length" "12")])
13196 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13198 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13199 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13200 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13202 (clobber (match_scratch:SI 4 "=&r,&r"))]
13205 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13207 [(set_attr "type" "compare")
13208 (set_attr "length" "12,16")])
13211 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13213 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13214 (match_operand:SI 2 "reg_or_short_operand" ""))
13215 (match_operand:SI 3 "gpc_reg_operand" ""))
13217 (clobber (match_scratch:SI 4 ""))]
13218 "TARGET_POWER && reload_completed"
13219 [(set (match_dup 4)
13220 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13222 (compare:CC (match_dup 4)
13227 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13229 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13230 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13231 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13233 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13234 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13237 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13239 [(set_attr "type" "compare")
13240 (set_attr "length" "12,16")])
13243 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13245 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13246 (match_operand:SI 2 "reg_or_short_operand" ""))
13247 (match_operand:SI 3 "gpc_reg_operand" ""))
13249 (set (match_operand:SI 0 "gpc_reg_operand" "")
13250 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13251 "TARGET_POWER && reload_completed"
13252 [(set (match_dup 0)
13253 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13255 (compare:CC (match_dup 0)
13260 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13261 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13262 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13264 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13265 [(set_attr "length" "12")])
13267 (define_insn_and_split "*gtu<mode>"
13268 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13269 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13270 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13274 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13275 (set (match_dup 0) (neg:P (match_dup 0)))]
13278 (define_insn_and_split "*gtu<mode>_compare"
13279 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13281 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13282 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13284 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13285 (gtu:P (match_dup 1) (match_dup 2)))]
13289 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13290 (parallel [(set (match_dup 3)
13291 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13292 (set (match_dup 0) (neg:P (match_dup 0)))])]
13295 (define_insn_and_split "*plus_gtu<mode>"
13296 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13297 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13298 (match_operand:P 2 "reg_or_short_operand" "rI"))
13299 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13302 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13303 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13304 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13307 (define_insn_and_split "*plus_gtu<mode>_compare"
13308 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13310 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13311 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13312 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13314 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13315 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13318 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13319 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13320 (parallel [(set (match_dup 4)
13321 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13323 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13326 (define_insn "*neg_gtu<mode>"
13327 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13328 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13329 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13331 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13332 [(set_attr "type" "two")
13333 (set_attr "length" "8")])
13336 ;; Define both directions of branch and return. If we need a reload
13337 ;; register, we'd rather use CR0 since it is much easier to copy a
13338 ;; register CC value to there.
13342 (if_then_else (match_operator 1 "branch_comparison_operator"
13344 "cc_reg_operand" "y")
13346 (label_ref (match_operand 0 "" ""))
13351 return output_cbranch (operands[1], \"%l0\", 0, insn);
13353 [(set_attr "type" "branch")])
13357 (if_then_else (match_operator 0 "branch_comparison_operator"
13359 "cc_reg_operand" "y")
13366 return output_cbranch (operands[0], NULL, 0, insn);
13368 [(set_attr "type" "jmpreg")
13369 (set_attr "length" "4")])
13373 (if_then_else (match_operator 1 "branch_comparison_operator"
13375 "cc_reg_operand" "y")
13378 (label_ref (match_operand 0 "" ""))))]
13382 return output_cbranch (operands[1], \"%l0\", 1, insn);
13384 [(set_attr "type" "branch")])
13388 (if_then_else (match_operator 0 "branch_comparison_operator"
13390 "cc_reg_operand" "y")
13397 return output_cbranch (operands[0], NULL, 1, insn);
13399 [(set_attr "type" "jmpreg")
13400 (set_attr "length" "4")])
13402 ;; Logic on condition register values.
13404 ; This pattern matches things like
13405 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13406 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13408 ; which are generated by the branch logic.
13409 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13411 (define_insn "*cceq_ior_compare"
13412 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13413 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13414 [(match_operator:SI 2
13415 "branch_positive_comparison_operator"
13417 "cc_reg_operand" "y,y")
13419 (match_operator:SI 4
13420 "branch_positive_comparison_operator"
13422 "cc_reg_operand" "0,y")
13426 "cr%q1 %E0,%j2,%j4"
13427 [(set_attr "type" "cr_logical,delayed_cr")])
13429 ; Why is the constant -1 here, but 1 in the previous pattern?
13430 ; Because ~1 has all but the low bit set.
13432 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13433 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13434 [(not:SI (match_operator:SI 2
13435 "branch_positive_comparison_operator"
13437 "cc_reg_operand" "y,y")
13439 (match_operator:SI 4
13440 "branch_positive_comparison_operator"
13442 "cc_reg_operand" "0,y")
13446 "cr%q1 %E0,%j2,%j4"
13447 [(set_attr "type" "cr_logical,delayed_cr")])
13449 (define_insn "*cceq_rev_compare"
13450 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13451 (compare:CCEQ (match_operator:SI 1
13452 "branch_positive_comparison_operator"
13454 "cc_reg_operand" "0,y")
13458 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13459 [(set_attr "type" "cr_logical,delayed_cr")])
13461 ;; If we are comparing the result of two comparisons, this can be done
13462 ;; using creqv or crxor.
13464 (define_insn_and_split ""
13465 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13466 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13467 [(match_operand 2 "cc_reg_operand" "y")
13469 (match_operator 3 "branch_comparison_operator"
13470 [(match_operand 4 "cc_reg_operand" "y")
13475 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13479 int positive_1, positive_2;
13481 positive_1 = branch_positive_comparison_operator (operands[1],
13482 GET_MODE (operands[1]));
13483 positive_2 = branch_positive_comparison_operator (operands[3],
13484 GET_MODE (operands[3]));
13487 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13488 GET_CODE (operands[1])),
13490 operands[2], const0_rtx);
13491 else if (GET_MODE (operands[1]) != SImode)
13492 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13493 operands[2], const0_rtx);
13496 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13497 GET_CODE (operands[3])),
13499 operands[4], const0_rtx);
13500 else if (GET_MODE (operands[3]) != SImode)
13501 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13502 operands[4], const0_rtx);
13504 if (positive_1 == positive_2)
13506 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13507 operands[5] = constm1_rtx;
13511 operands[5] = const1_rtx;
13515 ;; Unconditional branch and return.
13517 (define_insn "jump"
13519 (label_ref (match_operand 0 "" "")))]
13522 [(set_attr "type" "branch")])
13524 (define_insn "return"
13528 [(set_attr "type" "jmpreg")])
13530 (define_expand "indirect_jump"
13531 [(set (pc) (match_operand 0 "register_operand" ""))])
13533 (define_insn "*indirect_jump<mode>"
13534 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13539 [(set_attr "type" "jmpreg")])
13541 ;; Table jump for switch statements:
13542 (define_expand "tablejump"
13543 [(use (match_operand 0 "" ""))
13544 (use (label_ref (match_operand 1 "" "")))]
13549 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13551 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13555 (define_expand "tablejumpsi"
13556 [(set (match_dup 3)
13557 (plus:SI (match_operand:SI 0 "" "")
13559 (parallel [(set (pc) (match_dup 3))
13560 (use (label_ref (match_operand 1 "" "")))])]
13563 { operands[0] = force_reg (SImode, operands[0]);
13564 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13565 operands[3] = gen_reg_rtx (SImode);
13568 (define_expand "tablejumpdi"
13569 [(set (match_dup 4)
13570 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13572 (plus:DI (match_dup 4)
13574 (parallel [(set (pc) (match_dup 3))
13575 (use (label_ref (match_operand 1 "" "")))])]
13578 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13579 operands[3] = gen_reg_rtx (DImode);
13580 operands[4] = gen_reg_rtx (DImode);
13583 (define_insn "*tablejump<mode>_internal1"
13585 (match_operand:P 0 "register_operand" "c,*l"))
13586 (use (label_ref (match_operand 1 "" "")))]
13591 [(set_attr "type" "jmpreg")])
13596 "{cror 0,0,0|nop}")
13598 ;; Define the subtract-one-and-jump insns, starting with the template
13599 ;; so loop.c knows what to generate.
13601 (define_expand "doloop_end"
13602 [(use (match_operand 0 "" "")) ; loop pseudo
13603 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13604 (use (match_operand 2 "" "")) ; max iterations
13605 (use (match_operand 3 "" "")) ; loop level
13606 (use (match_operand 4 "" ""))] ; label
13610 /* Only use this on innermost loops. */
13611 if (INTVAL (operands[3]) > 1)
13615 if (GET_MODE (operands[0]) != DImode)
13617 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13621 if (GET_MODE (operands[0]) != SImode)
13623 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13628 (define_expand "ctr<mode>"
13629 [(parallel [(set (pc)
13630 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13632 (label_ref (match_operand 1 "" ""))
13635 (plus:P (match_dup 0)
13637 (clobber (match_scratch:CC 2 ""))
13638 (clobber (match_scratch:P 3 ""))])]
13642 ;; We need to be able to do this for any operand, including MEM, or we
13643 ;; will cause reload to blow up since we don't allow output reloads on
13645 ;; For the length attribute to be calculated correctly, the
13646 ;; label MUST be operand 0.
13648 (define_insn "*ctr<mode>_internal1"
13650 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13652 (label_ref (match_operand 0 "" ""))
13654 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13655 (plus:P (match_dup 1)
13657 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13658 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13662 if (which_alternative != 0)
13664 else if (get_attr_length (insn) == 4)
13665 return \"{bdn|bdnz} %l0\";
13667 return \"bdz $+8\;b %l0\";
13669 [(set_attr "type" "branch")
13670 (set_attr "length" "*,12,16,16")])
13672 (define_insn "*ctr<mode>_internal2"
13674 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13677 (label_ref (match_operand 0 "" ""))))
13678 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13679 (plus:P (match_dup 1)
13681 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13682 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13686 if (which_alternative != 0)
13688 else if (get_attr_length (insn) == 4)
13689 return \"bdz %l0\";
13691 return \"{bdn|bdnz} $+8\;b %l0\";
13693 [(set_attr "type" "branch")
13694 (set_attr "length" "*,12,16,16")])
13696 ;; Similar but use EQ
13698 (define_insn "*ctr<mode>_internal5"
13700 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13702 (label_ref (match_operand 0 "" ""))
13704 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13705 (plus:P (match_dup 1)
13707 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13708 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13712 if (which_alternative != 0)
13714 else if (get_attr_length (insn) == 4)
13715 return \"bdz %l0\";
13717 return \"{bdn|bdnz} $+8\;b %l0\";
13719 [(set_attr "type" "branch")
13720 (set_attr "length" "*,12,16,16")])
13722 (define_insn "*ctr<mode>_internal6"
13724 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13727 (label_ref (match_operand 0 "" ""))))
13728 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13729 (plus:P (match_dup 1)
13731 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13732 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13736 if (which_alternative != 0)
13738 else if (get_attr_length (insn) == 4)
13739 return \"{bdn|bdnz} %l0\";
13741 return \"bdz $+8\;b %l0\";
13743 [(set_attr "type" "branch")
13744 (set_attr "length" "*,12,16,16")])
13746 ;; Now the splitters if we could not allocate the CTR register
13750 (if_then_else (match_operator 2 "comparison_operator"
13751 [(match_operand:P 1 "gpc_reg_operand" "")
13753 (match_operand 5 "" "")
13754 (match_operand 6 "" "")))
13755 (set (match_operand:P 0 "gpc_reg_operand" "")
13756 (plus:P (match_dup 1) (const_int -1)))
13757 (clobber (match_scratch:CC 3 ""))
13758 (clobber (match_scratch:P 4 ""))]
13760 [(parallel [(set (match_dup 3)
13761 (compare:CC (plus:P (match_dup 1)
13765 (plus:P (match_dup 1)
13767 (set (pc) (if_then_else (match_dup 7)
13771 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13772 operands[3], const0_rtx); }")
13776 (if_then_else (match_operator 2 "comparison_operator"
13777 [(match_operand:P 1 "gpc_reg_operand" "")
13779 (match_operand 5 "" "")
13780 (match_operand 6 "" "")))
13781 (set (match_operand:P 0 "nonimmediate_operand" "")
13782 (plus:P (match_dup 1) (const_int -1)))
13783 (clobber (match_scratch:CC 3 ""))
13784 (clobber (match_scratch:P 4 ""))]
13785 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13786 [(parallel [(set (match_dup 3)
13787 (compare:CC (plus:P (match_dup 1)
13791 (plus:P (match_dup 1)
13795 (set (pc) (if_then_else (match_dup 7)
13799 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13800 operands[3], const0_rtx); }")
13802 (define_insn "trap"
13803 [(trap_if (const_int 1) (const_int 0))]
13807 (define_expand "conditional_trap"
13808 [(trap_if (match_operator 0 "trap_comparison_operator"
13809 [(match_dup 2) (match_dup 3)])
13810 (match_operand 1 "const_int_operand" ""))]
13812 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
13813 operands[2] = rs6000_compare_op0;
13814 operands[3] = rs6000_compare_op1;")
13817 [(trap_if (match_operator 0 "trap_comparison_operator"
13818 [(match_operand:GPR 1 "register_operand" "r")
13819 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13822 "{t|t<wd>}%V0%I2 %1,%2")
13824 ;; Insns related to generating the function prologue and epilogue.
13826 (define_expand "prologue"
13827 [(use (const_int 0))]
13828 "TARGET_SCHED_PROLOG"
13831 rs6000_emit_prologue ();
13835 (define_insn "*movesi_from_cr_one"
13836 [(match_parallel 0 "mfcr_operation"
13837 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13838 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13839 (match_operand 3 "immediate_operand" "n")]
13840 UNSPEC_MOVESI_FROM_CR))])]
13846 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13848 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13849 operands[4] = GEN_INT (mask);
13850 output_asm_insn (\"mfcr %1,%4\", operands);
13854 [(set_attr "type" "mfcrf")])
13856 (define_insn "movesi_from_cr"
13857 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13858 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
13859 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
13860 UNSPEC_MOVESI_FROM_CR))]
13863 [(set_attr "type" "mfcr")])
13865 (define_insn "*stmw"
13866 [(match_parallel 0 "stmw_operation"
13867 [(set (match_operand:SI 1 "memory_operand" "=m")
13868 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13871 [(set_attr "type" "store_ux")])
13873 (define_insn "*save_fpregs_<mode>"
13874 [(match_parallel 0 "any_parallel_operand"
13875 [(clobber (match_operand:P 1 "register_operand" "=l"))
13876 (use (match_operand:P 2 "call_operand" "s"))
13877 (set (match_operand:DF 3 "memory_operand" "=m")
13878 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
13881 [(set_attr "type" "branch")
13882 (set_attr "length" "4")])
13884 ; These are to explain that changes to the stack pointer should
13885 ; not be moved over stores to stack memory.
13886 (define_insn "stack_tie"
13887 [(set (match_operand:BLK 0 "memory_operand" "+m")
13888 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
13891 [(set_attr "length" "0")])
13894 (define_expand "epilogue"
13895 [(use (const_int 0))]
13896 "TARGET_SCHED_PROLOG"
13899 rs6000_emit_epilogue (FALSE);
13903 ; On some processors, doing the mtcrf one CC register at a time is
13904 ; faster (like on the 604e). On others, doing them all at once is
13905 ; faster; for instance, on the 601 and 750.
13907 (define_expand "movsi_to_cr_one"
13908 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13909 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13910 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13912 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13914 (define_insn "*movsi_to_cr"
13915 [(match_parallel 0 "mtcrf_operation"
13916 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13917 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13918 (match_operand 3 "immediate_operand" "n")]
13919 UNSPEC_MOVESI_TO_CR))])]
13925 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13926 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13927 operands[4] = GEN_INT (mask);
13928 return \"mtcrf %4,%2\";
13930 [(set_attr "type" "mtcr")])
13932 (define_insn "*mtcrfsi"
13933 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13934 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13935 (match_operand 2 "immediate_operand" "n")]
13936 UNSPEC_MOVESI_TO_CR))]
13937 "GET_CODE (operands[0]) == REG
13938 && CR_REGNO_P (REGNO (operands[0]))
13939 && GET_CODE (operands[2]) == CONST_INT
13940 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13942 [(set_attr "type" "mtcr")])
13944 ; The load-multiple instructions have similar properties.
13945 ; Note that "load_multiple" is a name known to the machine-independent
13946 ; code that actually corresponds to the PowerPC load-string.
13948 (define_insn "*lmw"
13949 [(match_parallel 0 "lmw_operation"
13950 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13951 (match_operand:SI 2 "memory_operand" "m"))])]
13954 [(set_attr "type" "load_ux")])
13956 (define_insn "*return_internal_<mode>"
13958 (use (match_operand:P 0 "register_operand" "lc"))]
13961 [(set_attr "type" "jmpreg")])
13963 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13964 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13966 (define_insn "*return_and_restore_fpregs_<mode>"
13967 [(match_parallel 0 "any_parallel_operand"
13969 (use (match_operand:P 1 "register_operand" "l"))
13970 (use (match_operand:P 2 "call_operand" "s"))
13971 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
13972 (match_operand:DF 4 "memory_operand" "m"))])]
13976 ; This is used in compiling the unwind routines.
13977 (define_expand "eh_return"
13978 [(use (match_operand 0 "general_operand" ""))]
13983 emit_insn (gen_eh_set_lr_si (operands[0]));
13985 emit_insn (gen_eh_set_lr_di (operands[0]));
13989 ; We can't expand this before we know where the link register is stored.
13990 (define_insn "eh_set_lr_<mode>"
13991 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
13993 (clobber (match_scratch:P 1 "=&b"))]
13998 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
13999 (clobber (match_scratch 1 ""))]
14004 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14008 (define_insn "prefetch"
14009 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14010 (match_operand:SI 1 "const_int_operand" "n")
14011 (match_operand:SI 2 "const_int_operand" "n"))]
14015 if (GET_CODE (operands[0]) == REG)
14016 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14017 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14019 [(set_attr "type" "load")])
14022 (include "sync.md")
14023 (include "altivec.md")