1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 2, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21 ;; MA 02110-1301, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 [(UNSPEC_FRSP 0) ; frsp for POWER machines
31 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
32 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
33 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
35 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
41 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
42 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
45 (UNSPEC_MOVESI_FROM_CR 19)
46 (UNSPEC_MOVESI_TO_CR 20)
48 (UNSPEC_TLSDTPRELHA 22)
49 (UNSPEC_TLSDTPRELLO 23)
50 (UNSPEC_TLSGOTDTPREL 24)
52 (UNSPEC_TLSTPRELHA 26)
53 (UNSPEC_TLSTPRELLO 27)
54 (UNSPEC_TLSGOTTPREL 28)
56 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
57 (UNSPEC_MV_CR_GT 31) ; move_from_CR_eq_bit
74 ;; UNSPEC_VOLATILE usage
79 (UNSPECV_LL 1) ; load-locked
80 (UNSPECV_SC 2) ; store-conditional
81 (UNSPECV_EH_RR 9) ; eh_reg_restore
84 ;; Define an insn type attribute. This is used in function unit delay
86 (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"
87 (const_string "integer"))
90 ; '(pc)' in the following doesn't include the instruction itself; it is
91 ; calculated as if the instruction had zero size.
92 (define_attr "length" ""
93 (if_then_else (eq_attr "type" "branch")
94 (if_then_else (and (ge (minus (match_dup 0) (pc))
96 (lt (minus (match_dup 0) (pc))
102 ;; Processor type -- this attribute must exactly match the processor_type
103 ;; enumeration in rs6000.h.
105 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
106 (const (symbol_ref "rs6000_cpu_attr")))
108 (automata_option "ndfa")
121 (include "power4.md")
122 (include "power5.md")
124 (include "predicates.md")
126 (include "darwin.md")
131 ; This mode macro allows :GPR to be used to indicate the allowable size
132 ; of whole values in GPRs.
133 (define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
135 ; Any supported integer mode.
136 (define_mode_macro INT [QI HI SI DI TI])
138 ; Any supported integer mode that fits in one register.
139 (define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
141 ; extend modes for DImode
142 (define_mode_macro QHSI [QI HI SI])
144 ; SImode or DImode, even if DImode doesn't fit in GPRs.
145 (define_mode_macro SDI [SI DI])
147 ; The size of a pointer. Also, the size of the value that a record-condition
148 ; (one with a '.') will compare.
149 (define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
151 ; Any hardware-supported floating-point mode
152 (define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
153 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
154 (TF "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
155 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128")])
157 ; Various instructions that come in SI and DI forms.
158 ; A generic w/d attribute, for things like cmpw/cmpd.
159 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
162 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
165 ;; Start with fixed-point load and store insns. Here we put only the more
166 ;; complex forms. Basic data transfer is done later.
168 (define_expand "zero_extend<mode>di2"
169 [(set (match_operand:DI 0 "gpc_reg_operand" "")
170 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
174 (define_insn "*zero_extend<mode>di2_internal1"
175 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
176 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
180 rldicl %0,%1,0,<dbits>"
181 [(set_attr "type" "load,*")])
183 (define_insn "*zero_extend<mode>di2_internal2"
184 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
185 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
187 (clobber (match_scratch:DI 2 "=r,r"))]
190 rldicl. %2,%1,0,<dbits>
192 [(set_attr "type" "compare")
193 (set_attr "length" "4,8")])
196 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
197 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
199 (clobber (match_scratch:DI 2 ""))]
200 "TARGET_POWERPC64 && reload_completed"
202 (zero_extend:DI (match_dup 1)))
204 (compare:CC (match_dup 2)
208 (define_insn "*zero_extend<mode>di2_internal3"
209 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
210 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
212 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
213 (zero_extend:DI (match_dup 1)))]
216 rldicl. %0,%1,0,<dbits>
218 [(set_attr "type" "compare")
219 (set_attr "length" "4,8")])
222 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
223 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
225 (set (match_operand:DI 0 "gpc_reg_operand" "")
226 (zero_extend:DI (match_dup 1)))]
227 "TARGET_POWERPC64 && reload_completed"
229 (zero_extend:DI (match_dup 1)))
231 (compare:CC (match_dup 0)
235 (define_insn "extendqidi2"
236 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
237 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
242 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
243 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
245 (clobber (match_scratch:DI 2 "=r,r"))]
250 [(set_attr "type" "compare")
251 (set_attr "length" "4,8")])
254 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
255 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
257 (clobber (match_scratch:DI 2 ""))]
258 "TARGET_POWERPC64 && reload_completed"
260 (sign_extend:DI (match_dup 1)))
262 (compare:CC (match_dup 2)
267 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
268 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
270 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
271 (sign_extend:DI (match_dup 1)))]
276 [(set_attr "type" "compare")
277 (set_attr "length" "4,8")])
280 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
281 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
283 (set (match_operand:DI 0 "gpc_reg_operand" "")
284 (sign_extend:DI (match_dup 1)))]
285 "TARGET_POWERPC64 && reload_completed"
287 (sign_extend:DI (match_dup 1)))
289 (compare:CC (match_dup 0)
293 (define_expand "extendhidi2"
294 [(set (match_operand:DI 0 "gpc_reg_operand" "")
295 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
300 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
301 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
306 [(set_attr "type" "load_ext,*")])
309 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
310 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
312 (clobber (match_scratch:DI 2 "=r,r"))]
317 [(set_attr "type" "compare")
318 (set_attr "length" "4,8")])
321 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
322 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
324 (clobber (match_scratch:DI 2 ""))]
325 "TARGET_POWERPC64 && reload_completed"
327 (sign_extend:DI (match_dup 1)))
329 (compare:CC (match_dup 2)
334 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
335 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
337 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
338 (sign_extend:DI (match_dup 1)))]
343 [(set_attr "type" "compare")
344 (set_attr "length" "4,8")])
347 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
348 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
350 (set (match_operand:DI 0 "gpc_reg_operand" "")
351 (sign_extend:DI (match_dup 1)))]
352 "TARGET_POWERPC64 && reload_completed"
354 (sign_extend:DI (match_dup 1)))
356 (compare:CC (match_dup 0)
360 (define_expand "extendsidi2"
361 [(set (match_operand:DI 0 "gpc_reg_operand" "")
362 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
367 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
368 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
373 [(set_attr "type" "load_ext,*")])
376 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
377 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
379 (clobber (match_scratch:DI 2 "=r,r"))]
384 [(set_attr "type" "compare")
385 (set_attr "length" "4,8")])
388 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
389 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
391 (clobber (match_scratch:DI 2 ""))]
392 "TARGET_POWERPC64 && reload_completed"
394 (sign_extend:DI (match_dup 1)))
396 (compare:CC (match_dup 2)
401 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
402 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
404 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
405 (sign_extend:DI (match_dup 1)))]
410 [(set_attr "type" "compare")
411 (set_attr "length" "4,8")])
414 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
415 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
417 (set (match_operand:DI 0 "gpc_reg_operand" "")
418 (sign_extend:DI (match_dup 1)))]
419 "TARGET_POWERPC64 && reload_completed"
421 (sign_extend:DI (match_dup 1)))
423 (compare:CC (match_dup 0)
427 (define_expand "zero_extendqisi2"
428 [(set (match_operand:SI 0 "gpc_reg_operand" "")
429 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
434 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
435 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
439 {rlinm|rlwinm} %0,%1,0,0xff"
440 [(set_attr "type" "load,*")])
443 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
444 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
446 (clobber (match_scratch:SI 2 "=r,r"))]
449 {andil.|andi.} %2,%1,0xff
451 [(set_attr "type" "compare")
452 (set_attr "length" "4,8")])
455 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
456 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
458 (clobber (match_scratch:SI 2 ""))]
461 (zero_extend:SI (match_dup 1)))
463 (compare:CC (match_dup 2)
468 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
469 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
471 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
472 (zero_extend:SI (match_dup 1)))]
475 {andil.|andi.} %0,%1,0xff
477 [(set_attr "type" "compare")
478 (set_attr "length" "4,8")])
481 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
482 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
484 (set (match_operand:SI 0 "gpc_reg_operand" "")
485 (zero_extend:SI (match_dup 1)))]
488 (zero_extend:SI (match_dup 1)))
490 (compare:CC (match_dup 0)
494 (define_expand "extendqisi2"
495 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
496 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
501 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
502 else if (TARGET_POWER)
503 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
505 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
509 (define_insn "extendqisi2_ppc"
510 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
511 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
516 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
517 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
519 (clobber (match_scratch:SI 2 "=r,r"))]
524 [(set_attr "type" "compare")
525 (set_attr "length" "4,8")])
528 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
529 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
531 (clobber (match_scratch:SI 2 ""))]
532 "TARGET_POWERPC && reload_completed"
534 (sign_extend:SI (match_dup 1)))
536 (compare:CC (match_dup 2)
541 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
542 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
544 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
545 (sign_extend:SI (match_dup 1)))]
550 [(set_attr "type" "compare")
551 (set_attr "length" "4,8")])
554 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
555 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
557 (set (match_operand:SI 0 "gpc_reg_operand" "")
558 (sign_extend:SI (match_dup 1)))]
559 "TARGET_POWERPC && reload_completed"
561 (sign_extend:SI (match_dup 1)))
563 (compare:CC (match_dup 0)
567 (define_expand "extendqisi2_power"
568 [(parallel [(set (match_dup 2)
569 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
571 (clobber (scratch:SI))])
572 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
573 (ashiftrt:SI (match_dup 2)
575 (clobber (scratch:SI))])]
578 { operands[1] = gen_lowpart (SImode, operands[1]);
579 operands[2] = gen_reg_rtx (SImode); }")
581 (define_expand "extendqisi2_no_power"
583 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
585 (set (match_operand:SI 0 "gpc_reg_operand" "")
586 (ashiftrt:SI (match_dup 2)
588 "! TARGET_POWER && ! TARGET_POWERPC"
590 { operands[1] = gen_lowpart (SImode, operands[1]);
591 operands[2] = gen_reg_rtx (SImode); }")
593 (define_expand "zero_extendqihi2"
594 [(set (match_operand:HI 0 "gpc_reg_operand" "")
595 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
600 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
601 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
605 {rlinm|rlwinm} %0,%1,0,0xff"
606 [(set_attr "type" "load,*")])
609 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
610 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
612 (clobber (match_scratch:HI 2 "=r,r"))]
615 {andil.|andi.} %2,%1,0xff
617 [(set_attr "type" "compare")
618 (set_attr "length" "4,8")])
621 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
622 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
624 (clobber (match_scratch:HI 2 ""))]
627 (zero_extend:HI (match_dup 1)))
629 (compare:CC (match_dup 2)
634 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
635 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
637 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
638 (zero_extend:HI (match_dup 1)))]
641 {andil.|andi.} %0,%1,0xff
643 [(set_attr "type" "compare")
644 (set_attr "length" "4,8")])
647 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
648 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
650 (set (match_operand:HI 0 "gpc_reg_operand" "")
651 (zero_extend:HI (match_dup 1)))]
654 (zero_extend:HI (match_dup 1)))
656 (compare:CC (match_dup 0)
660 (define_expand "extendqihi2"
661 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
662 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
667 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
668 else if (TARGET_POWER)
669 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
671 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
675 (define_insn "extendqihi2_ppc"
676 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
677 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
682 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
683 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
685 (clobber (match_scratch:HI 2 "=r,r"))]
690 [(set_attr "type" "compare")
691 (set_attr "length" "4,8")])
694 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
695 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
697 (clobber (match_scratch:HI 2 ""))]
698 "TARGET_POWERPC && reload_completed"
700 (sign_extend:HI (match_dup 1)))
702 (compare:CC (match_dup 2)
707 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
708 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
710 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
711 (sign_extend:HI (match_dup 1)))]
716 [(set_attr "type" "compare")
717 (set_attr "length" "4,8")])
720 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
721 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
723 (set (match_operand:HI 0 "gpc_reg_operand" "")
724 (sign_extend:HI (match_dup 1)))]
725 "TARGET_POWERPC && reload_completed"
727 (sign_extend:HI (match_dup 1)))
729 (compare:CC (match_dup 0)
733 (define_expand "extendqihi2_power"
734 [(parallel [(set (match_dup 2)
735 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
737 (clobber (scratch:SI))])
738 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
739 (ashiftrt:SI (match_dup 2)
741 (clobber (scratch:SI))])]
744 { operands[0] = gen_lowpart (SImode, operands[0]);
745 operands[1] = gen_lowpart (SImode, operands[1]);
746 operands[2] = gen_reg_rtx (SImode); }")
748 (define_expand "extendqihi2_no_power"
750 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
752 (set (match_operand:HI 0 "gpc_reg_operand" "")
753 (ashiftrt:SI (match_dup 2)
755 "! TARGET_POWER && ! TARGET_POWERPC"
757 { operands[0] = gen_lowpart (SImode, operands[0]);
758 operands[1] = gen_lowpart (SImode, operands[1]);
759 operands[2] = gen_reg_rtx (SImode); }")
761 (define_expand "zero_extendhisi2"
762 [(set (match_operand:SI 0 "gpc_reg_operand" "")
763 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
768 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
769 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
773 {rlinm|rlwinm} %0,%1,0,0xffff"
774 [(set_attr "type" "load,*")])
777 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
778 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
780 (clobber (match_scratch:SI 2 "=r,r"))]
783 {andil.|andi.} %2,%1,0xffff
785 [(set_attr "type" "compare")
786 (set_attr "length" "4,8")])
789 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
790 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
792 (clobber (match_scratch:SI 2 ""))]
795 (zero_extend:SI (match_dup 1)))
797 (compare:CC (match_dup 2)
802 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
803 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
805 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
806 (zero_extend:SI (match_dup 1)))]
809 {andil.|andi.} %0,%1,0xffff
811 [(set_attr "type" "compare")
812 (set_attr "length" "4,8")])
815 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
816 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
818 (set (match_operand:SI 0 "gpc_reg_operand" "")
819 (zero_extend:SI (match_dup 1)))]
822 (zero_extend:SI (match_dup 1)))
824 (compare:CC (match_dup 0)
828 (define_expand "extendhisi2"
829 [(set (match_operand:SI 0 "gpc_reg_operand" "")
830 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
835 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
836 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
841 [(set_attr "type" "load_ext,*")])
844 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
845 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
847 (clobber (match_scratch:SI 2 "=r,r"))]
852 [(set_attr "type" "compare")
853 (set_attr "length" "4,8")])
856 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
857 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
859 (clobber (match_scratch:SI 2 ""))]
862 (sign_extend:SI (match_dup 1)))
864 (compare:CC (match_dup 2)
869 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
870 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
872 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
873 (sign_extend:SI (match_dup 1)))]
878 [(set_attr "type" "compare")
879 (set_attr "length" "4,8")])
881 ;; IBM 405 and 440 half-word multiplication operations.
883 (define_insn "*macchwc"
884 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
885 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
886 (match_operand:SI 2 "gpc_reg_operand" "r")
889 (match_operand:HI 1 "gpc_reg_operand" "r")))
890 (match_operand:SI 4 "gpc_reg_operand" "0"))
892 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
893 (plus:SI (mult:SI (ashiftrt:SI
901 [(set_attr "type" "imul3")])
903 (define_insn "*macchw"
904 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
905 (plus:SI (mult:SI (ashiftrt:SI
906 (match_operand:SI 2 "gpc_reg_operand" "r")
909 (match_operand:HI 1 "gpc_reg_operand" "r")))
910 (match_operand:SI 3 "gpc_reg_operand" "0")))]
913 [(set_attr "type" "imul3")])
915 (define_insn "*macchwuc"
916 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
917 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
918 (match_operand:SI 2 "gpc_reg_operand" "r")
921 (match_operand:HI 1 "gpc_reg_operand" "r")))
922 (match_operand:SI 4 "gpc_reg_operand" "0"))
924 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
925 (plus:SI (mult:SI (lshiftrt:SI
932 "macchwu. %0, %1, %2"
933 [(set_attr "type" "imul3")])
935 (define_insn "*macchwu"
936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
937 (plus:SI (mult:SI (lshiftrt:SI
938 (match_operand:SI 2 "gpc_reg_operand" "r")
941 (match_operand:HI 1 "gpc_reg_operand" "r")))
942 (match_operand:SI 3 "gpc_reg_operand" "0")))]
945 [(set_attr "type" "imul3")])
947 (define_insn "*machhwc"
948 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
949 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
950 (match_operand:SI 1 "gpc_reg_operand" "%r")
953 (match_operand:SI 2 "gpc_reg_operand" "r")
955 (match_operand:SI 4 "gpc_reg_operand" "0"))
957 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
958 (plus:SI (mult:SI (ashiftrt:SI
967 [(set_attr "type" "imul3")])
969 (define_insn "*machhw"
970 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
971 (plus:SI (mult:SI (ashiftrt:SI
972 (match_operand:SI 1 "gpc_reg_operand" "%r")
975 (match_operand:SI 2 "gpc_reg_operand" "r")
977 (match_operand:SI 3 "gpc_reg_operand" "0")))]
980 [(set_attr "type" "imul3")])
982 (define_insn "*machhwuc"
983 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
984 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
985 (match_operand:SI 1 "gpc_reg_operand" "%r")
988 (match_operand:SI 2 "gpc_reg_operand" "r")
990 (match_operand:SI 4 "gpc_reg_operand" "0"))
992 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
993 (plus:SI (mult:SI (lshiftrt:SI
1001 "machhwu. %0, %1, %2"
1002 [(set_attr "type" "imul3")])
1004 (define_insn "*machhwu"
1005 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1006 (plus:SI (mult:SI (lshiftrt:SI
1007 (match_operand:SI 1 "gpc_reg_operand" "%r")
1010 (match_operand:SI 2 "gpc_reg_operand" "r")
1012 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1014 "machhwu %0, %1, %2"
1015 [(set_attr "type" "imul3")])
1017 (define_insn "*maclhwc"
1018 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1019 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1020 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1022 (match_operand:HI 2 "gpc_reg_operand" "r")))
1023 (match_operand:SI 4 "gpc_reg_operand" "0"))
1025 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1026 (plus:SI (mult:SI (sign_extend:SI
1032 "maclhw. %0, %1, %2"
1033 [(set_attr "type" "imul3")])
1035 (define_insn "*maclhw"
1036 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1037 (plus:SI (mult:SI (sign_extend:SI
1038 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1040 (match_operand:HI 2 "gpc_reg_operand" "r")))
1041 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1044 [(set_attr "type" "imul3")])
1046 (define_insn "*maclhwuc"
1047 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1048 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1049 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1051 (match_operand:HI 2 "gpc_reg_operand" "r")))
1052 (match_operand:SI 4 "gpc_reg_operand" "0"))
1054 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1055 (plus:SI (mult:SI (zero_extend:SI
1061 "maclhwu. %0, %1, %2"
1062 [(set_attr "type" "imul3")])
1064 (define_insn "*maclhwu"
1065 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1066 (plus:SI (mult:SI (zero_extend:SI
1067 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1069 (match_operand:HI 2 "gpc_reg_operand" "r")))
1070 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1072 "maclhwu %0, %1, %2"
1073 [(set_attr "type" "imul3")])
1075 (define_insn "*nmacchwc"
1076 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1077 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1078 (mult:SI (ashiftrt:SI
1079 (match_operand:SI 2 "gpc_reg_operand" "r")
1082 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1084 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1085 (minus:SI (match_dup 4)
1086 (mult:SI (ashiftrt:SI
1092 "nmacchw. %0, %1, %2"
1093 [(set_attr "type" "imul3")])
1095 (define_insn "*nmacchw"
1096 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1097 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1098 (mult:SI (ashiftrt:SI
1099 (match_operand:SI 2 "gpc_reg_operand" "r")
1102 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1104 "nmacchw %0, %1, %2"
1105 [(set_attr "type" "imul3")])
1107 (define_insn "*nmachhwc"
1108 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1109 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1110 (mult:SI (ashiftrt:SI
1111 (match_operand:SI 1 "gpc_reg_operand" "%r")
1114 (match_operand:SI 2 "gpc_reg_operand" "r")
1117 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1118 (minus:SI (match_dup 4)
1119 (mult:SI (ashiftrt:SI
1126 "nmachhw. %0, %1, %2"
1127 [(set_attr "type" "imul3")])
1129 (define_insn "*nmachhw"
1130 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1131 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1132 (mult:SI (ashiftrt:SI
1133 (match_operand:SI 1 "gpc_reg_operand" "%r")
1136 (match_operand:SI 2 "gpc_reg_operand" "r")
1139 "nmachhw %0, %1, %2"
1140 [(set_attr "type" "imul3")])
1142 (define_insn "*nmaclhwc"
1143 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1144 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1145 (mult:SI (sign_extend:SI
1146 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1148 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1150 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1151 (minus:SI (match_dup 4)
1152 (mult:SI (sign_extend:SI
1157 "nmaclhw. %0, %1, %2"
1158 [(set_attr "type" "imul3")])
1160 (define_insn "*nmaclhw"
1161 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1162 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1163 (mult:SI (sign_extend:SI
1164 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1166 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1168 "nmaclhw %0, %1, %2"
1169 [(set_attr "type" "imul3")])
1171 (define_insn "*mulchwc"
1172 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1173 (compare:CC (mult:SI (ashiftrt:SI
1174 (match_operand:SI 2 "gpc_reg_operand" "r")
1177 (match_operand:HI 1 "gpc_reg_operand" "r")))
1179 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1180 (mult:SI (ashiftrt:SI
1186 "mulchw. %0, %1, %2"
1187 [(set_attr "type" "imul3")])
1189 (define_insn "*mulchw"
1190 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1191 (mult:SI (ashiftrt:SI
1192 (match_operand:SI 2 "gpc_reg_operand" "r")
1195 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1198 [(set_attr "type" "imul3")])
1200 (define_insn "*mulchwuc"
1201 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1202 (compare:CC (mult:SI (lshiftrt:SI
1203 (match_operand:SI 2 "gpc_reg_operand" "r")
1206 (match_operand:HI 1 "gpc_reg_operand" "r")))
1208 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1209 (mult:SI (lshiftrt:SI
1215 "mulchwu. %0, %1, %2"
1216 [(set_attr "type" "imul3")])
1218 (define_insn "*mulchwu"
1219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1220 (mult:SI (lshiftrt:SI
1221 (match_operand:SI 2 "gpc_reg_operand" "r")
1224 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1226 "mulchwu %0, %1, %2"
1227 [(set_attr "type" "imul3")])
1229 (define_insn "*mulhhwc"
1230 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1231 (compare:CC (mult:SI (ashiftrt:SI
1232 (match_operand:SI 1 "gpc_reg_operand" "%r")
1235 (match_operand:SI 2 "gpc_reg_operand" "r")
1238 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1239 (mult:SI (ashiftrt:SI
1246 "mulhhw. %0, %1, %2"
1247 [(set_attr "type" "imul3")])
1249 (define_insn "*mulhhw"
1250 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1251 (mult:SI (ashiftrt:SI
1252 (match_operand:SI 1 "gpc_reg_operand" "%r")
1255 (match_operand:SI 2 "gpc_reg_operand" "r")
1259 [(set_attr "type" "imul3")])
1261 (define_insn "*mulhhwuc"
1262 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1263 (compare:CC (mult:SI (lshiftrt:SI
1264 (match_operand:SI 1 "gpc_reg_operand" "%r")
1267 (match_operand:SI 2 "gpc_reg_operand" "r")
1270 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1271 (mult:SI (lshiftrt:SI
1278 "mulhhwu. %0, %1, %2"
1279 [(set_attr "type" "imul3")])
1281 (define_insn "*mulhhwu"
1282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1283 (mult:SI (lshiftrt:SI
1284 (match_operand:SI 1 "gpc_reg_operand" "%r")
1287 (match_operand:SI 2 "gpc_reg_operand" "r")
1290 "mulhhwu %0, %1, %2"
1291 [(set_attr "type" "imul3")])
1293 (define_insn "*mullhwc"
1294 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1295 (compare:CC (mult:SI (sign_extend:SI
1296 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1298 (match_operand:HI 2 "gpc_reg_operand" "r")))
1300 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1301 (mult:SI (sign_extend:SI
1306 "mullhw. %0, %1, %2"
1307 [(set_attr "type" "imul3")])
1309 (define_insn "*mullhw"
1310 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1311 (mult:SI (sign_extend:SI
1312 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1314 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1317 [(set_attr "type" "imul3")])
1319 (define_insn "*mullhwuc"
1320 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1321 (compare:CC (mult:SI (zero_extend:SI
1322 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1324 (match_operand:HI 2 "gpc_reg_operand" "r")))
1326 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1327 (mult:SI (zero_extend:SI
1332 "mullhwu. %0, %1, %2"
1333 [(set_attr "type" "imul3")])
1335 (define_insn "*mullhwu"
1336 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1337 (mult:SI (zero_extend:SI
1338 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1340 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1342 "mullhwu %0, %1, %2"
1343 [(set_attr "type" "imul3")])
1346 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1347 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1349 (set (match_operand:SI 0 "gpc_reg_operand" "")
1350 (sign_extend:SI (match_dup 1)))]
1353 (sign_extend:SI (match_dup 1)))
1355 (compare:CC (match_dup 0)
1359 ;; Fixed-point arithmetic insns.
1361 (define_expand "add<mode>3"
1362 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1363 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1364 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1368 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1370 if (non_short_cint_operand (operands[2], DImode))
1373 else if (GET_CODE (operands[2]) == CONST_INT
1374 && ! add_operand (operands[2], <MODE>mode))
1376 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1377 ? operands[0] : gen_reg_rtx (<MODE>mode));
1379 HOST_WIDE_INT val = INTVAL (operands[2]);
1380 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1381 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1383 if (<MODE>mode == DImode && !CONST_OK_FOR_LETTER_P (rest, 'L'))
1386 /* The ordering here is important for the prolog expander.
1387 When space is allocated from the stack, adding 'low' first may
1388 produce a temporary deallocation (which would be bad). */
1389 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1390 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1395 ;; Discourage ai/addic because of carry but provide it in an alternative
1396 ;; allowing register zero as source.
1397 (define_insn "*add<mode>3_internal1"
1398 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1399 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1400 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1404 {cal %0,%2(%1)|addi %0,%1,%2}
1406 {cau|addis} %0,%1,%v2"
1407 [(set_attr "length" "4,4,4,4")])
1409 (define_insn "addsi3_high"
1410 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1411 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1412 (high:SI (match_operand 2 "" ""))))]
1413 "TARGET_MACHO && !TARGET_64BIT"
1414 "{cau|addis} %0,%1,ha16(%2)"
1415 [(set_attr "length" "4")])
1417 (define_insn "*add<mode>3_internal2"
1418 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1419 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1420 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1422 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1425 {cax.|add.} %3,%1,%2
1426 {ai.|addic.} %3,%1,%2
1429 [(set_attr "type" "fast_compare,compare,compare,compare")
1430 (set_attr "length" "4,4,8,8")])
1433 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1434 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1435 (match_operand:GPR 2 "reg_or_short_operand" ""))
1437 (clobber (match_scratch:GPR 3 ""))]
1440 (plus:GPR (match_dup 1)
1443 (compare:CC (match_dup 3)
1447 (define_insn "*add<mode>3_internal3"
1448 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1449 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1450 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1452 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1453 (plus:P (match_dup 1)
1457 {cax.|add.} %0,%1,%2
1458 {ai.|addic.} %0,%1,%2
1461 [(set_attr "type" "fast_compare,compare,compare,compare")
1462 (set_attr "length" "4,4,8,8")])
1465 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1466 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1467 (match_operand:P 2 "reg_or_short_operand" ""))
1469 (set (match_operand:P 0 "gpc_reg_operand" "")
1470 (plus:P (match_dup 1) (match_dup 2)))]
1473 (plus:P (match_dup 1)
1476 (compare:CC (match_dup 0)
1480 ;; Split an add that we can't do in one insn into two insns, each of which
1481 ;; does one 16-bit part. This is used by combine. Note that the low-order
1482 ;; add should be last in case the result gets used in an address.
1485 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1486 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1487 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1489 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1490 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1493 HOST_WIDE_INT val = INTVAL (operands[2]);
1494 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1495 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1497 operands[4] = GEN_INT (low);
1498 if (<MODE>mode == SImode || CONST_OK_FOR_LETTER_P (rest, 'L'))
1499 operands[3] = GEN_INT (rest);
1500 else if (! no_new_pseudos)
1502 operands[3] = gen_reg_rtx (DImode);
1503 emit_move_insn (operands[3], operands[2]);
1504 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1511 (define_insn "one_cmpl<mode>2"
1512 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1513 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1518 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1519 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1521 (clobber (match_scratch:P 2 "=r,r"))]
1526 [(set_attr "type" "compare")
1527 (set_attr "length" "4,8")])
1530 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1531 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1533 (clobber (match_scratch:P 2 ""))]
1536 (not:P (match_dup 1)))
1538 (compare:CC (match_dup 2)
1543 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1544 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1546 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1547 (not:P (match_dup 1)))]
1552 [(set_attr "type" "compare")
1553 (set_attr "length" "4,8")])
1556 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1557 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1559 (set (match_operand:P 0 "gpc_reg_operand" "")
1560 (not:P (match_dup 1)))]
1563 (not:P (match_dup 1)))
1565 (compare:CC (match_dup 0)
1570 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1571 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1572 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1574 "{sf%I1|subf%I1c} %0,%2,%1")
1577 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1578 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1579 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1586 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1587 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1588 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1590 (clobber (match_scratch:SI 3 "=r,r"))]
1593 {sf.|subfc.} %3,%2,%1
1595 [(set_attr "type" "compare")
1596 (set_attr "length" "4,8")])
1599 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1600 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1601 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1603 (clobber (match_scratch:P 3 "=r,r"))]
1608 [(set_attr "type" "fast_compare")
1609 (set_attr "length" "4,8")])
1612 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1613 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1614 (match_operand:P 2 "gpc_reg_operand" ""))
1616 (clobber (match_scratch:P 3 ""))]
1619 (minus:P (match_dup 1)
1622 (compare:CC (match_dup 3)
1627 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1628 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1629 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1631 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1632 (minus:SI (match_dup 1) (match_dup 2)))]
1635 {sf.|subfc.} %0,%2,%1
1637 [(set_attr "type" "compare")
1638 (set_attr "length" "4,8")])
1641 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1642 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1643 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1645 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1646 (minus:P (match_dup 1)
1652 [(set_attr "type" "fast_compare")
1653 (set_attr "length" "4,8")])
1656 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1657 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1658 (match_operand:P 2 "gpc_reg_operand" ""))
1660 (set (match_operand:P 0 "gpc_reg_operand" "")
1661 (minus:P (match_dup 1)
1665 (minus:P (match_dup 1)
1668 (compare:CC (match_dup 0)
1672 (define_expand "sub<mode>3"
1673 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1674 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1675 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1679 if (GET_CODE (operands[2]) == CONST_INT)
1681 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1682 negate_rtx (<MODE>mode, operands[2])));
1687 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1688 ;; instruction and some auxiliary computations. Then we just have a single
1689 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1692 (define_expand "sminsi3"
1694 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1695 (match_operand:SI 2 "reg_or_short_operand" ""))
1697 (minus:SI (match_dup 2) (match_dup 1))))
1698 (set (match_operand:SI 0 "gpc_reg_operand" "")
1699 (minus:SI (match_dup 2) (match_dup 3)))]
1700 "TARGET_POWER || TARGET_ISEL"
1705 operands[2] = force_reg (SImode, operands[2]);
1706 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1710 operands[3] = gen_reg_rtx (SImode);
1714 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1715 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1716 (match_operand:SI 2 "reg_or_short_operand" "")))
1717 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1720 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1722 (minus:SI (match_dup 2) (match_dup 1))))
1723 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1726 (define_expand "smaxsi3"
1728 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1729 (match_operand:SI 2 "reg_or_short_operand" ""))
1731 (minus:SI (match_dup 2) (match_dup 1))))
1732 (set (match_operand:SI 0 "gpc_reg_operand" "")
1733 (plus:SI (match_dup 3) (match_dup 1)))]
1734 "TARGET_POWER || TARGET_ISEL"
1739 operands[2] = force_reg (SImode, operands[2]);
1740 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1743 operands[3] = gen_reg_rtx (SImode);
1747 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1748 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1749 (match_operand:SI 2 "reg_or_short_operand" "")))
1750 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1753 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1755 (minus:SI (match_dup 2) (match_dup 1))))
1756 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1759 (define_expand "uminsi3"
1760 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1762 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1764 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1766 (minus:SI (match_dup 4) (match_dup 3))))
1767 (set (match_operand:SI 0 "gpc_reg_operand" "")
1768 (minus:SI (match_dup 2) (match_dup 3)))]
1769 "TARGET_POWER || TARGET_ISEL"
1774 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1777 operands[3] = gen_reg_rtx (SImode);
1778 operands[4] = gen_reg_rtx (SImode);
1779 operands[5] = GEN_INT (-2147483647 - 1);
1782 (define_expand "umaxsi3"
1783 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1785 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1787 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1789 (minus:SI (match_dup 4) (match_dup 3))))
1790 (set (match_operand:SI 0 "gpc_reg_operand" "")
1791 (plus:SI (match_dup 3) (match_dup 1)))]
1792 "TARGET_POWER || TARGET_ISEL"
1797 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1800 operands[3] = gen_reg_rtx (SImode);
1801 operands[4] = gen_reg_rtx (SImode);
1802 operands[5] = GEN_INT (-2147483647 - 1);
1806 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1807 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1808 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1810 (minus:SI (match_dup 2) (match_dup 1))))]
1815 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1817 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1818 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1820 (minus:SI (match_dup 2) (match_dup 1)))
1822 (clobber (match_scratch:SI 3 "=r,r"))]
1827 [(set_attr "type" "delayed_compare")
1828 (set_attr "length" "4,8")])
1831 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1833 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1834 (match_operand:SI 2 "reg_or_short_operand" ""))
1836 (minus:SI (match_dup 2) (match_dup 1)))
1838 (clobber (match_scratch:SI 3 ""))]
1839 "TARGET_POWER && reload_completed"
1841 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1843 (minus:SI (match_dup 2) (match_dup 1))))
1845 (compare:CC (match_dup 3)
1850 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1852 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1853 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1855 (minus:SI (match_dup 2) (match_dup 1)))
1857 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1858 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1860 (minus:SI (match_dup 2) (match_dup 1))))]
1865 [(set_attr "type" "delayed_compare")
1866 (set_attr "length" "4,8")])
1869 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1871 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1872 (match_operand:SI 2 "reg_or_short_operand" ""))
1874 (minus:SI (match_dup 2) (match_dup 1)))
1876 (set (match_operand:SI 0 "gpc_reg_operand" "")
1877 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1879 (minus:SI (match_dup 2) (match_dup 1))))]
1880 "TARGET_POWER && reload_completed"
1882 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1884 (minus:SI (match_dup 2) (match_dup 1))))
1886 (compare:CC (match_dup 0)
1890 ;; We don't need abs with condition code because such comparisons should
1892 (define_expand "abssi2"
1893 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1894 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1900 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1903 else if (! TARGET_POWER)
1905 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1910 (define_insn "*abssi2_power"
1911 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1912 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1916 (define_insn_and_split "abssi2_isel"
1917 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1918 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1919 (clobber (match_scratch:SI 2 "=&b"))
1920 (clobber (match_scratch:CC 3 "=y"))]
1923 "&& reload_completed"
1924 [(set (match_dup 2) (neg:SI (match_dup 1)))
1926 (compare:CC (match_dup 1)
1929 (if_then_else:SI (ge (match_dup 3)
1935 (define_insn_and_split "abssi2_nopower"
1936 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1937 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1938 (clobber (match_scratch:SI 2 "=&r,&r"))]
1939 "! TARGET_POWER && ! TARGET_ISEL"
1941 "&& reload_completed"
1942 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1943 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1944 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1947 (define_insn "*nabs_power"
1948 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1949 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1953 (define_insn_and_split "*nabs_nopower"
1954 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1955 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1956 (clobber (match_scratch:SI 2 "=&r,&r"))]
1959 "&& reload_completed"
1960 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1961 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1962 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1965 (define_expand "neg<mode>2"
1966 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1967 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1971 (define_insn "*neg<mode>2_internal"
1972 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1973 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1978 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1979 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1981 (clobber (match_scratch:P 2 "=r,r"))]
1986 [(set_attr "type" "fast_compare")
1987 (set_attr "length" "4,8")])
1990 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1991 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1993 (clobber (match_scratch:P 2 ""))]
1996 (neg:P (match_dup 1)))
1998 (compare:CC (match_dup 2)
2003 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2004 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2006 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2007 (neg:P (match_dup 1)))]
2012 [(set_attr "type" "fast_compare")
2013 (set_attr "length" "4,8")])
2016 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2017 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2019 (set (match_operand:P 0 "gpc_reg_operand" "")
2020 (neg:P (match_dup 1)))]
2023 (neg:P (match_dup 1)))
2025 (compare:CC (match_dup 0)
2029 (define_insn "clz<mode>2"
2030 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2031 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2033 "{cntlz|cntlz<wd>} %0,%1")
2035 (define_expand "ctz<mode>2"
2037 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2038 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2040 (clobber (scratch:CC))])
2041 (set (match_dup 4) (clz:GPR (match_dup 3)))
2042 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2043 (minus:GPR (match_dup 5) (match_dup 4)))]
2046 operands[2] = gen_reg_rtx (<MODE>mode);
2047 operands[3] = gen_reg_rtx (<MODE>mode);
2048 operands[4] = gen_reg_rtx (<MODE>mode);
2049 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2052 (define_expand "ffs<mode>2"
2054 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2055 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2057 (clobber (scratch:CC))])
2058 (set (match_dup 4) (clz:GPR (match_dup 3)))
2059 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2060 (minus:GPR (match_dup 5) (match_dup 4)))]
2063 operands[2] = gen_reg_rtx (<MODE>mode);
2064 operands[3] = gen_reg_rtx (<MODE>mode);
2065 operands[4] = gen_reg_rtx (<MODE>mode);
2066 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2069 (define_expand "popcount<mode>2"
2071 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2074 (mult:GPR (match_dup 2) (match_dup 4)))
2075 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2076 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
2079 operands[2] = gen_reg_rtx (<MODE>mode);
2080 operands[3] = gen_reg_rtx (<MODE>mode);
2081 operands[4] = force_reg (<MODE>mode,
2082 <MODE>mode == SImode
2083 ? GEN_INT (0x01010101)
2084 : GEN_INT ((HOST_WIDE_INT)
2085 0x01010101 << 32 | 0x01010101));
2086 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 8);
2089 (define_insn "popcntb<mode>2"
2090 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2091 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2096 (define_expand "mulsi3"
2097 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2098 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2099 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2104 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2106 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2110 (define_insn "mulsi3_mq"
2111 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2112 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2113 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2114 (clobber (match_scratch:SI 3 "=q,q"))]
2117 {muls|mullw} %0,%1,%2
2118 {muli|mulli} %0,%1,%2"
2120 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2121 (const_string "imul3")
2122 (match_operand:SI 2 "short_cint_operand" "")
2123 (const_string "imul2")]
2124 (const_string "imul")))])
2126 (define_insn "mulsi3_no_mq"
2127 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2128 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2129 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2132 {muls|mullw} %0,%1,%2
2133 {muli|mulli} %0,%1,%2"
2135 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2136 (const_string "imul3")
2137 (match_operand:SI 2 "short_cint_operand" "")
2138 (const_string "imul2")]
2139 (const_string "imul")))])
2141 (define_insn "*mulsi3_mq_internal1"
2142 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2143 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2144 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2146 (clobber (match_scratch:SI 3 "=r,r"))
2147 (clobber (match_scratch:SI 4 "=q,q"))]
2150 {muls.|mullw.} %3,%1,%2
2152 [(set_attr "type" "imul_compare")
2153 (set_attr "length" "4,8")])
2156 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2157 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2158 (match_operand:SI 2 "gpc_reg_operand" ""))
2160 (clobber (match_scratch:SI 3 ""))
2161 (clobber (match_scratch:SI 4 ""))]
2162 "TARGET_POWER && reload_completed"
2163 [(parallel [(set (match_dup 3)
2164 (mult:SI (match_dup 1) (match_dup 2)))
2165 (clobber (match_dup 4))])
2167 (compare:CC (match_dup 3)
2171 (define_insn "*mulsi3_no_mq_internal1"
2172 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2173 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2174 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2176 (clobber (match_scratch:SI 3 "=r,r"))]
2179 {muls.|mullw.} %3,%1,%2
2181 [(set_attr "type" "imul_compare")
2182 (set_attr "length" "4,8")])
2185 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2186 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2187 (match_operand:SI 2 "gpc_reg_operand" ""))
2189 (clobber (match_scratch:SI 3 ""))]
2190 "! TARGET_POWER && reload_completed"
2192 (mult:SI (match_dup 1) (match_dup 2)))
2194 (compare:CC (match_dup 3)
2198 (define_insn "*mulsi3_mq_internal2"
2199 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2200 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2201 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2203 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2204 (mult:SI (match_dup 1) (match_dup 2)))
2205 (clobber (match_scratch:SI 4 "=q,q"))]
2208 {muls.|mullw.} %0,%1,%2
2210 [(set_attr "type" "imul_compare")
2211 (set_attr "length" "4,8")])
2214 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2215 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2216 (match_operand:SI 2 "gpc_reg_operand" ""))
2218 (set (match_operand:SI 0 "gpc_reg_operand" "")
2219 (mult:SI (match_dup 1) (match_dup 2)))
2220 (clobber (match_scratch:SI 4 ""))]
2221 "TARGET_POWER && reload_completed"
2222 [(parallel [(set (match_dup 0)
2223 (mult:SI (match_dup 1) (match_dup 2)))
2224 (clobber (match_dup 4))])
2226 (compare:CC (match_dup 0)
2230 (define_insn "*mulsi3_no_mq_internal2"
2231 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2232 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2233 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2235 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2236 (mult:SI (match_dup 1) (match_dup 2)))]
2239 {muls.|mullw.} %0,%1,%2
2241 [(set_attr "type" "imul_compare")
2242 (set_attr "length" "4,8")])
2245 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2246 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2247 (match_operand:SI 2 "gpc_reg_operand" ""))
2249 (set (match_operand:SI 0 "gpc_reg_operand" "")
2250 (mult:SI (match_dup 1) (match_dup 2)))]
2251 "! TARGET_POWER && reload_completed"
2253 (mult:SI (match_dup 1) (match_dup 2)))
2255 (compare:CC (match_dup 0)
2259 ;; Operand 1 is divided by operand 2; quotient goes to operand
2260 ;; 0 and remainder to operand 3.
2261 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2263 (define_expand "divmodsi4"
2264 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2265 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2266 (match_operand:SI 2 "gpc_reg_operand" "")))
2267 (set (match_operand:SI 3 "register_operand" "")
2268 (mod:SI (match_dup 1) (match_dup 2)))])]
2269 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2272 if (! TARGET_POWER && ! TARGET_POWERPC)
2274 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2275 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2276 emit_insn (gen_divss_call ());
2277 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2278 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2283 (define_insn "*divmodsi4_internal"
2284 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2285 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2286 (match_operand:SI 2 "gpc_reg_operand" "r")))
2287 (set (match_operand:SI 3 "register_operand" "=q")
2288 (mod:SI (match_dup 1) (match_dup 2)))]
2291 [(set_attr "type" "idiv")])
2293 (define_expand "udiv<mode>3"
2294 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2295 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2296 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2297 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2300 if (! TARGET_POWER && ! TARGET_POWERPC)
2302 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2303 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2304 emit_insn (gen_quous_call ());
2305 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2308 else if (TARGET_POWER)
2310 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2315 (define_insn "udivsi3_mq"
2316 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2317 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2318 (match_operand:SI 2 "gpc_reg_operand" "r")))
2319 (clobber (match_scratch:SI 3 "=q"))]
2320 "TARGET_POWERPC && TARGET_POWER"
2322 [(set_attr "type" "idiv")])
2324 (define_insn "*udivsi3_no_mq"
2325 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2326 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2327 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2328 "TARGET_POWERPC && ! TARGET_POWER"
2330 [(set_attr "type" "idiv")])
2332 ;; For powers of two we can do srai/aze for divide and then adjust for
2333 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2334 ;; used; for PowerPC, force operands into register and do a normal divide;
2335 ;; for AIX common-mode, use quoss call on register operands.
2336 (define_expand "div<mode>3"
2337 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2338 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2339 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2343 if (GET_CODE (operands[2]) == CONST_INT
2344 && INTVAL (operands[2]) > 0
2345 && exact_log2 (INTVAL (operands[2])) >= 0)
2347 else if (TARGET_POWERPC)
2349 operands[2] = force_reg (SImode, operands[2]);
2352 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2356 else if (TARGET_POWER)
2360 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2361 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2362 emit_insn (gen_quoss_call ());
2363 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2368 (define_insn "divsi3_mq"
2369 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2370 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2371 (match_operand:SI 2 "gpc_reg_operand" "r")))
2372 (clobber (match_scratch:SI 3 "=q"))]
2373 "TARGET_POWERPC && TARGET_POWER"
2375 [(set_attr "type" "idiv")])
2377 (define_insn "*div<mode>3_no_mq"
2378 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2379 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2380 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2381 "TARGET_POWERPC && ! TARGET_POWER"
2383 [(set_attr "type" "idiv")])
2385 (define_expand "mod<mode>3"
2386 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2387 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2388 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2396 if (GET_CODE (operands[2]) != CONST_INT
2397 || INTVAL (operands[2]) <= 0
2398 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2401 temp1 = gen_reg_rtx (<MODE>mode);
2402 temp2 = gen_reg_rtx (<MODE>mode);
2404 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2405 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2406 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2411 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2412 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2413 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2415 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2416 [(set_attr "type" "two")
2417 (set_attr "length" "8")])
2420 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2421 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2422 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2424 (clobber (match_scratch:P 3 "=r,r"))]
2427 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2429 [(set_attr "type" "compare")
2430 (set_attr "length" "8,12")])
2433 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2434 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2435 (match_operand:GPR 2 "exact_log2_cint_operand"
2438 (clobber (match_scratch:GPR 3 ""))]
2441 (div:<MODE> (match_dup 1) (match_dup 2)))
2443 (compare:CC (match_dup 3)
2448 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2449 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2450 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2452 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2453 (div:P (match_dup 1) (match_dup 2)))]
2456 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2458 [(set_attr "type" "compare")
2459 (set_attr "length" "8,12")])
2462 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2463 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2464 (match_operand:GPR 2 "exact_log2_cint_operand"
2467 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2468 (div:GPR (match_dup 1) (match_dup 2)))]
2471 (div:<MODE> (match_dup 1) (match_dup 2)))
2473 (compare:CC (match_dup 0)
2478 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2481 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2483 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2484 (match_operand:SI 3 "gpc_reg_operand" "r")))
2485 (set (match_operand:SI 2 "register_operand" "=*q")
2488 (zero_extend:DI (match_dup 1)) (const_int 32))
2489 (zero_extend:DI (match_dup 4)))
2493 [(set_attr "type" "idiv")])
2495 ;; To do unsigned divide we handle the cases of the divisor looking like a
2496 ;; negative number. If it is a constant that is less than 2**31, we don't
2497 ;; have to worry about the branches. So make a few subroutines here.
2499 ;; First comes the normal case.
2500 (define_expand "udivmodsi4_normal"
2501 [(set (match_dup 4) (const_int 0))
2502 (parallel [(set (match_operand:SI 0 "" "")
2503 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2505 (zero_extend:DI (match_operand:SI 1 "" "")))
2506 (match_operand:SI 2 "" "")))
2507 (set (match_operand:SI 3 "" "")
2508 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2510 (zero_extend:DI (match_dup 1)))
2514 { operands[4] = gen_reg_rtx (SImode); }")
2516 ;; This handles the branches.
2517 (define_expand "udivmodsi4_tests"
2518 [(set (match_operand:SI 0 "" "") (const_int 0))
2519 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2520 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2521 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2522 (label_ref (match_operand:SI 4 "" "")) (pc)))
2523 (set (match_dup 0) (const_int 1))
2524 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2525 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2526 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2527 (label_ref (match_dup 4)) (pc)))]
2530 { operands[5] = gen_reg_rtx (CCUNSmode);
2531 operands[6] = gen_reg_rtx (CCmode);
2534 (define_expand "udivmodsi4"
2535 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2536 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2537 (match_operand:SI 2 "reg_or_cint_operand" "")))
2538 (set (match_operand:SI 3 "gpc_reg_operand" "")
2539 (umod:SI (match_dup 1) (match_dup 2)))])]
2547 if (! TARGET_POWERPC)
2549 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2550 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2551 emit_insn (gen_divus_call ());
2552 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2553 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2560 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2562 operands[2] = force_reg (SImode, operands[2]);
2563 label = gen_label_rtx ();
2564 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2565 operands[3], label));
2568 operands[2] = force_reg (SImode, operands[2]);
2570 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2578 ;; AIX architecture-independent common-mode multiply (DImode),
2579 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2580 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2581 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2582 ;; assumed unused if generating common-mode, so ignore.
2583 (define_insn "mulh_call"
2586 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2587 (sign_extend:DI (reg:SI 4)))
2589 (clobber (match_scratch:SI 0 "=l"))]
2590 "! TARGET_POWER && ! TARGET_POWERPC"
2592 [(set_attr "type" "imul")])
2594 (define_insn "mull_call"
2596 (mult:DI (sign_extend:DI (reg:SI 3))
2597 (sign_extend:DI (reg:SI 4))))
2598 (clobber (match_scratch:SI 0 "=l"))
2599 (clobber (reg:SI 0))]
2600 "! TARGET_POWER && ! TARGET_POWERPC"
2602 [(set_attr "type" "imul")])
2604 (define_insn "divss_call"
2606 (div:SI (reg:SI 3) (reg:SI 4)))
2608 (mod:SI (reg:SI 3) (reg:SI 4)))
2609 (clobber (match_scratch:SI 0 "=l"))
2610 (clobber (reg:SI 0))]
2611 "! TARGET_POWER && ! TARGET_POWERPC"
2613 [(set_attr "type" "idiv")])
2615 (define_insn "divus_call"
2617 (udiv:SI (reg:SI 3) (reg:SI 4)))
2619 (umod:SI (reg:SI 3) (reg:SI 4)))
2620 (clobber (match_scratch:SI 0 "=l"))
2621 (clobber (reg:SI 0))
2622 (clobber (match_scratch:CC 1 "=x"))
2623 (clobber (reg:CC 69))]
2624 "! TARGET_POWER && ! TARGET_POWERPC"
2626 [(set_attr "type" "idiv")])
2628 (define_insn "quoss_call"
2630 (div:SI (reg:SI 3) (reg:SI 4)))
2631 (clobber (match_scratch:SI 0 "=l"))]
2632 "! TARGET_POWER && ! TARGET_POWERPC"
2634 [(set_attr "type" "idiv")])
2636 (define_insn "quous_call"
2638 (udiv:SI (reg:SI 3) (reg:SI 4)))
2639 (clobber (match_scratch:SI 0 "=l"))
2640 (clobber (reg:SI 0))
2641 (clobber (match_scratch:CC 1 "=x"))
2642 (clobber (reg:CC 69))]
2643 "! TARGET_POWER && ! TARGET_POWERPC"
2645 [(set_attr "type" "idiv")])
2647 ;; Logical instructions
2648 ;; The logical instructions are mostly combined by using match_operator,
2649 ;; but the plain AND insns are somewhat different because there is no
2650 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2651 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2653 (define_insn "andsi3"
2654 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2655 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2656 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2657 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2661 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2662 {andil.|andi.} %0,%1,%b2
2663 {andiu.|andis.} %0,%1,%u2"
2664 [(set_attr "type" "*,*,compare,compare")])
2666 ;; Note to set cr's other than cr0 we do the and immediate and then
2667 ;; the test again -- this avoids a mfcr which on the higher end
2668 ;; machines causes an execution serialization
2670 (define_insn "*andsi3_internal2"
2671 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2672 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2673 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2675 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2676 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2680 {andil.|andi.} %3,%1,%b2
2681 {andiu.|andis.} %3,%1,%u2
2682 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2687 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2688 (set_attr "length" "4,4,4,4,8,8,8,8")])
2690 (define_insn "*andsi3_internal3"
2691 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2692 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2693 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2695 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2696 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2700 {andil.|andi.} %3,%1,%b2
2701 {andiu.|andis.} %3,%1,%u2
2702 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2707 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2708 (set_attr "length" "8,4,4,4,8,8,8,8")])
2711 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2712 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2713 (match_operand:GPR 2 "and_operand" ""))
2715 (clobber (match_scratch:GPR 3 ""))
2716 (clobber (match_scratch:CC 4 ""))]
2718 [(parallel [(set (match_dup 3)
2719 (and:<MODE> (match_dup 1)
2721 (clobber (match_dup 4))])
2723 (compare:CC (match_dup 3)
2727 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2728 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2731 [(set (match_operand:CC 0 "cc_reg_operand" "")
2732 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2733 (match_operand:SI 2 "gpc_reg_operand" ""))
2735 (clobber (match_scratch:SI 3 ""))
2736 (clobber (match_scratch:CC 4 ""))]
2737 "TARGET_POWERPC64 && reload_completed"
2738 [(parallel [(set (match_dup 3)
2739 (and:SI (match_dup 1)
2741 (clobber (match_dup 4))])
2743 (compare:CC (match_dup 3)
2747 (define_insn "*andsi3_internal4"
2748 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2749 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2750 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2752 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2753 (and:SI (match_dup 1)
2755 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2759 {andil.|andi.} %0,%1,%b2
2760 {andiu.|andis.} %0,%1,%u2
2761 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2766 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2767 (set_attr "length" "4,4,4,4,8,8,8,8")])
2769 (define_insn "*andsi3_internal5"
2770 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2771 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2772 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2774 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2775 (and:SI (match_dup 1)
2777 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2781 {andil.|andi.} %0,%1,%b2
2782 {andiu.|andis.} %0,%1,%u2
2783 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2788 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2789 (set_attr "length" "8,4,4,4,8,8,8,8")])
2792 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2793 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2794 (match_operand:SI 2 "and_operand" ""))
2796 (set (match_operand:SI 0 "gpc_reg_operand" "")
2797 (and:SI (match_dup 1)
2799 (clobber (match_scratch:CC 4 ""))]
2801 [(parallel [(set (match_dup 0)
2802 (and:SI (match_dup 1)
2804 (clobber (match_dup 4))])
2806 (compare:CC (match_dup 0)
2811 [(set (match_operand:CC 3 "cc_reg_operand" "")
2812 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2813 (match_operand:SI 2 "gpc_reg_operand" ""))
2815 (set (match_operand:SI 0 "gpc_reg_operand" "")
2816 (and:SI (match_dup 1)
2818 (clobber (match_scratch:CC 4 ""))]
2819 "TARGET_POWERPC64 && reload_completed"
2820 [(parallel [(set (match_dup 0)
2821 (and:SI (match_dup 1)
2823 (clobber (match_dup 4))])
2825 (compare:CC (match_dup 0)
2829 ;; Handle the PowerPC64 rlwinm corner case
2831 (define_insn_and_split "*andsi3_internal6"
2832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2833 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2834 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2839 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2842 (rotate:SI (match_dup 0) (match_dup 5)))]
2845 int mb = extract_MB (operands[2]);
2846 int me = extract_ME (operands[2]);
2847 operands[3] = GEN_INT (me + 1);
2848 operands[5] = GEN_INT (32 - (me + 1));
2849 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2851 [(set_attr "length" "8")])
2853 (define_expand "iorsi3"
2854 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2855 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2856 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2860 if (GET_CODE (operands[2]) == CONST_INT
2861 && ! logical_operand (operands[2], SImode))
2863 HOST_WIDE_INT value = INTVAL (operands[2]);
2864 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2865 ? operands[0] : gen_reg_rtx (SImode));
2867 emit_insn (gen_iorsi3 (tmp, operands[1],
2868 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2869 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2874 (define_expand "xorsi3"
2875 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2876 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2877 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2881 if (GET_CODE (operands[2]) == CONST_INT
2882 && ! logical_operand (operands[2], SImode))
2884 HOST_WIDE_INT value = INTVAL (operands[2]);
2885 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2886 ? operands[0] : gen_reg_rtx (SImode));
2888 emit_insn (gen_xorsi3 (tmp, operands[1],
2889 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2890 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2895 (define_insn "*boolsi3_internal1"
2896 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2897 (match_operator:SI 3 "boolean_or_operator"
2898 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2899 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2903 {%q3il|%q3i} %0,%1,%b2
2904 {%q3iu|%q3is} %0,%1,%u2")
2906 (define_insn "*boolsi3_internal2"
2907 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2908 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2909 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2910 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2912 (clobber (match_scratch:SI 3 "=r,r"))]
2917 [(set_attr "type" "compare")
2918 (set_attr "length" "4,8")])
2921 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2922 (compare:CC (match_operator:SI 4 "boolean_operator"
2923 [(match_operand:SI 1 "gpc_reg_operand" "")
2924 (match_operand:SI 2 "gpc_reg_operand" "")])
2926 (clobber (match_scratch:SI 3 ""))]
2927 "TARGET_32BIT && reload_completed"
2928 [(set (match_dup 3) (match_dup 4))
2930 (compare:CC (match_dup 3)
2934 (define_insn "*boolsi3_internal3"
2935 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2936 (compare:CC (match_operator:SI 4 "boolean_operator"
2937 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2938 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2940 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2946 [(set_attr "type" "compare")
2947 (set_attr "length" "4,8")])
2950 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2951 (compare:CC (match_operator:SI 4 "boolean_operator"
2952 [(match_operand:SI 1 "gpc_reg_operand" "")
2953 (match_operand:SI 2 "gpc_reg_operand" "")])
2955 (set (match_operand:SI 0 "gpc_reg_operand" "")
2957 "TARGET_32BIT && reload_completed"
2958 [(set (match_dup 0) (match_dup 4))
2960 (compare:CC (match_dup 0)
2964 ;; Split a logical operation that we can't do in one insn into two insns,
2965 ;; each of which does one 16-bit part. This is used by combine.
2968 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2969 (match_operator:SI 3 "boolean_or_operator"
2970 [(match_operand:SI 1 "gpc_reg_operand" "")
2971 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2973 [(set (match_dup 0) (match_dup 4))
2974 (set (match_dup 0) (match_dup 5))]
2978 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2979 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2981 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2982 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2986 (define_insn "*boolcsi3_internal1"
2987 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2988 (match_operator:SI 3 "boolean_operator"
2989 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2990 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2994 (define_insn "*boolcsi3_internal2"
2995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2996 (compare:CC (match_operator:SI 4 "boolean_operator"
2997 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2998 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3000 (clobber (match_scratch:SI 3 "=r,r"))]
3005 [(set_attr "type" "compare")
3006 (set_attr "length" "4,8")])
3009 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3010 (compare:CC (match_operator:SI 4 "boolean_operator"
3011 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3012 (match_operand:SI 2 "gpc_reg_operand" "")])
3014 (clobber (match_scratch:SI 3 ""))]
3015 "TARGET_32BIT && reload_completed"
3016 [(set (match_dup 3) (match_dup 4))
3018 (compare:CC (match_dup 3)
3022 (define_insn "*boolcsi3_internal3"
3023 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3024 (compare:CC (match_operator:SI 4 "boolean_operator"
3025 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3026 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3028 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3034 [(set_attr "type" "compare")
3035 (set_attr "length" "4,8")])
3038 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3039 (compare:CC (match_operator:SI 4 "boolean_operator"
3040 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3041 (match_operand:SI 2 "gpc_reg_operand" "")])
3043 (set (match_operand:SI 0 "gpc_reg_operand" "")
3045 "TARGET_32BIT && reload_completed"
3046 [(set (match_dup 0) (match_dup 4))
3048 (compare:CC (match_dup 0)
3052 (define_insn "*boolccsi3_internal1"
3053 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3054 (match_operator:SI 3 "boolean_operator"
3055 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3056 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3060 (define_insn "*boolccsi3_internal2"
3061 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3062 (compare:CC (match_operator:SI 4 "boolean_operator"
3063 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3064 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3066 (clobber (match_scratch:SI 3 "=r,r"))]
3071 [(set_attr "type" "compare")
3072 (set_attr "length" "4,8")])
3075 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3076 (compare:CC (match_operator:SI 4 "boolean_operator"
3077 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3078 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3080 (clobber (match_scratch:SI 3 ""))]
3081 "TARGET_32BIT && reload_completed"
3082 [(set (match_dup 3) (match_dup 4))
3084 (compare:CC (match_dup 3)
3088 (define_insn "*boolccsi3_internal3"
3089 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3090 (compare:CC (match_operator:SI 4 "boolean_operator"
3091 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3092 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3094 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3100 [(set_attr "type" "compare")
3101 (set_attr "length" "4,8")])
3104 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3105 (compare:CC (match_operator:SI 4 "boolean_operator"
3106 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3107 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3109 (set (match_operand:SI 0 "gpc_reg_operand" "")
3111 "TARGET_32BIT && reload_completed"
3112 [(set (match_dup 0) (match_dup 4))
3114 (compare:CC (match_dup 0)
3118 ;; maskir insn. We need four forms because things might be in arbitrary
3119 ;; orders. Don't define forms that only set CR fields because these
3120 ;; would modify an input register.
3122 (define_insn "*maskir_internal1"
3123 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3124 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3125 (match_operand:SI 1 "gpc_reg_operand" "0"))
3126 (and:SI (match_dup 2)
3127 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3131 (define_insn "*maskir_internal2"
3132 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3133 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3134 (match_operand:SI 1 "gpc_reg_operand" "0"))
3135 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3140 (define_insn "*maskir_internal3"
3141 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3142 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3143 (match_operand:SI 3 "gpc_reg_operand" "r"))
3144 (and:SI (not:SI (match_dup 2))
3145 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3149 (define_insn "*maskir_internal4"
3150 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3151 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3152 (match_operand:SI 2 "gpc_reg_operand" "r"))
3153 (and:SI (not:SI (match_dup 2))
3154 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3158 (define_insn "*maskir_internal5"
3159 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3161 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3162 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3163 (and:SI (match_dup 2)
3164 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3166 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3167 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3168 (and:SI (match_dup 2) (match_dup 3))))]
3173 [(set_attr "type" "compare")
3174 (set_attr "length" "4,8")])
3177 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3179 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3180 (match_operand:SI 1 "gpc_reg_operand" ""))
3181 (and:SI (match_dup 2)
3182 (match_operand:SI 3 "gpc_reg_operand" "")))
3184 (set (match_operand:SI 0 "gpc_reg_operand" "")
3185 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3186 (and:SI (match_dup 2) (match_dup 3))))]
3187 "TARGET_POWER && reload_completed"
3189 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3190 (and:SI (match_dup 2) (match_dup 3))))
3192 (compare:CC (match_dup 0)
3196 (define_insn "*maskir_internal6"
3197 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3199 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3200 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3201 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3204 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3205 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3206 (and:SI (match_dup 3) (match_dup 2))))]
3211 [(set_attr "type" "compare")
3212 (set_attr "length" "4,8")])
3215 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3217 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3218 (match_operand:SI 1 "gpc_reg_operand" ""))
3219 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3222 (set (match_operand:SI 0 "gpc_reg_operand" "")
3223 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3224 (and:SI (match_dup 3) (match_dup 2))))]
3225 "TARGET_POWER && reload_completed"
3227 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3228 (and:SI (match_dup 3) (match_dup 2))))
3230 (compare:CC (match_dup 0)
3234 (define_insn "*maskir_internal7"
3235 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3237 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3238 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3239 (and:SI (not:SI (match_dup 2))
3240 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3242 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3243 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3244 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3249 [(set_attr "type" "compare")
3250 (set_attr "length" "4,8")])
3253 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3255 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3256 (match_operand:SI 3 "gpc_reg_operand" ""))
3257 (and:SI (not:SI (match_dup 2))
3258 (match_operand:SI 1 "gpc_reg_operand" "")))
3260 (set (match_operand:SI 0 "gpc_reg_operand" "")
3261 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3262 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3263 "TARGET_POWER && reload_completed"
3265 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3266 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3268 (compare:CC (match_dup 0)
3272 (define_insn "*maskir_internal8"
3273 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3275 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3276 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3277 (and:SI (not:SI (match_dup 2))
3278 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3280 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3281 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3282 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3287 [(set_attr "type" "compare")
3288 (set_attr "length" "4,8")])
3291 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3293 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3294 (match_operand:SI 2 "gpc_reg_operand" ""))
3295 (and:SI (not:SI (match_dup 2))
3296 (match_operand:SI 1 "gpc_reg_operand" "")))
3298 (set (match_operand:SI 0 "gpc_reg_operand" "")
3299 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3300 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3301 "TARGET_POWER && reload_completed"
3303 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3304 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3306 (compare:CC (match_dup 0)
3310 ;; Rotate and shift insns, in all their variants. These support shifts,
3311 ;; field inserts and extracts, and various combinations thereof.
3312 (define_expand "insv"
3313 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3314 (match_operand:SI 1 "const_int_operand" "")
3315 (match_operand:SI 2 "const_int_operand" ""))
3316 (match_operand 3 "gpc_reg_operand" ""))]
3320 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3321 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3322 compiler if the address of the structure is taken later. */
3323 if (GET_CODE (operands[0]) == SUBREG
3324 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3327 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3328 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3330 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3334 (define_insn "insvsi"
3335 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3336 (match_operand:SI 1 "const_int_operand" "i")
3337 (match_operand:SI 2 "const_int_operand" "i"))
3338 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3342 int start = INTVAL (operands[2]) & 31;
3343 int size = INTVAL (operands[1]) & 31;
3345 operands[4] = GEN_INT (32 - start - size);
3346 operands[1] = GEN_INT (start + size - 1);
3347 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3349 [(set_attr "type" "insert_word")])
3351 (define_insn "*insvsi_internal1"
3352 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3353 (match_operand:SI 1 "const_int_operand" "i")
3354 (match_operand:SI 2 "const_int_operand" "i"))
3355 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3356 (match_operand:SI 4 "const_int_operand" "i")))]
3357 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3360 int shift = INTVAL (operands[4]) & 31;
3361 int start = INTVAL (operands[2]) & 31;
3362 int size = INTVAL (operands[1]) & 31;
3364 operands[4] = GEN_INT (shift - start - size);
3365 operands[1] = GEN_INT (start + size - 1);
3366 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3368 [(set_attr "type" "insert_word")])
3370 (define_insn "*insvsi_internal2"
3371 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3372 (match_operand:SI 1 "const_int_operand" "i")
3373 (match_operand:SI 2 "const_int_operand" "i"))
3374 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3375 (match_operand:SI 4 "const_int_operand" "i")))]
3376 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3379 int shift = INTVAL (operands[4]) & 31;
3380 int start = INTVAL (operands[2]) & 31;
3381 int size = INTVAL (operands[1]) & 31;
3383 operands[4] = GEN_INT (32 - shift - start - size);
3384 operands[1] = GEN_INT (start + size - 1);
3385 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3387 [(set_attr "type" "insert_word")])
3389 (define_insn "*insvsi_internal3"
3390 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3391 (match_operand:SI 1 "const_int_operand" "i")
3392 (match_operand:SI 2 "const_int_operand" "i"))
3393 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3394 (match_operand:SI 4 "const_int_operand" "i")))]
3395 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3398 int shift = INTVAL (operands[4]) & 31;
3399 int start = INTVAL (operands[2]) & 31;
3400 int size = INTVAL (operands[1]) & 31;
3402 operands[4] = GEN_INT (32 - shift - start - size);
3403 operands[1] = GEN_INT (start + size - 1);
3404 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3406 [(set_attr "type" "insert_word")])
3408 (define_insn "*insvsi_internal4"
3409 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3410 (match_operand:SI 1 "const_int_operand" "i")
3411 (match_operand:SI 2 "const_int_operand" "i"))
3412 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3413 (match_operand:SI 4 "const_int_operand" "i")
3414 (match_operand:SI 5 "const_int_operand" "i")))]
3415 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3418 int extract_start = INTVAL (operands[5]) & 31;
3419 int extract_size = INTVAL (operands[4]) & 31;
3420 int insert_start = INTVAL (operands[2]) & 31;
3421 int insert_size = INTVAL (operands[1]) & 31;
3423 /* Align extract field with insert field */
3424 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3425 operands[1] = GEN_INT (insert_start + insert_size - 1);
3426 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3428 [(set_attr "type" "insert_word")])
3430 ;; combine patterns for rlwimi
3431 (define_insn "*insvsi_internal5"
3432 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3433 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3434 (match_operand:SI 1 "mask_operand" "i"))
3435 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3436 (match_operand:SI 2 "const_int_operand" "i"))
3437 (match_operand:SI 5 "mask_operand" "i"))))]
3438 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3441 int me = extract_ME(operands[5]);
3442 int mb = extract_MB(operands[5]);
3443 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3444 operands[2] = GEN_INT(mb);
3445 operands[1] = GEN_INT(me);
3446 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3448 [(set_attr "type" "insert_word")])
3450 (define_insn "*insvsi_internal6"
3451 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3452 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3453 (match_operand:SI 2 "const_int_operand" "i"))
3454 (match_operand:SI 5 "mask_operand" "i"))
3455 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3456 (match_operand:SI 1 "mask_operand" "i"))))]
3457 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3460 int me = extract_ME(operands[5]);
3461 int mb = extract_MB(operands[5]);
3462 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3463 operands[2] = GEN_INT(mb);
3464 operands[1] = GEN_INT(me);
3465 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3467 [(set_attr "type" "insert_word")])
3469 (define_insn "insvdi"
3470 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3471 (match_operand:SI 1 "const_int_operand" "i")
3472 (match_operand:SI 2 "const_int_operand" "i"))
3473 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3477 int start = INTVAL (operands[2]) & 63;
3478 int size = INTVAL (operands[1]) & 63;
3480 operands[1] = GEN_INT (64 - start - size);
3481 return \"rldimi %0,%3,%H1,%H2\";
3484 (define_insn "*insvdi_internal2"
3485 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3486 (match_operand:SI 1 "const_int_operand" "i")
3487 (match_operand:SI 2 "const_int_operand" "i"))
3488 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3489 (match_operand:SI 4 "const_int_operand" "i")))]
3491 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3494 int shift = INTVAL (operands[4]) & 63;
3495 int start = (INTVAL (operands[2]) & 63) - 32;
3496 int size = INTVAL (operands[1]) & 63;
3498 operands[4] = GEN_INT (64 - shift - start - size);
3499 operands[2] = GEN_INT (start);
3500 operands[1] = GEN_INT (start + size - 1);
3501 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3504 (define_insn "*insvdi_internal3"
3505 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3506 (match_operand:SI 1 "const_int_operand" "i")
3507 (match_operand:SI 2 "const_int_operand" "i"))
3508 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3509 (match_operand:SI 4 "const_int_operand" "i")))]
3511 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3514 int shift = INTVAL (operands[4]) & 63;
3515 int start = (INTVAL (operands[2]) & 63) - 32;
3516 int size = INTVAL (operands[1]) & 63;
3518 operands[4] = GEN_INT (64 - shift - start - size);
3519 operands[2] = GEN_INT (start);
3520 operands[1] = GEN_INT (start + size - 1);
3521 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3524 (define_expand "extzv"
3525 [(set (match_operand 0 "gpc_reg_operand" "")
3526 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3527 (match_operand:SI 2 "const_int_operand" "")
3528 (match_operand:SI 3 "const_int_operand" "")))]
3532 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3533 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3534 compiler if the address of the structure is taken later. */
3535 if (GET_CODE (operands[0]) == SUBREG
3536 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3539 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3540 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3542 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3546 (define_insn "extzvsi"
3547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3548 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3549 (match_operand:SI 2 "const_int_operand" "i")
3550 (match_operand:SI 3 "const_int_operand" "i")))]
3554 int start = INTVAL (operands[3]) & 31;
3555 int size = INTVAL (operands[2]) & 31;
3557 if (start + size >= 32)
3558 operands[3] = const0_rtx;
3560 operands[3] = GEN_INT (start + size);
3561 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3564 (define_insn "*extzvsi_internal1"
3565 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3566 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3567 (match_operand:SI 2 "const_int_operand" "i,i")
3568 (match_operand:SI 3 "const_int_operand" "i,i"))
3570 (clobber (match_scratch:SI 4 "=r,r"))]
3574 int start = INTVAL (operands[3]) & 31;
3575 int size = INTVAL (operands[2]) & 31;
3577 /* Force split for non-cc0 compare. */
3578 if (which_alternative == 1)
3581 /* If the bit-field being tested fits in the upper or lower half of a
3582 word, it is possible to use andiu. or andil. to test it. This is
3583 useful because the condition register set-use delay is smaller for
3584 andi[ul]. than for rlinm. This doesn't work when the starting bit
3585 position is 0 because the LT and GT bits may be set wrong. */
3587 if ((start > 0 && start + size <= 16) || start >= 16)
3589 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3590 - (1 << (16 - (start & 15) - size))));
3592 return \"{andiu.|andis.} %4,%1,%3\";
3594 return \"{andil.|andi.} %4,%1,%3\";
3597 if (start + size >= 32)
3598 operands[3] = const0_rtx;
3600 operands[3] = GEN_INT (start + size);
3601 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3603 [(set_attr "type" "compare")
3604 (set_attr "length" "4,8")])
3607 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3608 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3609 (match_operand:SI 2 "const_int_operand" "")
3610 (match_operand:SI 3 "const_int_operand" ""))
3612 (clobber (match_scratch:SI 4 ""))]
3615 (zero_extract:SI (match_dup 1) (match_dup 2)
3618 (compare:CC (match_dup 4)
3622 (define_insn "*extzvsi_internal2"
3623 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3624 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3625 (match_operand:SI 2 "const_int_operand" "i,i")
3626 (match_operand:SI 3 "const_int_operand" "i,i"))
3628 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3629 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3633 int start = INTVAL (operands[3]) & 31;
3634 int size = INTVAL (operands[2]) & 31;
3636 /* Force split for non-cc0 compare. */
3637 if (which_alternative == 1)
3640 /* Since we are using the output value, we can't ignore any need for
3641 a shift. The bit-field must end at the LSB. */
3642 if (start >= 16 && start + size == 32)
3644 operands[3] = GEN_INT ((1 << size) - 1);
3645 return \"{andil.|andi.} %0,%1,%3\";
3648 if (start + size >= 32)
3649 operands[3] = const0_rtx;
3651 operands[3] = GEN_INT (start + size);
3652 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3654 [(set_attr "type" "compare")
3655 (set_attr "length" "4,8")])
3658 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3659 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3660 (match_operand:SI 2 "const_int_operand" "")
3661 (match_operand:SI 3 "const_int_operand" ""))
3663 (set (match_operand:SI 0 "gpc_reg_operand" "")
3664 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3667 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3669 (compare:CC (match_dup 0)
3673 (define_insn "extzvdi"
3674 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3675 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3676 (match_operand:SI 2 "const_int_operand" "i")
3677 (match_operand:SI 3 "const_int_operand" "i")))]
3681 int start = INTVAL (operands[3]) & 63;
3682 int size = INTVAL (operands[2]) & 63;
3684 if (start + size >= 64)
3685 operands[3] = const0_rtx;
3687 operands[3] = GEN_INT (start + size);
3688 operands[2] = GEN_INT (64 - size);
3689 return \"rldicl %0,%1,%3,%2\";
3692 (define_insn "*extzvdi_internal1"
3693 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3694 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3695 (match_operand:SI 2 "const_int_operand" "i")
3696 (match_operand:SI 3 "const_int_operand" "i"))
3698 (clobber (match_scratch:DI 4 "=r"))]
3702 int start = INTVAL (operands[3]) & 63;
3703 int size = INTVAL (operands[2]) & 63;
3705 if (start + size >= 64)
3706 operands[3] = const0_rtx;
3708 operands[3] = GEN_INT (start + size);
3709 operands[2] = GEN_INT (64 - size);
3710 return \"rldicl. %4,%1,%3,%2\";
3712 [(set_attr "type" "compare")])
3714 (define_insn "*extzvdi_internal2"
3715 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3716 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3717 (match_operand:SI 2 "const_int_operand" "i")
3718 (match_operand:SI 3 "const_int_operand" "i"))
3720 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3721 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3725 int start = INTVAL (operands[3]) & 63;
3726 int size = INTVAL (operands[2]) & 63;
3728 if (start + size >= 64)
3729 operands[3] = const0_rtx;
3731 operands[3] = GEN_INT (start + size);
3732 operands[2] = GEN_INT (64 - size);
3733 return \"rldicl. %0,%1,%3,%2\";
3735 [(set_attr "type" "compare")])
3737 (define_insn "rotlsi3"
3738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3739 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3740 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3742 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3744 (define_insn "*rotlsi3_internal2"
3745 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3746 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3747 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3749 (clobber (match_scratch:SI 3 "=r,r"))]
3752 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3754 [(set_attr "type" "delayed_compare")
3755 (set_attr "length" "4,8")])
3758 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3759 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3760 (match_operand:SI 2 "reg_or_cint_operand" ""))
3762 (clobber (match_scratch:SI 3 ""))]
3765 (rotate:SI (match_dup 1) (match_dup 2)))
3767 (compare:CC (match_dup 3)
3771 (define_insn "*rotlsi3_internal3"
3772 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3773 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3774 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3776 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3777 (rotate:SI (match_dup 1) (match_dup 2)))]
3780 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3782 [(set_attr "type" "delayed_compare")
3783 (set_attr "length" "4,8")])
3786 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3787 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3788 (match_operand:SI 2 "reg_or_cint_operand" ""))
3790 (set (match_operand:SI 0 "gpc_reg_operand" "")
3791 (rotate:SI (match_dup 1) (match_dup 2)))]
3794 (rotate:SI (match_dup 1) (match_dup 2)))
3796 (compare:CC (match_dup 0)
3800 (define_insn "*rotlsi3_internal4"
3801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3802 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3803 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3804 (match_operand:SI 3 "mask_operand" "n")))]
3806 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3808 (define_insn "*rotlsi3_internal5"
3809 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3811 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3812 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3813 (match_operand:SI 3 "mask_operand" "n,n"))
3815 (clobber (match_scratch:SI 4 "=r,r"))]
3818 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3820 [(set_attr "type" "delayed_compare")
3821 (set_attr "length" "4,8")])
3824 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3826 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3827 (match_operand:SI 2 "reg_or_cint_operand" ""))
3828 (match_operand:SI 3 "mask_operand" ""))
3830 (clobber (match_scratch:SI 4 ""))]
3833 (and:SI (rotate:SI (match_dup 1)
3837 (compare:CC (match_dup 4)
3841 (define_insn "*rotlsi3_internal6"
3842 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3844 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3845 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3846 (match_operand:SI 3 "mask_operand" "n,n"))
3848 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3849 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3852 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3854 [(set_attr "type" "delayed_compare")
3855 (set_attr "length" "4,8")])
3858 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3860 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3861 (match_operand:SI 2 "reg_or_cint_operand" ""))
3862 (match_operand:SI 3 "mask_operand" ""))
3864 (set (match_operand:SI 0 "gpc_reg_operand" "")
3865 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3868 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3870 (compare:CC (match_dup 0)
3874 (define_insn "*rotlsi3_internal7"
3875 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3878 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3879 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3881 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3883 (define_insn "*rotlsi3_internal8"
3884 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3885 (compare:CC (zero_extend:SI
3887 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3888 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3890 (clobber (match_scratch:SI 3 "=r,r"))]
3893 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3895 [(set_attr "type" "delayed_compare")
3896 (set_attr "length" "4,8")])
3899 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3900 (compare:CC (zero_extend:SI
3902 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3903 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3905 (clobber (match_scratch:SI 3 ""))]
3908 (zero_extend:SI (subreg:QI
3909 (rotate:SI (match_dup 1)
3912 (compare:CC (match_dup 3)
3916 (define_insn "*rotlsi3_internal9"
3917 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3918 (compare:CC (zero_extend:SI
3920 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3921 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3923 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3924 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3927 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3929 [(set_attr "type" "delayed_compare")
3930 (set_attr "length" "4,8")])
3933 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3934 (compare:CC (zero_extend:SI
3936 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3937 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3939 (set (match_operand:SI 0 "gpc_reg_operand" "")
3940 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3943 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3945 (compare:CC (match_dup 0)
3949 (define_insn "*rotlsi3_internal10"
3950 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3953 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3954 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3956 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3958 (define_insn "*rotlsi3_internal11"
3959 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3960 (compare:CC (zero_extend:SI
3962 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3963 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3965 (clobber (match_scratch:SI 3 "=r,r"))]
3968 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3970 [(set_attr "type" "delayed_compare")
3971 (set_attr "length" "4,8")])
3974 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3975 (compare:CC (zero_extend:SI
3977 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3978 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3980 (clobber (match_scratch:SI 3 ""))]
3983 (zero_extend:SI (subreg:HI
3984 (rotate:SI (match_dup 1)
3987 (compare:CC (match_dup 3)
3991 (define_insn "*rotlsi3_internal12"
3992 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3993 (compare:CC (zero_extend:SI
3995 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3996 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3998 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3999 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4002 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
4004 [(set_attr "type" "delayed_compare")
4005 (set_attr "length" "4,8")])
4008 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4009 (compare:CC (zero_extend:SI
4011 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4012 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4014 (set (match_operand:SI 0 "gpc_reg_operand" "")
4015 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4018 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4020 (compare:CC (match_dup 0)
4024 ;; Note that we use "sle." instead of "sl." so that we can set
4025 ;; SHIFT_COUNT_TRUNCATED.
4027 (define_expand "ashlsi3"
4028 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4029 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4030 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4035 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4037 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4041 (define_insn "ashlsi3_power"
4042 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4043 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4044 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4045 (clobber (match_scratch:SI 3 "=q,X"))]
4049 {sli|slwi} %0,%1,%h2")
4051 (define_insn "ashlsi3_no_power"
4052 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4053 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4054 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4056 "{sl|slw}%I2 %0,%1,%h2")
4059 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4060 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4061 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4063 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4064 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4068 {sli.|slwi.} %3,%1,%h2
4071 [(set_attr "type" "delayed_compare")
4072 (set_attr "length" "4,4,8,8")])
4075 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4076 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4077 (match_operand:SI 2 "reg_or_cint_operand" ""))
4079 (clobber (match_scratch:SI 3 ""))
4080 (clobber (match_scratch:SI 4 ""))]
4081 "TARGET_POWER && reload_completed"
4082 [(parallel [(set (match_dup 3)
4083 (ashift:SI (match_dup 1) (match_dup 2)))
4084 (clobber (match_dup 4))])
4086 (compare:CC (match_dup 3)
4091 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4092 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4093 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4095 (clobber (match_scratch:SI 3 "=r,r"))]
4096 "! TARGET_POWER && TARGET_32BIT"
4098 {sl|slw}%I2. %3,%1,%h2
4100 [(set_attr "type" "delayed_compare")
4101 (set_attr "length" "4,8")])
4104 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4105 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4106 (match_operand:SI 2 "reg_or_cint_operand" ""))
4108 (clobber (match_scratch:SI 3 ""))]
4109 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4111 (ashift:SI (match_dup 1) (match_dup 2)))
4113 (compare:CC (match_dup 3)
4118 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4119 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4120 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4122 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4123 (ashift:SI (match_dup 1) (match_dup 2)))
4124 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4128 {sli.|slwi.} %0,%1,%h2
4131 [(set_attr "type" "delayed_compare")
4132 (set_attr "length" "4,4,8,8")])
4135 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4136 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4137 (match_operand:SI 2 "reg_or_cint_operand" ""))
4139 (set (match_operand:SI 0 "gpc_reg_operand" "")
4140 (ashift:SI (match_dup 1) (match_dup 2)))
4141 (clobber (match_scratch:SI 4 ""))]
4142 "TARGET_POWER && reload_completed"
4143 [(parallel [(set (match_dup 0)
4144 (ashift:SI (match_dup 1) (match_dup 2)))
4145 (clobber (match_dup 4))])
4147 (compare:CC (match_dup 0)
4152 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4153 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4154 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4156 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4157 (ashift:SI (match_dup 1) (match_dup 2)))]
4158 "! TARGET_POWER && TARGET_32BIT"
4160 {sl|slw}%I2. %0,%1,%h2
4162 [(set_attr "type" "delayed_compare")
4163 (set_attr "length" "4,8")])
4166 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4167 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4168 (match_operand:SI 2 "reg_or_cint_operand" ""))
4170 (set (match_operand:SI 0 "gpc_reg_operand" "")
4171 (ashift:SI (match_dup 1) (match_dup 2)))]
4172 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4174 (ashift:SI (match_dup 1) (match_dup 2)))
4176 (compare:CC (match_dup 0)
4180 (define_insn "rlwinm"
4181 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4182 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4183 (match_operand:SI 2 "const_int_operand" "i"))
4184 (match_operand:SI 3 "mask_operand" "n")))]
4185 "includes_lshift_p (operands[2], operands[3])"
4186 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4189 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4191 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4192 (match_operand:SI 2 "const_int_operand" "i,i"))
4193 (match_operand:SI 3 "mask_operand" "n,n"))
4195 (clobber (match_scratch:SI 4 "=r,r"))]
4196 "includes_lshift_p (operands[2], operands[3])"
4198 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4200 [(set_attr "type" "delayed_compare")
4201 (set_attr "length" "4,8")])
4204 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4206 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4207 (match_operand:SI 2 "const_int_operand" ""))
4208 (match_operand:SI 3 "mask_operand" ""))
4210 (clobber (match_scratch:SI 4 ""))]
4211 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4213 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4216 (compare:CC (match_dup 4)
4221 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4223 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4224 (match_operand:SI 2 "const_int_operand" "i,i"))
4225 (match_operand:SI 3 "mask_operand" "n,n"))
4227 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4228 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4229 "includes_lshift_p (operands[2], operands[3])"
4231 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4233 [(set_attr "type" "delayed_compare")
4234 (set_attr "length" "4,8")])
4237 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4239 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4240 (match_operand:SI 2 "const_int_operand" ""))
4241 (match_operand:SI 3 "mask_operand" ""))
4243 (set (match_operand:SI 0 "gpc_reg_operand" "")
4244 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4245 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4247 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4249 (compare:CC (match_dup 0)
4253 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4255 (define_expand "lshrsi3"
4256 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4257 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4258 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4263 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4265 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4269 (define_insn "lshrsi3_power"
4270 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4271 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4272 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4273 (clobber (match_scratch:SI 3 "=q,X,X"))]
4278 {s%A2i|s%A2wi} %0,%1,%h2")
4280 (define_insn "lshrsi3_no_power"
4281 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4282 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4283 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
4287 {sr|srw}%I2 %0,%1,%h2")
4290 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4291 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4292 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4294 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4295 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4300 {s%A2i.|s%A2wi.} %3,%1,%h2
4304 [(set_attr "type" "delayed_compare")
4305 (set_attr "length" "4,4,4,8,8,8")])
4308 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4309 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4310 (match_operand:SI 2 "reg_or_cint_operand" ""))
4312 (clobber (match_scratch:SI 3 ""))
4313 (clobber (match_scratch:SI 4 ""))]
4314 "TARGET_POWER && reload_completed"
4315 [(parallel [(set (match_dup 3)
4316 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4317 (clobber (match_dup 4))])
4319 (compare:CC (match_dup 3)
4324 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4325 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4326 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4328 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
4329 "! TARGET_POWER && TARGET_32BIT"
4332 {sr|srw}%I2. %3,%1,%h2
4335 [(set_attr "type" "delayed_compare")
4336 (set_attr "length" "4,4,8,8")])
4339 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4340 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4341 (match_operand:SI 2 "reg_or_cint_operand" ""))
4343 (clobber (match_scratch:SI 3 ""))]
4344 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4346 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4348 (compare:CC (match_dup 3)
4353 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4354 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4355 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4357 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4358 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4359 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4364 {s%A2i.|s%A2wi.} %0,%1,%h2
4368 [(set_attr "type" "delayed_compare")
4369 (set_attr "length" "4,4,4,8,8,8")])
4372 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4373 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4374 (match_operand:SI 2 "reg_or_cint_operand" ""))
4376 (set (match_operand:SI 0 "gpc_reg_operand" "")
4377 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4378 (clobber (match_scratch:SI 4 ""))]
4379 "TARGET_POWER && reload_completed"
4380 [(parallel [(set (match_dup 0)
4381 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4382 (clobber (match_dup 4))])
4384 (compare:CC (match_dup 0)
4389 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4390 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4391 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4393 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4394 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4395 "! TARGET_POWER && TARGET_32BIT"
4398 {sr|srw}%I2. %0,%1,%h2
4401 [(set_attr "type" "delayed_compare")
4402 (set_attr "length" "4,4,8,8")])
4405 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4406 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4407 (match_operand:SI 2 "reg_or_cint_operand" ""))
4409 (set (match_operand:SI 0 "gpc_reg_operand" "")
4410 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4411 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4413 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4415 (compare:CC (match_dup 0)
4420 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4421 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4422 (match_operand:SI 2 "const_int_operand" "i"))
4423 (match_operand:SI 3 "mask_operand" "n")))]
4424 "includes_rshift_p (operands[2], operands[3])"
4425 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4428 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4430 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4431 (match_operand:SI 2 "const_int_operand" "i,i"))
4432 (match_operand:SI 3 "mask_operand" "n,n"))
4434 (clobber (match_scratch:SI 4 "=r,r"))]
4435 "includes_rshift_p (operands[2], operands[3])"
4437 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4439 [(set_attr "type" "delayed_compare")
4440 (set_attr "length" "4,8")])
4443 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4445 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4446 (match_operand:SI 2 "const_int_operand" ""))
4447 (match_operand:SI 3 "mask_operand" ""))
4449 (clobber (match_scratch:SI 4 ""))]
4450 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4452 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4455 (compare:CC (match_dup 4)
4460 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4462 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4463 (match_operand:SI 2 "const_int_operand" "i,i"))
4464 (match_operand:SI 3 "mask_operand" "n,n"))
4466 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4467 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4468 "includes_rshift_p (operands[2], operands[3])"
4470 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4472 [(set_attr "type" "delayed_compare")
4473 (set_attr "length" "4,8")])
4476 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4478 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4479 (match_operand:SI 2 "const_int_operand" ""))
4480 (match_operand:SI 3 "mask_operand" ""))
4482 (set (match_operand:SI 0 "gpc_reg_operand" "")
4483 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4484 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4486 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4488 (compare:CC (match_dup 0)
4493 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4496 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4497 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4498 "includes_rshift_p (operands[2], GEN_INT (255))"
4499 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4502 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4506 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4507 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4509 (clobber (match_scratch:SI 3 "=r,r"))]
4510 "includes_rshift_p (operands[2], GEN_INT (255))"
4512 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4514 [(set_attr "type" "delayed_compare")
4515 (set_attr "length" "4,8")])
4518 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4522 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4523 (match_operand:SI 2 "const_int_operand" "")) 0))
4525 (clobber (match_scratch:SI 3 ""))]
4526 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4528 (zero_extend:SI (subreg:QI
4529 (lshiftrt:SI (match_dup 1)
4532 (compare:CC (match_dup 3)
4537 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4541 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4542 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4544 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4545 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4546 "includes_rshift_p (operands[2], GEN_INT (255))"
4548 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4550 [(set_attr "type" "delayed_compare")
4551 (set_attr "length" "4,8")])
4554 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4558 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4559 (match_operand:SI 2 "const_int_operand" "")) 0))
4561 (set (match_operand:SI 0 "gpc_reg_operand" "")
4562 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4563 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4565 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4567 (compare:CC (match_dup 0)
4572 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4575 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4576 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4577 "includes_rshift_p (operands[2], GEN_INT (65535))"
4578 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4581 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4585 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4586 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4588 (clobber (match_scratch:SI 3 "=r,r"))]
4589 "includes_rshift_p (operands[2], GEN_INT (65535))"
4591 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4593 [(set_attr "type" "delayed_compare")
4594 (set_attr "length" "4,8")])
4597 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4601 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4602 (match_operand:SI 2 "const_int_operand" "")) 0))
4604 (clobber (match_scratch:SI 3 ""))]
4605 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4607 (zero_extend:SI (subreg:HI
4608 (lshiftrt:SI (match_dup 1)
4611 (compare:CC (match_dup 3)
4616 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4620 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4621 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4623 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4624 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4625 "includes_rshift_p (operands[2], GEN_INT (65535))"
4627 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4629 [(set_attr "type" "delayed_compare")
4630 (set_attr "length" "4,8")])
4633 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4637 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4638 (match_operand:SI 2 "const_int_operand" "")) 0))
4640 (set (match_operand:SI 0 "gpc_reg_operand" "")
4641 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4642 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4644 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4646 (compare:CC (match_dup 0)
4651 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4653 (match_operand:SI 1 "gpc_reg_operand" "r"))
4654 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4660 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4662 (match_operand:SI 1 "gpc_reg_operand" "r"))
4663 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4669 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4671 (match_operand:SI 1 "gpc_reg_operand" "r"))
4672 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4678 (define_expand "ashrsi3"
4679 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4680 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4681 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4686 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4688 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4692 (define_insn "ashrsi3_power"
4693 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4694 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4695 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4696 (clobber (match_scratch:SI 3 "=q,X"))]
4700 {srai|srawi} %0,%1,%h2")
4702 (define_insn "ashrsi3_no_power"
4703 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4704 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4705 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4707 "{sra|sraw}%I2 %0,%1,%h2")
4710 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4711 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4712 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4714 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4715 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4719 {srai.|srawi.} %3,%1,%h2
4722 [(set_attr "type" "delayed_compare")
4723 (set_attr "length" "4,4,8,8")])
4726 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4727 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4728 (match_operand:SI 2 "reg_or_cint_operand" ""))
4730 (clobber (match_scratch:SI 3 ""))
4731 (clobber (match_scratch:SI 4 ""))]
4732 "TARGET_POWER && reload_completed"
4733 [(parallel [(set (match_dup 3)
4734 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4735 (clobber (match_dup 4))])
4737 (compare:CC (match_dup 3)
4742 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4743 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4744 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4746 (clobber (match_scratch:SI 3 "=r,r"))]
4749 {sra|sraw}%I2. %3,%1,%h2
4751 [(set_attr "type" "delayed_compare")
4752 (set_attr "length" "4,8")])
4755 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4756 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4757 (match_operand:SI 2 "reg_or_cint_operand" ""))
4759 (clobber (match_scratch:SI 3 ""))]
4760 "! TARGET_POWER && reload_completed"
4762 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4764 (compare:CC (match_dup 3)
4769 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4770 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4771 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4773 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4774 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4775 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4779 {srai.|srawi.} %0,%1,%h2
4782 [(set_attr "type" "delayed_compare")
4783 (set_attr "length" "4,4,8,8")])
4786 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4787 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4788 (match_operand:SI 2 "reg_or_cint_operand" ""))
4790 (set (match_operand:SI 0 "gpc_reg_operand" "")
4791 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4792 (clobber (match_scratch:SI 4 ""))]
4793 "TARGET_POWER && reload_completed"
4794 [(parallel [(set (match_dup 0)
4795 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4796 (clobber (match_dup 4))])
4798 (compare:CC (match_dup 0)
4803 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4804 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4805 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4807 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4808 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4811 {sra|sraw}%I2. %0,%1,%h2
4813 [(set_attr "type" "delayed_compare")
4814 (set_attr "length" "4,8")])
4817 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4818 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4819 (match_operand:SI 2 "reg_or_cint_operand" ""))
4821 (set (match_operand:SI 0 "gpc_reg_operand" "")
4822 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4823 "! TARGET_POWER && reload_completed"
4825 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4827 (compare:CC (match_dup 0)
4831 ;; Floating-point insns, excluding normal data motion.
4833 ;; PowerPC has a full set of single-precision floating point instructions.
4835 ;; For the POWER architecture, we pretend that we have both SFmode and
4836 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4837 ;; The only conversions we will do will be when storing to memory. In that
4838 ;; case, we will use the "frsp" instruction before storing.
4840 ;; Note that when we store into a single-precision memory location, we need to
4841 ;; use the frsp insn first. If the register being stored isn't dead, we
4842 ;; need a scratch register for the frsp. But this is difficult when the store
4843 ;; is done by reload. It is not incorrect to do the frsp on the register in
4844 ;; this case, we just lose precision that we would have otherwise gotten but
4845 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4847 (define_expand "extendsfdf2"
4848 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4849 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4850 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4853 (define_insn_and_split "*extendsfdf2_fpr"
4854 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4855 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4856 "TARGET_HARD_FLOAT && TARGET_FPRS"
4861 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4864 emit_note (NOTE_INSN_DELETED);
4867 [(set_attr "type" "fp,fp,fpload")])
4869 (define_expand "truncdfsf2"
4870 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4871 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4872 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4875 (define_insn "*truncdfsf2_fpr"
4876 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4877 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4878 "TARGET_HARD_FLOAT && TARGET_FPRS"
4880 [(set_attr "type" "fp")])
4882 (define_insn "aux_truncdfsf2"
4883 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4884 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4885 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4887 [(set_attr "type" "fp")])
4889 (define_expand "negsf2"
4890 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4891 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4895 (define_insn "*negsf2"
4896 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4897 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4898 "TARGET_HARD_FLOAT && TARGET_FPRS"
4900 [(set_attr "type" "fp")])
4902 (define_expand "abssf2"
4903 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4904 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4908 (define_insn "*abssf2"
4909 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4910 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4911 "TARGET_HARD_FLOAT && TARGET_FPRS"
4913 [(set_attr "type" "fp")])
4916 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4917 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4918 "TARGET_HARD_FLOAT && TARGET_FPRS"
4920 [(set_attr "type" "fp")])
4922 (define_expand "addsf3"
4923 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4924 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4925 (match_operand:SF 2 "gpc_reg_operand" "")))]
4930 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4931 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4932 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4933 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4935 [(set_attr "type" "fp")])
4938 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4939 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4940 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4941 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4942 "{fa|fadd} %0,%1,%2"
4943 [(set_attr "type" "fp")])
4945 (define_expand "subsf3"
4946 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4947 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4948 (match_operand:SF 2 "gpc_reg_operand" "")))]
4953 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4954 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4955 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4956 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4958 [(set_attr "type" "fp")])
4961 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4962 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4963 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4964 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4965 "{fs|fsub} %0,%1,%2"
4966 [(set_attr "type" "fp")])
4968 (define_expand "mulsf3"
4969 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4970 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4971 (match_operand:SF 2 "gpc_reg_operand" "")))]
4976 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4977 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4978 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4979 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4981 [(set_attr "type" "fp")])
4984 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4985 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4986 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4987 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4988 "{fm|fmul} %0,%1,%2"
4989 [(set_attr "type" "dmul")])
4992 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4993 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
4994 "TARGET_PPC_GFXOPT && flag_finite_math_only"
4996 [(set_attr "type" "fp")])
4998 (define_expand "divsf3"
4999 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5000 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5001 (match_operand:SF 2 "gpc_reg_operand" "")))]
5004 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
5005 && flag_finite_math_only && !flag_trapping_math)
5007 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5013 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5014 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5015 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5016 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5018 [(set_attr "type" "sdiv")])
5021 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5022 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5023 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5024 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5025 "{fd|fdiv} %0,%1,%2"
5026 [(set_attr "type" "ddiv")])
5029 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5030 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5031 (match_operand:SF 2 "gpc_reg_operand" "f"))
5032 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5033 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5034 "fmadds %0,%1,%2,%3"
5035 [(set_attr "type" "fp")])
5038 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5039 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5040 (match_operand:SF 2 "gpc_reg_operand" "f"))
5041 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5042 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5043 "{fma|fmadd} %0,%1,%2,%3"
5044 [(set_attr "type" "dmul")])
5047 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5048 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5049 (match_operand:SF 2 "gpc_reg_operand" "f"))
5050 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5051 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5052 "fmsubs %0,%1,%2,%3"
5053 [(set_attr "type" "fp")])
5056 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5057 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5058 (match_operand:SF 2 "gpc_reg_operand" "f"))
5059 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5060 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5061 "{fms|fmsub} %0,%1,%2,%3"
5062 [(set_attr "type" "dmul")])
5065 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5066 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5067 (match_operand:SF 2 "gpc_reg_operand" "f"))
5068 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5069 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5070 && HONOR_SIGNED_ZEROS (SFmode)"
5071 "fnmadds %0,%1,%2,%3"
5072 [(set_attr "type" "fp")])
5075 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5076 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5077 (match_operand:SF 2 "gpc_reg_operand" "f"))
5078 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5079 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5080 && ! HONOR_SIGNED_ZEROS (SFmode)"
5081 "fnmadds %0,%1,%2,%3"
5082 [(set_attr "type" "fp")])
5085 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5086 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5087 (match_operand:SF 2 "gpc_reg_operand" "f"))
5088 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5089 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5090 "{fnma|fnmadd} %0,%1,%2,%3"
5091 [(set_attr "type" "dmul")])
5094 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5095 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5096 (match_operand:SF 2 "gpc_reg_operand" "f"))
5097 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5098 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5099 && ! HONOR_SIGNED_ZEROS (SFmode)"
5100 "{fnma|fnmadd} %0,%1,%2,%3"
5101 [(set_attr "type" "dmul")])
5104 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5105 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5106 (match_operand:SF 2 "gpc_reg_operand" "f"))
5107 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5108 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5109 && HONOR_SIGNED_ZEROS (SFmode)"
5110 "fnmsubs %0,%1,%2,%3"
5111 [(set_attr "type" "fp")])
5114 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5115 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5116 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5117 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5118 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5119 && ! HONOR_SIGNED_ZEROS (SFmode)"
5120 "fnmsubs %0,%1,%2,%3"
5121 [(set_attr "type" "fp")])
5124 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5125 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5126 (match_operand:SF 2 "gpc_reg_operand" "f"))
5127 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5128 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5129 "{fnms|fnmsub} %0,%1,%2,%3"
5130 [(set_attr "type" "dmul")])
5133 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5134 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5135 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5136 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5137 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5138 && ! HONOR_SIGNED_ZEROS (SFmode)"
5139 "{fnms|fnmsub} %0,%1,%2,%3"
5140 [(set_attr "type" "dmul")])
5142 (define_expand "sqrtsf2"
5143 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5144 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5145 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5149 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5150 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5151 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5153 [(set_attr "type" "ssqrt")])
5156 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5157 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5158 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5160 [(set_attr "type" "dsqrt")])
5162 (define_expand "copysignsf3"
5164 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5166 (neg:SF (abs:SF (match_dup 1))))
5167 (set (match_operand:SF 0 "gpc_reg_operand" "")
5168 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5172 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5173 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5175 operands[3] = gen_reg_rtx (SFmode);
5176 operands[4] = gen_reg_rtx (SFmode);
5177 operands[5] = CONST0_RTX (SFmode);
5180 (define_expand "copysigndf3"
5182 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5184 (neg:DF (abs:DF (match_dup 1))))
5185 (set (match_operand:DF 0 "gpc_reg_operand" "")
5186 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5190 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5191 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5193 operands[3] = gen_reg_rtx (DFmode);
5194 operands[4] = gen_reg_rtx (DFmode);
5195 operands[5] = CONST0_RTX (DFmode);
5198 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5199 ;; fsel instruction and some auxiliary computations. Then we just have a
5200 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5202 (define_expand "smaxsf3"
5203 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5204 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5205 (match_operand:SF 2 "gpc_reg_operand" ""))
5208 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5209 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5211 (define_expand "sminsf3"
5212 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5213 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5214 (match_operand:SF 2 "gpc_reg_operand" ""))
5217 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5218 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5221 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5222 (match_operator:SF 3 "min_max_operator"
5223 [(match_operand:SF 1 "gpc_reg_operand" "")
5224 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5225 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5228 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5229 operands[1], operands[2]);
5233 (define_expand "movsicc"
5234 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5235 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5236 (match_operand:SI 2 "gpc_reg_operand" "")
5237 (match_operand:SI 3 "gpc_reg_operand" "")))]
5241 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5247 ;; We use the BASE_REGS for the isel input operands because, if rA is
5248 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5249 ;; because we may switch the operands and rB may end up being rA.
5251 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5252 ;; leave out the mode in operand 4 and use one pattern, but reload can
5253 ;; change the mode underneath our feet and then gets confused trying
5254 ;; to reload the value.
5255 (define_insn "isel_signed"
5256 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5258 (match_operator 1 "comparison_operator"
5259 [(match_operand:CC 4 "cc_reg_operand" "y")
5261 (match_operand:SI 2 "gpc_reg_operand" "b")
5262 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5265 { return output_isel (operands); }"
5266 [(set_attr "length" "4")])
5268 (define_insn "isel_unsigned"
5269 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5271 (match_operator 1 "comparison_operator"
5272 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5274 (match_operand:SI 2 "gpc_reg_operand" "b")
5275 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5278 { return output_isel (operands); }"
5279 [(set_attr "length" "4")])
5281 (define_expand "movsfcc"
5282 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5283 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5284 (match_operand:SF 2 "gpc_reg_operand" "")
5285 (match_operand:SF 3 "gpc_reg_operand" "")))]
5286 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5289 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5295 (define_insn "*fselsfsf4"
5296 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5297 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5298 (match_operand:SF 4 "zero_fp_constant" "F"))
5299 (match_operand:SF 2 "gpc_reg_operand" "f")
5300 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5301 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5303 [(set_attr "type" "fp")])
5305 (define_insn "*fseldfsf4"
5306 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5307 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5308 (match_operand:DF 4 "zero_fp_constant" "F"))
5309 (match_operand:SF 2 "gpc_reg_operand" "f")
5310 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5311 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5313 [(set_attr "type" "fp")])
5315 (define_expand "negdf2"
5316 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5317 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5318 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5321 (define_insn "*negdf2_fpr"
5322 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5323 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5324 "TARGET_HARD_FLOAT && TARGET_FPRS"
5326 [(set_attr "type" "fp")])
5328 (define_expand "absdf2"
5329 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5330 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5331 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5334 (define_insn "*absdf2_fpr"
5335 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5336 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5337 "TARGET_HARD_FLOAT && TARGET_FPRS"
5339 [(set_attr "type" "fp")])
5341 (define_insn "*nabsdf2_fpr"
5342 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5343 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5344 "TARGET_HARD_FLOAT && TARGET_FPRS"
5346 [(set_attr "type" "fp")])
5348 (define_expand "adddf3"
5349 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5350 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5351 (match_operand:DF 2 "gpc_reg_operand" "")))]
5352 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5355 (define_insn "*adddf3_fpr"
5356 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5357 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5358 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5359 "TARGET_HARD_FLOAT && TARGET_FPRS"
5360 "{fa|fadd} %0,%1,%2"
5361 [(set_attr "type" "fp")])
5363 (define_expand "subdf3"
5364 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5365 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5366 (match_operand:DF 2 "gpc_reg_operand" "")))]
5367 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5370 (define_insn "*subdf3_fpr"
5371 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5372 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5373 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5374 "TARGET_HARD_FLOAT && TARGET_FPRS"
5375 "{fs|fsub} %0,%1,%2"
5376 [(set_attr "type" "fp")])
5378 (define_expand "muldf3"
5379 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5380 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5381 (match_operand:DF 2 "gpc_reg_operand" "")))]
5382 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5385 (define_insn "*muldf3_fpr"
5386 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5387 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5388 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5389 "TARGET_HARD_FLOAT && TARGET_FPRS"
5390 "{fm|fmul} %0,%1,%2"
5391 [(set_attr "type" "dmul")])
5394 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5395 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5396 "TARGET_POPCNTB && flag_finite_math_only"
5398 [(set_attr "type" "fp")])
5400 (define_expand "divdf3"
5401 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5402 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5403 (match_operand:DF 2 "gpc_reg_operand" "")))]
5404 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5406 if (swdiv && !optimize_size && TARGET_POPCNTB
5407 && flag_finite_math_only && !flag_trapping_math)
5409 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5414 (define_insn "*divdf3_fpr"
5415 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5416 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5417 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5418 "TARGET_HARD_FLOAT && TARGET_FPRS"
5419 "{fd|fdiv} %0,%1,%2"
5420 [(set_attr "type" "ddiv")])
5423 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5424 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5425 (match_operand:DF 2 "gpc_reg_operand" "f"))
5426 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5427 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5428 "{fma|fmadd} %0,%1,%2,%3"
5429 [(set_attr "type" "dmul")])
5432 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5433 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5434 (match_operand:DF 2 "gpc_reg_operand" "f"))
5435 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5436 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5437 "{fms|fmsub} %0,%1,%2,%3"
5438 [(set_attr "type" "dmul")])
5441 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5442 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5443 (match_operand:DF 2 "gpc_reg_operand" "f"))
5444 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5445 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5446 && HONOR_SIGNED_ZEROS (DFmode)"
5447 "{fnma|fnmadd} %0,%1,%2,%3"
5448 [(set_attr "type" "dmul")])
5451 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5452 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5453 (match_operand:DF 2 "gpc_reg_operand" "f"))
5454 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5455 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5456 && ! HONOR_SIGNED_ZEROS (DFmode)"
5457 "{fnma|fnmadd} %0,%1,%2,%3"
5458 [(set_attr "type" "dmul")])
5461 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5462 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5463 (match_operand:DF 2 "gpc_reg_operand" "f"))
5464 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5465 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5466 && HONOR_SIGNED_ZEROS (DFmode)"
5467 "{fnms|fnmsub} %0,%1,%2,%3"
5468 [(set_attr "type" "dmul")])
5471 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5472 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5473 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5474 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5475 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5476 && ! HONOR_SIGNED_ZEROS (DFmode)"
5477 "{fnms|fnmsub} %0,%1,%2,%3"
5478 [(set_attr "type" "dmul")])
5480 (define_insn "sqrtdf2"
5481 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5482 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5483 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5485 [(set_attr "type" "dsqrt")])
5487 ;; The conditional move instructions allow us to perform max and min
5488 ;; operations even when
5490 (define_expand "smaxdf3"
5491 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5492 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5493 (match_operand:DF 2 "gpc_reg_operand" ""))
5496 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5497 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5499 (define_expand "smindf3"
5500 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5501 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5502 (match_operand:DF 2 "gpc_reg_operand" ""))
5505 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5506 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5509 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5510 (match_operator:DF 3 "min_max_operator"
5511 [(match_operand:DF 1 "gpc_reg_operand" "")
5512 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5513 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5516 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5517 operands[1], operands[2]);
5521 (define_expand "movdfcc"
5522 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5523 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5524 (match_operand:DF 2 "gpc_reg_operand" "")
5525 (match_operand:DF 3 "gpc_reg_operand" "")))]
5526 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5529 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5535 (define_insn "*fseldfdf4"
5536 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5537 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5538 (match_operand:DF 4 "zero_fp_constant" "F"))
5539 (match_operand:DF 2 "gpc_reg_operand" "f")
5540 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5541 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5543 [(set_attr "type" "fp")])
5545 (define_insn "*fselsfdf4"
5546 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5547 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5548 (match_operand:SF 4 "zero_fp_constant" "F"))
5549 (match_operand:DF 2 "gpc_reg_operand" "f")
5550 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5553 [(set_attr "type" "fp")])
5555 ;; Conversions to and from floating-point.
5557 (define_expand "fixuns_truncsfsi2"
5558 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5559 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5560 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5563 (define_expand "fix_truncsfsi2"
5564 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5565 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5566 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5569 ; For each of these conversions, there is a define_expand, a define_insn
5570 ; with a '#' template, and a define_split (with C code). The idea is
5571 ; to allow constant folding with the template of the define_insn,
5572 ; then to have the insns split later (between sched1 and final).
5574 (define_expand "floatsidf2"
5575 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5576 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5579 (clobber (match_dup 4))
5580 (clobber (match_dup 5))
5581 (clobber (match_dup 6))])]
5582 "TARGET_HARD_FLOAT && TARGET_FPRS"
5585 if (TARGET_E500_DOUBLE)
5587 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5590 if (TARGET_POWERPC64)
5592 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5593 rtx t1 = gen_reg_rtx (DImode);
5594 rtx t2 = gen_reg_rtx (DImode);
5595 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5599 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5600 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5601 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5602 operands[5] = gen_reg_rtx (DFmode);
5603 operands[6] = gen_reg_rtx (SImode);
5606 (define_insn_and_split "*floatsidf2_internal"
5607 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5608 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5609 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5610 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5611 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5612 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5613 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5614 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5616 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5620 rtx lowword, highword;
5621 gcc_assert (MEM_P (operands[4]));
5622 highword = adjust_address (operands[4], SImode, 0);
5623 lowword = adjust_address (operands[4], SImode, 4);
5624 if (! WORDS_BIG_ENDIAN)
5627 tmp = highword; highword = lowword; lowword = tmp;
5630 emit_insn (gen_xorsi3 (operands[6], operands[1],
5631 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5632 emit_move_insn (lowword, operands[6]);
5633 emit_move_insn (highword, operands[2]);
5634 emit_move_insn (operands[5], operands[4]);
5635 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5638 [(set_attr "length" "24")])
5640 (define_expand "floatunssisf2"
5641 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5642 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5643 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5646 (define_expand "floatunssidf2"
5647 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5648 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5651 (clobber (match_dup 4))
5652 (clobber (match_dup 5))])]
5653 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5656 if (TARGET_E500_DOUBLE)
5658 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5661 if (TARGET_POWERPC64)
5663 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5664 rtx t1 = gen_reg_rtx (DImode);
5665 rtx t2 = gen_reg_rtx (DImode);
5666 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5671 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5672 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5673 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5674 operands[5] = gen_reg_rtx (DFmode);
5677 (define_insn_and_split "*floatunssidf2_internal"
5678 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5679 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5680 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5681 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5682 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5683 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5684 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5686 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5690 rtx lowword, highword;
5691 gcc_assert (MEM_P (operands[4]));
5692 highword = adjust_address (operands[4], SImode, 0);
5693 lowword = adjust_address (operands[4], SImode, 4);
5694 if (! WORDS_BIG_ENDIAN)
5697 tmp = highword; highword = lowword; lowword = tmp;
5700 emit_move_insn (lowword, operands[1]);
5701 emit_move_insn (highword, operands[2]);
5702 emit_move_insn (operands[5], operands[4]);
5703 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5706 [(set_attr "length" "20")])
5708 (define_expand "fix_truncdfsi2"
5709 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5710 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5711 (clobber (match_dup 2))
5712 (clobber (match_dup 3))])]
5713 "(TARGET_POWER2 || TARGET_POWERPC)
5714 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5717 if (TARGET_E500_DOUBLE)
5719 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5722 operands[2] = gen_reg_rtx (DImode);
5723 if (TARGET_PPC_GFXOPT)
5725 rtx orig_dest = operands[0];
5726 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5727 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5728 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5730 if (operands[0] != orig_dest)
5731 emit_move_insn (orig_dest, operands[0]);
5734 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5737 (define_insn_and_split "*fix_truncdfsi2_internal"
5738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5739 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5740 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5741 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5742 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5744 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[3]))"
5749 gcc_assert (MEM_P (operands[3]));
5750 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5752 emit_insn (gen_fctiwz (operands[2], operands[1]));
5753 emit_move_insn (operands[3], operands[2]);
5754 emit_move_insn (operands[0], lowword);
5757 [(set_attr "length" "16")])
5759 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5760 [(set (match_operand:SI 0 "memory_operand" "=Z")
5761 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5762 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5763 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5764 && TARGET_PPC_GFXOPT"
5770 emit_insn (gen_fctiwz (operands[2], operands[1]));
5771 emit_insn (gen_stfiwx (operands[0], operands[2]));
5774 [(set_attr "length" "16")])
5776 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5777 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5778 ; because the first makes it clear that operand 0 is not live
5779 ; before the instruction.
5780 (define_insn "fctiwz"
5781 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5782 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5784 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5785 "{fcirz|fctiwz} %0,%1"
5786 [(set_attr "type" "fp")])
5788 (define_insn "btruncdf2"
5789 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5790 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5791 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5793 [(set_attr "type" "fp")])
5795 (define_insn "btruncsf2"
5796 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5797 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5798 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5800 [(set_attr "type" "fp")])
5802 (define_insn "ceildf2"
5803 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5804 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5805 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5807 [(set_attr "type" "fp")])
5809 (define_insn "ceilsf2"
5810 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5811 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5812 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5814 [(set_attr "type" "fp")])
5816 (define_insn "floordf2"
5817 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5818 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5819 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5821 [(set_attr "type" "fp")])
5823 (define_insn "floorsf2"
5824 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5825 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5826 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5828 [(set_attr "type" "fp")])
5830 (define_insn "rounddf2"
5831 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5832 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
5833 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5835 [(set_attr "type" "fp")])
5837 (define_insn "roundsf2"
5838 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5839 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
5840 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5842 [(set_attr "type" "fp")])
5844 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5845 (define_insn "stfiwx"
5846 [(set (match_operand:SI 0 "memory_operand" "=Z")
5847 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
5851 [(set_attr "type" "fpstore")])
5853 (define_expand "floatsisf2"
5854 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5855 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5856 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5859 (define_insn "floatdidf2"
5860 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5861 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5862 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5864 [(set_attr "type" "fp")])
5866 (define_insn_and_split "floatsidf_ppc64"
5867 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5868 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5869 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5870 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5871 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5872 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5875 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5876 (set (match_dup 2) (match_dup 3))
5877 (set (match_dup 4) (match_dup 2))
5878 (set (match_dup 0) (float:DF (match_dup 4)))]
5881 (define_insn_and_split "floatunssidf_ppc64"
5882 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5883 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5884 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5885 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5886 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5887 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5890 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5891 (set (match_dup 2) (match_dup 3))
5892 (set (match_dup 4) (match_dup 2))
5893 (set (match_dup 0) (float:DF (match_dup 4)))]
5896 (define_insn "fix_truncdfdi2"
5897 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5898 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5899 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5901 [(set_attr "type" "fp")])
5903 (define_expand "floatdisf2"
5904 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5905 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5906 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5909 rtx val = operands[1];
5910 if (!flag_unsafe_math_optimizations)
5912 rtx label = gen_label_rtx ();
5913 val = gen_reg_rtx (DImode);
5914 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5917 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5921 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5922 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5923 ;; from double rounding.
5924 (define_insn_and_split "floatdisf2_internal1"
5925 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5926 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5927 (clobber (match_scratch:DF 2 "=f"))]
5928 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5930 "&& reload_completed"
5932 (float:DF (match_dup 1)))
5934 (float_truncate:SF (match_dup 2)))]
5937 ;; Twiddles bits to avoid double rounding.
5938 ;; Bits that might be truncated when converting to DFmode are replaced
5939 ;; by a bit that won't be lost at that stage, but is below the SFmode
5940 ;; rounding position.
5941 (define_expand "floatdisf2_internal2"
5942 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
5944 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
5946 (clobber (scratch:CC))])
5947 (set (match_dup 3) (plus:DI (match_dup 3)
5949 (set (match_dup 0) (plus:DI (match_dup 0)
5951 (set (match_dup 4) (compare:CCUNS (match_dup 3)
5953 (set (match_dup 0) (ior:DI (match_dup 0)
5955 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
5957 (clobber (scratch:CC))])
5958 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
5959 (label_ref (match_operand:DI 2 "" ""))
5961 (set (match_dup 0) (match_dup 1))]
5962 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5965 operands[3] = gen_reg_rtx (DImode);
5966 operands[4] = gen_reg_rtx (CCUNSmode);
5969 ;; Define the DImode operations that can be done in a small number
5970 ;; of instructions. The & constraints are to prevent the register
5971 ;; allocator from allocating registers that overlap with the inputs
5972 ;; (for example, having an input in 7,8 and an output in 6,7). We
5973 ;; also allow for the output being the same as one of the inputs.
5975 (define_insn "*adddi3_noppc64"
5976 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5977 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5978 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5979 "! TARGET_POWERPC64"
5982 if (WORDS_BIG_ENDIAN)
5983 return (GET_CODE (operands[2])) != CONST_INT
5984 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5985 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5987 return (GET_CODE (operands[2])) != CONST_INT
5988 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5989 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5991 [(set_attr "type" "two")
5992 (set_attr "length" "8")])
5994 (define_insn "*subdi3_noppc64"
5995 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5996 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5997 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5998 "! TARGET_POWERPC64"
6001 if (WORDS_BIG_ENDIAN)
6002 return (GET_CODE (operands[1]) != CONST_INT)
6003 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6004 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6006 return (GET_CODE (operands[1]) != CONST_INT)
6007 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6008 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6010 [(set_attr "type" "two")
6011 (set_attr "length" "8")])
6013 (define_insn "*negdi2_noppc64"
6014 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6015 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6016 "! TARGET_POWERPC64"
6019 return (WORDS_BIG_ENDIAN)
6020 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6021 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6023 [(set_attr "type" "two")
6024 (set_attr "length" "8")])
6026 (define_expand "mulsidi3"
6027 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6028 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6029 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6030 "! TARGET_POWERPC64"
6033 if (! TARGET_POWER && ! TARGET_POWERPC)
6035 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6036 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6037 emit_insn (gen_mull_call ());
6038 if (WORDS_BIG_ENDIAN)
6039 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6042 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6043 gen_rtx_REG (SImode, 3));
6044 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6045 gen_rtx_REG (SImode, 4));
6049 else if (TARGET_POWER)
6051 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6056 (define_insn "mulsidi3_mq"
6057 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6058 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6059 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6060 (clobber (match_scratch:SI 3 "=q"))]
6062 "mul %0,%1,%2\;mfmq %L0"
6063 [(set_attr "type" "imul")
6064 (set_attr "length" "8")])
6066 (define_insn "*mulsidi3_no_mq"
6067 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6068 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6069 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6070 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6073 return (WORDS_BIG_ENDIAN)
6074 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6075 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6077 [(set_attr "type" "imul")
6078 (set_attr "length" "8")])
6081 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6082 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6083 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6084 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6087 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6088 (sign_extend:DI (match_dup 2)))
6091 (mult:SI (match_dup 1)
6095 int endian = (WORDS_BIG_ENDIAN == 0);
6096 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6097 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6100 (define_expand "umulsidi3"
6101 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6102 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6103 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6104 "TARGET_POWERPC && ! TARGET_POWERPC64"
6109 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6114 (define_insn "umulsidi3_mq"
6115 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6116 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6117 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6118 (clobber (match_scratch:SI 3 "=q"))]
6119 "TARGET_POWERPC && TARGET_POWER"
6122 return (WORDS_BIG_ENDIAN)
6123 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6124 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6126 [(set_attr "type" "imul")
6127 (set_attr "length" "8")])
6129 (define_insn "*umulsidi3_no_mq"
6130 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6131 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6132 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6133 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6136 return (WORDS_BIG_ENDIAN)
6137 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6138 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6140 [(set_attr "type" "imul")
6141 (set_attr "length" "8")])
6144 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6145 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6146 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6147 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6150 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6151 (zero_extend:DI (match_dup 2)))
6154 (mult:SI (match_dup 1)
6158 int endian = (WORDS_BIG_ENDIAN == 0);
6159 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6160 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6163 (define_expand "smulsi3_highpart"
6164 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6166 (lshiftrt:DI (mult:DI (sign_extend:DI
6167 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6169 (match_operand:SI 2 "gpc_reg_operand" "r")))
6174 if (! TARGET_POWER && ! TARGET_POWERPC)
6176 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6177 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6178 emit_insn (gen_mulh_call ());
6179 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6182 else if (TARGET_POWER)
6184 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6189 (define_insn "smulsi3_highpart_mq"
6190 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6192 (lshiftrt:DI (mult:DI (sign_extend:DI
6193 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6195 (match_operand:SI 2 "gpc_reg_operand" "r")))
6197 (clobber (match_scratch:SI 3 "=q"))]
6200 [(set_attr "type" "imul")])
6202 (define_insn "*smulsi3_highpart_no_mq"
6203 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6205 (lshiftrt:DI (mult:DI (sign_extend:DI
6206 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6208 (match_operand:SI 2 "gpc_reg_operand" "r")))
6210 "TARGET_POWERPC && ! TARGET_POWER"
6212 [(set_attr "type" "imul")])
6214 (define_expand "umulsi3_highpart"
6215 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6217 (lshiftrt:DI (mult:DI (zero_extend:DI
6218 (match_operand:SI 1 "gpc_reg_operand" ""))
6220 (match_operand:SI 2 "gpc_reg_operand" "")))
6227 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6232 (define_insn "umulsi3_highpart_mq"
6233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6235 (lshiftrt:DI (mult:DI (zero_extend:DI
6236 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6238 (match_operand:SI 2 "gpc_reg_operand" "r")))
6240 (clobber (match_scratch:SI 3 "=q"))]
6241 "TARGET_POWERPC && TARGET_POWER"
6243 [(set_attr "type" "imul")])
6245 (define_insn "*umulsi3_highpart_no_mq"
6246 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6248 (lshiftrt:DI (mult:DI (zero_extend:DI
6249 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6251 (match_operand:SI 2 "gpc_reg_operand" "r")))
6253 "TARGET_POWERPC && ! TARGET_POWER"
6255 [(set_attr "type" "imul")])
6257 ;; If operands 0 and 2 are in the same register, we have a problem. But
6258 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6259 ;; why we have the strange constraints below.
6260 (define_insn "ashldi3_power"
6261 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6262 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6263 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6264 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6267 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6268 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6269 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6270 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6271 [(set_attr "length" "8")])
6273 (define_insn "lshrdi3_power"
6274 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6275 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6276 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6277 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6280 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6281 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6282 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6283 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6284 [(set_attr "length" "8")])
6286 ;; Shift by a variable amount is too complex to be worth open-coding. We
6287 ;; just handle shifts by constants.
6288 (define_insn "ashrdi3_power"
6289 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6290 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6291 (match_operand:SI 2 "const_int_operand" "M,i")))
6292 (clobber (match_scratch:SI 3 "=X,q"))]
6295 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6296 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6297 [(set_attr "length" "8")])
6299 (define_insn "ashrdi3_no_power"
6300 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6301 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6302 (match_operand:SI 2 "const_int_operand" "M,i")))]
6303 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6305 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6306 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6307 [(set_attr "type" "two,three")
6308 (set_attr "length" "8,12")])
6310 (define_insn "*ashrdisi3_noppc64"
6311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6312 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6313 (const_int 32)) 4))]
6314 "TARGET_32BIT && !TARGET_POWERPC64"
6317 if (REGNO (operands[0]) == REGNO (operands[1]))
6320 return \"mr %0,%1\";
6322 [(set_attr "length" "4")])
6325 ;; PowerPC64 DImode operations.
6327 (define_insn_and_split "absdi2"
6328 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6329 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6330 (clobber (match_scratch:DI 2 "=&r,&r"))]
6333 "&& reload_completed"
6334 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6335 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6336 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6339 (define_insn_and_split "*nabsdi2"
6340 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6341 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6342 (clobber (match_scratch:DI 2 "=&r,&r"))]
6345 "&& reload_completed"
6346 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6347 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6348 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6351 (define_insn "muldi3"
6352 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6353 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6354 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6360 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6361 (const_string "imul3")
6362 (match_operand:SI 2 "short_cint_operand" "")
6363 (const_string "imul2")]
6364 (const_string "lmul")))])
6366 (define_insn "*muldi3_internal1"
6367 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6368 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6369 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6371 (clobber (match_scratch:DI 3 "=r,r"))]
6376 [(set_attr "type" "lmul_compare")
6377 (set_attr "length" "4,8")])
6380 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6381 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6382 (match_operand:DI 2 "gpc_reg_operand" ""))
6384 (clobber (match_scratch:DI 3 ""))]
6385 "TARGET_POWERPC64 && reload_completed"
6387 (mult:DI (match_dup 1) (match_dup 2)))
6389 (compare:CC (match_dup 3)
6393 (define_insn "*muldi3_internal2"
6394 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6395 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6396 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6398 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6399 (mult:DI (match_dup 1) (match_dup 2)))]
6404 [(set_attr "type" "lmul_compare")
6405 (set_attr "length" "4,8")])
6408 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6409 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6410 (match_operand:DI 2 "gpc_reg_operand" ""))
6412 (set (match_operand:DI 0 "gpc_reg_operand" "")
6413 (mult:DI (match_dup 1) (match_dup 2)))]
6414 "TARGET_POWERPC64 && reload_completed"
6416 (mult:DI (match_dup 1) (match_dup 2)))
6418 (compare:CC (match_dup 0)
6422 (define_insn "smuldi3_highpart"
6423 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6425 (lshiftrt:TI (mult:TI (sign_extend:TI
6426 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6428 (match_operand:DI 2 "gpc_reg_operand" "r")))
6432 [(set_attr "type" "lmul")])
6434 (define_insn "umuldi3_highpart"
6435 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6437 (lshiftrt:TI (mult:TI (zero_extend:TI
6438 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6440 (match_operand:DI 2 "gpc_reg_operand" "r")))
6444 [(set_attr "type" "lmul")])
6446 (define_insn "rotldi3"
6447 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6448 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6449 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6451 "rld%I2cl %0,%1,%H2,0")
6453 (define_insn "*rotldi3_internal2"
6454 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6455 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6456 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6458 (clobber (match_scratch:DI 3 "=r,r"))]
6461 rld%I2cl. %3,%1,%H2,0
6463 [(set_attr "type" "delayed_compare")
6464 (set_attr "length" "4,8")])
6467 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6468 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6469 (match_operand:DI 2 "reg_or_cint_operand" ""))
6471 (clobber (match_scratch:DI 3 ""))]
6472 "TARGET_POWERPC64 && reload_completed"
6474 (rotate:DI (match_dup 1) (match_dup 2)))
6476 (compare:CC (match_dup 3)
6480 (define_insn "*rotldi3_internal3"
6481 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6482 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6483 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6485 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6486 (rotate:DI (match_dup 1) (match_dup 2)))]
6489 rld%I2cl. %0,%1,%H2,0
6491 [(set_attr "type" "delayed_compare")
6492 (set_attr "length" "4,8")])
6495 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6496 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6497 (match_operand:DI 2 "reg_or_cint_operand" ""))
6499 (set (match_operand:DI 0 "gpc_reg_operand" "")
6500 (rotate:DI (match_dup 1) (match_dup 2)))]
6501 "TARGET_POWERPC64 && reload_completed"
6503 (rotate:DI (match_dup 1) (match_dup 2)))
6505 (compare:CC (match_dup 0)
6509 (define_insn "*rotldi3_internal4"
6510 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6511 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6512 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6513 (match_operand:DI 3 "mask64_operand" "n")))]
6515 "rld%I2c%B3 %0,%1,%H2,%S3")
6517 (define_insn "*rotldi3_internal5"
6518 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6520 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6521 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6522 (match_operand:DI 3 "mask64_operand" "n,n"))
6524 (clobber (match_scratch:DI 4 "=r,r"))]
6527 rld%I2c%B3. %4,%1,%H2,%S3
6529 [(set_attr "type" "delayed_compare")
6530 (set_attr "length" "4,8")])
6533 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6535 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6536 (match_operand:DI 2 "reg_or_cint_operand" ""))
6537 (match_operand:DI 3 "mask64_operand" ""))
6539 (clobber (match_scratch:DI 4 ""))]
6540 "TARGET_POWERPC64 && reload_completed"
6542 (and:DI (rotate:DI (match_dup 1)
6546 (compare:CC (match_dup 4)
6550 (define_insn "*rotldi3_internal6"
6551 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6553 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6554 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6555 (match_operand:DI 3 "mask64_operand" "n,n"))
6557 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6558 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6561 rld%I2c%B3. %0,%1,%H2,%S3
6563 [(set_attr "type" "delayed_compare")
6564 (set_attr "length" "4,8")])
6567 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6569 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6570 (match_operand:DI 2 "reg_or_cint_operand" ""))
6571 (match_operand:DI 3 "mask64_operand" ""))
6573 (set (match_operand:DI 0 "gpc_reg_operand" "")
6574 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6575 "TARGET_POWERPC64 && reload_completed"
6577 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6579 (compare:CC (match_dup 0)
6583 (define_insn "*rotldi3_internal7"
6584 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6587 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6588 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6590 "rld%I2cl %0,%1,%H2,56")
6592 (define_insn "*rotldi3_internal8"
6593 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6594 (compare:CC (zero_extend:DI
6596 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6597 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6599 (clobber (match_scratch:DI 3 "=r,r"))]
6602 rld%I2cl. %3,%1,%H2,56
6604 [(set_attr "type" "delayed_compare")
6605 (set_attr "length" "4,8")])
6608 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6609 (compare:CC (zero_extend:DI
6611 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6612 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6614 (clobber (match_scratch:DI 3 ""))]
6615 "TARGET_POWERPC64 && reload_completed"
6617 (zero_extend:DI (subreg:QI
6618 (rotate:DI (match_dup 1)
6621 (compare:CC (match_dup 3)
6625 (define_insn "*rotldi3_internal9"
6626 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6627 (compare:CC (zero_extend:DI
6629 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6630 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6632 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6633 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6636 rld%I2cl. %0,%1,%H2,56
6638 [(set_attr "type" "delayed_compare")
6639 (set_attr "length" "4,8")])
6642 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6643 (compare:CC (zero_extend:DI
6645 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6646 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6648 (set (match_operand:DI 0 "gpc_reg_operand" "")
6649 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6650 "TARGET_POWERPC64 && reload_completed"
6652 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6654 (compare:CC (match_dup 0)
6658 (define_insn "*rotldi3_internal10"
6659 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6662 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6663 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6665 "rld%I2cl %0,%1,%H2,48")
6667 (define_insn "*rotldi3_internal11"
6668 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6669 (compare:CC (zero_extend:DI
6671 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6672 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6674 (clobber (match_scratch:DI 3 "=r,r"))]
6677 rld%I2cl. %3,%1,%H2,48
6679 [(set_attr "type" "delayed_compare")
6680 (set_attr "length" "4,8")])
6683 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6684 (compare:CC (zero_extend:DI
6686 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6687 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6689 (clobber (match_scratch:DI 3 ""))]
6690 "TARGET_POWERPC64 && reload_completed"
6692 (zero_extend:DI (subreg:HI
6693 (rotate:DI (match_dup 1)
6696 (compare:CC (match_dup 3)
6700 (define_insn "*rotldi3_internal12"
6701 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6702 (compare:CC (zero_extend:DI
6704 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6705 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6707 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6708 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6711 rld%I2cl. %0,%1,%H2,48
6713 [(set_attr "type" "delayed_compare")
6714 (set_attr "length" "4,8")])
6717 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6718 (compare:CC (zero_extend:DI
6720 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6721 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6723 (set (match_operand:DI 0 "gpc_reg_operand" "")
6724 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6725 "TARGET_POWERPC64 && reload_completed"
6727 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6729 (compare:CC (match_dup 0)
6733 (define_insn "*rotldi3_internal13"
6734 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6737 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6738 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6740 "rld%I2cl %0,%1,%H2,32")
6742 (define_insn "*rotldi3_internal14"
6743 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6744 (compare:CC (zero_extend:DI
6746 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6747 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6749 (clobber (match_scratch:DI 3 "=r,r"))]
6752 rld%I2cl. %3,%1,%H2,32
6754 [(set_attr "type" "delayed_compare")
6755 (set_attr "length" "4,8")])
6758 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6759 (compare:CC (zero_extend:DI
6761 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6762 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6764 (clobber (match_scratch:DI 3 ""))]
6765 "TARGET_POWERPC64 && reload_completed"
6767 (zero_extend:DI (subreg:SI
6768 (rotate:DI (match_dup 1)
6771 (compare:CC (match_dup 3)
6775 (define_insn "*rotldi3_internal15"
6776 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6777 (compare:CC (zero_extend:DI
6779 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6780 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6782 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6783 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6786 rld%I2cl. %0,%1,%H2,32
6788 [(set_attr "type" "delayed_compare")
6789 (set_attr "length" "4,8")])
6792 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6793 (compare:CC (zero_extend:DI
6795 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6796 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6798 (set (match_operand:DI 0 "gpc_reg_operand" "")
6799 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6800 "TARGET_POWERPC64 && reload_completed"
6802 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6804 (compare:CC (match_dup 0)
6808 (define_expand "ashldi3"
6809 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6810 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6811 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6812 "TARGET_POWERPC64 || TARGET_POWER"
6815 if (TARGET_POWERPC64)
6817 else if (TARGET_POWER)
6819 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6826 (define_insn "*ashldi3_internal1"
6827 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6828 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6829 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6833 (define_insn "*ashldi3_internal2"
6834 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6835 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6836 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6838 (clobber (match_scratch:DI 3 "=r,r"))]
6843 [(set_attr "type" "delayed_compare")
6844 (set_attr "length" "4,8")])
6847 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6848 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6849 (match_operand:SI 2 "reg_or_cint_operand" ""))
6851 (clobber (match_scratch:DI 3 ""))]
6852 "TARGET_POWERPC64 && reload_completed"
6854 (ashift:DI (match_dup 1) (match_dup 2)))
6856 (compare:CC (match_dup 3)
6860 (define_insn "*ashldi3_internal3"
6861 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6862 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6863 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6865 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6866 (ashift:DI (match_dup 1) (match_dup 2)))]
6871 [(set_attr "type" "delayed_compare")
6872 (set_attr "length" "4,8")])
6875 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6876 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6877 (match_operand:SI 2 "reg_or_cint_operand" ""))
6879 (set (match_operand:DI 0 "gpc_reg_operand" "")
6880 (ashift:DI (match_dup 1) (match_dup 2)))]
6881 "TARGET_POWERPC64 && reload_completed"
6883 (ashift:DI (match_dup 1) (match_dup 2)))
6885 (compare:CC (match_dup 0)
6889 (define_insn "*ashldi3_internal4"
6890 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6891 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6892 (match_operand:SI 2 "const_int_operand" "i"))
6893 (match_operand:DI 3 "const_int_operand" "n")))]
6894 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6895 "rldic %0,%1,%H2,%W3")
6897 (define_insn "ashldi3_internal5"
6898 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6900 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6901 (match_operand:SI 2 "const_int_operand" "i,i"))
6902 (match_operand:DI 3 "const_int_operand" "n,n"))
6904 (clobber (match_scratch:DI 4 "=r,r"))]
6905 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6907 rldic. %4,%1,%H2,%W3
6909 [(set_attr "type" "compare")
6910 (set_attr "length" "4,8")])
6913 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6915 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6916 (match_operand:SI 2 "const_int_operand" ""))
6917 (match_operand:DI 3 "const_int_operand" ""))
6919 (clobber (match_scratch:DI 4 ""))]
6920 "TARGET_POWERPC64 && reload_completed
6921 && includes_rldic_lshift_p (operands[2], operands[3])"
6923 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6926 (compare:CC (match_dup 4)
6930 (define_insn "*ashldi3_internal6"
6931 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6933 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6934 (match_operand:SI 2 "const_int_operand" "i,i"))
6935 (match_operand:DI 3 "const_int_operand" "n,n"))
6937 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6938 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6939 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6941 rldic. %0,%1,%H2,%W3
6943 [(set_attr "type" "compare")
6944 (set_attr "length" "4,8")])
6947 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6949 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6950 (match_operand:SI 2 "const_int_operand" ""))
6951 (match_operand:DI 3 "const_int_operand" ""))
6953 (set (match_operand:DI 0 "gpc_reg_operand" "")
6954 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6955 "TARGET_POWERPC64 && reload_completed
6956 && includes_rldic_lshift_p (operands[2], operands[3])"
6958 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6961 (compare:CC (match_dup 0)
6965 (define_insn "*ashldi3_internal7"
6966 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6967 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6968 (match_operand:SI 2 "const_int_operand" "i"))
6969 (match_operand:DI 3 "mask64_operand" "n")))]
6970 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6971 "rldicr %0,%1,%H2,%S3")
6973 (define_insn "ashldi3_internal8"
6974 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6976 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6977 (match_operand:SI 2 "const_int_operand" "i,i"))
6978 (match_operand:DI 3 "mask64_operand" "n,n"))
6980 (clobber (match_scratch:DI 4 "=r,r"))]
6981 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6983 rldicr. %4,%1,%H2,%S3
6985 [(set_attr "type" "compare")
6986 (set_attr "length" "4,8")])
6989 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6991 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6992 (match_operand:SI 2 "const_int_operand" ""))
6993 (match_operand:DI 3 "mask64_operand" ""))
6995 (clobber (match_scratch:DI 4 ""))]
6996 "TARGET_POWERPC64 && reload_completed
6997 && includes_rldicr_lshift_p (operands[2], operands[3])"
6999 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7002 (compare:CC (match_dup 4)
7006 (define_insn "*ashldi3_internal9"
7007 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7009 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7010 (match_operand:SI 2 "const_int_operand" "i,i"))
7011 (match_operand:DI 3 "mask64_operand" "n,n"))
7013 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7014 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7015 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7017 rldicr. %0,%1,%H2,%S3
7019 [(set_attr "type" "compare")
7020 (set_attr "length" "4,8")])
7023 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7025 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7026 (match_operand:SI 2 "const_int_operand" ""))
7027 (match_operand:DI 3 "mask64_operand" ""))
7029 (set (match_operand:DI 0 "gpc_reg_operand" "")
7030 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7031 "TARGET_POWERPC64 && reload_completed
7032 && includes_rldicr_lshift_p (operands[2], operands[3])"
7034 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7037 (compare:CC (match_dup 0)
7041 (define_expand "lshrdi3"
7042 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7043 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7044 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7045 "TARGET_POWERPC64 || TARGET_POWER"
7048 if (TARGET_POWERPC64)
7050 else if (TARGET_POWER)
7052 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7059 (define_insn "*lshrdi3_internal1"
7060 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7061 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7062 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7066 (define_insn "*lshrdi3_internal2"
7067 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7068 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7069 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7071 (clobber (match_scratch:DI 3 "=r,r"))]
7076 [(set_attr "type" "delayed_compare")
7077 (set_attr "length" "4,8")])
7080 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7081 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7082 (match_operand:SI 2 "reg_or_cint_operand" ""))
7084 (clobber (match_scratch:DI 3 ""))]
7085 "TARGET_POWERPC64 && reload_completed"
7087 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7089 (compare:CC (match_dup 3)
7093 (define_insn "*lshrdi3_internal3"
7094 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7095 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7096 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7098 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7099 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7104 [(set_attr "type" "delayed_compare")
7105 (set_attr "length" "4,8")])
7108 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7109 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7110 (match_operand:SI 2 "reg_or_cint_operand" ""))
7112 (set (match_operand:DI 0 "gpc_reg_operand" "")
7113 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7114 "TARGET_POWERPC64 && reload_completed"
7116 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7118 (compare:CC (match_dup 0)
7122 (define_expand "ashrdi3"
7123 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7124 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7125 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7129 if (TARGET_POWERPC64)
7131 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7133 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7136 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7137 && WORDS_BIG_ENDIAN)
7139 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7146 (define_insn "*ashrdi3_internal1"
7147 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7148 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7149 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7151 "srad%I2 %0,%1,%H2")
7153 (define_insn "*ashrdi3_internal2"
7154 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7155 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7156 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7158 (clobber (match_scratch:DI 3 "=r,r"))]
7163 [(set_attr "type" "delayed_compare")
7164 (set_attr "length" "4,8")])
7167 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7168 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7169 (match_operand:SI 2 "reg_or_cint_operand" ""))
7171 (clobber (match_scratch:DI 3 ""))]
7172 "TARGET_POWERPC64 && reload_completed"
7174 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7176 (compare:CC (match_dup 3)
7180 (define_insn "*ashrdi3_internal3"
7181 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7182 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7183 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7185 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7186 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7191 [(set_attr "type" "delayed_compare")
7192 (set_attr "length" "4,8")])
7195 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7196 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7197 (match_operand:SI 2 "reg_or_cint_operand" ""))
7199 (set (match_operand:DI 0 "gpc_reg_operand" "")
7200 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7201 "TARGET_POWERPC64 && reload_completed"
7203 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7205 (compare:CC (match_dup 0)
7209 (define_insn "anddi3"
7210 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7211 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7212 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7213 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7217 rldic%B2 %0,%1,0,%S2
7218 rlwinm %0,%1,0,%m2,%M2
7222 [(set_attr "type" "*,*,*,compare,compare,*")
7223 (set_attr "length" "4,4,4,4,4,8")])
7226 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7227 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7228 (match_operand:DI 2 "mask64_2_operand" "")))
7229 (clobber (match_scratch:CC 3 ""))]
7231 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7232 && !mask_operand (operands[2], DImode)
7233 && !mask64_operand (operands[2], DImode)"
7235 (and:DI (rotate:DI (match_dup 1)
7239 (and:DI (rotate:DI (match_dup 0)
7243 build_mask64_2_operands (operands[2], &operands[4]);
7246 (define_insn "*anddi3_internal2"
7247 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7248 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7249 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7251 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7252 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7256 rldic%B2. %3,%1,0,%S2
7257 rlwinm. %3,%1,0,%m2,%M2
7267 [(set_attr "type" "compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7268 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7271 [(set (match_operand:CC 0 "cc_reg_operand" "")
7272 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7273 (match_operand:DI 2 "mask64_2_operand" ""))
7275 (clobber (match_scratch:DI 3 ""))
7276 (clobber (match_scratch:CC 4 ""))]
7277 "TARGET_64BIT && reload_completed
7278 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7279 && !mask_operand (operands[2], DImode)
7280 && !mask64_operand (operands[2], DImode)"
7282 (and:DI (rotate:DI (match_dup 1)
7285 (parallel [(set (match_dup 0)
7286 (compare:CC (and:DI (rotate:DI (match_dup 3)
7290 (clobber (match_dup 3))])]
7293 build_mask64_2_operands (operands[2], &operands[5]);
7296 (define_insn "*anddi3_internal3"
7297 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7298 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7299 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7301 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7302 (and:DI (match_dup 1) (match_dup 2)))
7303 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7307 rldic%B2. %0,%1,0,%S2
7308 rlwinm. %0,%1,0,%m2,%M2
7318 [(set_attr "type" "compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7319 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7322 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7323 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7324 (match_operand:DI 2 "and64_2_operand" ""))
7326 (set (match_operand:DI 0 "gpc_reg_operand" "")
7327 (and:DI (match_dup 1) (match_dup 2)))
7328 (clobber (match_scratch:CC 4 ""))]
7329 "TARGET_64BIT && reload_completed"
7330 [(parallel [(set (match_dup 0)
7331 (and:DI (match_dup 1) (match_dup 2)))
7332 (clobber (match_dup 4))])
7334 (compare:CC (match_dup 0)
7339 [(set (match_operand:CC 3 "cc_reg_operand" "")
7340 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7341 (match_operand:DI 2 "mask64_2_operand" ""))
7343 (set (match_operand:DI 0 "gpc_reg_operand" "")
7344 (and:DI (match_dup 1) (match_dup 2)))
7345 (clobber (match_scratch:CC 4 ""))]
7346 "TARGET_64BIT && reload_completed
7347 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7348 && !mask_operand (operands[2], DImode)
7349 && !mask64_operand (operands[2], DImode)"
7351 (and:DI (rotate:DI (match_dup 1)
7354 (parallel [(set (match_dup 3)
7355 (compare:CC (and:DI (rotate:DI (match_dup 0)
7360 (and:DI (rotate:DI (match_dup 0)
7365 build_mask64_2_operands (operands[2], &operands[5]);
7368 (define_expand "iordi3"
7369 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7370 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7371 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7375 if (non_logical_cint_operand (operands[2], DImode))
7377 HOST_WIDE_INT value;
7378 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7379 ? operands[0] : gen_reg_rtx (DImode));
7381 if (GET_CODE (operands[2]) == CONST_INT)
7383 value = INTVAL (operands[2]);
7384 emit_insn (gen_iordi3 (tmp, operands[1],
7385 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7389 value = CONST_DOUBLE_LOW (operands[2]);
7390 emit_insn (gen_iordi3 (tmp, operands[1],
7391 immed_double_const (value
7392 & (~ (HOST_WIDE_INT) 0xffff),
7396 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7401 (define_expand "xordi3"
7402 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7403 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7404 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7408 if (non_logical_cint_operand (operands[2], DImode))
7410 HOST_WIDE_INT value;
7411 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7412 ? operands[0] : gen_reg_rtx (DImode));
7414 if (GET_CODE (operands[2]) == CONST_INT)
7416 value = INTVAL (operands[2]);
7417 emit_insn (gen_xordi3 (tmp, operands[1],
7418 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7422 value = CONST_DOUBLE_LOW (operands[2]);
7423 emit_insn (gen_xordi3 (tmp, operands[1],
7424 immed_double_const (value
7425 & (~ (HOST_WIDE_INT) 0xffff),
7429 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7434 (define_insn "*booldi3_internal1"
7435 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7436 (match_operator:DI 3 "boolean_or_operator"
7437 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7438 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7445 (define_insn "*booldi3_internal2"
7446 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7447 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7448 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7449 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7451 (clobber (match_scratch:DI 3 "=r,r"))]
7456 [(set_attr "type" "compare")
7457 (set_attr "length" "4,8")])
7460 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7461 (compare:CC (match_operator:DI 4 "boolean_operator"
7462 [(match_operand:DI 1 "gpc_reg_operand" "")
7463 (match_operand:DI 2 "gpc_reg_operand" "")])
7465 (clobber (match_scratch:DI 3 ""))]
7466 "TARGET_POWERPC64 && reload_completed"
7467 [(set (match_dup 3) (match_dup 4))
7469 (compare:CC (match_dup 3)
7473 (define_insn "*booldi3_internal3"
7474 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7475 (compare:CC (match_operator:DI 4 "boolean_operator"
7476 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7477 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7479 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7485 [(set_attr "type" "compare")
7486 (set_attr "length" "4,8")])
7489 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7490 (compare:CC (match_operator:DI 4 "boolean_operator"
7491 [(match_operand:DI 1 "gpc_reg_operand" "")
7492 (match_operand:DI 2 "gpc_reg_operand" "")])
7494 (set (match_operand:DI 0 "gpc_reg_operand" "")
7496 "TARGET_POWERPC64 && reload_completed"
7497 [(set (match_dup 0) (match_dup 4))
7499 (compare:CC (match_dup 0)
7503 ;; Split a logical operation that we can't do in one insn into two insns,
7504 ;; each of which does one 16-bit part. This is used by combine.
7507 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7508 (match_operator:DI 3 "boolean_or_operator"
7509 [(match_operand:DI 1 "gpc_reg_operand" "")
7510 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7512 [(set (match_dup 0) (match_dup 4))
7513 (set (match_dup 0) (match_dup 5))]
7518 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7520 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7521 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7523 i4 = GEN_INT (value & 0xffff);
7527 i3 = GEN_INT (INTVAL (operands[2])
7528 & (~ (HOST_WIDE_INT) 0xffff));
7529 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7531 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7533 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7537 (define_insn "*boolcdi3_internal1"
7538 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7539 (match_operator:DI 3 "boolean_operator"
7540 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7541 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7545 (define_insn "*boolcdi3_internal2"
7546 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7547 (compare:CC (match_operator:DI 4 "boolean_operator"
7548 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7549 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7551 (clobber (match_scratch:DI 3 "=r,r"))]
7556 [(set_attr "type" "compare")
7557 (set_attr "length" "4,8")])
7560 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7561 (compare:CC (match_operator:DI 4 "boolean_operator"
7562 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7563 (match_operand:DI 2 "gpc_reg_operand" "")])
7565 (clobber (match_scratch:DI 3 ""))]
7566 "TARGET_POWERPC64 && reload_completed"
7567 [(set (match_dup 3) (match_dup 4))
7569 (compare:CC (match_dup 3)
7573 (define_insn "*boolcdi3_internal3"
7574 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7575 (compare:CC (match_operator:DI 4 "boolean_operator"
7576 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7577 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7579 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7585 [(set_attr "type" "compare")
7586 (set_attr "length" "4,8")])
7589 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7590 (compare:CC (match_operator:DI 4 "boolean_operator"
7591 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7592 (match_operand:DI 2 "gpc_reg_operand" "")])
7594 (set (match_operand:DI 0 "gpc_reg_operand" "")
7596 "TARGET_POWERPC64 && reload_completed"
7597 [(set (match_dup 0) (match_dup 4))
7599 (compare:CC (match_dup 0)
7603 (define_insn "*boolccdi3_internal1"
7604 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7605 (match_operator:DI 3 "boolean_operator"
7606 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7607 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7611 (define_insn "*boolccdi3_internal2"
7612 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7613 (compare:CC (match_operator:DI 4 "boolean_operator"
7614 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7615 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7617 (clobber (match_scratch:DI 3 "=r,r"))]
7622 [(set_attr "type" "compare")
7623 (set_attr "length" "4,8")])
7626 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7627 (compare:CC (match_operator:DI 4 "boolean_operator"
7628 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7629 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7631 (clobber (match_scratch:DI 3 ""))]
7632 "TARGET_POWERPC64 && reload_completed"
7633 [(set (match_dup 3) (match_dup 4))
7635 (compare:CC (match_dup 3)
7639 (define_insn "*boolccdi3_internal3"
7640 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7641 (compare:CC (match_operator:DI 4 "boolean_operator"
7642 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7643 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7645 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7651 [(set_attr "type" "compare")
7652 (set_attr "length" "4,8")])
7655 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7656 (compare:CC (match_operator:DI 4 "boolean_operator"
7657 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7658 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7660 (set (match_operand:DI 0 "gpc_reg_operand" "")
7662 "TARGET_POWERPC64 && reload_completed"
7663 [(set (match_dup 0) (match_dup 4))
7665 (compare:CC (match_dup 0)
7669 ;; Now define ways of moving data around.
7671 ;; Set up a register with a value from the GOT table
7673 (define_expand "movsi_got"
7674 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7675 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7676 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7677 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7680 if (GET_CODE (operands[1]) == CONST)
7682 rtx offset = const0_rtx;
7683 HOST_WIDE_INT value;
7685 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7686 value = INTVAL (offset);
7689 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7690 emit_insn (gen_movsi_got (tmp, operands[1]));
7691 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7696 operands[2] = rs6000_got_register (operands[1]);
7699 (define_insn "*movsi_got_internal"
7700 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7701 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7702 (match_operand:SI 2 "gpc_reg_operand" "b")]
7704 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7705 "{l|lwz} %0,%a1@got(%2)"
7706 [(set_attr "type" "load")])
7708 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7709 ;; didn't get allocated to a hard register.
7711 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7712 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7713 (match_operand:SI 2 "memory_operand" "")]
7715 "DEFAULT_ABI == ABI_V4
7717 && (reload_in_progress || reload_completed)"
7718 [(set (match_dup 0) (match_dup 2))
7719 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7723 ;; For SI, we special-case integers that can't be loaded in one insn. We
7724 ;; do the load 16-bits at a time. We could do this by loading from memory,
7725 ;; and this is even supposed to be faster, but it is simpler not to get
7726 ;; integers in the TOC.
7727 (define_insn "movsi_low"
7728 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7729 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7730 (match_operand 2 "" ""))))]
7731 "TARGET_MACHO && ! TARGET_64BIT"
7732 "{l|lwz} %0,lo16(%2)(%1)"
7733 [(set_attr "type" "load")
7734 (set_attr "length" "4")])
7736 (define_insn "*movsi_internal1"
7737 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7738 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7739 "gpc_reg_operand (operands[0], SImode)
7740 || gpc_reg_operand (operands[1], SImode)"
7744 {l%U1%X1|lwz%U1%X1} %0,%1
7745 {st%U0%X0|stw%U0%X0} %1,%0
7755 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7756 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7758 ;; Split a load of a large constant into the appropriate two-insn
7762 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7763 (match_operand:SI 1 "const_int_operand" ""))]
7764 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7765 && (INTVAL (operands[1]) & 0xffff) != 0"
7769 (ior:SI (match_dup 0)
7772 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7774 if (tem == operands[0])
7780 (define_insn "*mov<mode>_internal2"
7781 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7782 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7784 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7787 {cmpi|cmp<wd>i} %2,%0,0
7790 [(set_attr "type" "cmp,compare,cmp")
7791 (set_attr "length" "4,4,8")])
7794 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7795 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7797 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7799 [(set (match_dup 0) (match_dup 1))
7801 (compare:CC (match_dup 0)
7805 (define_insn "*movhi_internal"
7806 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7807 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7808 "gpc_reg_operand (operands[0], HImode)
7809 || gpc_reg_operand (operands[1], HImode)"
7819 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7821 (define_expand "mov<mode>"
7822 [(set (match_operand:INT 0 "general_operand" "")
7823 (match_operand:INT 1 "any_operand" ""))]
7825 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7827 (define_insn "*movqi_internal"
7828 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7829 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7830 "gpc_reg_operand (operands[0], QImode)
7831 || gpc_reg_operand (operands[1], QImode)"
7841 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7843 ;; Here is how to move condition codes around. When we store CC data in
7844 ;; an integer register or memory, we store just the high-order 4 bits.
7845 ;; This lets us not shift in the most common case of CR0.
7846 (define_expand "movcc"
7847 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7848 (match_operand:CC 1 "nonimmediate_operand" ""))]
7852 (define_insn "*movcc_internal1"
7853 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7854 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7855 "register_operand (operands[0], CCmode)
7856 || register_operand (operands[1], CCmode)"
7860 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7862 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7867 {l%U1%X1|lwz%U1%X1} %0,%1
7868 {st%U0%U1|stw%U0%U1} %1,%0"
7870 (cond [(eq_attr "alternative" "0")
7871 (const_string "cr_logical")
7872 (eq_attr "alternative" "1,2")
7873 (const_string "mtcr")
7874 (eq_attr "alternative" "5,7")
7875 (const_string "integer")
7876 (eq_attr "alternative" "6")
7877 (const_string "mfjmpr")
7878 (eq_attr "alternative" "8")
7879 (const_string "mtjmpr")
7880 (eq_attr "alternative" "9")
7881 (const_string "load")
7882 (eq_attr "alternative" "10")
7883 (const_string "store")
7884 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7885 (const_string "mfcrf")
7887 (const_string "mfcr")))
7888 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7890 ;; For floating-point, we normally deal with the floating-point registers
7891 ;; unless -msoft-float is used. The sole exception is that parameter passing
7892 ;; can produce floating-point values in fixed-point registers. Unless the
7893 ;; value is a simple constant or already in memory, we deal with this by
7894 ;; allocating memory and copying the value explicitly via that memory location.
7895 (define_expand "movsf"
7896 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7897 (match_operand:SF 1 "any_operand" ""))]
7899 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7902 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7903 (match_operand:SF 1 "const_double_operand" ""))]
7905 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7906 || (GET_CODE (operands[0]) == SUBREG
7907 && GET_CODE (SUBREG_REG (operands[0])) == REG
7908 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7909 [(set (match_dup 2) (match_dup 3))]
7915 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7916 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7918 if (! TARGET_POWERPC64)
7919 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7921 operands[2] = gen_lowpart (SImode, operands[0]);
7923 operands[3] = gen_int_mode (l, SImode);
7926 (define_insn "*movsf_hardfloat"
7927 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
7928 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7929 "(gpc_reg_operand (operands[0], SFmode)
7930 || gpc_reg_operand (operands[1], SFmode))
7931 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7934 {l%U1%X1|lwz%U1%X1} %0,%1
7935 {st%U0%X0|stw%U0%X0} %1,%0
7945 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
7946 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7948 (define_insn "*movsf_softfloat"
7949 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7950 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7951 "(gpc_reg_operand (operands[0], SFmode)
7952 || gpc_reg_operand (operands[1], SFmode))
7953 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7959 {l%U1%X1|lwz%U1%X1} %0,%1
7960 {st%U0%X0|stw%U0%X0} %1,%0
7967 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
7968 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7971 (define_expand "movdf"
7972 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7973 (match_operand:DF 1 "any_operand" ""))]
7975 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7978 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7979 (match_operand:DF 1 "const_int_operand" ""))]
7980 "! TARGET_POWERPC64 && reload_completed
7981 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7982 || (GET_CODE (operands[0]) == SUBREG
7983 && GET_CODE (SUBREG_REG (operands[0])) == REG
7984 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7985 [(set (match_dup 2) (match_dup 4))
7986 (set (match_dup 3) (match_dup 1))]
7989 int endian = (WORDS_BIG_ENDIAN == 0);
7990 HOST_WIDE_INT value = INTVAL (operands[1]);
7992 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7993 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7994 #if HOST_BITS_PER_WIDE_INT == 32
7995 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7997 operands[4] = GEN_INT (value >> 32);
7998 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8003 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8004 (match_operand:DF 1 "const_double_operand" ""))]
8005 "! TARGET_POWERPC64 && reload_completed
8006 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8007 || (GET_CODE (operands[0]) == SUBREG
8008 && GET_CODE (SUBREG_REG (operands[0])) == REG
8009 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8010 [(set (match_dup 2) (match_dup 4))
8011 (set (match_dup 3) (match_dup 5))]
8014 int endian = (WORDS_BIG_ENDIAN == 0);
8018 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8019 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8021 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8022 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8023 operands[4] = gen_int_mode (l[endian], SImode);
8024 operands[5] = gen_int_mode (l[1 - endian], SImode);
8028 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8029 (match_operand:DF 1 "const_double_operand" ""))]
8030 "TARGET_POWERPC64 && reload_completed
8031 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8032 || (GET_CODE (operands[0]) == SUBREG
8033 && GET_CODE (SUBREG_REG (operands[0])) == REG
8034 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8035 [(set (match_dup 2) (match_dup 3))]
8038 int endian = (WORDS_BIG_ENDIAN == 0);
8041 #if HOST_BITS_PER_WIDE_INT >= 64
8045 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8046 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8048 operands[2] = gen_lowpart (DImode, operands[0]);
8049 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8050 #if HOST_BITS_PER_WIDE_INT >= 64
8051 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8052 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8054 operands[3] = gen_int_mode (val, DImode);
8056 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8060 ;; Don't have reload use general registers to load a constant. First,
8061 ;; it might not work if the output operand is the equivalent of
8062 ;; a non-offsettable memref, but also it is less efficient than loading
8063 ;; the constant into an FP register, since it will probably be used there.
8064 ;; The "??" is a kludge until we can figure out a more reasonable way
8065 ;; of handling these non-offsettable values.
8066 (define_insn "*movdf_hardfloat32"
8067 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8068 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8069 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8070 && (gpc_reg_operand (operands[0], DFmode)
8071 || gpc_reg_operand (operands[1], DFmode))"
8074 switch (which_alternative)
8079 /* We normally copy the low-numbered register first. However, if
8080 the first register operand 0 is the same as the second register
8081 of operand 1, we must copy in the opposite order. */
8082 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8083 return \"mr %L0,%L1\;mr %0,%1\";
8085 return \"mr %0,%1\;mr %L0,%L1\";
8087 if (GET_CODE (operands[1]) == MEM
8088 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[1], 0),
8089 reload_completed || reload_in_progress)
8090 || rs6000_legitimate_small_data_p (DFmode, XEXP (operands[1], 0))
8091 || GET_CODE (XEXP (operands[1], 0)) == REG
8092 || GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8093 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8094 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC))
8096 /* If the low-address word is used in the address, we must load
8097 it last. Otherwise, load it first. Note that we cannot have
8098 auto-increment in that case since the address register is
8099 known to be dead. */
8100 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8102 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8104 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8110 addreg = find_addr_reg (XEXP (operands[1], 0));
8111 if (refers_to_regno_p (REGNO (operands[0]),
8112 REGNO (operands[0]) + 1,
8115 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8116 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8117 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8118 return \"{lx|lwzx} %0,%1\";
8122 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8123 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8124 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8125 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8130 if (GET_CODE (operands[0]) == MEM
8131 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[0], 0),
8132 reload_completed || reload_in_progress)
8133 || rs6000_legitimate_small_data_p (DFmode, XEXP (operands[0], 0))
8134 || GET_CODE (XEXP (operands[0], 0)) == REG
8135 || GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8136 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8137 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))
8138 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8143 addreg = find_addr_reg (XEXP (operands[0], 0));
8144 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8145 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8146 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8147 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8151 return \"fmr %0,%1\";
8153 return \"lfd%U1%X1 %0,%1\";
8155 return \"stfd%U0%X0 %1,%0\";
8162 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8163 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8165 (define_insn "*movdf_softfloat32"
8166 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8167 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8168 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8169 && (gpc_reg_operand (operands[0], DFmode)
8170 || gpc_reg_operand (operands[1], DFmode))"
8173 switch (which_alternative)
8178 /* We normally copy the low-numbered register first. However, if
8179 the first register operand 0 is the same as the second register of
8180 operand 1, we must copy in the opposite order. */
8181 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8182 return \"mr %L0,%L1\;mr %0,%1\";
8184 return \"mr %0,%1\;mr %L0,%L1\";
8186 /* If the low-address word is used in the address, we must load
8187 it last. Otherwise, load it first. Note that we cannot have
8188 auto-increment in that case since the address register is
8189 known to be dead. */
8190 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8192 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8194 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8196 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8203 [(set_attr "type" "two,load,store,*,*,*")
8204 (set_attr "length" "8,8,8,8,12,16")])
8206 ; ld/std require word-aligned displacements -> 'Y' constraint.
8207 ; List Y->r and r->Y before r->r for reload.
8208 (define_insn "*movdf_hardfloat64"
8209 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8210 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8211 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8212 && (gpc_reg_operand (operands[0], DFmode)
8213 || gpc_reg_operand (operands[1], DFmode))"
8227 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8228 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8230 (define_insn "*movdf_softfloat64"
8231 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8232 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8233 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8234 && (gpc_reg_operand (operands[0], DFmode)
8235 || gpc_reg_operand (operands[1], DFmode))"
8246 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8247 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8249 (define_expand "movtf"
8250 [(set (match_operand:TF 0 "general_operand" "")
8251 (match_operand:TF 1 "any_operand" ""))]
8252 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8253 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8254 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8256 ; It's important to list the o->f and f->o moves before f->f because
8257 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8258 ; which doesn't make progress. Likewise r->Y must be before r->r.
8259 (define_insn_and_split "*movtf_internal"
8260 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8261 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8262 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8263 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8264 && (gpc_reg_operand (operands[0], TFmode)
8265 || gpc_reg_operand (operands[1], TFmode))"
8267 "&& reload_completed"
8269 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8270 [(set_attr "length" "8,8,8,20,20,16")])
8272 (define_expand "extenddftf2"
8273 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8274 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8275 (use (match_dup 2))])]
8276 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8277 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8279 operands[2] = CONST0_RTX (DFmode);
8282 (define_insn_and_split "*extenddftf2_internal"
8283 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8284 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8285 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8286 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8287 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8289 "&& reload_completed"
8292 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8293 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8294 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8296 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8301 (define_expand "extendsftf2"
8302 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8303 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8304 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8305 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8307 rtx tmp = gen_reg_rtx (DFmode);
8308 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8309 emit_insn (gen_extenddftf2 (operands[0], tmp));
8313 (define_expand "trunctfdf2"
8314 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8315 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8316 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8317 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8320 (define_insn_and_split "trunctfdf2_internal1"
8321 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8322 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8323 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
8324 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8328 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8331 emit_note (NOTE_INSN_DELETED);
8334 [(set_attr "type" "fp")])
8336 (define_insn "trunctfdf2_internal2"
8337 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8338 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8339 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
8340 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8342 [(set_attr "type" "fp")])
8344 (define_insn_and_split "trunctfsf2"
8345 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8346 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8347 (clobber (match_scratch:DF 2 "=f"))]
8348 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8349 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8351 "&& reload_completed"
8353 (float_truncate:DF (match_dup 1)))
8355 (float_truncate:SF (match_dup 2)))]
8358 (define_expand "floatsitf2"
8359 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8360 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8361 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8362 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8364 rtx tmp = gen_reg_rtx (DFmode);
8365 expand_float (tmp, operands[1], false);
8366 emit_insn (gen_extenddftf2 (operands[0], tmp));
8370 ; fadd, but rounding towards zero.
8371 ; This is probably not the optimal code sequence.
8372 (define_insn "fix_trunc_helper"
8373 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8374 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8375 UNSPEC_FIX_TRUNC_TF))
8376 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8377 "TARGET_HARD_FLOAT && TARGET_FPRS"
8378 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8379 [(set_attr "type" "fp")
8380 (set_attr "length" "20")])
8382 (define_expand "fix_trunctfsi2"
8383 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8384 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8385 (clobber (match_dup 2))
8386 (clobber (match_dup 3))
8387 (clobber (match_dup 4))
8388 (clobber (match_dup 5))])]
8389 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8390 && (TARGET_POWER2 || TARGET_POWERPC)
8391 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8393 operands[2] = gen_reg_rtx (DFmode);
8394 operands[3] = gen_reg_rtx (DFmode);
8395 operands[4] = gen_reg_rtx (DImode);
8396 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8399 (define_insn_and_split "*fix_trunctfsi2_internal"
8400 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8401 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8402 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8403 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8404 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8405 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8406 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8407 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8409 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[5]))"
8413 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8415 gcc_assert (MEM_P (operands[5]));
8416 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8418 emit_insn (gen_fctiwz (operands[4], operands[2]));
8419 emit_move_insn (operands[5], operands[4]);
8420 emit_move_insn (operands[0], lowword);
8424 (define_insn "negtf2"
8425 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8426 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8427 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8428 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8431 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8432 return \"fneg %L0,%L1\;fneg %0,%1\";
8434 return \"fneg %0,%1\;fneg %L0,%L1\";
8436 [(set_attr "type" "fp")
8437 (set_attr "length" "8")])
8439 (define_expand "abstf2"
8440 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8441 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8442 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8443 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8446 rtx label = gen_label_rtx ();
8447 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8452 (define_expand "abstf2_internal"
8453 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8454 (match_operand:TF 1 "gpc_reg_operand" "f"))
8455 (set (match_dup 3) (match_dup 5))
8456 (set (match_dup 5) (abs:DF (match_dup 5)))
8457 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8458 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8459 (label_ref (match_operand 2 "" ""))
8461 (set (match_dup 6) (neg:DF (match_dup 6)))]
8462 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8463 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8466 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8467 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8468 operands[3] = gen_reg_rtx (DFmode);
8469 operands[4] = gen_reg_rtx (CCFPmode);
8470 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8471 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8474 ;; Next come the multi-word integer load and store and the load and store
8477 ; List r->r after r->"o<>", otherwise reload will try to reload a
8478 ; non-offsettable address by using r->r which won't make progress.
8479 (define_insn "*movdi_internal32"
8480 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8481 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8483 && (gpc_reg_operand (operands[0], DImode)
8484 || gpc_reg_operand (operands[1], DImode))"
8493 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8496 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8497 (match_operand:DI 1 "const_int_operand" ""))]
8498 "! TARGET_POWERPC64 && reload_completed"
8499 [(set (match_dup 2) (match_dup 4))
8500 (set (match_dup 3) (match_dup 1))]
8503 HOST_WIDE_INT value = INTVAL (operands[1]);
8504 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8506 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8508 #if HOST_BITS_PER_WIDE_INT == 32
8509 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8511 operands[4] = GEN_INT (value >> 32);
8512 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8517 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8518 (match_operand:DI 1 "input_operand" ""))]
8519 "reload_completed && !TARGET_POWERPC64
8520 && gpr_or_gpr_p (operands[0], operands[1])"
8522 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8524 (define_insn "*movdi_internal64"
8525 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8526 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8528 && (gpc_reg_operand (operands[0], DImode)
8529 || gpc_reg_operand (operands[1], DImode))"
8544 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8545 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8547 ;; immediate value valid for a single instruction hiding in a const_double
8549 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8550 (match_operand:DI 1 "const_double_operand" "F"))]
8551 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8552 && GET_CODE (operands[1]) == CONST_DOUBLE
8553 && num_insns_constant (operands[1], DImode) == 1"
8556 return ((unsigned HOST_WIDE_INT)
8557 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8558 ? \"li %0,%1\" : \"lis %0,%v1\";
8561 ;; Generate all one-bits and clear left or right.
8562 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8564 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8565 (match_operand:DI 1 "mask64_operand" ""))]
8566 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8567 [(set (match_dup 0) (const_int -1))
8569 (and:DI (rotate:DI (match_dup 0)
8574 ;; Split a load of a large constant into the appropriate five-instruction
8575 ;; sequence. Handle anything in a constant number of insns.
8576 ;; When non-easy constants can go in the TOC, this should use
8577 ;; easy_fp_constant predicate.
8579 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8580 (match_operand:DI 1 "const_int_operand" ""))]
8581 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8582 [(set (match_dup 0) (match_dup 2))
8583 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8585 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8587 if (tem == operands[0])
8594 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8595 (match_operand:DI 1 "const_double_operand" ""))]
8596 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8597 [(set (match_dup 0) (match_dup 2))
8598 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8600 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8602 if (tem == operands[0])
8608 ;; TImode is similar, except that we usually want to compute the address into
8609 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8610 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8612 ;; We say that MQ is clobbered in the last alternative because the first
8613 ;; alternative would never get used otherwise since it would need a reload
8614 ;; while the 2nd alternative would not. We put memory cases first so they
8615 ;; are preferred. Otherwise, we'd try to reload the output instead of
8616 ;; giving the SCRATCH mq.
8618 (define_insn "*movti_power"
8619 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8620 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8621 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8622 "TARGET_POWER && ! TARGET_POWERPC64
8623 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8626 switch (which_alternative)
8633 return \"{stsi|stswi} %1,%P0,16\";
8638 /* If the address is not used in the output, we can use lsi. Otherwise,
8639 fall through to generating four loads. */
8641 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8642 return \"{lsi|lswi} %0,%P1,16\";
8643 /* ... fall through ... */
8649 [(set_attr "type" "store,store,*,load,load,*")])
8651 (define_insn "*movti_string"
8652 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8653 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8654 "! TARGET_POWER && ! TARGET_POWERPC64
8655 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8658 switch (which_alternative)
8664 return \"{stsi|stswi} %1,%P0,16\";
8669 /* If the address is not used in the output, we can use lsi. Otherwise,
8670 fall through to generating four loads. */
8672 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8673 return \"{lsi|lswi} %0,%P1,16\";
8674 /* ... fall through ... */
8680 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
8682 (define_insn "*movti_ppc64"
8683 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8684 (match_operand:TI 1 "input_operand" "r,r,m"))]
8685 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8686 || gpc_reg_operand (operands[1], TImode))"
8688 [(set_attr "type" "*,load,store")])
8691 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8692 (match_operand:TI 1 "const_double_operand" ""))]
8694 [(set (match_dup 2) (match_dup 4))
8695 (set (match_dup 3) (match_dup 5))]
8698 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8700 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8702 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8704 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8705 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8707 else if (GET_CODE (operands[1]) == CONST_INT)
8709 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8710 operands[5] = operands[1];
8717 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8718 (match_operand:TI 1 "input_operand" ""))]
8720 && gpr_or_gpr_p (operands[0], operands[1])"
8722 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8724 (define_expand "load_multiple"
8725 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8726 (match_operand:SI 1 "" ""))
8727 (use (match_operand:SI 2 "" ""))])]
8728 "TARGET_STRING && !TARGET_POWERPC64"
8736 /* Support only loading a constant number of fixed-point registers from
8737 memory and only bother with this if more than two; the machine
8738 doesn't support more than eight. */
8739 if (GET_CODE (operands[2]) != CONST_INT
8740 || INTVAL (operands[2]) <= 2
8741 || INTVAL (operands[2]) > 8
8742 || GET_CODE (operands[1]) != MEM
8743 || GET_CODE (operands[0]) != REG
8744 || REGNO (operands[0]) >= 32)
8747 count = INTVAL (operands[2]);
8748 regno = REGNO (operands[0]);
8750 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8751 op1 = replace_equiv_address (operands[1],
8752 force_reg (SImode, XEXP (operands[1], 0)));
8754 for (i = 0; i < count; i++)
8755 XVECEXP (operands[3], 0, i)
8756 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8757 adjust_address_nv (op1, SImode, i * 4));
8760 (define_insn "*ldmsi8"
8761 [(match_parallel 0 "load_multiple_operation"
8762 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8763 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8764 (set (match_operand:SI 3 "gpc_reg_operand" "")
8765 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8766 (set (match_operand:SI 4 "gpc_reg_operand" "")
8767 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8768 (set (match_operand:SI 5 "gpc_reg_operand" "")
8769 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8770 (set (match_operand:SI 6 "gpc_reg_operand" "")
8771 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8772 (set (match_operand:SI 7 "gpc_reg_operand" "")
8773 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8774 (set (match_operand:SI 8 "gpc_reg_operand" "")
8775 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8776 (set (match_operand:SI 9 "gpc_reg_operand" "")
8777 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8778 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8780 { return rs6000_output_load_multiple (operands); }"
8781 [(set_attr "type" "load_ux")
8782 (set_attr "length" "32")])
8784 (define_insn "*ldmsi7"
8785 [(match_parallel 0 "load_multiple_operation"
8786 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8787 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8788 (set (match_operand:SI 3 "gpc_reg_operand" "")
8789 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8790 (set (match_operand:SI 4 "gpc_reg_operand" "")
8791 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8792 (set (match_operand:SI 5 "gpc_reg_operand" "")
8793 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8794 (set (match_operand:SI 6 "gpc_reg_operand" "")
8795 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8796 (set (match_operand:SI 7 "gpc_reg_operand" "")
8797 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8798 (set (match_operand:SI 8 "gpc_reg_operand" "")
8799 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8800 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8802 { return rs6000_output_load_multiple (operands); }"
8803 [(set_attr "type" "load_ux")
8804 (set_attr "length" "32")])
8806 (define_insn "*ldmsi6"
8807 [(match_parallel 0 "load_multiple_operation"
8808 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8809 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8810 (set (match_operand:SI 3 "gpc_reg_operand" "")
8811 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8812 (set (match_operand:SI 4 "gpc_reg_operand" "")
8813 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8814 (set (match_operand:SI 5 "gpc_reg_operand" "")
8815 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8816 (set (match_operand:SI 6 "gpc_reg_operand" "")
8817 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8818 (set (match_operand:SI 7 "gpc_reg_operand" "")
8819 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8820 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8822 { return rs6000_output_load_multiple (operands); }"
8823 [(set_attr "type" "load_ux")
8824 (set_attr "length" "32")])
8826 (define_insn "*ldmsi5"
8827 [(match_parallel 0 "load_multiple_operation"
8828 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8829 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8830 (set (match_operand:SI 3 "gpc_reg_operand" "")
8831 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8832 (set (match_operand:SI 4 "gpc_reg_operand" "")
8833 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8834 (set (match_operand:SI 5 "gpc_reg_operand" "")
8835 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8836 (set (match_operand:SI 6 "gpc_reg_operand" "")
8837 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8838 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8840 { return rs6000_output_load_multiple (operands); }"
8841 [(set_attr "type" "load_ux")
8842 (set_attr "length" "32")])
8844 (define_insn "*ldmsi4"
8845 [(match_parallel 0 "load_multiple_operation"
8846 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8847 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8848 (set (match_operand:SI 3 "gpc_reg_operand" "")
8849 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8850 (set (match_operand:SI 4 "gpc_reg_operand" "")
8851 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8852 (set (match_operand:SI 5 "gpc_reg_operand" "")
8853 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8854 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8856 { return rs6000_output_load_multiple (operands); }"
8857 [(set_attr "type" "load_ux")
8858 (set_attr "length" "32")])
8860 (define_insn "*ldmsi3"
8861 [(match_parallel 0 "load_multiple_operation"
8862 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8863 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8864 (set (match_operand:SI 3 "gpc_reg_operand" "")
8865 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8866 (set (match_operand:SI 4 "gpc_reg_operand" "")
8867 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8868 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8870 { return rs6000_output_load_multiple (operands); }"
8871 [(set_attr "type" "load_ux")
8872 (set_attr "length" "32")])
8874 (define_expand "store_multiple"
8875 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8876 (match_operand:SI 1 "" ""))
8877 (clobber (scratch:SI))
8878 (use (match_operand:SI 2 "" ""))])]
8879 "TARGET_STRING && !TARGET_POWERPC64"
8888 /* Support only storing a constant number of fixed-point registers to
8889 memory and only bother with this if more than two; the machine
8890 doesn't support more than eight. */
8891 if (GET_CODE (operands[2]) != CONST_INT
8892 || INTVAL (operands[2]) <= 2
8893 || INTVAL (operands[2]) > 8
8894 || GET_CODE (operands[0]) != MEM
8895 || GET_CODE (operands[1]) != REG
8896 || REGNO (operands[1]) >= 32)
8899 count = INTVAL (operands[2]);
8900 regno = REGNO (operands[1]);
8902 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8903 to = force_reg (SImode, XEXP (operands[0], 0));
8904 op0 = replace_equiv_address (operands[0], to);
8906 XVECEXP (operands[3], 0, 0)
8907 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8908 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8909 gen_rtx_SCRATCH (SImode));
8911 for (i = 1; i < count; i++)
8912 XVECEXP (operands[3], 0, i + 1)
8913 = gen_rtx_SET (VOIDmode,
8914 adjust_address_nv (op0, SImode, i * 4),
8915 gen_rtx_REG (SImode, regno + i));
8918 (define_insn "*store_multiple_power"
8919 [(match_parallel 0 "store_multiple_operation"
8920 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8921 (match_operand:SI 2 "gpc_reg_operand" "r"))
8922 (clobber (match_scratch:SI 3 "=q"))])]
8923 "TARGET_STRING && TARGET_POWER"
8924 "{stsi|stswi} %2,%P1,%O0"
8925 [(set_attr "type" "store")])
8927 (define_insn "*stmsi8"
8928 [(match_parallel 0 "store_multiple_operation"
8929 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8930 (match_operand:SI 2 "gpc_reg_operand" "r"))
8931 (clobber (match_scratch:SI 3 "X"))
8932 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8933 (match_operand:SI 4 "gpc_reg_operand" "r"))
8934 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8935 (match_operand:SI 5 "gpc_reg_operand" "r"))
8936 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8937 (match_operand:SI 6 "gpc_reg_operand" "r"))
8938 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8939 (match_operand:SI 7 "gpc_reg_operand" "r"))
8940 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8941 (match_operand:SI 8 "gpc_reg_operand" "r"))
8942 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8943 (match_operand:SI 9 "gpc_reg_operand" "r"))
8944 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8945 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8946 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8947 "{stsi|stswi} %2,%1,%O0"
8948 [(set_attr "type" "store_ux")])
8950 (define_insn "*stmsi7"
8951 [(match_parallel 0 "store_multiple_operation"
8952 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8953 (match_operand:SI 2 "gpc_reg_operand" "r"))
8954 (clobber (match_scratch:SI 3 "X"))
8955 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8956 (match_operand:SI 4 "gpc_reg_operand" "r"))
8957 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8958 (match_operand:SI 5 "gpc_reg_operand" "r"))
8959 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8960 (match_operand:SI 6 "gpc_reg_operand" "r"))
8961 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8962 (match_operand:SI 7 "gpc_reg_operand" "r"))
8963 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8964 (match_operand:SI 8 "gpc_reg_operand" "r"))
8965 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8966 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8967 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
8968 "{stsi|stswi} %2,%1,%O0"
8969 [(set_attr "type" "store_ux")])
8971 (define_insn "*stmsi6"
8972 [(match_parallel 0 "store_multiple_operation"
8973 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8974 (match_operand:SI 2 "gpc_reg_operand" "r"))
8975 (clobber (match_scratch:SI 3 "X"))
8976 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8977 (match_operand:SI 4 "gpc_reg_operand" "r"))
8978 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8979 (match_operand:SI 5 "gpc_reg_operand" "r"))
8980 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8981 (match_operand:SI 6 "gpc_reg_operand" "r"))
8982 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8983 (match_operand:SI 7 "gpc_reg_operand" "r"))
8984 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8985 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
8986 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
8987 "{stsi|stswi} %2,%1,%O0"
8988 [(set_attr "type" "store_ux")])
8990 (define_insn "*stmsi5"
8991 [(match_parallel 0 "store_multiple_operation"
8992 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8993 (match_operand:SI 2 "gpc_reg_operand" "r"))
8994 (clobber (match_scratch:SI 3 "X"))
8995 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8996 (match_operand:SI 4 "gpc_reg_operand" "r"))
8997 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8998 (match_operand:SI 5 "gpc_reg_operand" "r"))
8999 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9000 (match_operand:SI 6 "gpc_reg_operand" "r"))
9001 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9002 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9003 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9004 "{stsi|stswi} %2,%1,%O0"
9005 [(set_attr "type" "store_ux")])
9007 (define_insn "*stmsi4"
9008 [(match_parallel 0 "store_multiple_operation"
9009 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9010 (match_operand:SI 2 "gpc_reg_operand" "r"))
9011 (clobber (match_scratch:SI 3 "X"))
9012 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9013 (match_operand:SI 4 "gpc_reg_operand" "r"))
9014 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9015 (match_operand:SI 5 "gpc_reg_operand" "r"))
9016 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9017 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9018 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9019 "{stsi|stswi} %2,%1,%O0"
9020 [(set_attr "type" "store_ux")])
9022 (define_insn "*stmsi3"
9023 [(match_parallel 0 "store_multiple_operation"
9024 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9025 (match_operand:SI 2 "gpc_reg_operand" "r"))
9026 (clobber (match_scratch:SI 3 "X"))
9027 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9028 (match_operand:SI 4 "gpc_reg_operand" "r"))
9029 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9030 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9031 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9032 "{stsi|stswi} %2,%1,%O0"
9033 [(set_attr "type" "store_ux")])
9035 (define_expand "setmemsi"
9036 [(parallel [(set (match_operand:BLK 0 "" "")
9037 (match_operand 2 "const_int_operand" ""))
9038 (use (match_operand:SI 1 "" ""))
9039 (use (match_operand:SI 3 "" ""))])]
9043 /* If value to set is not zero, use the library routine. */
9044 if (operands[2] != const0_rtx)
9047 if (expand_block_clear (operands))
9053 ;; String/block move insn.
9054 ;; Argument 0 is the destination
9055 ;; Argument 1 is the source
9056 ;; Argument 2 is the length
9057 ;; Argument 3 is the alignment
9059 (define_expand "movmemsi"
9060 [(parallel [(set (match_operand:BLK 0 "" "")
9061 (match_operand:BLK 1 "" ""))
9062 (use (match_operand:SI 2 "" ""))
9063 (use (match_operand:SI 3 "" ""))])]
9067 if (expand_block_move (operands))
9073 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9074 ;; register allocator doesn't have a clue about allocating 8 word registers.
9075 ;; rD/rS = r5 is preferred, efficient form.
9076 (define_expand "movmemsi_8reg"
9077 [(parallel [(set (match_operand 0 "" "")
9078 (match_operand 1 "" ""))
9079 (use (match_operand 2 "" ""))
9080 (use (match_operand 3 "" ""))
9081 (clobber (reg:SI 5))
9082 (clobber (reg:SI 6))
9083 (clobber (reg:SI 7))
9084 (clobber (reg:SI 8))
9085 (clobber (reg:SI 9))
9086 (clobber (reg:SI 10))
9087 (clobber (reg:SI 11))
9088 (clobber (reg:SI 12))
9089 (clobber (match_scratch:SI 4 ""))])]
9094 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9095 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9096 (use (match_operand:SI 2 "immediate_operand" "i"))
9097 (use (match_operand:SI 3 "immediate_operand" "i"))
9098 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9099 (clobber (reg:SI 6))
9100 (clobber (reg:SI 7))
9101 (clobber (reg:SI 8))
9102 (clobber (reg:SI 9))
9103 (clobber (reg:SI 10))
9104 (clobber (reg:SI 11))
9105 (clobber (reg:SI 12))
9106 (clobber (match_scratch:SI 5 "=q"))]
9107 "TARGET_STRING && TARGET_POWER
9108 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9109 || INTVAL (operands[2]) == 0)
9110 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9111 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9112 && REGNO (operands[4]) == 5"
9113 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9114 [(set_attr "type" "store_ux")
9115 (set_attr "length" "8")])
9118 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9119 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9120 (use (match_operand:SI 2 "immediate_operand" "i"))
9121 (use (match_operand:SI 3 "immediate_operand" "i"))
9122 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9123 (clobber (reg:SI 6))
9124 (clobber (reg:SI 7))
9125 (clobber (reg:SI 8))
9126 (clobber (reg:SI 9))
9127 (clobber (reg:SI 10))
9128 (clobber (reg:SI 11))
9129 (clobber (reg:SI 12))
9130 (clobber (match_scratch:SI 5 "X"))]
9131 "TARGET_STRING && ! TARGET_POWER
9132 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9133 || INTVAL (operands[2]) == 0)
9134 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9135 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9136 && REGNO (operands[4]) == 5"
9137 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9138 [(set_attr "type" "store_ux")
9139 (set_attr "length" "8")])
9141 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9142 ;; register allocator doesn't have a clue about allocating 6 word registers.
9143 ;; rD/rS = r5 is preferred, efficient form.
9144 (define_expand "movmemsi_6reg"
9145 [(parallel [(set (match_operand 0 "" "")
9146 (match_operand 1 "" ""))
9147 (use (match_operand 2 "" ""))
9148 (use (match_operand 3 "" ""))
9149 (clobber (reg:SI 5))
9150 (clobber (reg:SI 6))
9151 (clobber (reg:SI 7))
9152 (clobber (reg:SI 8))
9153 (clobber (reg:SI 9))
9154 (clobber (reg:SI 10))
9155 (clobber (match_scratch:SI 4 ""))])]
9160 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9161 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9162 (use (match_operand:SI 2 "immediate_operand" "i"))
9163 (use (match_operand:SI 3 "immediate_operand" "i"))
9164 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9165 (clobber (reg:SI 6))
9166 (clobber (reg:SI 7))
9167 (clobber (reg:SI 8))
9168 (clobber (reg:SI 9))
9169 (clobber (reg:SI 10))
9170 (clobber (match_scratch:SI 5 "=q"))]
9171 "TARGET_STRING && TARGET_POWER
9172 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9173 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9174 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9175 && REGNO (operands[4]) == 5"
9176 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9177 [(set_attr "type" "store_ux")
9178 (set_attr "length" "8")])
9181 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9182 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9183 (use (match_operand:SI 2 "immediate_operand" "i"))
9184 (use (match_operand:SI 3 "immediate_operand" "i"))
9185 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9186 (clobber (reg:SI 6))
9187 (clobber (reg:SI 7))
9188 (clobber (reg:SI 8))
9189 (clobber (reg:SI 9))
9190 (clobber (reg:SI 10))
9191 (clobber (match_scratch:SI 5 "X"))]
9192 "TARGET_STRING && ! TARGET_POWER
9193 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9194 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9195 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9196 && REGNO (operands[4]) == 5"
9197 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9198 [(set_attr "type" "store_ux")
9199 (set_attr "length" "8")])
9201 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9202 ;; problems with TImode.
9203 ;; rD/rS = r5 is preferred, efficient form.
9204 (define_expand "movmemsi_4reg"
9205 [(parallel [(set (match_operand 0 "" "")
9206 (match_operand 1 "" ""))
9207 (use (match_operand 2 "" ""))
9208 (use (match_operand 3 "" ""))
9209 (clobber (reg:SI 5))
9210 (clobber (reg:SI 6))
9211 (clobber (reg:SI 7))
9212 (clobber (reg:SI 8))
9213 (clobber (match_scratch:SI 4 ""))])]
9218 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9219 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9220 (use (match_operand:SI 2 "immediate_operand" "i"))
9221 (use (match_operand:SI 3 "immediate_operand" "i"))
9222 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9223 (clobber (reg:SI 6))
9224 (clobber (reg:SI 7))
9225 (clobber (reg:SI 8))
9226 (clobber (match_scratch:SI 5 "=q"))]
9227 "TARGET_STRING && TARGET_POWER
9228 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9229 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9230 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9231 && REGNO (operands[4]) == 5"
9232 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9233 [(set_attr "type" "store_ux")
9234 (set_attr "length" "8")])
9237 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9238 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9239 (use (match_operand:SI 2 "immediate_operand" "i"))
9240 (use (match_operand:SI 3 "immediate_operand" "i"))
9241 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9242 (clobber (reg:SI 6))
9243 (clobber (reg:SI 7))
9244 (clobber (reg:SI 8))
9245 (clobber (match_scratch:SI 5 "X"))]
9246 "TARGET_STRING && ! TARGET_POWER
9247 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9248 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9249 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9250 && REGNO (operands[4]) == 5"
9251 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9252 [(set_attr "type" "store_ux")
9253 (set_attr "length" "8")])
9255 ;; Move up to 8 bytes at a time.
9256 (define_expand "movmemsi_2reg"
9257 [(parallel [(set (match_operand 0 "" "")
9258 (match_operand 1 "" ""))
9259 (use (match_operand 2 "" ""))
9260 (use (match_operand 3 "" ""))
9261 (clobber (match_scratch:DI 4 ""))
9262 (clobber (match_scratch:SI 5 ""))])]
9263 "TARGET_STRING && ! TARGET_POWERPC64"
9267 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9268 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9269 (use (match_operand:SI 2 "immediate_operand" "i"))
9270 (use (match_operand:SI 3 "immediate_operand" "i"))
9271 (clobber (match_scratch:DI 4 "=&r"))
9272 (clobber (match_scratch:SI 5 "=q"))]
9273 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9274 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9275 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9276 [(set_attr "type" "store_ux")
9277 (set_attr "length" "8")])
9280 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9281 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9282 (use (match_operand:SI 2 "immediate_operand" "i"))
9283 (use (match_operand:SI 3 "immediate_operand" "i"))
9284 (clobber (match_scratch:DI 4 "=&r"))
9285 (clobber (match_scratch:SI 5 "X"))]
9286 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9287 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9288 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9289 [(set_attr "type" "store_ux")
9290 (set_attr "length" "8")])
9292 ;; Move up to 4 bytes at a time.
9293 (define_expand "movmemsi_1reg"
9294 [(parallel [(set (match_operand 0 "" "")
9295 (match_operand 1 "" ""))
9296 (use (match_operand 2 "" ""))
9297 (use (match_operand 3 "" ""))
9298 (clobber (match_scratch:SI 4 ""))
9299 (clobber (match_scratch:SI 5 ""))])]
9304 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9305 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9306 (use (match_operand:SI 2 "immediate_operand" "i"))
9307 (use (match_operand:SI 3 "immediate_operand" "i"))
9308 (clobber (match_scratch:SI 4 "=&r"))
9309 (clobber (match_scratch:SI 5 "=q"))]
9310 "TARGET_STRING && TARGET_POWER
9311 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9312 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9313 [(set_attr "type" "store_ux")
9314 (set_attr "length" "8")])
9317 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9318 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9319 (use (match_operand:SI 2 "immediate_operand" "i"))
9320 (use (match_operand:SI 3 "immediate_operand" "i"))
9321 (clobber (match_scratch:SI 4 "=&r"))
9322 (clobber (match_scratch:SI 5 "X"))]
9323 "TARGET_STRING && ! TARGET_POWER
9324 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9325 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9326 [(set_attr "type" "store_ux")
9327 (set_attr "length" "8")])
9329 ;; Define insns that do load or store with update. Some of these we can
9330 ;; get by using pre-decrement or pre-increment, but the hardware can also
9331 ;; do cases where the increment is not the size of the object.
9333 ;; In all these cases, we use operands 0 and 1 for the register being
9334 ;; incremented because those are the operands that local-alloc will
9335 ;; tie and these are the pair most likely to be tieable (and the ones
9336 ;; that will benefit the most).
9338 (define_insn "*movdi_update1"
9339 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9340 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9341 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9342 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9343 (plus:DI (match_dup 1) (match_dup 2)))]
9344 "TARGET_POWERPC64 && TARGET_UPDATE"
9348 [(set_attr "type" "load_ux,load_u")])
9350 (define_insn "movdi_<mode>_update"
9351 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9352 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9353 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9354 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9355 (plus:P (match_dup 1) (match_dup 2)))]
9356 "TARGET_POWERPC64 && TARGET_UPDATE"
9360 [(set_attr "type" "store_ux,store_u")])
9362 (define_insn "*movsi_update1"
9363 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9364 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9365 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9366 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9367 (plus:SI (match_dup 1) (match_dup 2)))]
9370 {lux|lwzux} %3,%0,%2
9371 {lu|lwzu} %3,%2(%0)"
9372 [(set_attr "type" "load_ux,load_u")])
9374 (define_insn "*movsi_update2"
9375 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9377 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9378 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9379 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9380 (plus:DI (match_dup 1) (match_dup 2)))]
9383 [(set_attr "type" "load_ext_ux")])
9385 (define_insn "movsi_update"
9386 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9387 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9388 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9389 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9390 (plus:SI (match_dup 1) (match_dup 2)))]
9393 {stux|stwux} %3,%0,%2
9394 {stu|stwu} %3,%2(%0)"
9395 [(set_attr "type" "store_ux,store_u")])
9397 (define_insn "*movhi_update1"
9398 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9399 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9400 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9401 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9402 (plus:SI (match_dup 1) (match_dup 2)))]
9407 [(set_attr "type" "load_ux,load_u")])
9409 (define_insn "*movhi_update2"
9410 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9412 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9413 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9414 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9415 (plus:SI (match_dup 1) (match_dup 2)))]
9420 [(set_attr "type" "load_ux,load_u")])
9422 (define_insn "*movhi_update3"
9423 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9425 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9426 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9427 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9428 (plus:SI (match_dup 1) (match_dup 2)))]
9433 [(set_attr "type" "load_ext_ux,load_ext_u")])
9435 (define_insn "*movhi_update4"
9436 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9437 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9438 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9439 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9440 (plus:SI (match_dup 1) (match_dup 2)))]
9445 [(set_attr "type" "store_ux,store_u")])
9447 (define_insn "*movqi_update1"
9448 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9449 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9450 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9451 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9452 (plus:SI (match_dup 1) (match_dup 2)))]
9457 [(set_attr "type" "load_ux,load_u")])
9459 (define_insn "*movqi_update2"
9460 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9462 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9463 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9464 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9465 (plus:SI (match_dup 1) (match_dup 2)))]
9470 [(set_attr "type" "load_ux,load_u")])
9472 (define_insn "*movqi_update3"
9473 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9474 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9475 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9476 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9477 (plus:SI (match_dup 1) (match_dup 2)))]
9482 [(set_attr "type" "store_ux,store_u")])
9484 (define_insn "*movsf_update1"
9485 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9486 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9487 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9488 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9489 (plus:SI (match_dup 1) (match_dup 2)))]
9490 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9494 [(set_attr "type" "fpload_ux,fpload_u")])
9496 (define_insn "*movsf_update2"
9497 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9498 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9499 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9500 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9501 (plus:SI (match_dup 1) (match_dup 2)))]
9502 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9506 [(set_attr "type" "fpstore_ux,fpstore_u")])
9508 (define_insn "*movsf_update3"
9509 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9510 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9511 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9512 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9513 (plus:SI (match_dup 1) (match_dup 2)))]
9514 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9516 {lux|lwzux} %3,%0,%2
9517 {lu|lwzu} %3,%2(%0)"
9518 [(set_attr "type" "load_ux,load_u")])
9520 (define_insn "*movsf_update4"
9521 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9522 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9523 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9524 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9525 (plus:SI (match_dup 1) (match_dup 2)))]
9526 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9528 {stux|stwux} %3,%0,%2
9529 {stu|stwu} %3,%2(%0)"
9530 [(set_attr "type" "store_ux,store_u")])
9532 (define_insn "*movdf_update1"
9533 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9534 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9535 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9536 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9537 (plus:SI (match_dup 1) (match_dup 2)))]
9538 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9542 [(set_attr "type" "fpload_ux,fpload_u")])
9544 (define_insn "*movdf_update2"
9545 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9546 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9547 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9548 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9549 (plus:SI (match_dup 1) (match_dup 2)))]
9550 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9554 [(set_attr "type" "fpstore_ux,fpstore_u")])
9556 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9558 (define_insn "*lfq_power2"
9559 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
9560 (match_operand:V2DF 1 "memory_operand" ""))]
9562 && TARGET_HARD_FLOAT && TARGET_FPRS"
9566 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9567 (match_operand:DF 1 "memory_operand" ""))
9568 (set (match_operand:DF 2 "gpc_reg_operand" "")
9569 (match_operand:DF 3 "memory_operand" ""))]
9571 && TARGET_HARD_FLOAT && TARGET_FPRS
9572 && registers_ok_for_quad_peep (operands[0], operands[2])
9573 && mems_ok_for_quad_peep (operands[1], operands[3])"
9576 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
9577 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
9579 (define_insn "*stfq_power2"
9580 [(set (match_operand:V2DF 0 "memory_operand" "")
9581 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
9583 && TARGET_HARD_FLOAT && TARGET_FPRS"
9588 [(set (match_operand:DF 0 "memory_operand" "")
9589 (match_operand:DF 1 "gpc_reg_operand" ""))
9590 (set (match_operand:DF 2 "memory_operand" "")
9591 (match_operand:DF 3 "gpc_reg_operand" ""))]
9593 && TARGET_HARD_FLOAT && TARGET_FPRS
9594 && registers_ok_for_quad_peep (operands[1], operands[3])
9595 && mems_ok_for_quad_peep (operands[0], operands[2])"
9598 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
9599 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
9601 ;; after inserting conditional returns we can sometimes have
9602 ;; unnecessary register moves. Unfortunately we cannot have a
9603 ;; modeless peephole here, because some single SImode sets have early
9604 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9605 ;; sequences, using get_attr_length here will smash the operands
9606 ;; array. Neither is there an early_cobbler_p predicate.
9608 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9609 (match_operand:DF 1 "any_operand" ""))
9610 (set (match_operand:DF 2 "gpc_reg_operand" "")
9612 "peep2_reg_dead_p (2, operands[0])"
9613 [(set (match_dup 2) (match_dup 1))])
9616 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9617 (match_operand:SF 1 "any_operand" ""))
9618 (set (match_operand:SF 2 "gpc_reg_operand" "")
9620 "peep2_reg_dead_p (2, operands[0])"
9621 [(set (match_dup 2) (match_dup 1))])
9626 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9627 (define_insn "tls_gd_32"
9628 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9629 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9630 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9632 "HAVE_AS_TLS && !TARGET_64BIT"
9633 "addi %0,%1,%2@got@tlsgd")
9635 (define_insn "tls_gd_64"
9636 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9637 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9638 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9640 "HAVE_AS_TLS && TARGET_64BIT"
9641 "addi %0,%1,%2@got@tlsgd")
9643 (define_insn "tls_ld_32"
9644 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9645 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9647 "HAVE_AS_TLS && !TARGET_64BIT"
9648 "addi %0,%1,%&@got@tlsld")
9650 (define_insn "tls_ld_64"
9651 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9652 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9654 "HAVE_AS_TLS && TARGET_64BIT"
9655 "addi %0,%1,%&@got@tlsld")
9657 (define_insn "tls_dtprel_32"
9658 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9659 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9660 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9662 "HAVE_AS_TLS && !TARGET_64BIT"
9663 "addi %0,%1,%2@dtprel")
9665 (define_insn "tls_dtprel_64"
9666 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9667 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9668 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9670 "HAVE_AS_TLS && TARGET_64BIT"
9671 "addi %0,%1,%2@dtprel")
9673 (define_insn "tls_dtprel_ha_32"
9674 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9675 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9676 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9677 UNSPEC_TLSDTPRELHA))]
9678 "HAVE_AS_TLS && !TARGET_64BIT"
9679 "addis %0,%1,%2@dtprel@ha")
9681 (define_insn "tls_dtprel_ha_64"
9682 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9683 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9684 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9685 UNSPEC_TLSDTPRELHA))]
9686 "HAVE_AS_TLS && TARGET_64BIT"
9687 "addis %0,%1,%2@dtprel@ha")
9689 (define_insn "tls_dtprel_lo_32"
9690 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9691 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9692 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9693 UNSPEC_TLSDTPRELLO))]
9694 "HAVE_AS_TLS && !TARGET_64BIT"
9695 "addi %0,%1,%2@dtprel@l")
9697 (define_insn "tls_dtprel_lo_64"
9698 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9699 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9700 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9701 UNSPEC_TLSDTPRELLO))]
9702 "HAVE_AS_TLS && TARGET_64BIT"
9703 "addi %0,%1,%2@dtprel@l")
9705 (define_insn "tls_got_dtprel_32"
9706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9707 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9708 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9709 UNSPEC_TLSGOTDTPREL))]
9710 "HAVE_AS_TLS && !TARGET_64BIT"
9711 "lwz %0,%2@got@dtprel(%1)")
9713 (define_insn "tls_got_dtprel_64"
9714 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9715 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9716 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9717 UNSPEC_TLSGOTDTPREL))]
9718 "HAVE_AS_TLS && TARGET_64BIT"
9719 "ld %0,%2@got@dtprel(%1)")
9721 (define_insn "tls_tprel_32"
9722 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9723 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9724 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9726 "HAVE_AS_TLS && !TARGET_64BIT"
9727 "addi %0,%1,%2@tprel")
9729 (define_insn "tls_tprel_64"
9730 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9731 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9732 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9734 "HAVE_AS_TLS && TARGET_64BIT"
9735 "addi %0,%1,%2@tprel")
9737 (define_insn "tls_tprel_ha_32"
9738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9739 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9740 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9741 UNSPEC_TLSTPRELHA))]
9742 "HAVE_AS_TLS && !TARGET_64BIT"
9743 "addis %0,%1,%2@tprel@ha")
9745 (define_insn "tls_tprel_ha_64"
9746 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9747 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9748 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9749 UNSPEC_TLSTPRELHA))]
9750 "HAVE_AS_TLS && TARGET_64BIT"
9751 "addis %0,%1,%2@tprel@ha")
9753 (define_insn "tls_tprel_lo_32"
9754 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9755 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9756 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9757 UNSPEC_TLSTPRELLO))]
9758 "HAVE_AS_TLS && !TARGET_64BIT"
9759 "addi %0,%1,%2@tprel@l")
9761 (define_insn "tls_tprel_lo_64"
9762 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9763 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9764 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9765 UNSPEC_TLSTPRELLO))]
9766 "HAVE_AS_TLS && TARGET_64BIT"
9767 "addi %0,%1,%2@tprel@l")
9769 ;; "b" output constraint here and on tls_tls input to support linker tls
9770 ;; optimization. The linker may edit the instructions emitted by a
9771 ;; tls_got_tprel/tls_tls pair to addis,addi.
9772 (define_insn "tls_got_tprel_32"
9773 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9774 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9775 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9776 UNSPEC_TLSGOTTPREL))]
9777 "HAVE_AS_TLS && !TARGET_64BIT"
9778 "lwz %0,%2@got@tprel(%1)")
9780 (define_insn "tls_got_tprel_64"
9781 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9782 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9783 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9784 UNSPEC_TLSGOTTPREL))]
9785 "HAVE_AS_TLS && TARGET_64BIT"
9786 "ld %0,%2@got@tprel(%1)")
9788 (define_insn "tls_tls_32"
9789 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9790 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9791 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9793 "HAVE_AS_TLS && !TARGET_64BIT"
9796 (define_insn "tls_tls_64"
9797 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9798 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9799 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9801 "HAVE_AS_TLS && TARGET_64BIT"
9804 ;; Next come insns related to the calling sequence.
9806 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9807 ;; We move the back-chain and decrement the stack pointer.
9809 (define_expand "allocate_stack"
9810 [(set (match_operand 0 "gpc_reg_operand" "=r")
9811 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9813 (minus (reg 1) (match_dup 1)))]
9816 { rtx chain = gen_reg_rtx (Pmode);
9817 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9820 emit_move_insn (chain, stack_bot);
9822 /* Check stack bounds if necessary. */
9823 if (current_function_limit_stack)
9826 available = expand_binop (Pmode, sub_optab,
9827 stack_pointer_rtx, stack_limit_rtx,
9828 NULL_RTX, 1, OPTAB_WIDEN);
9829 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9832 if (GET_CODE (operands[1]) != CONST_INT
9833 || INTVAL (operands[1]) < -32767
9834 || INTVAL (operands[1]) > 32768)
9836 neg_op0 = gen_reg_rtx (Pmode);
9838 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9840 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9843 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9846 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
9847 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9851 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9852 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9853 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9856 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9860 ;; These patterns say how to save and restore the stack pointer. We need not
9861 ;; save the stack pointer at function level since we are careful to
9862 ;; preserve the backchain. At block level, we have to restore the backchain
9863 ;; when we restore the stack pointer.
9865 ;; For nonlocal gotos, we must save both the stack pointer and its
9866 ;; backchain and restore both. Note that in the nonlocal case, the
9867 ;; save area is a memory location.
9869 (define_expand "save_stack_function"
9870 [(match_operand 0 "any_operand" "")
9871 (match_operand 1 "any_operand" "")]
9875 (define_expand "restore_stack_function"
9876 [(match_operand 0 "any_operand" "")
9877 (match_operand 1 "any_operand" "")]
9881 ;; Adjust stack pointer (op0) to a new value (op1).
9882 ;; First copy old stack backchain to new location, and ensure that the
9883 ;; scheduler won't reorder the sp assignment before the backchain write.
9884 (define_expand "restore_stack_block"
9885 [(set (match_dup 2) (match_dup 3))
9886 (set (match_dup 4) (match_dup 2))
9887 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
9888 (set (match_operand 0 "register_operand" "")
9889 (match_operand 1 "register_operand" ""))]
9893 operands[2] = gen_reg_rtx (Pmode);
9894 operands[3] = gen_frame_mem (Pmode, operands[0]);
9895 operands[4] = gen_frame_mem (Pmode, operands[1]);
9896 operands[5] = gen_frame_mem (BLKmode, operands[0]);
9899 (define_expand "save_stack_nonlocal"
9900 [(set (match_dup 3) (match_dup 4))
9901 (set (match_operand 0 "memory_operand" "") (match_dup 3))
9902 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
9906 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9908 /* Copy the backchain to the first word, sp to the second. */
9909 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
9910 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
9911 operands[3] = gen_reg_rtx (Pmode);
9912 operands[4] = gen_frame_mem (Pmode, operands[1]);
9915 (define_expand "restore_stack_nonlocal"
9916 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
9917 (set (match_dup 3) (match_dup 4))
9918 (set (match_dup 5) (match_dup 2))
9919 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
9920 (set (match_operand 0 "register_operand" "") (match_dup 3))]
9924 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9926 /* Restore the backchain from the first word, sp from the second. */
9927 operands[2] = gen_reg_rtx (Pmode);
9928 operands[3] = gen_reg_rtx (Pmode);
9929 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
9930 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
9931 operands[5] = gen_frame_mem (Pmode, operands[3]);
9932 operands[6] = gen_frame_mem (BLKmode, operands[0]);
9935 ;; TOC register handling.
9937 ;; Code to initialize the TOC register...
9939 (define_insn "load_toc_aix_si"
9940 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9941 (unspec:SI [(const_int 0)] UNSPEC_TOC))
9943 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9947 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9948 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9949 operands[2] = gen_rtx_REG (Pmode, 2);
9950 return \"{l|lwz} %0,%1(%2)\";
9952 [(set_attr "type" "load")])
9954 (define_insn "load_toc_aix_di"
9955 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9956 (unspec:DI [(const_int 0)] UNSPEC_TOC))
9958 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9962 #ifdef TARGET_RELOCATABLE
9963 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9964 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9966 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9969 strcat (buf, \"@toc\");
9970 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9971 operands[2] = gen_rtx_REG (Pmode, 2);
9972 return \"ld %0,%1(%2)\";
9974 [(set_attr "type" "load")])
9976 (define_insn "load_toc_v4_pic_si"
9977 [(set (match_operand:SI 0 "register_operand" "=l")
9978 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
9979 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9980 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9981 [(set_attr "type" "branch")
9982 (set_attr "length" "4")])
9984 (define_insn "load_toc_v4_PIC_1"
9985 [(set (match_operand:SI 0 "register_operand" "=l")
9986 (match_operand:SI 1 "immediate_operand" "s"))
9987 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
9988 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
9989 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
9990 "bcl 20,31,%1\\n%1:"
9991 [(set_attr "type" "branch")
9992 (set_attr "length" "4")])
9994 (define_insn "load_toc_v4_PIC_1b"
9995 [(set (match_operand:SI 0 "register_operand" "=l")
9996 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
9998 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9999 "bcl 20,31,$+8\\n\\t.long %1-$"
10000 [(set_attr "type" "branch")
10001 (set_attr "length" "8")])
10003 (define_insn "load_toc_v4_PIC_2"
10004 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10005 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10006 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10007 (match_operand:SI 3 "immediate_operand" "s")))))]
10008 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10009 "{l|lwz} %0,%2-%3(%1)"
10010 [(set_attr "type" "load")])
10012 (define_insn "load_toc_v4_PIC_3b"
10013 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10014 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10016 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10017 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10018 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10019 "{cau|addis} %0,%1,%2-%3@ha")
10021 (define_insn "load_toc_v4_PIC_3c"
10022 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10023 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10024 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10025 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10026 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10027 "{cal|addi} %0,%1,%2-%3@l")
10029 ;; If the TOC is shared over a translation unit, as happens with all
10030 ;; the kinds of PIC that we support, we need to restore the TOC
10031 ;; pointer only when jumping over units of translation.
10032 ;; On Darwin, we need to reload the picbase.
10034 (define_expand "builtin_setjmp_receiver"
10035 [(use (label_ref (match_operand 0 "" "")))]
10036 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10037 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10038 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10042 if (DEFAULT_ABI == ABI_DARWIN)
10044 const char *picbase = machopic_function_base_name ();
10045 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10046 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10050 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10051 CODE_LABEL_NUMBER (operands[0]));
10052 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10054 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10055 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10059 rs6000_emit_load_toc_table (FALSE);
10063 ;; Elf specific ways of loading addresses for non-PIC code.
10064 ;; The output of this could be r0, but we make a very strong
10065 ;; preference for a base register because it will usually
10066 ;; be needed there.
10067 (define_insn "elf_high"
10068 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10069 (high:SI (match_operand 1 "" "")))]
10070 "TARGET_ELF && ! TARGET_64BIT"
10071 "{liu|lis} %0,%1@ha")
10073 (define_insn "elf_low"
10074 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10075 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10076 (match_operand 2 "" "")))]
10077 "TARGET_ELF && ! TARGET_64BIT"
10079 {cal|la} %0,%2@l(%1)
10080 {ai|addic} %0,%1,%K2")
10082 ;; A function pointer under AIX is a pointer to a data area whose first word
10083 ;; contains the actual address of the function, whose second word contains a
10084 ;; pointer to its TOC, and whose third word contains a value to place in the
10085 ;; static chain register (r11). Note that if we load the static chain, our
10086 ;; "trampoline" need not have any executable code.
10088 (define_expand "call_indirect_aix32"
10089 [(set (match_dup 2)
10090 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10091 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10094 (mem:SI (plus:SI (match_dup 0)
10097 (mem:SI (plus:SI (match_dup 0)
10099 (parallel [(call (mem:SI (match_dup 2))
10100 (match_operand 1 "" ""))
10104 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10105 (clobber (scratch:SI))])]
10108 { operands[2] = gen_reg_rtx (SImode); }")
10110 (define_expand "call_indirect_aix64"
10111 [(set (match_dup 2)
10112 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10113 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10116 (mem:DI (plus:DI (match_dup 0)
10119 (mem:DI (plus:DI (match_dup 0)
10121 (parallel [(call (mem:SI (match_dup 2))
10122 (match_operand 1 "" ""))
10126 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10127 (clobber (scratch:SI))])]
10130 { operands[2] = gen_reg_rtx (DImode); }")
10132 (define_expand "call_value_indirect_aix32"
10133 [(set (match_dup 3)
10134 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10135 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10138 (mem:SI (plus:SI (match_dup 1)
10141 (mem:SI (plus:SI (match_dup 1)
10143 (parallel [(set (match_operand 0 "" "")
10144 (call (mem:SI (match_dup 3))
10145 (match_operand 2 "" "")))
10149 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10150 (clobber (scratch:SI))])]
10153 { operands[3] = gen_reg_rtx (SImode); }")
10155 (define_expand "call_value_indirect_aix64"
10156 [(set (match_dup 3)
10157 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10158 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10161 (mem:DI (plus:DI (match_dup 1)
10164 (mem:DI (plus:DI (match_dup 1)
10166 (parallel [(set (match_operand 0 "" "")
10167 (call (mem:SI (match_dup 3))
10168 (match_operand 2 "" "")))
10172 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10173 (clobber (scratch:SI))])]
10176 { operands[3] = gen_reg_rtx (DImode); }")
10178 ;; Now the definitions for the call and call_value insns
10179 (define_expand "call"
10180 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10181 (match_operand 1 "" ""))
10182 (use (match_operand 2 "" ""))
10183 (clobber (scratch:SI))])]
10188 if (MACHOPIC_INDIRECT)
10189 operands[0] = machopic_indirect_call_target (operands[0]);
10192 gcc_assert (GET_CODE (operands[0]) == MEM);
10193 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10195 operands[0] = XEXP (operands[0], 0);
10197 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10199 && GET_CODE (operands[0]) == SYMBOL_REF
10200 && !SYMBOL_REF_LOCAL_P (operands[0]))
10205 tmp = gen_rtvec (3,
10206 gen_rtx_CALL (VOIDmode,
10207 gen_rtx_MEM (SImode, operands[0]),
10209 gen_rtx_USE (VOIDmode, operands[2]),
10210 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10211 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10212 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10216 if (GET_CODE (operands[0]) != SYMBOL_REF
10217 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10218 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10220 if (INTVAL (operands[2]) & CALL_LONG)
10221 operands[0] = rs6000_longcall_ref (operands[0]);
10223 switch (DEFAULT_ABI)
10227 operands[0] = force_reg (Pmode, operands[0]);
10231 /* AIX function pointers are really pointers to a three word
10233 emit_call_insn (TARGET_32BIT
10234 ? gen_call_indirect_aix32 (force_reg (SImode,
10237 : gen_call_indirect_aix64 (force_reg (DImode,
10243 gcc_unreachable ();
10248 (define_expand "call_value"
10249 [(parallel [(set (match_operand 0 "" "")
10250 (call (mem:SI (match_operand 1 "address_operand" ""))
10251 (match_operand 2 "" "")))
10252 (use (match_operand 3 "" ""))
10253 (clobber (scratch:SI))])]
10258 if (MACHOPIC_INDIRECT)
10259 operands[1] = machopic_indirect_call_target (operands[1]);
10262 gcc_assert (GET_CODE (operands[1]) == MEM);
10263 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10265 operands[1] = XEXP (operands[1], 0);
10267 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10269 && GET_CODE (operands[1]) == SYMBOL_REF
10270 && !SYMBOL_REF_LOCAL_P (operands[1]))
10275 tmp = gen_rtvec (3,
10276 gen_rtx_SET (VOIDmode,
10278 gen_rtx_CALL (VOIDmode,
10279 gen_rtx_MEM (SImode,
10282 gen_rtx_USE (VOIDmode, operands[3]),
10283 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10284 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10285 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10289 if (GET_CODE (operands[1]) != SYMBOL_REF
10290 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10291 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10293 if (INTVAL (operands[3]) & CALL_LONG)
10294 operands[1] = rs6000_longcall_ref (operands[1]);
10296 switch (DEFAULT_ABI)
10300 operands[1] = force_reg (Pmode, operands[1]);
10304 /* AIX function pointers are really pointers to a three word
10306 emit_call_insn (TARGET_32BIT
10307 ? gen_call_value_indirect_aix32 (operands[0],
10311 : gen_call_value_indirect_aix64 (operands[0],
10318 gcc_unreachable ();
10323 ;; Call to function in current module. No TOC pointer reload needed.
10324 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10325 ;; either the function was not prototyped, or it was prototyped as a
10326 ;; variable argument function. It is > 0 if FP registers were passed
10327 ;; and < 0 if they were not.
10329 (define_insn "*call_local32"
10330 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10331 (match_operand 1 "" "g,g"))
10332 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10333 (clobber (match_scratch:SI 3 "=l,l"))]
10334 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10337 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10338 output_asm_insn (\"crxor 6,6,6\", operands);
10340 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10341 output_asm_insn (\"creqv 6,6,6\", operands);
10343 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10345 [(set_attr "type" "branch")
10346 (set_attr "length" "4,8")])
10348 (define_insn "*call_local64"
10349 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10350 (match_operand 1 "" "g,g"))
10351 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10352 (clobber (match_scratch:SI 3 "=l,l"))]
10353 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10356 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10357 output_asm_insn (\"crxor 6,6,6\", operands);
10359 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10360 output_asm_insn (\"creqv 6,6,6\", operands);
10362 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10364 [(set_attr "type" "branch")
10365 (set_attr "length" "4,8")])
10367 (define_insn "*call_value_local32"
10368 [(set (match_operand 0 "" "")
10369 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10370 (match_operand 2 "" "g,g")))
10371 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10372 (clobber (match_scratch:SI 4 "=l,l"))]
10373 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10376 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10377 output_asm_insn (\"crxor 6,6,6\", operands);
10379 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10380 output_asm_insn (\"creqv 6,6,6\", operands);
10382 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10384 [(set_attr "type" "branch")
10385 (set_attr "length" "4,8")])
10388 (define_insn "*call_value_local64"
10389 [(set (match_operand 0 "" "")
10390 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10391 (match_operand 2 "" "g,g")))
10392 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10393 (clobber (match_scratch:SI 4 "=l,l"))]
10394 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10397 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10398 output_asm_insn (\"crxor 6,6,6\", operands);
10400 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10401 output_asm_insn (\"creqv 6,6,6\", operands);
10403 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10405 [(set_attr "type" "branch")
10406 (set_attr "length" "4,8")])
10408 ;; Call to function which may be in another module. Restore the TOC
10409 ;; pointer (r2) after the call unless this is System V.
10410 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10411 ;; either the function was not prototyped, or it was prototyped as a
10412 ;; variable argument function. It is > 0 if FP registers were passed
10413 ;; and < 0 if they were not.
10415 (define_insn "*call_indirect_nonlocal_aix32"
10416 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10417 (match_operand 1 "" "g,g"))
10421 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10422 (clobber (match_scratch:SI 2 "=l,l"))]
10423 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10424 "b%T0l\;{l|lwz} 2,20(1)"
10425 [(set_attr "type" "jmpreg")
10426 (set_attr "length" "8")])
10428 (define_insn "*call_nonlocal_aix32"
10429 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10430 (match_operand 1 "" "g"))
10431 (use (match_operand:SI 2 "immediate_operand" "O"))
10432 (clobber (match_scratch:SI 3 "=l"))]
10434 && DEFAULT_ABI == ABI_AIX
10435 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10437 [(set_attr "type" "branch")
10438 (set_attr "length" "8")])
10440 (define_insn "*call_indirect_nonlocal_aix64"
10441 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10442 (match_operand 1 "" "g,g"))
10446 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10447 (clobber (match_scratch:SI 2 "=l,l"))]
10448 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10449 "b%T0l\;ld 2,40(1)"
10450 [(set_attr "type" "jmpreg")
10451 (set_attr "length" "8")])
10453 (define_insn "*call_nonlocal_aix64"
10454 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10455 (match_operand 1 "" "g"))
10456 (use (match_operand:SI 2 "immediate_operand" "O"))
10457 (clobber (match_scratch:SI 3 "=l"))]
10459 && DEFAULT_ABI == ABI_AIX
10460 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10462 [(set_attr "type" "branch")
10463 (set_attr "length" "8")])
10465 (define_insn "*call_value_indirect_nonlocal_aix32"
10466 [(set (match_operand 0 "" "")
10467 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10468 (match_operand 2 "" "g,g")))
10472 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10473 (clobber (match_scratch:SI 3 "=l,l"))]
10474 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10475 "b%T1l\;{l|lwz} 2,20(1)"
10476 [(set_attr "type" "jmpreg")
10477 (set_attr "length" "8")])
10479 (define_insn "*call_value_nonlocal_aix32"
10480 [(set (match_operand 0 "" "")
10481 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10482 (match_operand 2 "" "g")))
10483 (use (match_operand:SI 3 "immediate_operand" "O"))
10484 (clobber (match_scratch:SI 4 "=l"))]
10486 && DEFAULT_ABI == ABI_AIX
10487 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10489 [(set_attr "type" "branch")
10490 (set_attr "length" "8")])
10492 (define_insn "*call_value_indirect_nonlocal_aix64"
10493 [(set (match_operand 0 "" "")
10494 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10495 (match_operand 2 "" "g,g")))
10499 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10500 (clobber (match_scratch:SI 3 "=l,l"))]
10501 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10502 "b%T1l\;ld 2,40(1)"
10503 [(set_attr "type" "jmpreg")
10504 (set_attr "length" "8")])
10506 (define_insn "*call_value_nonlocal_aix64"
10507 [(set (match_operand 0 "" "")
10508 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10509 (match_operand 2 "" "g")))
10510 (use (match_operand:SI 3 "immediate_operand" "O"))
10511 (clobber (match_scratch:SI 4 "=l"))]
10513 && DEFAULT_ABI == ABI_AIX
10514 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10516 [(set_attr "type" "branch")
10517 (set_attr "length" "8")])
10519 ;; A function pointer under System V is just a normal pointer
10520 ;; operands[0] is the function pointer
10521 ;; operands[1] is the stack size to clean up
10522 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10523 ;; which indicates how to set cr1
10525 (define_insn "*call_indirect_nonlocal_sysv"
10526 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
10527 (match_operand 1 "" "g,g,g,g"))
10528 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10529 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10530 "DEFAULT_ABI == ABI_V4
10531 || DEFAULT_ABI == ABI_DARWIN"
10533 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10534 output_asm_insn ("crxor 6,6,6", operands);
10536 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10537 output_asm_insn ("creqv 6,6,6", operands);
10541 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10542 (set_attr "length" "4,4,8,8")])
10544 (define_insn "*call_nonlocal_sysv"
10545 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10546 (match_operand 1 "" "g,g"))
10547 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10548 (clobber (match_scratch:SI 3 "=l,l"))]
10549 "(DEFAULT_ABI == ABI_DARWIN
10550 || (DEFAULT_ABI == ABI_V4
10551 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10553 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10554 output_asm_insn ("crxor 6,6,6", operands);
10556 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10557 output_asm_insn ("creqv 6,6,6", operands);
10560 return output_call(insn, operands, 0, 2);
10562 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10564 if (TARGET_SECURE_PLT && flag_pic == 2)
10565 /* The magic 32768 offset here and in the other sysv call insns
10566 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10567 See sysv4.h:toc_section. */
10568 return "bl %z0+32768@plt";
10570 return "bl %z0@plt";
10576 [(set_attr "type" "branch,branch")
10577 (set_attr "length" "4,8")])
10579 (define_insn "*call_value_indirect_nonlocal_sysv"
10580 [(set (match_operand 0 "" "")
10581 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
10582 (match_operand 2 "" "g,g,g,g")))
10583 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10584 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10585 "DEFAULT_ABI == ABI_V4
10586 || DEFAULT_ABI == ABI_DARWIN"
10588 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10589 output_asm_insn ("crxor 6,6,6", operands);
10591 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10592 output_asm_insn ("creqv 6,6,6", operands);
10596 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10597 (set_attr "length" "4,4,8,8")])
10599 (define_insn "*call_value_nonlocal_sysv"
10600 [(set (match_operand 0 "" "")
10601 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10602 (match_operand 2 "" "g,g")))
10603 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10604 (clobber (match_scratch:SI 4 "=l,l"))]
10605 "(DEFAULT_ABI == ABI_DARWIN
10606 || (DEFAULT_ABI == ABI_V4
10607 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10609 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10610 output_asm_insn ("crxor 6,6,6", operands);
10612 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10613 output_asm_insn ("creqv 6,6,6", operands);
10616 return output_call(insn, operands, 1, 3);
10618 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10620 if (TARGET_SECURE_PLT && flag_pic == 2)
10621 return "bl %z1+32768@plt";
10623 return "bl %z1@plt";
10629 [(set_attr "type" "branch,branch")
10630 (set_attr "length" "4,8")])
10632 ;; Call subroutine returning any type.
10633 (define_expand "untyped_call"
10634 [(parallel [(call (match_operand 0 "" "")
10636 (match_operand 1 "" "")
10637 (match_operand 2 "" "")])]
10643 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10645 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10647 rtx set = XVECEXP (operands[2], 0, i);
10648 emit_move_insn (SET_DEST (set), SET_SRC (set));
10651 /* The optimizer does not know that the call sets the function value
10652 registers we stored in the result block. We avoid problems by
10653 claiming that all hard registers are used and clobbered at this
10655 emit_insn (gen_blockage ());
10660 ;; sibling call patterns
10661 (define_expand "sibcall"
10662 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10663 (match_operand 1 "" ""))
10664 (use (match_operand 2 "" ""))
10665 (use (match_operand 3 "" ""))
10671 if (MACHOPIC_INDIRECT)
10672 operands[0] = machopic_indirect_call_target (operands[0]);
10675 gcc_assert (GET_CODE (operands[0]) == MEM);
10676 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10678 operands[0] = XEXP (operands[0], 0);
10679 operands[3] = gen_reg_rtx (SImode);
10683 ;; this and similar patterns must be marked as using LR, otherwise
10684 ;; dataflow will try to delete the store into it. This is true
10685 ;; even when the actual reg to jump to is in CTR, when LR was
10686 ;; saved and restored around the PIC-setting BCL.
10687 (define_insn "*sibcall_local32"
10688 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10689 (match_operand 1 "" "g,g"))
10690 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10691 (use (match_operand:SI 3 "register_operand" "l,l"))
10693 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10696 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10697 output_asm_insn (\"crxor 6,6,6\", operands);
10699 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10700 output_asm_insn (\"creqv 6,6,6\", operands);
10702 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10704 [(set_attr "type" "branch")
10705 (set_attr "length" "4,8")])
10707 (define_insn "*sibcall_local64"
10708 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10709 (match_operand 1 "" "g,g"))
10710 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10711 (use (match_operand:SI 3 "register_operand" "l,l"))
10713 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10716 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10717 output_asm_insn (\"crxor 6,6,6\", operands);
10719 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10720 output_asm_insn (\"creqv 6,6,6\", operands);
10722 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10724 [(set_attr "type" "branch")
10725 (set_attr "length" "4,8")])
10727 (define_insn "*sibcall_value_local32"
10728 [(set (match_operand 0 "" "")
10729 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10730 (match_operand 2 "" "g,g")))
10731 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10732 (use (match_operand:SI 4 "register_operand" "l,l"))
10734 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10737 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10738 output_asm_insn (\"crxor 6,6,6\", operands);
10740 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10741 output_asm_insn (\"creqv 6,6,6\", operands);
10743 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10745 [(set_attr "type" "branch")
10746 (set_attr "length" "4,8")])
10749 (define_insn "*sibcall_value_local64"
10750 [(set (match_operand 0 "" "")
10751 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10752 (match_operand 2 "" "g,g")))
10753 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10754 (use (match_operand:SI 4 "register_operand" "l,l"))
10756 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10759 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10760 output_asm_insn (\"crxor 6,6,6\", operands);
10762 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10763 output_asm_insn (\"creqv 6,6,6\", operands);
10765 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10767 [(set_attr "type" "branch")
10768 (set_attr "length" "4,8")])
10770 (define_insn "*sibcall_nonlocal_aix32"
10771 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10772 (match_operand 1 "" "g"))
10773 (use (match_operand:SI 2 "immediate_operand" "O"))
10774 (use (match_operand:SI 3 "register_operand" "l"))
10777 && DEFAULT_ABI == ABI_AIX
10778 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10780 [(set_attr "type" "branch")
10781 (set_attr "length" "4")])
10783 (define_insn "*sibcall_nonlocal_aix64"
10784 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10785 (match_operand 1 "" "g"))
10786 (use (match_operand:SI 2 "immediate_operand" "O"))
10787 (use (match_operand:SI 3 "register_operand" "l"))
10790 && DEFAULT_ABI == ABI_AIX
10791 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10793 [(set_attr "type" "branch")
10794 (set_attr "length" "4")])
10796 (define_insn "*sibcall_value_nonlocal_aix32"
10797 [(set (match_operand 0 "" "")
10798 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10799 (match_operand 2 "" "g")))
10800 (use (match_operand:SI 3 "immediate_operand" "O"))
10801 (use (match_operand:SI 4 "register_operand" "l"))
10804 && DEFAULT_ABI == ABI_AIX
10805 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10807 [(set_attr "type" "branch")
10808 (set_attr "length" "4")])
10810 (define_insn "*sibcall_value_nonlocal_aix64"
10811 [(set (match_operand 0 "" "")
10812 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10813 (match_operand 2 "" "g")))
10814 (use (match_operand:SI 3 "immediate_operand" "O"))
10815 (use (match_operand:SI 4 "register_operand" "l"))
10818 && DEFAULT_ABI == ABI_AIX
10819 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10821 [(set_attr "type" "branch")
10822 (set_attr "length" "4")])
10824 (define_insn "*sibcall_nonlocal_sysv"
10825 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10826 (match_operand 1 "" ""))
10827 (use (match_operand 2 "immediate_operand" "O,n"))
10828 (use (match_operand:SI 3 "register_operand" "l,l"))
10830 "(DEFAULT_ABI == ABI_DARWIN
10831 || DEFAULT_ABI == ABI_V4)
10832 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10835 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10836 output_asm_insn (\"crxor 6,6,6\", operands);
10838 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10839 output_asm_insn (\"creqv 6,6,6\", operands);
10841 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10843 if (TARGET_SECURE_PLT && flag_pic == 2)
10844 return \"b %z0+32768@plt\";
10846 return \"b %z0@plt\";
10851 [(set_attr "type" "branch,branch")
10852 (set_attr "length" "4,8")])
10854 (define_expand "sibcall_value"
10855 [(parallel [(set (match_operand 0 "register_operand" "")
10856 (call (mem:SI (match_operand 1 "address_operand" ""))
10857 (match_operand 2 "" "")))
10858 (use (match_operand 3 "" ""))
10859 (use (match_operand 4 "" ""))
10865 if (MACHOPIC_INDIRECT)
10866 operands[1] = machopic_indirect_call_target (operands[1]);
10869 gcc_assert (GET_CODE (operands[1]) == MEM);
10870 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10872 operands[1] = XEXP (operands[1], 0);
10873 operands[4] = gen_reg_rtx (SImode);
10877 (define_insn "*sibcall_value_nonlocal_sysv"
10878 [(set (match_operand 0 "" "")
10879 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10880 (match_operand 2 "" "")))
10881 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10882 (use (match_operand:SI 4 "register_operand" "l,l"))
10884 "(DEFAULT_ABI == ABI_DARWIN
10885 || DEFAULT_ABI == ABI_V4)
10886 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10889 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10890 output_asm_insn (\"crxor 6,6,6\", operands);
10892 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10893 output_asm_insn (\"creqv 6,6,6\", operands);
10895 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10897 if (TARGET_SECURE_PLT && flag_pic == 2)
10898 return \"b %z1+32768@plt\";
10900 return \"b %z1@plt\";
10905 [(set_attr "type" "branch,branch")
10906 (set_attr "length" "4,8")])
10908 (define_expand "sibcall_epilogue"
10909 [(use (const_int 0))]
10910 "TARGET_SCHED_PROLOG"
10913 rs6000_emit_epilogue (TRUE);
10917 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10918 ;; all of memory. This blocks insns from being moved across this point.
10920 (define_insn "blockage"
10921 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10925 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10926 ;; signed & unsigned, and one type of branch.
10928 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10929 ;; insns, and branches. We store the operands of compares until we see
10931 (define_expand "cmp<mode>"
10933 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
10934 (match_operand:GPR 1 "reg_or_short_operand" "")))]
10938 /* Take care of the possibility that operands[1] might be negative but
10939 this might be a logical operation. That insn doesn't exist. */
10940 if (GET_CODE (operands[1]) == CONST_INT
10941 && INTVAL (operands[1]) < 0)
10942 operands[1] = force_reg (<MODE>mode, operands[1]);
10944 rs6000_compare_op0 = operands[0];
10945 rs6000_compare_op1 = operands[1];
10946 rs6000_compare_fp_p = 0;
10950 (define_expand "cmp<mode>"
10951 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
10952 (match_operand:FP 1 "gpc_reg_operand" "")))]
10956 rs6000_compare_op0 = operands[0];
10957 rs6000_compare_op1 = operands[1];
10958 rs6000_compare_fp_p = 1;
10962 (define_expand "beq"
10963 [(use (match_operand 0 "" ""))]
10965 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10967 (define_expand "bne"
10968 [(use (match_operand 0 "" ""))]
10970 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10972 (define_expand "bge"
10973 [(use (match_operand 0 "" ""))]
10975 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10977 (define_expand "bgt"
10978 [(use (match_operand 0 "" ""))]
10980 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10982 (define_expand "ble"
10983 [(use (match_operand 0 "" ""))]
10985 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10987 (define_expand "blt"
10988 [(use (match_operand 0 "" ""))]
10990 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10992 (define_expand "bgeu"
10993 [(use (match_operand 0 "" ""))]
10995 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10997 (define_expand "bgtu"
10998 [(use (match_operand 0 "" ""))]
11000 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11002 (define_expand "bleu"
11003 [(use (match_operand 0 "" ""))]
11005 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11007 (define_expand "bltu"
11008 [(use (match_operand 0 "" ""))]
11010 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11012 (define_expand "bunordered"
11013 [(use (match_operand 0 "" ""))]
11014 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11015 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11017 (define_expand "bordered"
11018 [(use (match_operand 0 "" ""))]
11019 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11020 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11022 (define_expand "buneq"
11023 [(use (match_operand 0 "" ""))]
11025 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11027 (define_expand "bunge"
11028 [(use (match_operand 0 "" ""))]
11030 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11032 (define_expand "bungt"
11033 [(use (match_operand 0 "" ""))]
11035 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11037 (define_expand "bunle"
11038 [(use (match_operand 0 "" ""))]
11040 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11042 (define_expand "bunlt"
11043 [(use (match_operand 0 "" ""))]
11045 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11047 (define_expand "bltgt"
11048 [(use (match_operand 0 "" ""))]
11050 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11052 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11053 ;; For SEQ, likewise, except that comparisons with zero should be done
11054 ;; with an scc insns. However, due to the order that combine see the
11055 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11056 ;; the cases we don't want to handle.
11057 (define_expand "seq"
11058 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11060 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11062 (define_expand "sne"
11063 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11067 if (! rs6000_compare_fp_p)
11070 rs6000_emit_sCOND (NE, operands[0]);
11074 ;; A >= 0 is best done the portable way for A an integer.
11075 (define_expand "sge"
11076 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11080 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11083 rs6000_emit_sCOND (GE, operands[0]);
11087 ;; A > 0 is best done using the portable sequence, so fail in that case.
11088 (define_expand "sgt"
11089 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11093 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11096 rs6000_emit_sCOND (GT, operands[0]);
11100 ;; A <= 0 is best done the portable way for A an integer.
11101 (define_expand "sle"
11102 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11106 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11109 rs6000_emit_sCOND (LE, operands[0]);
11113 ;; A < 0 is best done in the portable way for A an integer.
11114 (define_expand "slt"
11115 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11119 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11122 rs6000_emit_sCOND (LT, operands[0]);
11126 (define_expand "sgeu"
11127 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11129 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11131 (define_expand "sgtu"
11132 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11134 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11136 (define_expand "sleu"
11137 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11139 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11141 (define_expand "sltu"
11142 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11144 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11146 (define_expand "sunordered"
11147 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11148 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11149 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11151 (define_expand "sordered"
11152 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11153 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11154 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11156 (define_expand "suneq"
11157 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11159 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11161 (define_expand "sunge"
11162 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11164 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11166 (define_expand "sungt"
11167 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11169 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11171 (define_expand "sunle"
11172 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11174 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11176 (define_expand "sunlt"
11177 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11179 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11181 (define_expand "sltgt"
11182 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11184 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11186 (define_expand "stack_protect_set"
11187 [(match_operand 0 "memory_operand" "")
11188 (match_operand 1 "memory_operand" "")]
11191 #ifdef TARGET_THREAD_SSP_OFFSET
11192 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11193 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11194 operands[1] = gen_rtx_MEM (Pmode, addr);
11197 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11199 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11203 (define_insn "stack_protect_setsi"
11204 [(set (match_operand:SI 0 "memory_operand" "=m")
11205 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11206 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11208 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11209 [(set_attr "type" "three")
11210 (set_attr "length" "12")])
11212 (define_insn "stack_protect_setdi"
11213 [(set (match_operand:DI 0 "memory_operand" "=m")
11214 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11215 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11217 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11218 [(set_attr "type" "three")
11219 (set_attr "length" "12")])
11221 (define_expand "stack_protect_test"
11222 [(match_operand 0 "memory_operand" "")
11223 (match_operand 1 "memory_operand" "")
11224 (match_operand 2 "" "")]
11227 #ifdef TARGET_THREAD_SSP_OFFSET
11228 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11229 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11230 operands[1] = gen_rtx_MEM (Pmode, addr);
11232 rs6000_compare_op0 = operands[0];
11233 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11235 rs6000_compare_fp_p = 0;
11236 emit_jump_insn (gen_beq (operands[2]));
11240 (define_insn "stack_protect_testsi"
11241 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11242 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11243 (match_operand:SI 2 "memory_operand" "m,m")]
11245 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11246 (clobber (match_scratch:SI 3 "=&r,&r"))]
11249 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11250 {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"
11251 [(set_attr "length" "16,20")])
11253 (define_insn "stack_protect_testdi"
11254 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11255 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11256 (match_operand:DI 2 "memory_operand" "m,m")]
11258 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11259 (clobber (match_scratch:DI 3 "=&r,&r"))]
11262 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11263 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11264 [(set_attr "length" "16,20")])
11267 ;; Here are the actual compare insns.
11268 (define_insn "*cmp<mode>_internal1"
11269 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11270 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11271 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11273 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11274 [(set_attr "type" "cmp")])
11276 ;; If we are comparing a register for equality with a large constant,
11277 ;; we can do this with an XOR followed by a compare. But this is profitable
11278 ;; only if the large constant is only used for the comparison (and in this
11279 ;; case we already have a register to reuse as scratch).
11281 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11282 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11285 [(set (match_operand:SI 0 "register_operand")
11286 (match_operand:SI 1 "logical_operand" ""))
11287 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11289 (match_operand:SI 2 "logical_operand" "")]))
11290 (set (match_operand:CC 4 "cc_reg_operand" "")
11291 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11294 (if_then_else (match_operator 6 "equality_operator"
11295 [(match_dup 4) (const_int 0)])
11296 (match_operand 7 "" "")
11297 (match_operand 8 "" "")))]
11298 "peep2_reg_dead_p (3, operands[0])
11299 && peep2_reg_dead_p (4, operands[4])"
11300 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11301 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11302 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11305 /* Get the constant we are comparing against, and see what it looks like
11306 when sign-extended from 16 to 32 bits. Then see what constant we could
11307 XOR with SEXTC to get the sign-extended value. */
11308 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11310 operands[1], operands[2]);
11311 HOST_WIDE_INT c = INTVAL (cnst);
11312 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11313 HOST_WIDE_INT xorv = c ^ sextc;
11315 operands[9] = GEN_INT (xorv);
11316 operands[10] = GEN_INT (sextc);
11319 (define_insn "*cmpsi_internal2"
11320 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11321 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11322 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11324 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11325 [(set_attr "type" "cmp")])
11327 (define_insn "*cmpdi_internal2"
11328 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11329 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11330 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11332 "cmpld%I2 %0,%1,%b2"
11333 [(set_attr "type" "cmp")])
11335 ;; The following two insns don't exist as single insns, but if we provide
11336 ;; them, we can swap an add and compare, which will enable us to overlap more
11337 ;; of the required delay between a compare and branch. We generate code for
11338 ;; them by splitting.
11341 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11342 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11343 (match_operand:SI 2 "short_cint_operand" "i")))
11344 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11345 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11348 [(set_attr "length" "8")])
11351 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11352 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11353 (match_operand:SI 2 "u_short_cint_operand" "i")))
11354 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11355 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11358 [(set_attr "length" "8")])
11361 [(set (match_operand:CC 3 "cc_reg_operand" "")
11362 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11363 (match_operand:SI 2 "short_cint_operand" "")))
11364 (set (match_operand:SI 0 "gpc_reg_operand" "")
11365 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11367 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11368 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11371 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11372 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11373 (match_operand:SI 2 "u_short_cint_operand" "")))
11374 (set (match_operand:SI 0 "gpc_reg_operand" "")
11375 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11377 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11378 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11380 (define_insn "*cmpsf_internal1"
11381 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11382 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11383 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11384 "TARGET_HARD_FLOAT && TARGET_FPRS"
11386 [(set_attr "type" "fpcompare")])
11388 (define_insn "*cmpdf_internal1"
11389 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11390 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11391 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11392 "TARGET_HARD_FLOAT && TARGET_FPRS"
11394 [(set_attr "type" "fpcompare")])
11396 ;; Only need to compare second words if first words equal
11397 (define_insn "*cmptf_internal1"
11398 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11399 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11400 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11401 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
11402 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11403 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11404 [(set_attr "type" "fpcompare")
11405 (set_attr "length" "12")])
11407 (define_insn_and_split "*cmptf_internal2"
11408 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11409 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11410 (match_operand:TF 2 "gpc_reg_operand" "f")))
11411 (clobber (match_scratch:DF 3 "=f"))
11412 (clobber (match_scratch:DF 4 "=f"))
11413 (clobber (match_scratch:DF 5 "=f"))
11414 (clobber (match_scratch:DF 6 "=f"))
11415 (clobber (match_scratch:DF 7 "=f"))
11416 (clobber (match_scratch:DF 8 "=f"))
11417 (clobber (match_scratch:DF 9 "=f"))
11418 (clobber (match_scratch:DF 10 "=f"))]
11419 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
11420 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11422 "&& reload_completed"
11423 [(set (match_dup 3) (match_dup 13))
11424 (set (match_dup 4) (match_dup 14))
11425 (set (match_dup 9) (abs:DF (match_dup 5)))
11426 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11427 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11428 (label_ref (match_dup 11))
11430 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11431 (set (pc) (label_ref (match_dup 12)))
11433 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11434 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11435 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11436 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11439 REAL_VALUE_TYPE rv;
11440 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11441 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11443 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11444 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11445 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11446 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11447 operands[11] = gen_label_rtx ();
11448 operands[12] = gen_label_rtx ();
11450 operands[13] = force_const_mem (DFmode,
11451 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11452 operands[14] = force_const_mem (DFmode,
11453 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11457 operands[13] = gen_const_mem (DFmode,
11458 create_TOC_reference (XEXP (operands[13], 0)));
11459 operands[14] = gen_const_mem (DFmode,
11460 create_TOC_reference (XEXP (operands[14], 0)));
11461 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11462 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11466 ;; Now we have the scc insns. We can do some combinations because of the
11467 ;; way the machine works.
11469 ;; Note that this is probably faster if we can put an insn between the
11470 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11471 ;; cases the insns below which don't use an intermediate CR field will
11472 ;; be used instead.
11474 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11475 (match_operator:SI 1 "scc_comparison_operator"
11476 [(match_operand 2 "cc_reg_operand" "y")
11479 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11480 [(set (attr "type")
11481 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11482 (const_string "mfcrf")
11484 (const_string "mfcr")))
11485 (set_attr "length" "8")])
11487 ;; Same as above, but get the GT bit.
11488 (define_insn "move_from_CR_gt_bit"
11489 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11490 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11492 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11493 [(set_attr "type" "mfcr")
11494 (set_attr "length" "8")])
11496 ;; Same as above, but get the OV/ORDERED bit.
11497 (define_insn "move_from_CR_ov_bit"
11498 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11499 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11501 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11502 [(set_attr "type" "mfcr")
11503 (set_attr "length" "8")])
11506 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11507 (match_operator:DI 1 "scc_comparison_operator"
11508 [(match_operand 2 "cc_reg_operand" "y")
11511 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11512 [(set (attr "type")
11513 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11514 (const_string "mfcrf")
11516 (const_string "mfcr")))
11517 (set_attr "length" "8")])
11520 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11521 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11522 [(match_operand 2 "cc_reg_operand" "y,y")
11525 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11526 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11529 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11531 [(set_attr "type" "delayed_compare")
11532 (set_attr "length" "8,16")])
11535 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11536 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11537 [(match_operand 2 "cc_reg_operand" "")
11540 (set (match_operand:SI 3 "gpc_reg_operand" "")
11541 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11542 "TARGET_32BIT && reload_completed"
11543 [(set (match_dup 3)
11544 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11546 (compare:CC (match_dup 3)
11551 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11552 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11553 [(match_operand 2 "cc_reg_operand" "y")
11555 (match_operand:SI 3 "const_int_operand" "n")))]
11559 int is_bit = ccr_bit (operands[1], 1);
11560 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11563 if (is_bit >= put_bit)
11564 count = is_bit - put_bit;
11566 count = 32 - (put_bit - is_bit);
11568 operands[4] = GEN_INT (count);
11569 operands[5] = GEN_INT (put_bit);
11571 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11573 [(set (attr "type")
11574 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11575 (const_string "mfcrf")
11577 (const_string "mfcr")))
11578 (set_attr "length" "8")])
11581 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11583 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11584 [(match_operand 2 "cc_reg_operand" "y,y")
11586 (match_operand:SI 3 "const_int_operand" "n,n"))
11588 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11589 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11594 int is_bit = ccr_bit (operands[1], 1);
11595 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11598 /* Force split for non-cc0 compare. */
11599 if (which_alternative == 1)
11602 if (is_bit >= put_bit)
11603 count = is_bit - put_bit;
11605 count = 32 - (put_bit - is_bit);
11607 operands[5] = GEN_INT (count);
11608 operands[6] = GEN_INT (put_bit);
11610 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11612 [(set_attr "type" "delayed_compare")
11613 (set_attr "length" "8,16")])
11616 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11618 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11619 [(match_operand 2 "cc_reg_operand" "")
11621 (match_operand:SI 3 "const_int_operand" ""))
11623 (set (match_operand:SI 4 "gpc_reg_operand" "")
11624 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11627 [(set (match_dup 4)
11628 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11631 (compare:CC (match_dup 4)
11635 ;; There is a 3 cycle delay between consecutive mfcr instructions
11636 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11639 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11640 (match_operator:SI 1 "scc_comparison_operator"
11641 [(match_operand 2 "cc_reg_operand" "y")
11643 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11644 (match_operator:SI 4 "scc_comparison_operator"
11645 [(match_operand 5 "cc_reg_operand" "y")
11647 "REGNO (operands[2]) != REGNO (operands[5])"
11648 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11649 [(set_attr "type" "mfcr")
11650 (set_attr "length" "12")])
11653 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11654 (match_operator:DI 1 "scc_comparison_operator"
11655 [(match_operand 2 "cc_reg_operand" "y")
11657 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11658 (match_operator:DI 4 "scc_comparison_operator"
11659 [(match_operand 5 "cc_reg_operand" "y")
11661 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11662 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11663 [(set_attr "type" "mfcr")
11664 (set_attr "length" "12")])
11666 ;; There are some scc insns that can be done directly, without a compare.
11667 ;; These are faster because they don't involve the communications between
11668 ;; the FXU and branch units. In fact, we will be replacing all of the
11669 ;; integer scc insns here or in the portable methods in emit_store_flag.
11671 ;; Also support (neg (scc ..)) since that construct is used to replace
11672 ;; branches, (plus (scc ..) ..) since that construct is common and
11673 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11674 ;; cases where it is no more expensive than (neg (scc ..)).
11676 ;; Have reload force a constant into a register for the simple insns that
11677 ;; otherwise won't accept constants. We do this because it is faster than
11678 ;; the cmp/mfcr sequence we would otherwise generate.
11680 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11683 (define_insn_and_split "*eq<mode>"
11684 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11685 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11686 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
11690 [(set (match_dup 0)
11691 (clz:GPR (match_dup 3)))
11693 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
11695 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11697 /* Use output operand as intermediate. */
11698 operands[3] = operands[0];
11700 if (logical_operand (operands[2], <MODE>mode))
11701 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11702 gen_rtx_XOR (<MODE>mode,
11703 operands[1], operands[2])));
11705 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11706 gen_rtx_PLUS (<MODE>mode, operands[1],
11707 negate_rtx (<MODE>mode,
11711 operands[3] = operands[1];
11713 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11716 (define_insn_and_split "*eq<mode>_compare"
11717 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11719 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11720 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11722 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11723 (eq:P (match_dup 1) (match_dup 2)))]
11724 "!TARGET_POWER && optimize_size"
11726 "!TARGET_POWER && optimize_size"
11727 [(set (match_dup 0)
11728 (clz:P (match_dup 4)))
11729 (parallel [(set (match_dup 3)
11730 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
11733 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
11735 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11737 /* Use output operand as intermediate. */
11738 operands[4] = operands[0];
11740 if (logical_operand (operands[2], <MODE>mode))
11741 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11742 gen_rtx_XOR (<MODE>mode,
11743 operands[1], operands[2])));
11745 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11746 gen_rtx_PLUS (<MODE>mode, operands[1],
11747 negate_rtx (<MODE>mode,
11751 operands[4] = operands[1];
11753 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11756 (define_insn "*eqsi_power"
11757 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11758 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11759 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11760 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11763 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11764 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11765 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11766 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11767 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11768 [(set_attr "type" "three,two,three,three,three")
11769 (set_attr "length" "12,8,12,12,12")])
11771 ;; We have insns of the form shown by the first define_insn below. If
11772 ;; there is something inside the comparison operation, we must split it.
11774 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11775 (plus:SI (match_operator 1 "comparison_operator"
11776 [(match_operand:SI 2 "" "")
11777 (match_operand:SI 3
11778 "reg_or_cint_operand" "")])
11779 (match_operand:SI 4 "gpc_reg_operand" "")))
11780 (clobber (match_operand:SI 5 "register_operand" ""))]
11781 "! gpc_reg_operand (operands[2], SImode)"
11782 [(set (match_dup 5) (match_dup 2))
11783 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11786 (define_insn "*plus_eqsi"
11787 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11788 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11789 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11790 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11793 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11794 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11795 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11796 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11797 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11798 [(set_attr "type" "three,two,three,three,three")
11799 (set_attr "length" "12,8,12,12,12")])
11801 (define_insn "*compare_plus_eqsi"
11802 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11805 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11806 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11807 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11809 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11810 "TARGET_32BIT && optimize_size"
11812 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11813 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11814 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11815 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11816 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11822 [(set_attr "type" "compare")
11823 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11826 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11829 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11830 (match_operand:SI 2 "scc_eq_operand" ""))
11831 (match_operand:SI 3 "gpc_reg_operand" ""))
11833 (clobber (match_scratch:SI 4 ""))]
11834 "TARGET_32BIT && optimize_size && reload_completed"
11835 [(set (match_dup 4)
11836 (plus:SI (eq:SI (match_dup 1)
11840 (compare:CC (match_dup 4)
11844 (define_insn "*plus_eqsi_compare"
11845 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11848 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11849 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11850 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11852 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11853 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11854 "TARGET_32BIT && optimize_size"
11856 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11857 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11858 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11859 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11860 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11866 [(set_attr "type" "compare")
11867 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11870 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11873 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11874 (match_operand:SI 2 "scc_eq_operand" ""))
11875 (match_operand:SI 3 "gpc_reg_operand" ""))
11877 (set (match_operand:SI 0 "gpc_reg_operand" "")
11878 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11879 "TARGET_32BIT && optimize_size && reload_completed"
11880 [(set (match_dup 0)
11881 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11883 (compare:CC (match_dup 0)
11887 (define_insn "*neg_eq0<mode>"
11888 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11889 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
11892 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
11893 [(set_attr "type" "two")
11894 (set_attr "length" "8")])
11896 (define_insn_and_split "*neg_eq<mode>"
11897 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11898 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
11899 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
11903 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
11905 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11907 /* Use output operand as intermediate. */
11908 operands[3] = operands[0];
11910 if (logical_operand (operands[2], <MODE>mode))
11911 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11912 gen_rtx_XOR (<MODE>mode,
11913 operands[1], operands[2])));
11915 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11916 gen_rtx_PLUS (<MODE>mode, operands[1],
11917 negate_rtx (<MODE>mode,
11921 operands[3] = operands[1];
11924 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11925 ;; since it nabs/sr is just as fast.
11926 (define_insn "*ne0si"
11927 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11928 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11930 (clobber (match_scratch:SI 2 "=&r"))]
11931 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11932 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11933 [(set_attr "type" "two")
11934 (set_attr "length" "8")])
11936 (define_insn "*ne0di"
11937 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11938 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11940 (clobber (match_scratch:DI 2 "=&r"))]
11942 "addic %2,%1,-1\;subfe %0,%2,%1"
11943 [(set_attr "type" "two")
11944 (set_attr "length" "8")])
11946 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11947 (define_insn "*plus_ne0si"
11948 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11949 (plus:SI (lshiftrt:SI
11950 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11952 (match_operand:SI 2 "gpc_reg_operand" "r")))
11953 (clobber (match_scratch:SI 3 "=&r"))]
11955 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11956 [(set_attr "type" "two")
11957 (set_attr "length" "8")])
11959 (define_insn "*plus_ne0di"
11960 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11961 (plus:DI (lshiftrt:DI
11962 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11964 (match_operand:DI 2 "gpc_reg_operand" "r")))
11965 (clobber (match_scratch:DI 3 "=&r"))]
11967 "addic %3,%1,-1\;addze %0,%2"
11968 [(set_attr "type" "two")
11969 (set_attr "length" "8")])
11971 (define_insn "*compare_plus_ne0si"
11972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11974 (plus:SI (lshiftrt:SI
11975 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11977 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11979 (clobber (match_scratch:SI 3 "=&r,&r"))
11980 (clobber (match_scratch:SI 4 "=X,&r"))]
11983 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11985 [(set_attr "type" "compare")
11986 (set_attr "length" "8,12")])
11989 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11991 (plus:SI (lshiftrt:SI
11992 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11994 (match_operand:SI 2 "gpc_reg_operand" ""))
11996 (clobber (match_scratch:SI 3 ""))
11997 (clobber (match_scratch:SI 4 ""))]
11998 "TARGET_32BIT && reload_completed"
11999 [(parallel [(set (match_dup 3)
12000 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12003 (clobber (match_dup 4))])
12005 (compare:CC (match_dup 3)
12009 (define_insn "*compare_plus_ne0di"
12010 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12012 (plus:DI (lshiftrt:DI
12013 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12015 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12017 (clobber (match_scratch:DI 3 "=&r,&r"))]
12020 addic %3,%1,-1\;addze. %3,%2
12022 [(set_attr "type" "compare")
12023 (set_attr "length" "8,12")])
12026 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12028 (plus:DI (lshiftrt:DI
12029 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12031 (match_operand:DI 2 "gpc_reg_operand" ""))
12033 (clobber (match_scratch:DI 3 ""))]
12034 "TARGET_64BIT && reload_completed"
12035 [(set (match_dup 3)
12036 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12040 (compare:CC (match_dup 3)
12044 (define_insn "*plus_ne0si_compare"
12045 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12047 (plus:SI (lshiftrt:SI
12048 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12050 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12052 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12053 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12055 (clobber (match_scratch:SI 3 "=&r,&r"))]
12058 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12060 [(set_attr "type" "compare")
12061 (set_attr "length" "8,12")])
12064 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12066 (plus:SI (lshiftrt:SI
12067 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12069 (match_operand:SI 2 "gpc_reg_operand" ""))
12071 (set (match_operand:SI 0 "gpc_reg_operand" "")
12072 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12074 (clobber (match_scratch:SI 3 ""))]
12075 "TARGET_32BIT && reload_completed"
12076 [(parallel [(set (match_dup 0)
12077 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12079 (clobber (match_dup 3))])
12081 (compare:CC (match_dup 0)
12085 (define_insn "*plus_ne0di_compare"
12086 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12088 (plus:DI (lshiftrt:DI
12089 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12091 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12093 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12094 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12096 (clobber (match_scratch:DI 3 "=&r,&r"))]
12099 addic %3,%1,-1\;addze. %0,%2
12101 [(set_attr "type" "compare")
12102 (set_attr "length" "8,12")])
12105 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12107 (plus:DI (lshiftrt:DI
12108 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12110 (match_operand:DI 2 "gpc_reg_operand" ""))
12112 (set (match_operand:DI 0 "gpc_reg_operand" "")
12113 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12115 (clobber (match_scratch:DI 3 ""))]
12116 "TARGET_64BIT && reload_completed"
12117 [(parallel [(set (match_dup 0)
12118 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12120 (clobber (match_dup 3))])
12122 (compare:CC (match_dup 0)
12127 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12128 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12129 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12130 (clobber (match_scratch:SI 3 "=r,X"))]
12133 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12134 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12135 [(set_attr "length" "12")])
12138 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12140 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12141 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12143 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12144 (le:SI (match_dup 1) (match_dup 2)))
12145 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12148 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12149 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12152 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12153 (set_attr "length" "12,12,16,16")])
12156 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12158 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12159 (match_operand:SI 2 "reg_or_short_operand" ""))
12161 (set (match_operand:SI 0 "gpc_reg_operand" "")
12162 (le:SI (match_dup 1) (match_dup 2)))
12163 (clobber (match_scratch:SI 3 ""))]
12164 "TARGET_POWER && reload_completed"
12165 [(parallel [(set (match_dup 0)
12166 (le:SI (match_dup 1) (match_dup 2)))
12167 (clobber (match_dup 3))])
12169 (compare:CC (match_dup 0)
12174 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12175 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12176 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12177 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12180 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12181 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12182 [(set_attr "length" "12")])
12185 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12187 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12188 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12189 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12191 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12194 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12195 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12198 [(set_attr "type" "compare")
12199 (set_attr "length" "12,12,16,16")])
12202 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12204 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12205 (match_operand:SI 2 "reg_or_short_operand" ""))
12206 (match_operand:SI 3 "gpc_reg_operand" ""))
12208 (clobber (match_scratch:SI 4 ""))]
12209 "TARGET_POWER && reload_completed"
12210 [(set (match_dup 4)
12211 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12214 (compare:CC (match_dup 4)
12219 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12221 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12222 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12223 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12225 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12226 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12229 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12230 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12233 [(set_attr "type" "compare")
12234 (set_attr "length" "12,12,16,16")])
12237 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12239 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12240 (match_operand:SI 2 "reg_or_short_operand" ""))
12241 (match_operand:SI 3 "gpc_reg_operand" ""))
12243 (set (match_operand:SI 0 "gpc_reg_operand" "")
12244 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12245 "TARGET_POWER && reload_completed"
12246 [(set (match_dup 0)
12247 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12249 (compare:CC (match_dup 0)
12254 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12255 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12256 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12259 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12260 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12261 [(set_attr "length" "12")])
12263 (define_insn "*leu<mode>"
12264 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12265 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12266 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12268 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12269 [(set_attr "type" "three")
12270 (set_attr "length" "12")])
12272 (define_insn "*leu<mode>_compare"
12273 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12275 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12276 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12278 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12279 (leu:P (match_dup 1) (match_dup 2)))]
12282 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12284 [(set_attr "type" "compare")
12285 (set_attr "length" "12,16")])
12288 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12290 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12291 (match_operand:P 2 "reg_or_short_operand" ""))
12293 (set (match_operand:P 0 "gpc_reg_operand" "")
12294 (leu:P (match_dup 1) (match_dup 2)))]
12296 [(set (match_dup 0)
12297 (leu:P (match_dup 1) (match_dup 2)))
12299 (compare:CC (match_dup 0)
12303 (define_insn "*plus_leu<mode>"
12304 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12305 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12306 (match_operand:P 2 "reg_or_short_operand" "rI"))
12307 (match_operand:P 3 "gpc_reg_operand" "r")))]
12309 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12310 [(set_attr "type" "two")
12311 (set_attr "length" "8")])
12314 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12316 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12317 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12318 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12320 (clobber (match_scratch:SI 4 "=&r,&r"))]
12323 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12325 [(set_attr "type" "compare")
12326 (set_attr "length" "8,12")])
12329 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12331 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12332 (match_operand:SI 2 "reg_or_short_operand" ""))
12333 (match_operand:SI 3 "gpc_reg_operand" ""))
12335 (clobber (match_scratch:SI 4 ""))]
12336 "TARGET_32BIT && reload_completed"
12337 [(set (match_dup 4)
12338 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12341 (compare:CC (match_dup 4)
12346 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12348 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12349 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12350 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12352 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12353 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12356 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12358 [(set_attr "type" "compare")
12359 (set_attr "length" "8,12")])
12362 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12364 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12365 (match_operand:SI 2 "reg_or_short_operand" ""))
12366 (match_operand:SI 3 "gpc_reg_operand" ""))
12368 (set (match_operand:SI 0 "gpc_reg_operand" "")
12369 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12370 "TARGET_32BIT && reload_completed"
12371 [(set (match_dup 0)
12372 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12374 (compare:CC (match_dup 0)
12378 (define_insn "*neg_leu<mode>"
12379 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12380 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12381 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12383 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12384 [(set_attr "type" "three")
12385 (set_attr "length" "12")])
12387 (define_insn "*and_neg_leu<mode>"
12388 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12390 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12391 (match_operand:P 2 "reg_or_short_operand" "rI")))
12392 (match_operand:P 3 "gpc_reg_operand" "r")))]
12394 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12395 [(set_attr "type" "three")
12396 (set_attr "length" "12")])
12399 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12402 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12403 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12404 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12406 (clobber (match_scratch:SI 4 "=&r,&r"))]
12409 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12411 [(set_attr "type" "compare")
12412 (set_attr "length" "12,16")])
12415 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12418 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12419 (match_operand:SI 2 "reg_or_short_operand" "")))
12420 (match_operand:SI 3 "gpc_reg_operand" ""))
12422 (clobber (match_scratch:SI 4 ""))]
12423 "TARGET_32BIT && reload_completed"
12424 [(set (match_dup 4)
12425 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12428 (compare:CC (match_dup 4)
12433 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12436 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12437 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12438 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12440 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12441 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12444 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12446 [(set_attr "type" "compare")
12447 (set_attr "length" "12,16")])
12450 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12453 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12454 (match_operand:SI 2 "reg_or_short_operand" "")))
12455 (match_operand:SI 3 "gpc_reg_operand" ""))
12457 (set (match_operand:SI 0 "gpc_reg_operand" "")
12458 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12459 "TARGET_32BIT && reload_completed"
12460 [(set (match_dup 0)
12461 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12464 (compare:CC (match_dup 0)
12469 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12470 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12471 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12473 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12474 [(set_attr "length" "12")])
12477 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12479 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12480 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12482 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12483 (lt:SI (match_dup 1) (match_dup 2)))]
12486 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12488 [(set_attr "type" "delayed_compare")
12489 (set_attr "length" "12,16")])
12492 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12494 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12495 (match_operand:SI 2 "reg_or_short_operand" ""))
12497 (set (match_operand:SI 0 "gpc_reg_operand" "")
12498 (lt:SI (match_dup 1) (match_dup 2)))]
12499 "TARGET_POWER && reload_completed"
12500 [(set (match_dup 0)
12501 (lt:SI (match_dup 1) (match_dup 2)))
12503 (compare:CC (match_dup 0)
12508 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12509 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12510 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12511 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12513 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12514 [(set_attr "length" "12")])
12517 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12519 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12520 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12521 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12523 (clobber (match_scratch:SI 4 "=&r,&r"))]
12526 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12528 [(set_attr "type" "compare")
12529 (set_attr "length" "12,16")])
12532 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12534 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12535 (match_operand:SI 2 "reg_or_short_operand" ""))
12536 (match_operand:SI 3 "gpc_reg_operand" ""))
12538 (clobber (match_scratch:SI 4 ""))]
12539 "TARGET_POWER && reload_completed"
12540 [(set (match_dup 4)
12541 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12544 (compare:CC (match_dup 4)
12549 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12551 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12552 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12553 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12555 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12556 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12559 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12561 [(set_attr "type" "compare")
12562 (set_attr "length" "12,16")])
12565 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12567 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12568 (match_operand:SI 2 "reg_or_short_operand" ""))
12569 (match_operand:SI 3 "gpc_reg_operand" ""))
12571 (set (match_operand:SI 0 "gpc_reg_operand" "")
12572 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12573 "TARGET_POWER && reload_completed"
12574 [(set (match_dup 0)
12575 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12577 (compare:CC (match_dup 0)
12582 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12583 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12584 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12586 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12587 [(set_attr "length" "12")])
12589 (define_insn_and_split "*ltu<mode>"
12590 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12591 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12592 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12596 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12597 (set (match_dup 0) (neg:P (match_dup 0)))]
12600 (define_insn_and_split "*ltu<mode>_compare"
12601 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12603 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12604 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12606 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12607 (ltu:P (match_dup 1) (match_dup 2)))]
12611 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12612 (parallel [(set (match_dup 3)
12613 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12614 (set (match_dup 0) (neg:P (match_dup 0)))])]
12617 (define_insn_and_split "*plus_ltu<mode>"
12618 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
12619 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12620 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12621 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
12624 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12625 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12626 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
12629 (define_insn_and_split "*plus_ltu<mode>_compare"
12630 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12632 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12633 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12634 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
12636 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12637 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
12640 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12641 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12642 (parallel [(set (match_dup 4)
12643 (compare:CC (minus:P (match_dup 3) (match_dup 0))
12645 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
12648 (define_insn "*neg_ltu<mode>"
12649 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12650 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12651 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
12654 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12655 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12656 [(set_attr "type" "two")
12657 (set_attr "length" "8")])
12660 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12661 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12662 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12663 (clobber (match_scratch:SI 3 "=r"))]
12665 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12666 [(set_attr "length" "12")])
12669 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12671 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12672 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12674 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12675 (ge:SI (match_dup 1) (match_dup 2)))
12676 (clobber (match_scratch:SI 3 "=r,r"))]
12679 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12681 [(set_attr "type" "compare")
12682 (set_attr "length" "12,16")])
12685 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12687 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12688 (match_operand:SI 2 "reg_or_short_operand" ""))
12690 (set (match_operand:SI 0 "gpc_reg_operand" "")
12691 (ge:SI (match_dup 1) (match_dup 2)))
12692 (clobber (match_scratch:SI 3 ""))]
12693 "TARGET_POWER && reload_completed"
12694 [(parallel [(set (match_dup 0)
12695 (ge:SI (match_dup 1) (match_dup 2)))
12696 (clobber (match_dup 3))])
12698 (compare:CC (match_dup 0)
12703 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12704 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12705 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12706 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12708 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12709 [(set_attr "length" "12")])
12712 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12714 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12715 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12716 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12718 (clobber (match_scratch:SI 4 "=&r,&r"))]
12721 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12723 [(set_attr "type" "compare")
12724 (set_attr "length" "12,16")])
12727 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12729 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12730 (match_operand:SI 2 "reg_or_short_operand" ""))
12731 (match_operand:SI 3 "gpc_reg_operand" ""))
12733 (clobber (match_scratch:SI 4 ""))]
12734 "TARGET_POWER && reload_completed"
12735 [(set (match_dup 4)
12736 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12739 (compare:CC (match_dup 4)
12744 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12746 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12747 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12748 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12750 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12751 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12754 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12756 [(set_attr "type" "compare")
12757 (set_attr "length" "12,16")])
12760 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12762 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12763 (match_operand:SI 2 "reg_or_short_operand" ""))
12764 (match_operand:SI 3 "gpc_reg_operand" ""))
12766 (set (match_operand:SI 0 "gpc_reg_operand" "")
12767 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12768 "TARGET_POWER && reload_completed"
12769 [(set (match_dup 0)
12770 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12772 (compare:CC (match_dup 0)
12777 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12778 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12779 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12781 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12782 [(set_attr "length" "12")])
12784 (define_insn "*geu<mode>"
12785 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12786 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12787 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12790 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12791 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12792 [(set_attr "type" "three")
12793 (set_attr "length" "12")])
12795 (define_insn "*geu<mode>_compare"
12796 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12798 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12799 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12801 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12802 (geu:P (match_dup 1) (match_dup 2)))]
12805 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12806 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12809 [(set_attr "type" "compare")
12810 (set_attr "length" "12,12,16,16")])
12813 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12815 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
12816 (match_operand:P 2 "reg_or_neg_short_operand" ""))
12818 (set (match_operand:P 0 "gpc_reg_operand" "")
12819 (geu:P (match_dup 1) (match_dup 2)))]
12821 [(set (match_dup 0)
12822 (geu:P (match_dup 1) (match_dup 2)))
12824 (compare:CC (match_dup 0)
12828 (define_insn "*plus_geu<mode>"
12829 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12830 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12831 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12832 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12835 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12836 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12837 [(set_attr "type" "two")
12838 (set_attr "length" "8")])
12841 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12843 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12844 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12845 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12847 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12850 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12851 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12854 [(set_attr "type" "compare")
12855 (set_attr "length" "8,8,12,12")])
12858 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12860 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12861 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12862 (match_operand:SI 3 "gpc_reg_operand" ""))
12864 (clobber (match_scratch:SI 4 ""))]
12865 "TARGET_32BIT && reload_completed"
12866 [(set (match_dup 4)
12867 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12870 (compare:CC (match_dup 4)
12875 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12877 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12878 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12879 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12881 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12882 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12885 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12886 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12889 [(set_attr "type" "compare")
12890 (set_attr "length" "8,8,12,12")])
12893 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12895 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12896 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12897 (match_operand:SI 3 "gpc_reg_operand" ""))
12899 (set (match_operand:SI 0 "gpc_reg_operand" "")
12900 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12901 "TARGET_32BIT && reload_completed"
12902 [(set (match_dup 0)
12903 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12905 (compare:CC (match_dup 0)
12909 (define_insn "*neg_geu<mode>"
12910 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12911 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12912 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
12915 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12916 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12917 [(set_attr "type" "three")
12918 (set_attr "length" "12")])
12920 (define_insn "*and_neg_geu<mode>"
12921 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12923 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12924 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
12925 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12928 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12929 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12930 [(set_attr "type" "three")
12931 (set_attr "length" "12")])
12934 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12937 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12938 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12939 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12941 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12944 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12945 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12948 [(set_attr "type" "compare")
12949 (set_attr "length" "12,12,16,16")])
12952 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12955 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12956 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12957 (match_operand:SI 3 "gpc_reg_operand" ""))
12959 (clobber (match_scratch:SI 4 ""))]
12960 "TARGET_32BIT && reload_completed"
12961 [(set (match_dup 4)
12962 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12965 (compare:CC (match_dup 4)
12970 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12973 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12974 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12975 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12977 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12978 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12981 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12982 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12985 [(set_attr "type" "compare")
12986 (set_attr "length" "12,12,16,16")])
12989 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12992 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12993 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12994 (match_operand:SI 3 "gpc_reg_operand" ""))
12996 (set (match_operand:SI 0 "gpc_reg_operand" "")
12997 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12998 "TARGET_32BIT && reload_completed"
12999 [(set (match_dup 0)
13000 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13002 (compare:CC (match_dup 0)
13007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13008 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13009 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13011 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13012 [(set_attr "length" "12")])
13015 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13017 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13018 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13020 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13021 (gt:SI (match_dup 1) (match_dup 2)))]
13024 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13026 [(set_attr "type" "delayed_compare")
13027 (set_attr "length" "12,16")])
13030 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13032 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13033 (match_operand:SI 2 "reg_or_short_operand" ""))
13035 (set (match_operand:SI 0 "gpc_reg_operand" "")
13036 (gt:SI (match_dup 1) (match_dup 2)))]
13037 "TARGET_POWER && reload_completed"
13038 [(set (match_dup 0)
13039 (gt:SI (match_dup 1) (match_dup 2)))
13041 (compare:CC (match_dup 0)
13045 (define_insn "*plus_gt0<mode>"
13046 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13047 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13049 (match_operand:P 2 "gpc_reg_operand" "r")))]
13051 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13052 [(set_attr "type" "three")
13053 (set_attr "length" "12")])
13056 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13058 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13060 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13062 (clobber (match_scratch:SI 3 "=&r,&r"))]
13065 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13067 [(set_attr "type" "compare")
13068 (set_attr "length" "12,16")])
13071 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13073 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13075 (match_operand:SI 2 "gpc_reg_operand" ""))
13077 (clobber (match_scratch:SI 3 ""))]
13078 "TARGET_32BIT && reload_completed"
13079 [(set (match_dup 3)
13080 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13083 (compare:CC (match_dup 3)
13088 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13090 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13092 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13094 (clobber (match_scratch:DI 3 "=&r,&r"))]
13097 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13099 [(set_attr "type" "compare")
13100 (set_attr "length" "12,16")])
13103 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13105 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13107 (match_operand:DI 2 "gpc_reg_operand" ""))
13109 (clobber (match_scratch:DI 3 ""))]
13110 "TARGET_64BIT && reload_completed"
13111 [(set (match_dup 3)
13112 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13115 (compare:CC (match_dup 3)
13120 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13122 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13124 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13126 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13127 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13130 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13132 [(set_attr "type" "compare")
13133 (set_attr "length" "12,16")])
13136 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13138 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13140 (match_operand:SI 2 "gpc_reg_operand" ""))
13142 (set (match_operand:SI 0 "gpc_reg_operand" "")
13143 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13144 "TARGET_32BIT && reload_completed"
13145 [(set (match_dup 0)
13146 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13148 (compare:CC (match_dup 0)
13153 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13155 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13157 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13159 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13160 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13163 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13165 [(set_attr "type" "compare")
13166 (set_attr "length" "12,16")])
13169 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13171 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13173 (match_operand:DI 2 "gpc_reg_operand" ""))
13175 (set (match_operand:DI 0 "gpc_reg_operand" "")
13176 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13177 "TARGET_64BIT && reload_completed"
13178 [(set (match_dup 0)
13179 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13181 (compare:CC (match_dup 0)
13186 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13187 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13188 (match_operand:SI 2 "reg_or_short_operand" "r"))
13189 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13191 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13192 [(set_attr "length" "12")])
13195 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13197 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13198 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13199 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13201 (clobber (match_scratch:SI 4 "=&r,&r"))]
13204 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13206 [(set_attr "type" "compare")
13207 (set_attr "length" "12,16")])
13210 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13212 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13213 (match_operand:SI 2 "reg_or_short_operand" ""))
13214 (match_operand:SI 3 "gpc_reg_operand" ""))
13216 (clobber (match_scratch:SI 4 ""))]
13217 "TARGET_POWER && reload_completed"
13218 [(set (match_dup 4)
13219 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13221 (compare:CC (match_dup 4)
13226 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13228 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13229 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13230 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13232 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13233 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13236 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13238 [(set_attr "type" "compare")
13239 (set_attr "length" "12,16")])
13242 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13244 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13245 (match_operand:SI 2 "reg_or_short_operand" ""))
13246 (match_operand:SI 3 "gpc_reg_operand" ""))
13248 (set (match_operand:SI 0 "gpc_reg_operand" "")
13249 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13250 "TARGET_POWER && reload_completed"
13251 [(set (match_dup 0)
13252 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13254 (compare:CC (match_dup 0)
13259 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13260 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13261 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13263 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13264 [(set_attr "length" "12")])
13266 (define_insn_and_split "*gtu<mode>"
13267 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13268 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13269 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13273 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13274 (set (match_dup 0) (neg:P (match_dup 0)))]
13277 (define_insn_and_split "*gtu<mode>_compare"
13278 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13280 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13281 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13283 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13284 (gtu:P (match_dup 1) (match_dup 2)))]
13288 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13289 (parallel [(set (match_dup 3)
13290 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13291 (set (match_dup 0) (neg:P (match_dup 0)))])]
13294 (define_insn_and_split "*plus_gtu<mode>"
13295 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13296 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13297 (match_operand:P 2 "reg_or_short_operand" "rI"))
13298 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13301 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13302 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13303 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13306 (define_insn_and_split "*plus_gtu<mode>_compare"
13307 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13309 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13310 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13311 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13313 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13314 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13317 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13318 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13319 (parallel [(set (match_dup 4)
13320 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13322 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13325 (define_insn "*neg_gtu<mode>"
13326 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13327 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13328 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13330 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13331 [(set_attr "type" "two")
13332 (set_attr "length" "8")])
13335 ;; Define both directions of branch and return. If we need a reload
13336 ;; register, we'd rather use CR0 since it is much easier to copy a
13337 ;; register CC value to there.
13341 (if_then_else (match_operator 1 "branch_comparison_operator"
13343 "cc_reg_operand" "y")
13345 (label_ref (match_operand 0 "" ""))
13350 return output_cbranch (operands[1], \"%l0\", 0, insn);
13352 [(set_attr "type" "branch")])
13356 (if_then_else (match_operator 0 "branch_comparison_operator"
13358 "cc_reg_operand" "y")
13365 return output_cbranch (operands[0], NULL, 0, insn);
13367 [(set_attr "type" "jmpreg")
13368 (set_attr "length" "4")])
13372 (if_then_else (match_operator 1 "branch_comparison_operator"
13374 "cc_reg_operand" "y")
13377 (label_ref (match_operand 0 "" ""))))]
13381 return output_cbranch (operands[1], \"%l0\", 1, insn);
13383 [(set_attr "type" "branch")])
13387 (if_then_else (match_operator 0 "branch_comparison_operator"
13389 "cc_reg_operand" "y")
13396 return output_cbranch (operands[0], NULL, 1, insn);
13398 [(set_attr "type" "jmpreg")
13399 (set_attr "length" "4")])
13401 ;; Logic on condition register values.
13403 ; This pattern matches things like
13404 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13405 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13407 ; which are generated by the branch logic.
13408 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13410 (define_insn "*cceq_ior_compare"
13411 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13412 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13413 [(match_operator:SI 2
13414 "branch_positive_comparison_operator"
13416 "cc_reg_operand" "y,y")
13418 (match_operator:SI 4
13419 "branch_positive_comparison_operator"
13421 "cc_reg_operand" "0,y")
13425 "cr%q1 %E0,%j2,%j4"
13426 [(set_attr "type" "cr_logical,delayed_cr")])
13428 ; Why is the constant -1 here, but 1 in the previous pattern?
13429 ; Because ~1 has all but the low bit set.
13431 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13432 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13433 [(not:SI (match_operator:SI 2
13434 "branch_positive_comparison_operator"
13436 "cc_reg_operand" "y,y")
13438 (match_operator:SI 4
13439 "branch_positive_comparison_operator"
13441 "cc_reg_operand" "0,y")
13445 "cr%q1 %E0,%j2,%j4"
13446 [(set_attr "type" "cr_logical,delayed_cr")])
13448 (define_insn "*cceq_rev_compare"
13449 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13450 (compare:CCEQ (match_operator:SI 1
13451 "branch_positive_comparison_operator"
13453 "cc_reg_operand" "0,y")
13457 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13458 [(set_attr "type" "cr_logical,delayed_cr")])
13460 ;; If we are comparing the result of two comparisons, this can be done
13461 ;; using creqv or crxor.
13463 (define_insn_and_split ""
13464 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13465 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13466 [(match_operand 2 "cc_reg_operand" "y")
13468 (match_operator 3 "branch_comparison_operator"
13469 [(match_operand 4 "cc_reg_operand" "y")
13474 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13478 int positive_1, positive_2;
13480 positive_1 = branch_positive_comparison_operator (operands[1],
13481 GET_MODE (operands[1]));
13482 positive_2 = branch_positive_comparison_operator (operands[3],
13483 GET_MODE (operands[3]));
13486 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13487 GET_CODE (operands[1])),
13489 operands[2], const0_rtx);
13490 else if (GET_MODE (operands[1]) != SImode)
13491 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13492 operands[2], const0_rtx);
13495 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13496 GET_CODE (operands[3])),
13498 operands[4], const0_rtx);
13499 else if (GET_MODE (operands[3]) != SImode)
13500 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13501 operands[4], const0_rtx);
13503 if (positive_1 == positive_2)
13505 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13506 operands[5] = constm1_rtx;
13510 operands[5] = const1_rtx;
13514 ;; Unconditional branch and return.
13516 (define_insn "jump"
13518 (label_ref (match_operand 0 "" "")))]
13521 [(set_attr "type" "branch")])
13523 (define_insn "return"
13527 [(set_attr "type" "jmpreg")])
13529 (define_expand "indirect_jump"
13530 [(set (pc) (match_operand 0 "register_operand" ""))])
13532 (define_insn "*indirect_jump<mode>"
13533 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13538 [(set_attr "type" "jmpreg")])
13540 ;; Table jump for switch statements:
13541 (define_expand "tablejump"
13542 [(use (match_operand 0 "" ""))
13543 (use (label_ref (match_operand 1 "" "")))]
13548 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13550 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13554 (define_expand "tablejumpsi"
13555 [(set (match_dup 3)
13556 (plus:SI (match_operand:SI 0 "" "")
13558 (parallel [(set (pc) (match_dup 3))
13559 (use (label_ref (match_operand 1 "" "")))])]
13562 { operands[0] = force_reg (SImode, operands[0]);
13563 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13564 operands[3] = gen_reg_rtx (SImode);
13567 (define_expand "tablejumpdi"
13568 [(set (match_dup 4)
13569 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13571 (plus:DI (match_dup 4)
13573 (parallel [(set (pc) (match_dup 3))
13574 (use (label_ref (match_operand 1 "" "")))])]
13577 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13578 operands[3] = gen_reg_rtx (DImode);
13579 operands[4] = gen_reg_rtx (DImode);
13582 (define_insn "*tablejump<mode>_internal1"
13584 (match_operand:P 0 "register_operand" "c,*l"))
13585 (use (label_ref (match_operand 1 "" "")))]
13590 [(set_attr "type" "jmpreg")])
13595 "{cror 0,0,0|nop}")
13597 ;; Define the subtract-one-and-jump insns, starting with the template
13598 ;; so loop.c knows what to generate.
13600 (define_expand "doloop_end"
13601 [(use (match_operand 0 "" "")) ; loop pseudo
13602 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13603 (use (match_operand 2 "" "")) ; max iterations
13604 (use (match_operand 3 "" "")) ; loop level
13605 (use (match_operand 4 "" ""))] ; label
13609 /* Only use this on innermost loops. */
13610 if (INTVAL (operands[3]) > 1)
13614 if (GET_MODE (operands[0]) != DImode)
13616 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13620 if (GET_MODE (operands[0]) != SImode)
13622 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13627 (define_expand "ctr<mode>"
13628 [(parallel [(set (pc)
13629 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13631 (label_ref (match_operand 1 "" ""))
13634 (plus:P (match_dup 0)
13636 (clobber (match_scratch:CC 2 ""))
13637 (clobber (match_scratch:P 3 ""))])]
13641 ;; We need to be able to do this for any operand, including MEM, or we
13642 ;; will cause reload to blow up since we don't allow output reloads on
13644 ;; For the length attribute to be calculated correctly, the
13645 ;; label MUST be operand 0.
13647 (define_insn "*ctr<mode>_internal1"
13649 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13651 (label_ref (match_operand 0 "" ""))
13653 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13654 (plus:P (match_dup 1)
13656 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13657 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13661 if (which_alternative != 0)
13663 else if (get_attr_length (insn) == 4)
13664 return \"{bdn|bdnz} %l0\";
13666 return \"bdz $+8\;b %l0\";
13668 [(set_attr "type" "branch")
13669 (set_attr "length" "*,12,16,16")])
13671 (define_insn "*ctr<mode>_internal2"
13673 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13676 (label_ref (match_operand 0 "" ""))))
13677 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13678 (plus:P (match_dup 1)
13680 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13681 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13685 if (which_alternative != 0)
13687 else if (get_attr_length (insn) == 4)
13688 return \"bdz %l0\";
13690 return \"{bdn|bdnz} $+8\;b %l0\";
13692 [(set_attr "type" "branch")
13693 (set_attr "length" "*,12,16,16")])
13695 ;; Similar but use EQ
13697 (define_insn "*ctr<mode>_internal5"
13699 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13701 (label_ref (match_operand 0 "" ""))
13703 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13704 (plus:P (match_dup 1)
13706 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13707 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13711 if (which_alternative != 0)
13713 else if (get_attr_length (insn) == 4)
13714 return \"bdz %l0\";
13716 return \"{bdn|bdnz} $+8\;b %l0\";
13718 [(set_attr "type" "branch")
13719 (set_attr "length" "*,12,16,16")])
13721 (define_insn "*ctr<mode>_internal6"
13723 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13726 (label_ref (match_operand 0 "" ""))))
13727 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13728 (plus:P (match_dup 1)
13730 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13731 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13735 if (which_alternative != 0)
13737 else if (get_attr_length (insn) == 4)
13738 return \"{bdn|bdnz} %l0\";
13740 return \"bdz $+8\;b %l0\";
13742 [(set_attr "type" "branch")
13743 (set_attr "length" "*,12,16,16")])
13745 ;; Now the splitters if we could not allocate the CTR register
13749 (if_then_else (match_operator 2 "comparison_operator"
13750 [(match_operand:P 1 "gpc_reg_operand" "")
13752 (match_operand 5 "" "")
13753 (match_operand 6 "" "")))
13754 (set (match_operand:P 0 "gpc_reg_operand" "")
13755 (plus:P (match_dup 1) (const_int -1)))
13756 (clobber (match_scratch:CC 3 ""))
13757 (clobber (match_scratch:P 4 ""))]
13759 [(parallel [(set (match_dup 3)
13760 (compare:CC (plus:P (match_dup 1)
13764 (plus:P (match_dup 1)
13766 (set (pc) (if_then_else (match_dup 7)
13770 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13771 operands[3], const0_rtx); }")
13775 (if_then_else (match_operator 2 "comparison_operator"
13776 [(match_operand:P 1 "gpc_reg_operand" "")
13778 (match_operand 5 "" "")
13779 (match_operand 6 "" "")))
13780 (set (match_operand:P 0 "nonimmediate_operand" "")
13781 (plus:P (match_dup 1) (const_int -1)))
13782 (clobber (match_scratch:CC 3 ""))
13783 (clobber (match_scratch:P 4 ""))]
13784 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13785 [(parallel [(set (match_dup 3)
13786 (compare:CC (plus:P (match_dup 1)
13790 (plus:P (match_dup 1)
13794 (set (pc) (if_then_else (match_dup 7)
13798 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13799 operands[3], const0_rtx); }")
13801 (define_insn "trap"
13802 [(trap_if (const_int 1) (const_int 0))]
13806 (define_expand "conditional_trap"
13807 [(trap_if (match_operator 0 "trap_comparison_operator"
13808 [(match_dup 2) (match_dup 3)])
13809 (match_operand 1 "const_int_operand" ""))]
13811 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
13812 operands[2] = rs6000_compare_op0;
13813 operands[3] = rs6000_compare_op1;")
13816 [(trap_if (match_operator 0 "trap_comparison_operator"
13817 [(match_operand:GPR 1 "register_operand" "r")
13818 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13821 "{t|t<wd>}%V0%I2 %1,%2")
13823 ;; Insns related to generating the function prologue and epilogue.
13825 (define_expand "prologue"
13826 [(use (const_int 0))]
13827 "TARGET_SCHED_PROLOG"
13830 rs6000_emit_prologue ();
13834 (define_insn "*movesi_from_cr_one"
13835 [(match_parallel 0 "mfcr_operation"
13836 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13837 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13838 (match_operand 3 "immediate_operand" "n")]
13839 UNSPEC_MOVESI_FROM_CR))])]
13845 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13847 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13848 operands[4] = GEN_INT (mask);
13849 output_asm_insn (\"mfcr %1,%4\", operands);
13853 [(set_attr "type" "mfcrf")])
13855 (define_insn "movesi_from_cr"
13856 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13857 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
13858 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
13859 UNSPEC_MOVESI_FROM_CR))]
13862 [(set_attr "type" "mfcr")])
13864 (define_insn "*stmw"
13865 [(match_parallel 0 "stmw_operation"
13866 [(set (match_operand:SI 1 "memory_operand" "=m")
13867 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13870 [(set_attr "type" "store_ux")])
13872 (define_insn "*save_fpregs_<mode>"
13873 [(match_parallel 0 "any_parallel_operand"
13874 [(clobber (match_operand:P 1 "register_operand" "=l"))
13875 (use (match_operand:P 2 "call_operand" "s"))
13876 (set (match_operand:DF 3 "memory_operand" "=m")
13877 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
13880 [(set_attr "type" "branch")
13881 (set_attr "length" "4")])
13883 ; These are to explain that changes to the stack pointer should
13884 ; not be moved over stores to stack memory.
13885 (define_insn "stack_tie"
13886 [(set (match_operand:BLK 0 "memory_operand" "+m")
13887 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
13890 [(set_attr "length" "0")])
13893 (define_expand "epilogue"
13894 [(use (const_int 0))]
13895 "TARGET_SCHED_PROLOG"
13898 rs6000_emit_epilogue (FALSE);
13902 ; On some processors, doing the mtcrf one CC register at a time is
13903 ; faster (like on the 604e). On others, doing them all at once is
13904 ; faster; for instance, on the 601 and 750.
13906 (define_expand "movsi_to_cr_one"
13907 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13908 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13909 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13911 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13913 (define_insn "*movsi_to_cr"
13914 [(match_parallel 0 "mtcrf_operation"
13915 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13916 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13917 (match_operand 3 "immediate_operand" "n")]
13918 UNSPEC_MOVESI_TO_CR))])]
13924 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13925 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13926 operands[4] = GEN_INT (mask);
13927 return \"mtcrf %4,%2\";
13929 [(set_attr "type" "mtcr")])
13931 (define_insn "*mtcrfsi"
13932 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13933 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13934 (match_operand 2 "immediate_operand" "n")]
13935 UNSPEC_MOVESI_TO_CR))]
13936 "GET_CODE (operands[0]) == REG
13937 && CR_REGNO_P (REGNO (operands[0]))
13938 && GET_CODE (operands[2]) == CONST_INT
13939 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13941 [(set_attr "type" "mtcr")])
13943 ; The load-multiple instructions have similar properties.
13944 ; Note that "load_multiple" is a name known to the machine-independent
13945 ; code that actually corresponds to the PowerPC load-string.
13947 (define_insn "*lmw"
13948 [(match_parallel 0 "lmw_operation"
13949 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13950 (match_operand:SI 2 "memory_operand" "m"))])]
13953 [(set_attr "type" "load_ux")])
13955 (define_insn "*return_internal_<mode>"
13957 (use (match_operand:P 0 "register_operand" "lc"))]
13960 [(set_attr "type" "jmpreg")])
13962 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13963 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13965 (define_insn "*return_and_restore_fpregs_<mode>"
13966 [(match_parallel 0 "any_parallel_operand"
13968 (use (match_operand:P 1 "register_operand" "l"))
13969 (use (match_operand:P 2 "call_operand" "s"))
13970 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
13971 (match_operand:DF 4 "memory_operand" "m"))])]
13975 ; This is used in compiling the unwind routines.
13976 (define_expand "eh_return"
13977 [(use (match_operand 0 "general_operand" ""))]
13982 emit_insn (gen_eh_set_lr_si (operands[0]));
13984 emit_insn (gen_eh_set_lr_di (operands[0]));
13988 ; We can't expand this before we know where the link register is stored.
13989 (define_insn "eh_set_lr_<mode>"
13990 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
13992 (clobber (match_scratch:P 1 "=&b"))]
13997 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
13998 (clobber (match_scratch 1 ""))]
14003 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14007 (define_insn "prefetch"
14008 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14009 (match_operand:SI 1 "const_int_operand" "n")
14010 (match_operand:SI 2 "const_int_operand" "n"))]
14014 if (GET_CODE (operands[0]) == REG)
14015 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14016 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14018 [(set_attr "type" "load")])
14021 (include "sync.md")
14022 (include "altivec.md")