1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 2, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 ;; MA 02110-1301, USA.
24 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
31 [(UNSPEC_FRSP 0) ; frsp for POWER machines
32 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
33 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
34 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
36 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
42 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
43 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
46 (UNSPEC_MOVESI_FROM_CR 19)
47 (UNSPEC_MOVESI_TO_CR 20)
49 (UNSPEC_TLSDTPRELHA 22)
50 (UNSPEC_TLSDTPRELLO 23)
51 (UNSPEC_TLSGOTDTPREL 24)
53 (UNSPEC_TLSTPRELHA 26)
54 (UNSPEC_TLSTPRELLO 27)
55 (UNSPEC_TLSGOTTPREL 28)
57 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
58 (UNSPEC_MV_CR_GT 31) ; move_from_CR_eq_bit
74 (UNSPEC_DLMZB_STRLEN 47)
78 ;; UNSPEC_VOLATILE usage
83 (UNSPECV_LL 1) ; load-locked
84 (UNSPECV_SC 2) ; store-conditional
85 (UNSPECV_EH_RR 9) ; eh_reg_restore
88 ;; Define an insn type attribute. This is used in function unit delay
90 (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"
91 (const_string "integer"))
94 ; '(pc)' in the following doesn't include the instruction itself; it is
95 ; calculated as if the instruction had zero size.
96 (define_attr "length" ""
97 (if_then_else (eq_attr "type" "branch")
98 (if_then_else (and (ge (minus (match_dup 0) (pc))
100 (lt (minus (match_dup 0) (pc))
106 ;; Processor type -- this attribute must exactly match the processor_type
107 ;; enumeration in rs6000.h.
109 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
110 (const (symbol_ref "rs6000_cpu_attr")))
112 (automata_option "ndfa")
125 (include "power4.md")
126 (include "power5.md")
128 (include "predicates.md")
130 (include "darwin.md")
135 ; This mode macro allows :GPR to be used to indicate the allowable size
136 ; of whole values in GPRs.
137 (define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
139 ; Any supported integer mode.
140 (define_mode_macro INT [QI HI SI DI TI])
142 ; Any supported integer mode that fits in one register.
143 (define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
145 ; extend modes for DImode
146 (define_mode_macro QHSI [QI HI SI])
148 ; SImode or DImode, even if DImode doesn't fit in GPRs.
149 (define_mode_macro SDI [SI DI])
151 ; The size of a pointer. Also, the size of the value that a record-condition
152 ; (one with a '.') will compare.
153 (define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
155 ; Any hardware-supported floating-point mode
156 (define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
157 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
158 (TF "!TARGET_IEEEQUAD
159 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128")])
161 ; Various instructions that come in SI and DI forms.
162 ; A generic w/d attribute, for things like cmpw/cmpd.
163 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
166 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
169 ;; Start with fixed-point load and store insns. Here we put only the more
170 ;; complex forms. Basic data transfer is done later.
172 (define_expand "zero_extend<mode>di2"
173 [(set (match_operand:DI 0 "gpc_reg_operand" "")
174 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
178 (define_insn "*zero_extend<mode>di2_internal1"
179 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
180 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
184 rldicl %0,%1,0,<dbits>"
185 [(set_attr "type" "load,*")])
187 (define_insn "*zero_extend<mode>di2_internal2"
188 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
189 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
191 (clobber (match_scratch:DI 2 "=r,r"))]
194 rldicl. %2,%1,0,<dbits>
196 [(set_attr "type" "compare")
197 (set_attr "length" "4,8")])
200 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
201 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
203 (clobber (match_scratch:DI 2 ""))]
204 "TARGET_POWERPC64 && reload_completed"
206 (zero_extend:DI (match_dup 1)))
208 (compare:CC (match_dup 2)
212 (define_insn "*zero_extend<mode>di2_internal3"
213 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
214 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
216 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
217 (zero_extend:DI (match_dup 1)))]
220 rldicl. %0,%1,0,<dbits>
222 [(set_attr "type" "compare")
223 (set_attr "length" "4,8")])
226 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
227 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
229 (set (match_operand:DI 0 "gpc_reg_operand" "")
230 (zero_extend:DI (match_dup 1)))]
231 "TARGET_POWERPC64 && reload_completed"
233 (zero_extend:DI (match_dup 1)))
235 (compare:CC (match_dup 0)
239 (define_insn "extendqidi2"
240 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
241 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
246 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
247 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
249 (clobber (match_scratch:DI 2 "=r,r"))]
254 [(set_attr "type" "compare")
255 (set_attr "length" "4,8")])
258 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
259 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
261 (clobber (match_scratch:DI 2 ""))]
262 "TARGET_POWERPC64 && reload_completed"
264 (sign_extend:DI (match_dup 1)))
266 (compare:CC (match_dup 2)
271 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
272 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
274 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
275 (sign_extend:DI (match_dup 1)))]
280 [(set_attr "type" "compare")
281 (set_attr "length" "4,8")])
284 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
285 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
287 (set (match_operand:DI 0 "gpc_reg_operand" "")
288 (sign_extend:DI (match_dup 1)))]
289 "TARGET_POWERPC64 && reload_completed"
291 (sign_extend:DI (match_dup 1)))
293 (compare:CC (match_dup 0)
297 (define_expand "extendhidi2"
298 [(set (match_operand:DI 0 "gpc_reg_operand" "")
299 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
304 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
305 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
310 [(set_attr "type" "load_ext,*")])
313 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
314 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
316 (clobber (match_scratch:DI 2 "=r,r"))]
321 [(set_attr "type" "compare")
322 (set_attr "length" "4,8")])
325 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
326 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
328 (clobber (match_scratch:DI 2 ""))]
329 "TARGET_POWERPC64 && reload_completed"
331 (sign_extend:DI (match_dup 1)))
333 (compare:CC (match_dup 2)
338 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
339 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
341 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
342 (sign_extend:DI (match_dup 1)))]
347 [(set_attr "type" "compare")
348 (set_attr "length" "4,8")])
351 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
352 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
354 (set (match_operand:DI 0 "gpc_reg_operand" "")
355 (sign_extend:DI (match_dup 1)))]
356 "TARGET_POWERPC64 && reload_completed"
358 (sign_extend:DI (match_dup 1)))
360 (compare:CC (match_dup 0)
364 (define_expand "extendsidi2"
365 [(set (match_operand:DI 0 "gpc_reg_operand" "")
366 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
371 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
372 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
377 [(set_attr "type" "load_ext,*")])
380 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
381 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
383 (clobber (match_scratch:DI 2 "=r,r"))]
388 [(set_attr "type" "compare")
389 (set_attr "length" "4,8")])
392 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
393 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
395 (clobber (match_scratch:DI 2 ""))]
396 "TARGET_POWERPC64 && reload_completed"
398 (sign_extend:DI (match_dup 1)))
400 (compare:CC (match_dup 2)
405 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
406 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
408 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
409 (sign_extend:DI (match_dup 1)))]
414 [(set_attr "type" "compare")
415 (set_attr "length" "4,8")])
418 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
419 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
421 (set (match_operand:DI 0 "gpc_reg_operand" "")
422 (sign_extend:DI (match_dup 1)))]
423 "TARGET_POWERPC64 && reload_completed"
425 (sign_extend:DI (match_dup 1)))
427 (compare:CC (match_dup 0)
431 (define_expand "zero_extendqisi2"
432 [(set (match_operand:SI 0 "gpc_reg_operand" "")
433 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
438 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
439 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
443 {rlinm|rlwinm} %0,%1,0,0xff"
444 [(set_attr "type" "load,*")])
447 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
448 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
450 (clobber (match_scratch:SI 2 "=r,r"))]
453 {andil.|andi.} %2,%1,0xff
455 [(set_attr "type" "compare")
456 (set_attr "length" "4,8")])
459 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
460 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
462 (clobber (match_scratch:SI 2 ""))]
465 (zero_extend:SI (match_dup 1)))
467 (compare:CC (match_dup 2)
472 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
473 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
475 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
476 (zero_extend:SI (match_dup 1)))]
479 {andil.|andi.} %0,%1,0xff
481 [(set_attr "type" "compare")
482 (set_attr "length" "4,8")])
485 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
486 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
488 (set (match_operand:SI 0 "gpc_reg_operand" "")
489 (zero_extend:SI (match_dup 1)))]
492 (zero_extend:SI (match_dup 1)))
494 (compare:CC (match_dup 0)
498 (define_expand "extendqisi2"
499 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
500 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
505 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
506 else if (TARGET_POWER)
507 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
509 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
513 (define_insn "extendqisi2_ppc"
514 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
515 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
520 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
521 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
523 (clobber (match_scratch:SI 2 "=r,r"))]
528 [(set_attr "type" "compare")
529 (set_attr "length" "4,8")])
532 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
533 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
535 (clobber (match_scratch:SI 2 ""))]
536 "TARGET_POWERPC && reload_completed"
538 (sign_extend:SI (match_dup 1)))
540 (compare:CC (match_dup 2)
545 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
546 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
548 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
549 (sign_extend:SI (match_dup 1)))]
554 [(set_attr "type" "compare")
555 (set_attr "length" "4,8")])
558 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
559 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
561 (set (match_operand:SI 0 "gpc_reg_operand" "")
562 (sign_extend:SI (match_dup 1)))]
563 "TARGET_POWERPC && reload_completed"
565 (sign_extend:SI (match_dup 1)))
567 (compare:CC (match_dup 0)
571 (define_expand "extendqisi2_power"
572 [(parallel [(set (match_dup 2)
573 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
575 (clobber (scratch:SI))])
576 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
577 (ashiftrt:SI (match_dup 2)
579 (clobber (scratch:SI))])]
582 { operands[1] = gen_lowpart (SImode, operands[1]);
583 operands[2] = gen_reg_rtx (SImode); }")
585 (define_expand "extendqisi2_no_power"
587 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
589 (set (match_operand:SI 0 "gpc_reg_operand" "")
590 (ashiftrt:SI (match_dup 2)
592 "! TARGET_POWER && ! TARGET_POWERPC"
594 { operands[1] = gen_lowpart (SImode, operands[1]);
595 operands[2] = gen_reg_rtx (SImode); }")
597 (define_expand "zero_extendqihi2"
598 [(set (match_operand:HI 0 "gpc_reg_operand" "")
599 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
604 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
605 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
609 {rlinm|rlwinm} %0,%1,0,0xff"
610 [(set_attr "type" "load,*")])
613 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
614 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
616 (clobber (match_scratch:HI 2 "=r,r"))]
619 {andil.|andi.} %2,%1,0xff
621 [(set_attr "type" "compare")
622 (set_attr "length" "4,8")])
625 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
626 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
628 (clobber (match_scratch:HI 2 ""))]
631 (zero_extend:HI (match_dup 1)))
633 (compare:CC (match_dup 2)
638 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
639 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
641 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
642 (zero_extend:HI (match_dup 1)))]
645 {andil.|andi.} %0,%1,0xff
647 [(set_attr "type" "compare")
648 (set_attr "length" "4,8")])
651 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
652 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
654 (set (match_operand:HI 0 "gpc_reg_operand" "")
655 (zero_extend:HI (match_dup 1)))]
658 (zero_extend:HI (match_dup 1)))
660 (compare:CC (match_dup 0)
664 (define_expand "extendqihi2"
665 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
666 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
671 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
672 else if (TARGET_POWER)
673 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
675 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
679 (define_insn "extendqihi2_ppc"
680 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
681 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
686 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
687 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
689 (clobber (match_scratch:HI 2 "=r,r"))]
694 [(set_attr "type" "compare")
695 (set_attr "length" "4,8")])
698 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
699 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
701 (clobber (match_scratch:HI 2 ""))]
702 "TARGET_POWERPC && reload_completed"
704 (sign_extend:HI (match_dup 1)))
706 (compare:CC (match_dup 2)
711 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
712 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
714 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
715 (sign_extend:HI (match_dup 1)))]
720 [(set_attr "type" "compare")
721 (set_attr "length" "4,8")])
724 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
725 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
727 (set (match_operand:HI 0 "gpc_reg_operand" "")
728 (sign_extend:HI (match_dup 1)))]
729 "TARGET_POWERPC && reload_completed"
731 (sign_extend:HI (match_dup 1)))
733 (compare:CC (match_dup 0)
737 (define_expand "extendqihi2_power"
738 [(parallel [(set (match_dup 2)
739 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
741 (clobber (scratch:SI))])
742 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
743 (ashiftrt:SI (match_dup 2)
745 (clobber (scratch:SI))])]
748 { operands[0] = gen_lowpart (SImode, operands[0]);
749 operands[1] = gen_lowpart (SImode, operands[1]);
750 operands[2] = gen_reg_rtx (SImode); }")
752 (define_expand "extendqihi2_no_power"
754 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
756 (set (match_operand:HI 0 "gpc_reg_operand" "")
757 (ashiftrt:SI (match_dup 2)
759 "! TARGET_POWER && ! TARGET_POWERPC"
761 { operands[0] = gen_lowpart (SImode, operands[0]);
762 operands[1] = gen_lowpart (SImode, operands[1]);
763 operands[2] = gen_reg_rtx (SImode); }")
765 (define_expand "zero_extendhisi2"
766 [(set (match_operand:SI 0 "gpc_reg_operand" "")
767 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
772 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
773 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
777 {rlinm|rlwinm} %0,%1,0,0xffff"
778 [(set_attr "type" "load,*")])
781 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
782 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
784 (clobber (match_scratch:SI 2 "=r,r"))]
787 {andil.|andi.} %2,%1,0xffff
789 [(set_attr "type" "compare")
790 (set_attr "length" "4,8")])
793 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
794 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
796 (clobber (match_scratch:SI 2 ""))]
799 (zero_extend:SI (match_dup 1)))
801 (compare:CC (match_dup 2)
806 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
807 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
809 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
810 (zero_extend:SI (match_dup 1)))]
813 {andil.|andi.} %0,%1,0xffff
815 [(set_attr "type" "compare")
816 (set_attr "length" "4,8")])
819 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
820 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
822 (set (match_operand:SI 0 "gpc_reg_operand" "")
823 (zero_extend:SI (match_dup 1)))]
826 (zero_extend:SI (match_dup 1)))
828 (compare:CC (match_dup 0)
832 (define_expand "extendhisi2"
833 [(set (match_operand:SI 0 "gpc_reg_operand" "")
834 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
839 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
840 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
845 [(set_attr "type" "load_ext,*")])
848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
849 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
851 (clobber (match_scratch:SI 2 "=r,r"))]
856 [(set_attr "type" "compare")
857 (set_attr "length" "4,8")])
860 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
861 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
863 (clobber (match_scratch:SI 2 ""))]
866 (sign_extend:SI (match_dup 1)))
868 (compare:CC (match_dup 2)
873 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
874 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
876 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
877 (sign_extend:SI (match_dup 1)))]
882 [(set_attr "type" "compare")
883 (set_attr "length" "4,8")])
885 ;; IBM 405 and 440 half-word multiplication operations.
887 (define_insn "*macchwc"
888 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
889 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
890 (match_operand:SI 2 "gpc_reg_operand" "r")
893 (match_operand:HI 1 "gpc_reg_operand" "r")))
894 (match_operand:SI 4 "gpc_reg_operand" "0"))
896 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
897 (plus:SI (mult:SI (ashiftrt:SI
905 [(set_attr "type" "imul3")])
907 (define_insn "*macchw"
908 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
909 (plus:SI (mult:SI (ashiftrt:SI
910 (match_operand:SI 2 "gpc_reg_operand" "r")
913 (match_operand:HI 1 "gpc_reg_operand" "r")))
914 (match_operand:SI 3 "gpc_reg_operand" "0")))]
917 [(set_attr "type" "imul3")])
919 (define_insn "*macchwuc"
920 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
921 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
922 (match_operand:SI 2 "gpc_reg_operand" "r")
925 (match_operand:HI 1 "gpc_reg_operand" "r")))
926 (match_operand:SI 4 "gpc_reg_operand" "0"))
928 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
929 (plus:SI (mult:SI (lshiftrt:SI
936 "macchwu. %0, %1, %2"
937 [(set_attr "type" "imul3")])
939 (define_insn "*macchwu"
940 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
941 (plus:SI (mult:SI (lshiftrt:SI
942 (match_operand:SI 2 "gpc_reg_operand" "r")
945 (match_operand:HI 1 "gpc_reg_operand" "r")))
946 (match_operand:SI 3 "gpc_reg_operand" "0")))]
949 [(set_attr "type" "imul3")])
951 (define_insn "*machhwc"
952 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
953 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
954 (match_operand:SI 1 "gpc_reg_operand" "%r")
957 (match_operand:SI 2 "gpc_reg_operand" "r")
959 (match_operand:SI 4 "gpc_reg_operand" "0"))
961 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
962 (plus:SI (mult:SI (ashiftrt:SI
971 [(set_attr "type" "imul3")])
973 (define_insn "*machhw"
974 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
975 (plus:SI (mult:SI (ashiftrt:SI
976 (match_operand:SI 1 "gpc_reg_operand" "%r")
979 (match_operand:SI 2 "gpc_reg_operand" "r")
981 (match_operand:SI 3 "gpc_reg_operand" "0")))]
984 [(set_attr "type" "imul3")])
986 (define_insn "*machhwuc"
987 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
988 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
989 (match_operand:SI 1 "gpc_reg_operand" "%r")
992 (match_operand:SI 2 "gpc_reg_operand" "r")
994 (match_operand:SI 4 "gpc_reg_operand" "0"))
996 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
997 (plus:SI (mult:SI (lshiftrt:SI
1005 "machhwu. %0, %1, %2"
1006 [(set_attr "type" "imul3")])
1008 (define_insn "*machhwu"
1009 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1010 (plus:SI (mult:SI (lshiftrt:SI
1011 (match_operand:SI 1 "gpc_reg_operand" "%r")
1014 (match_operand:SI 2 "gpc_reg_operand" "r")
1016 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1018 "machhwu %0, %1, %2"
1019 [(set_attr "type" "imul3")])
1021 (define_insn "*maclhwc"
1022 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1023 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1024 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1026 (match_operand:HI 2 "gpc_reg_operand" "r")))
1027 (match_operand:SI 4 "gpc_reg_operand" "0"))
1029 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1030 (plus:SI (mult:SI (sign_extend:SI
1036 "maclhw. %0, %1, %2"
1037 [(set_attr "type" "imul3")])
1039 (define_insn "*maclhw"
1040 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1041 (plus:SI (mult:SI (sign_extend:SI
1042 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1044 (match_operand:HI 2 "gpc_reg_operand" "r")))
1045 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1048 [(set_attr "type" "imul3")])
1050 (define_insn "*maclhwuc"
1051 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1052 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1053 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1055 (match_operand:HI 2 "gpc_reg_operand" "r")))
1056 (match_operand:SI 4 "gpc_reg_operand" "0"))
1058 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1059 (plus:SI (mult:SI (zero_extend:SI
1065 "maclhwu. %0, %1, %2"
1066 [(set_attr "type" "imul3")])
1068 (define_insn "*maclhwu"
1069 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1070 (plus:SI (mult:SI (zero_extend:SI
1071 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1073 (match_operand:HI 2 "gpc_reg_operand" "r")))
1074 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1076 "maclhwu %0, %1, %2"
1077 [(set_attr "type" "imul3")])
1079 (define_insn "*nmacchwc"
1080 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1081 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1082 (mult:SI (ashiftrt:SI
1083 (match_operand:SI 2 "gpc_reg_operand" "r")
1086 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1088 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1089 (minus:SI (match_dup 4)
1090 (mult:SI (ashiftrt:SI
1096 "nmacchw. %0, %1, %2"
1097 [(set_attr "type" "imul3")])
1099 (define_insn "*nmacchw"
1100 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1101 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1102 (mult:SI (ashiftrt:SI
1103 (match_operand:SI 2 "gpc_reg_operand" "r")
1106 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1108 "nmacchw %0, %1, %2"
1109 [(set_attr "type" "imul3")])
1111 (define_insn "*nmachhwc"
1112 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1113 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1114 (mult:SI (ashiftrt:SI
1115 (match_operand:SI 1 "gpc_reg_operand" "%r")
1118 (match_operand:SI 2 "gpc_reg_operand" "r")
1121 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1122 (minus:SI (match_dup 4)
1123 (mult:SI (ashiftrt:SI
1130 "nmachhw. %0, %1, %2"
1131 [(set_attr "type" "imul3")])
1133 (define_insn "*nmachhw"
1134 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1135 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1136 (mult:SI (ashiftrt:SI
1137 (match_operand:SI 1 "gpc_reg_operand" "%r")
1140 (match_operand:SI 2 "gpc_reg_operand" "r")
1143 "nmachhw %0, %1, %2"
1144 [(set_attr "type" "imul3")])
1146 (define_insn "*nmaclhwc"
1147 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1148 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1149 (mult:SI (sign_extend:SI
1150 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1152 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1154 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1155 (minus:SI (match_dup 4)
1156 (mult:SI (sign_extend:SI
1161 "nmaclhw. %0, %1, %2"
1162 [(set_attr "type" "imul3")])
1164 (define_insn "*nmaclhw"
1165 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1166 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1167 (mult:SI (sign_extend:SI
1168 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1170 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1172 "nmaclhw %0, %1, %2"
1173 [(set_attr "type" "imul3")])
1175 (define_insn "*mulchwc"
1176 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1177 (compare:CC (mult:SI (ashiftrt:SI
1178 (match_operand:SI 2 "gpc_reg_operand" "r")
1181 (match_operand:HI 1 "gpc_reg_operand" "r")))
1183 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1184 (mult:SI (ashiftrt:SI
1190 "mulchw. %0, %1, %2"
1191 [(set_attr "type" "imul3")])
1193 (define_insn "*mulchw"
1194 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1195 (mult:SI (ashiftrt:SI
1196 (match_operand:SI 2 "gpc_reg_operand" "r")
1199 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1202 [(set_attr "type" "imul3")])
1204 (define_insn "*mulchwuc"
1205 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1206 (compare:CC (mult:SI (lshiftrt:SI
1207 (match_operand:SI 2 "gpc_reg_operand" "r")
1210 (match_operand:HI 1 "gpc_reg_operand" "r")))
1212 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1213 (mult:SI (lshiftrt:SI
1219 "mulchwu. %0, %1, %2"
1220 [(set_attr "type" "imul3")])
1222 (define_insn "*mulchwu"
1223 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1224 (mult:SI (lshiftrt:SI
1225 (match_operand:SI 2 "gpc_reg_operand" "r")
1228 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1230 "mulchwu %0, %1, %2"
1231 [(set_attr "type" "imul3")])
1233 (define_insn "*mulhhwc"
1234 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1235 (compare:CC (mult:SI (ashiftrt:SI
1236 (match_operand:SI 1 "gpc_reg_operand" "%r")
1239 (match_operand:SI 2 "gpc_reg_operand" "r")
1242 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1243 (mult:SI (ashiftrt:SI
1250 "mulhhw. %0, %1, %2"
1251 [(set_attr "type" "imul3")])
1253 (define_insn "*mulhhw"
1254 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1255 (mult:SI (ashiftrt:SI
1256 (match_operand:SI 1 "gpc_reg_operand" "%r")
1259 (match_operand:SI 2 "gpc_reg_operand" "r")
1263 [(set_attr "type" "imul3")])
1265 (define_insn "*mulhhwuc"
1266 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1267 (compare:CC (mult:SI (lshiftrt:SI
1268 (match_operand:SI 1 "gpc_reg_operand" "%r")
1271 (match_operand:SI 2 "gpc_reg_operand" "r")
1274 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1275 (mult:SI (lshiftrt:SI
1282 "mulhhwu. %0, %1, %2"
1283 [(set_attr "type" "imul3")])
1285 (define_insn "*mulhhwu"
1286 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1287 (mult:SI (lshiftrt:SI
1288 (match_operand:SI 1 "gpc_reg_operand" "%r")
1291 (match_operand:SI 2 "gpc_reg_operand" "r")
1294 "mulhhwu %0, %1, %2"
1295 [(set_attr "type" "imul3")])
1297 (define_insn "*mullhwc"
1298 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1299 (compare:CC (mult:SI (sign_extend:SI
1300 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1302 (match_operand:HI 2 "gpc_reg_operand" "r")))
1304 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1305 (mult:SI (sign_extend:SI
1310 "mullhw. %0, %1, %2"
1311 [(set_attr "type" "imul3")])
1313 (define_insn "*mullhw"
1314 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1315 (mult:SI (sign_extend:SI
1316 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1318 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1321 [(set_attr "type" "imul3")])
1323 (define_insn "*mullhwuc"
1324 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1325 (compare:CC (mult:SI (zero_extend:SI
1326 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1328 (match_operand:HI 2 "gpc_reg_operand" "r")))
1330 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1331 (mult:SI (zero_extend:SI
1336 "mullhwu. %0, %1, %2"
1337 [(set_attr "type" "imul3")])
1339 (define_insn "*mullhwu"
1340 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1341 (mult:SI (zero_extend:SI
1342 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1344 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1346 "mullhwu %0, %1, %2"
1347 [(set_attr "type" "imul3")])
1349 ;; IBM 405 and 440 string-search dlmzb instruction support.
1350 (define_insn "dlmzb"
1351 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1352 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1353 (match_operand:SI 2 "gpc_reg_operand" "r")]
1355 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1356 (unspec:SI [(match_dup 1)
1360 "dlmzb. %0, %1, %2")
1362 (define_expand "strlensi"
1363 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1364 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1365 (match_operand:QI 2 "const_int_operand" "")
1366 (match_operand 3 "const_int_operand" "")]
1367 UNSPEC_DLMZB_STRLEN))
1368 (clobber (match_scratch:CC 4 "=x"))]
1369 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1371 rtx result = operands[0];
1372 rtx src = operands[1];
1373 rtx search_char = operands[2];
1374 rtx align = operands[3];
1375 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1376 rtx loop_label, end_label, mem, cr0, cond;
1377 if (search_char != const0_rtx
1378 || GET_CODE (align) != CONST_INT
1379 || INTVAL (align) < 8)
1381 word1 = gen_reg_rtx (SImode);
1382 word2 = gen_reg_rtx (SImode);
1383 scratch_dlmzb = gen_reg_rtx (SImode);
1384 scratch_string = gen_reg_rtx (Pmode);
1385 loop_label = gen_label_rtx ();
1386 end_label = gen_label_rtx ();
1387 addr = force_reg (Pmode, XEXP (src, 0));
1388 emit_move_insn (scratch_string, addr);
1389 emit_label (loop_label);
1390 mem = change_address (src, SImode, scratch_string);
1391 emit_move_insn (word1, mem);
1392 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1393 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1394 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1395 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1396 emit_jump_insn (gen_rtx_SET (VOIDmode,
1398 gen_rtx_IF_THEN_ELSE (VOIDmode,
1404 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1405 emit_jump_insn (gen_rtx_SET (VOIDmode,
1407 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1409 emit_label (end_label);
1410 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1411 emit_insn (gen_subsi3 (result, scratch_string, addr));
1412 emit_insn (gen_subsi3 (result, result, const1_rtx));
1417 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1418 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1420 (set (match_operand:SI 0 "gpc_reg_operand" "")
1421 (sign_extend:SI (match_dup 1)))]
1424 (sign_extend:SI (match_dup 1)))
1426 (compare:CC (match_dup 0)
1430 ;; Fixed-point arithmetic insns.
1432 (define_expand "add<mode>3"
1433 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1434 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1435 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1439 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1441 if (non_short_cint_operand (operands[2], DImode))
1444 else if (GET_CODE (operands[2]) == CONST_INT
1445 && ! add_operand (operands[2], <MODE>mode))
1447 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1448 ? operands[0] : gen_reg_rtx (<MODE>mode));
1450 HOST_WIDE_INT val = INTVAL (operands[2]);
1451 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1452 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1454 if (<MODE>mode == DImode && !CONST_OK_FOR_LETTER_P (rest, 'L'))
1457 /* The ordering here is important for the prolog expander.
1458 When space is allocated from the stack, adding 'low' first may
1459 produce a temporary deallocation (which would be bad). */
1460 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1461 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1466 ;; Discourage ai/addic because of carry but provide it in an alternative
1467 ;; allowing register zero as source.
1468 (define_insn "*add<mode>3_internal1"
1469 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1470 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1471 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1475 {cal %0,%2(%1)|addi %0,%1,%2}
1477 {cau|addis} %0,%1,%v2"
1478 [(set_attr "length" "4,4,4,4")])
1480 (define_insn "addsi3_high"
1481 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1482 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1483 (high:SI (match_operand 2 "" ""))))]
1484 "TARGET_MACHO && !TARGET_64BIT"
1485 "{cau|addis} %0,%1,ha16(%2)"
1486 [(set_attr "length" "4")])
1488 (define_insn "*add<mode>3_internal2"
1489 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1490 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1491 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1493 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1496 {cax.|add.} %3,%1,%2
1497 {ai.|addic.} %3,%1,%2
1500 [(set_attr "type" "fast_compare,compare,compare,compare")
1501 (set_attr "length" "4,4,8,8")])
1504 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1505 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1506 (match_operand:GPR 2 "reg_or_short_operand" ""))
1508 (clobber (match_scratch:GPR 3 ""))]
1511 (plus:GPR (match_dup 1)
1514 (compare:CC (match_dup 3)
1518 (define_insn "*add<mode>3_internal3"
1519 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1520 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1521 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1523 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1524 (plus:P (match_dup 1)
1528 {cax.|add.} %0,%1,%2
1529 {ai.|addic.} %0,%1,%2
1532 [(set_attr "type" "fast_compare,compare,compare,compare")
1533 (set_attr "length" "4,4,8,8")])
1536 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1537 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1538 (match_operand:P 2 "reg_or_short_operand" ""))
1540 (set (match_operand:P 0 "gpc_reg_operand" "")
1541 (plus:P (match_dup 1) (match_dup 2)))]
1544 (plus:P (match_dup 1)
1547 (compare:CC (match_dup 0)
1551 ;; Split an add that we can't do in one insn into two insns, each of which
1552 ;; does one 16-bit part. This is used by combine. Note that the low-order
1553 ;; add should be last in case the result gets used in an address.
1556 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1557 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1558 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1560 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1561 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1564 HOST_WIDE_INT val = INTVAL (operands[2]);
1565 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1566 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1568 operands[4] = GEN_INT (low);
1569 if (<MODE>mode == SImode || CONST_OK_FOR_LETTER_P (rest, 'L'))
1570 operands[3] = GEN_INT (rest);
1571 else if (! no_new_pseudos)
1573 operands[3] = gen_reg_rtx (DImode);
1574 emit_move_insn (operands[3], operands[2]);
1575 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1582 (define_insn "one_cmpl<mode>2"
1583 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1584 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1589 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1590 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1592 (clobber (match_scratch:P 2 "=r,r"))]
1597 [(set_attr "type" "compare")
1598 (set_attr "length" "4,8")])
1601 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1602 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1604 (clobber (match_scratch:P 2 ""))]
1607 (not:P (match_dup 1)))
1609 (compare:CC (match_dup 2)
1614 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1615 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1617 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1618 (not:P (match_dup 1)))]
1623 [(set_attr "type" "compare")
1624 (set_attr "length" "4,8")])
1627 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1628 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1630 (set (match_operand:P 0 "gpc_reg_operand" "")
1631 (not:P (match_dup 1)))]
1634 (not:P (match_dup 1)))
1636 (compare:CC (match_dup 0)
1641 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1642 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1643 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1645 "{sf%I1|subf%I1c} %0,%2,%1")
1648 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1649 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1650 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1657 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1658 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1659 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1661 (clobber (match_scratch:SI 3 "=r,r"))]
1664 {sf.|subfc.} %3,%2,%1
1666 [(set_attr "type" "compare")
1667 (set_attr "length" "4,8")])
1670 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1671 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1672 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1674 (clobber (match_scratch:P 3 "=r,r"))]
1679 [(set_attr "type" "fast_compare")
1680 (set_attr "length" "4,8")])
1683 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1684 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1685 (match_operand:P 2 "gpc_reg_operand" ""))
1687 (clobber (match_scratch:P 3 ""))]
1690 (minus:P (match_dup 1)
1693 (compare:CC (match_dup 3)
1698 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1699 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1700 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1702 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1703 (minus:SI (match_dup 1) (match_dup 2)))]
1706 {sf.|subfc.} %0,%2,%1
1708 [(set_attr "type" "compare")
1709 (set_attr "length" "4,8")])
1712 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1713 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1714 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1716 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1717 (minus:P (match_dup 1)
1723 [(set_attr "type" "fast_compare")
1724 (set_attr "length" "4,8")])
1727 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1728 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1729 (match_operand:P 2 "gpc_reg_operand" ""))
1731 (set (match_operand:P 0 "gpc_reg_operand" "")
1732 (minus:P (match_dup 1)
1736 (minus:P (match_dup 1)
1739 (compare:CC (match_dup 0)
1743 (define_expand "sub<mode>3"
1744 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1745 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1746 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1750 if (GET_CODE (operands[2]) == CONST_INT)
1752 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1753 negate_rtx (<MODE>mode, operands[2])));
1758 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1759 ;; instruction and some auxiliary computations. Then we just have a single
1760 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1763 (define_expand "sminsi3"
1765 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1766 (match_operand:SI 2 "reg_or_short_operand" ""))
1768 (minus:SI (match_dup 2) (match_dup 1))))
1769 (set (match_operand:SI 0 "gpc_reg_operand" "")
1770 (minus:SI (match_dup 2) (match_dup 3)))]
1771 "TARGET_POWER || TARGET_ISEL"
1776 operands[2] = force_reg (SImode, operands[2]);
1777 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1781 operands[3] = gen_reg_rtx (SImode);
1785 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1786 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1787 (match_operand:SI 2 "reg_or_short_operand" "")))
1788 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1791 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1793 (minus:SI (match_dup 2) (match_dup 1))))
1794 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1797 (define_expand "smaxsi3"
1799 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1800 (match_operand:SI 2 "reg_or_short_operand" ""))
1802 (minus:SI (match_dup 2) (match_dup 1))))
1803 (set (match_operand:SI 0 "gpc_reg_operand" "")
1804 (plus:SI (match_dup 3) (match_dup 1)))]
1805 "TARGET_POWER || TARGET_ISEL"
1810 operands[2] = force_reg (SImode, operands[2]);
1811 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1814 operands[3] = gen_reg_rtx (SImode);
1818 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1819 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1820 (match_operand:SI 2 "reg_or_short_operand" "")))
1821 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1824 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1826 (minus:SI (match_dup 2) (match_dup 1))))
1827 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1830 (define_expand "uminsi3"
1831 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1833 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1835 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1837 (minus:SI (match_dup 4) (match_dup 3))))
1838 (set (match_operand:SI 0 "gpc_reg_operand" "")
1839 (minus:SI (match_dup 2) (match_dup 3)))]
1840 "TARGET_POWER || TARGET_ISEL"
1845 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1848 operands[3] = gen_reg_rtx (SImode);
1849 operands[4] = gen_reg_rtx (SImode);
1850 operands[5] = GEN_INT (-2147483647 - 1);
1853 (define_expand "umaxsi3"
1854 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1856 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1858 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1860 (minus:SI (match_dup 4) (match_dup 3))))
1861 (set (match_operand:SI 0 "gpc_reg_operand" "")
1862 (plus:SI (match_dup 3) (match_dup 1)))]
1863 "TARGET_POWER || TARGET_ISEL"
1868 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1871 operands[3] = gen_reg_rtx (SImode);
1872 operands[4] = gen_reg_rtx (SImode);
1873 operands[5] = GEN_INT (-2147483647 - 1);
1877 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1878 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1879 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1881 (minus:SI (match_dup 2) (match_dup 1))))]
1886 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1888 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1889 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1891 (minus:SI (match_dup 2) (match_dup 1)))
1893 (clobber (match_scratch:SI 3 "=r,r"))]
1898 [(set_attr "type" "delayed_compare")
1899 (set_attr "length" "4,8")])
1902 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1904 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1905 (match_operand:SI 2 "reg_or_short_operand" ""))
1907 (minus:SI (match_dup 2) (match_dup 1)))
1909 (clobber (match_scratch:SI 3 ""))]
1910 "TARGET_POWER && reload_completed"
1912 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1914 (minus:SI (match_dup 2) (match_dup 1))))
1916 (compare:CC (match_dup 3)
1921 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1923 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1924 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1926 (minus:SI (match_dup 2) (match_dup 1)))
1928 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1929 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1931 (minus:SI (match_dup 2) (match_dup 1))))]
1936 [(set_attr "type" "delayed_compare")
1937 (set_attr "length" "4,8")])
1940 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1942 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1943 (match_operand:SI 2 "reg_or_short_operand" ""))
1945 (minus:SI (match_dup 2) (match_dup 1)))
1947 (set (match_operand:SI 0 "gpc_reg_operand" "")
1948 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1950 (minus:SI (match_dup 2) (match_dup 1))))]
1951 "TARGET_POWER && reload_completed"
1953 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1955 (minus:SI (match_dup 2) (match_dup 1))))
1957 (compare:CC (match_dup 0)
1961 ;; We don't need abs with condition code because such comparisons should
1963 (define_expand "abssi2"
1964 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1965 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1971 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1974 else if (! TARGET_POWER)
1976 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1981 (define_insn "*abssi2_power"
1982 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1983 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1987 (define_insn_and_split "abssi2_isel"
1988 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1989 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1990 (clobber (match_scratch:SI 2 "=&b"))
1991 (clobber (match_scratch:CC 3 "=y"))]
1994 "&& reload_completed"
1995 [(set (match_dup 2) (neg:SI (match_dup 1)))
1997 (compare:CC (match_dup 1)
2000 (if_then_else:SI (ge (match_dup 3)
2006 (define_insn_and_split "abssi2_nopower"
2007 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2008 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2009 (clobber (match_scratch:SI 2 "=&r,&r"))]
2010 "! TARGET_POWER && ! TARGET_ISEL"
2012 "&& reload_completed"
2013 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2014 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2015 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2018 (define_insn "*nabs_power"
2019 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2020 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2024 (define_insn_and_split "*nabs_nopower"
2025 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2026 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2027 (clobber (match_scratch:SI 2 "=&r,&r"))]
2030 "&& reload_completed"
2031 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2032 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2033 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2036 (define_expand "neg<mode>2"
2037 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2038 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2042 (define_insn "*neg<mode>2_internal"
2043 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2044 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2049 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2050 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2052 (clobber (match_scratch:P 2 "=r,r"))]
2057 [(set_attr "type" "fast_compare")
2058 (set_attr "length" "4,8")])
2061 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2062 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2064 (clobber (match_scratch:P 2 ""))]
2067 (neg:P (match_dup 1)))
2069 (compare:CC (match_dup 2)
2074 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2075 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2077 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2078 (neg:P (match_dup 1)))]
2083 [(set_attr "type" "fast_compare")
2084 (set_attr "length" "4,8")])
2087 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2088 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2090 (set (match_operand:P 0 "gpc_reg_operand" "")
2091 (neg:P (match_dup 1)))]
2094 (neg:P (match_dup 1)))
2096 (compare:CC (match_dup 0)
2100 (define_insn "clz<mode>2"
2101 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2102 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2104 "{cntlz|cntlz<wd>} %0,%1")
2106 (define_expand "ctz<mode>2"
2108 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2109 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2111 (clobber (scratch:CC))])
2112 (set (match_dup 4) (clz:GPR (match_dup 3)))
2113 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2114 (minus:GPR (match_dup 5) (match_dup 4)))]
2117 operands[2] = gen_reg_rtx (<MODE>mode);
2118 operands[3] = gen_reg_rtx (<MODE>mode);
2119 operands[4] = gen_reg_rtx (<MODE>mode);
2120 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2123 (define_expand "ffs<mode>2"
2125 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2126 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2128 (clobber (scratch:CC))])
2129 (set (match_dup 4) (clz:GPR (match_dup 3)))
2130 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2131 (minus:GPR (match_dup 5) (match_dup 4)))]
2134 operands[2] = gen_reg_rtx (<MODE>mode);
2135 operands[3] = gen_reg_rtx (<MODE>mode);
2136 operands[4] = gen_reg_rtx (<MODE>mode);
2137 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2140 (define_expand "popcount<mode>2"
2142 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2145 (mult:GPR (match_dup 2) (match_dup 4)))
2146 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2147 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
2150 operands[2] = gen_reg_rtx (<MODE>mode);
2151 operands[3] = gen_reg_rtx (<MODE>mode);
2152 operands[4] = force_reg (<MODE>mode,
2153 <MODE>mode == SImode
2154 ? GEN_INT (0x01010101)
2155 : GEN_INT ((HOST_WIDE_INT)
2156 0x01010101 << 32 | 0x01010101));
2157 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 8);
2160 (define_insn "popcntb<mode>2"
2161 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2162 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2167 (define_expand "mulsi3"
2168 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2169 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2170 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2175 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2177 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2181 (define_insn "mulsi3_mq"
2182 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2183 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2184 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2185 (clobber (match_scratch:SI 3 "=q,q"))]
2188 {muls|mullw} %0,%1,%2
2189 {muli|mulli} %0,%1,%2"
2191 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2192 (const_string "imul3")
2193 (match_operand:SI 2 "short_cint_operand" "")
2194 (const_string "imul2")]
2195 (const_string "imul")))])
2197 (define_insn "mulsi3_no_mq"
2198 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2199 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2200 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2203 {muls|mullw} %0,%1,%2
2204 {muli|mulli} %0,%1,%2"
2206 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2207 (const_string "imul3")
2208 (match_operand:SI 2 "short_cint_operand" "")
2209 (const_string "imul2")]
2210 (const_string "imul")))])
2212 (define_insn "*mulsi3_mq_internal1"
2213 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2214 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2215 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2217 (clobber (match_scratch:SI 3 "=r,r"))
2218 (clobber (match_scratch:SI 4 "=q,q"))]
2221 {muls.|mullw.} %3,%1,%2
2223 [(set_attr "type" "imul_compare")
2224 (set_attr "length" "4,8")])
2227 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2228 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2229 (match_operand:SI 2 "gpc_reg_operand" ""))
2231 (clobber (match_scratch:SI 3 ""))
2232 (clobber (match_scratch:SI 4 ""))]
2233 "TARGET_POWER && reload_completed"
2234 [(parallel [(set (match_dup 3)
2235 (mult:SI (match_dup 1) (match_dup 2)))
2236 (clobber (match_dup 4))])
2238 (compare:CC (match_dup 3)
2242 (define_insn "*mulsi3_no_mq_internal1"
2243 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2244 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2245 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2247 (clobber (match_scratch:SI 3 "=r,r"))]
2250 {muls.|mullw.} %3,%1,%2
2252 [(set_attr "type" "imul_compare")
2253 (set_attr "length" "4,8")])
2256 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2257 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2258 (match_operand:SI 2 "gpc_reg_operand" ""))
2260 (clobber (match_scratch:SI 3 ""))]
2261 "! TARGET_POWER && reload_completed"
2263 (mult:SI (match_dup 1) (match_dup 2)))
2265 (compare:CC (match_dup 3)
2269 (define_insn "*mulsi3_mq_internal2"
2270 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2271 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2272 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2274 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2275 (mult:SI (match_dup 1) (match_dup 2)))
2276 (clobber (match_scratch:SI 4 "=q,q"))]
2279 {muls.|mullw.} %0,%1,%2
2281 [(set_attr "type" "imul_compare")
2282 (set_attr "length" "4,8")])
2285 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2286 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2287 (match_operand:SI 2 "gpc_reg_operand" ""))
2289 (set (match_operand:SI 0 "gpc_reg_operand" "")
2290 (mult:SI (match_dup 1) (match_dup 2)))
2291 (clobber (match_scratch:SI 4 ""))]
2292 "TARGET_POWER && reload_completed"
2293 [(parallel [(set (match_dup 0)
2294 (mult:SI (match_dup 1) (match_dup 2)))
2295 (clobber (match_dup 4))])
2297 (compare:CC (match_dup 0)
2301 (define_insn "*mulsi3_no_mq_internal2"
2302 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2303 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2304 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2306 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2307 (mult:SI (match_dup 1) (match_dup 2)))]
2310 {muls.|mullw.} %0,%1,%2
2312 [(set_attr "type" "imul_compare")
2313 (set_attr "length" "4,8")])
2316 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2317 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2318 (match_operand:SI 2 "gpc_reg_operand" ""))
2320 (set (match_operand:SI 0 "gpc_reg_operand" "")
2321 (mult:SI (match_dup 1) (match_dup 2)))]
2322 "! TARGET_POWER && reload_completed"
2324 (mult:SI (match_dup 1) (match_dup 2)))
2326 (compare:CC (match_dup 0)
2330 ;; Operand 1 is divided by operand 2; quotient goes to operand
2331 ;; 0 and remainder to operand 3.
2332 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2334 (define_expand "divmodsi4"
2335 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2336 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2337 (match_operand:SI 2 "gpc_reg_operand" "")))
2338 (set (match_operand:SI 3 "register_operand" "")
2339 (mod:SI (match_dup 1) (match_dup 2)))])]
2340 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2343 if (! TARGET_POWER && ! TARGET_POWERPC)
2345 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2346 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2347 emit_insn (gen_divss_call ());
2348 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2349 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2354 (define_insn "*divmodsi4_internal"
2355 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2356 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2357 (match_operand:SI 2 "gpc_reg_operand" "r")))
2358 (set (match_operand:SI 3 "register_operand" "=q")
2359 (mod:SI (match_dup 1) (match_dup 2)))]
2362 [(set_attr "type" "idiv")])
2364 (define_expand "udiv<mode>3"
2365 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2366 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2367 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2368 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2371 if (! TARGET_POWER && ! TARGET_POWERPC)
2373 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2374 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2375 emit_insn (gen_quous_call ());
2376 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2379 else if (TARGET_POWER)
2381 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2386 (define_insn "udivsi3_mq"
2387 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2388 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2389 (match_operand:SI 2 "gpc_reg_operand" "r")))
2390 (clobber (match_scratch:SI 3 "=q"))]
2391 "TARGET_POWERPC && TARGET_POWER"
2393 [(set_attr "type" "idiv")])
2395 (define_insn "*udivsi3_no_mq"
2396 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2397 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2398 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2399 "TARGET_POWERPC && ! TARGET_POWER"
2401 [(set_attr "type" "idiv")])
2403 ;; For powers of two we can do srai/aze for divide and then adjust for
2404 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2405 ;; used; for PowerPC, force operands into register and do a normal divide;
2406 ;; for AIX common-mode, use quoss call on register operands.
2407 (define_expand "div<mode>3"
2408 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2409 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2410 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2414 if (GET_CODE (operands[2]) == CONST_INT
2415 && INTVAL (operands[2]) > 0
2416 && exact_log2 (INTVAL (operands[2])) >= 0)
2418 else if (TARGET_POWERPC)
2420 operands[2] = force_reg (SImode, operands[2]);
2423 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2427 else if (TARGET_POWER)
2431 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2432 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2433 emit_insn (gen_quoss_call ());
2434 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2439 (define_insn "divsi3_mq"
2440 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2441 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2442 (match_operand:SI 2 "gpc_reg_operand" "r")))
2443 (clobber (match_scratch:SI 3 "=q"))]
2444 "TARGET_POWERPC && TARGET_POWER"
2446 [(set_attr "type" "idiv")])
2448 (define_insn "*div<mode>3_no_mq"
2449 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2450 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2451 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2452 "TARGET_POWERPC && ! TARGET_POWER"
2454 [(set_attr "type" "idiv")])
2456 (define_expand "mod<mode>3"
2457 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2458 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2459 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2467 if (GET_CODE (operands[2]) != CONST_INT
2468 || INTVAL (operands[2]) <= 0
2469 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2472 temp1 = gen_reg_rtx (<MODE>mode);
2473 temp2 = gen_reg_rtx (<MODE>mode);
2475 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2476 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2477 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2482 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2483 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2484 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2486 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2487 [(set_attr "type" "two")
2488 (set_attr "length" "8")])
2491 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2492 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2493 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2495 (clobber (match_scratch:P 3 "=r,r"))]
2498 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2500 [(set_attr "type" "compare")
2501 (set_attr "length" "8,12")])
2504 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2505 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2506 (match_operand:GPR 2 "exact_log2_cint_operand"
2509 (clobber (match_scratch:GPR 3 ""))]
2512 (div:<MODE> (match_dup 1) (match_dup 2)))
2514 (compare:CC (match_dup 3)
2519 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2520 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2521 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2523 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2524 (div:P (match_dup 1) (match_dup 2)))]
2527 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2529 [(set_attr "type" "compare")
2530 (set_attr "length" "8,12")])
2533 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2534 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2535 (match_operand:GPR 2 "exact_log2_cint_operand"
2538 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2539 (div:GPR (match_dup 1) (match_dup 2)))]
2542 (div:<MODE> (match_dup 1) (match_dup 2)))
2544 (compare:CC (match_dup 0)
2549 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2552 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2554 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2555 (match_operand:SI 3 "gpc_reg_operand" "r")))
2556 (set (match_operand:SI 2 "register_operand" "=*q")
2559 (zero_extend:DI (match_dup 1)) (const_int 32))
2560 (zero_extend:DI (match_dup 4)))
2564 [(set_attr "type" "idiv")])
2566 ;; To do unsigned divide we handle the cases of the divisor looking like a
2567 ;; negative number. If it is a constant that is less than 2**31, we don't
2568 ;; have to worry about the branches. So make a few subroutines here.
2570 ;; First comes the normal case.
2571 (define_expand "udivmodsi4_normal"
2572 [(set (match_dup 4) (const_int 0))
2573 (parallel [(set (match_operand:SI 0 "" "")
2574 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2576 (zero_extend:DI (match_operand:SI 1 "" "")))
2577 (match_operand:SI 2 "" "")))
2578 (set (match_operand:SI 3 "" "")
2579 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2581 (zero_extend:DI (match_dup 1)))
2585 { operands[4] = gen_reg_rtx (SImode); }")
2587 ;; This handles the branches.
2588 (define_expand "udivmodsi4_tests"
2589 [(set (match_operand:SI 0 "" "") (const_int 0))
2590 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2591 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2592 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2593 (label_ref (match_operand:SI 4 "" "")) (pc)))
2594 (set (match_dup 0) (const_int 1))
2595 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2596 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2597 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2598 (label_ref (match_dup 4)) (pc)))]
2601 { operands[5] = gen_reg_rtx (CCUNSmode);
2602 operands[6] = gen_reg_rtx (CCmode);
2605 (define_expand "udivmodsi4"
2606 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2607 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2608 (match_operand:SI 2 "reg_or_cint_operand" "")))
2609 (set (match_operand:SI 3 "gpc_reg_operand" "")
2610 (umod:SI (match_dup 1) (match_dup 2)))])]
2618 if (! TARGET_POWERPC)
2620 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2621 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2622 emit_insn (gen_divus_call ());
2623 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2624 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2631 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2633 operands[2] = force_reg (SImode, operands[2]);
2634 label = gen_label_rtx ();
2635 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2636 operands[3], label));
2639 operands[2] = force_reg (SImode, operands[2]);
2641 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2649 ;; AIX architecture-independent common-mode multiply (DImode),
2650 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2651 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2652 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2653 ;; assumed unused if generating common-mode, so ignore.
2654 (define_insn "mulh_call"
2657 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2658 (sign_extend:DI (reg:SI 4)))
2660 (clobber (match_scratch:SI 0 "=l"))]
2661 "! TARGET_POWER && ! TARGET_POWERPC"
2663 [(set_attr "type" "imul")])
2665 (define_insn "mull_call"
2667 (mult:DI (sign_extend:DI (reg:SI 3))
2668 (sign_extend:DI (reg:SI 4))))
2669 (clobber (match_scratch:SI 0 "=l"))
2670 (clobber (reg:SI 0))]
2671 "! TARGET_POWER && ! TARGET_POWERPC"
2673 [(set_attr "type" "imul")])
2675 (define_insn "divss_call"
2677 (div:SI (reg:SI 3) (reg:SI 4)))
2679 (mod:SI (reg:SI 3) (reg:SI 4)))
2680 (clobber (match_scratch:SI 0 "=l"))
2681 (clobber (reg:SI 0))]
2682 "! TARGET_POWER && ! TARGET_POWERPC"
2684 [(set_attr "type" "idiv")])
2686 (define_insn "divus_call"
2688 (udiv:SI (reg:SI 3) (reg:SI 4)))
2690 (umod:SI (reg:SI 3) (reg:SI 4)))
2691 (clobber (match_scratch:SI 0 "=l"))
2692 (clobber (reg:SI 0))
2693 (clobber (match_scratch:CC 1 "=x"))
2694 (clobber (reg:CC 69))]
2695 "! TARGET_POWER && ! TARGET_POWERPC"
2697 [(set_attr "type" "idiv")])
2699 (define_insn "quoss_call"
2701 (div:SI (reg:SI 3) (reg:SI 4)))
2702 (clobber (match_scratch:SI 0 "=l"))]
2703 "! TARGET_POWER && ! TARGET_POWERPC"
2705 [(set_attr "type" "idiv")])
2707 (define_insn "quous_call"
2709 (udiv:SI (reg:SI 3) (reg:SI 4)))
2710 (clobber (match_scratch:SI 0 "=l"))
2711 (clobber (reg:SI 0))
2712 (clobber (match_scratch:CC 1 "=x"))
2713 (clobber (reg:CC 69))]
2714 "! TARGET_POWER && ! TARGET_POWERPC"
2716 [(set_attr "type" "idiv")])
2718 ;; Logical instructions
2719 ;; The logical instructions are mostly combined by using match_operator,
2720 ;; but the plain AND insns are somewhat different because there is no
2721 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2722 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2724 (define_insn "andsi3"
2725 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2726 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2727 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2728 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2732 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2733 {andil.|andi.} %0,%1,%b2
2734 {andiu.|andis.} %0,%1,%u2"
2735 [(set_attr "type" "*,*,compare,compare")])
2737 ;; Note to set cr's other than cr0 we do the and immediate and then
2738 ;; the test again -- this avoids a mfcr which on the higher end
2739 ;; machines causes an execution serialization
2741 (define_insn "*andsi3_internal2"
2742 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2743 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2744 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2746 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2747 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2751 {andil.|andi.} %3,%1,%b2
2752 {andiu.|andis.} %3,%1,%u2
2753 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2758 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2759 (set_attr "length" "4,4,4,4,8,8,8,8")])
2761 (define_insn "*andsi3_internal3"
2762 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2763 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2764 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2766 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2767 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2771 {andil.|andi.} %3,%1,%b2
2772 {andiu.|andis.} %3,%1,%u2
2773 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2778 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2779 (set_attr "length" "8,4,4,4,8,8,8,8")])
2782 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2783 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2784 (match_operand:GPR 2 "and_operand" ""))
2786 (clobber (match_scratch:GPR 3 ""))
2787 (clobber (match_scratch:CC 4 ""))]
2789 [(parallel [(set (match_dup 3)
2790 (and:<MODE> (match_dup 1)
2792 (clobber (match_dup 4))])
2794 (compare:CC (match_dup 3)
2798 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2799 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2802 [(set (match_operand:CC 0 "cc_reg_operand" "")
2803 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2804 (match_operand:SI 2 "gpc_reg_operand" ""))
2806 (clobber (match_scratch:SI 3 ""))
2807 (clobber (match_scratch:CC 4 ""))]
2808 "TARGET_POWERPC64 && reload_completed"
2809 [(parallel [(set (match_dup 3)
2810 (and:SI (match_dup 1)
2812 (clobber (match_dup 4))])
2814 (compare:CC (match_dup 3)
2818 (define_insn "*andsi3_internal4"
2819 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2820 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2821 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2823 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2824 (and:SI (match_dup 1)
2826 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2830 {andil.|andi.} %0,%1,%b2
2831 {andiu.|andis.} %0,%1,%u2
2832 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2837 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2838 (set_attr "length" "4,4,4,4,8,8,8,8")])
2840 (define_insn "*andsi3_internal5"
2841 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2842 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2843 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2845 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2846 (and:SI (match_dup 1)
2848 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2852 {andil.|andi.} %0,%1,%b2
2853 {andiu.|andis.} %0,%1,%u2
2854 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2859 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2860 (set_attr "length" "8,4,4,4,8,8,8,8")])
2863 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2864 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2865 (match_operand:SI 2 "and_operand" ""))
2867 (set (match_operand:SI 0 "gpc_reg_operand" "")
2868 (and:SI (match_dup 1)
2870 (clobber (match_scratch:CC 4 ""))]
2872 [(parallel [(set (match_dup 0)
2873 (and:SI (match_dup 1)
2875 (clobber (match_dup 4))])
2877 (compare:CC (match_dup 0)
2882 [(set (match_operand:CC 3 "cc_reg_operand" "")
2883 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2884 (match_operand:SI 2 "gpc_reg_operand" ""))
2886 (set (match_operand:SI 0 "gpc_reg_operand" "")
2887 (and:SI (match_dup 1)
2889 (clobber (match_scratch:CC 4 ""))]
2890 "TARGET_POWERPC64 && reload_completed"
2891 [(parallel [(set (match_dup 0)
2892 (and:SI (match_dup 1)
2894 (clobber (match_dup 4))])
2896 (compare:CC (match_dup 0)
2900 ;; Handle the PowerPC64 rlwinm corner case
2902 (define_insn_and_split "*andsi3_internal6"
2903 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2904 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2905 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2910 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2913 (rotate:SI (match_dup 0) (match_dup 5)))]
2916 int mb = extract_MB (operands[2]);
2917 int me = extract_ME (operands[2]);
2918 operands[3] = GEN_INT (me + 1);
2919 operands[5] = GEN_INT (32 - (me + 1));
2920 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2922 [(set_attr "length" "8")])
2924 (define_expand "iorsi3"
2925 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2926 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2927 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2931 if (GET_CODE (operands[2]) == CONST_INT
2932 && ! logical_operand (operands[2], SImode))
2934 HOST_WIDE_INT value = INTVAL (operands[2]);
2935 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2936 ? operands[0] : gen_reg_rtx (SImode));
2938 emit_insn (gen_iorsi3 (tmp, operands[1],
2939 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2940 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2945 (define_expand "xorsi3"
2946 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2947 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2948 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2952 if (GET_CODE (operands[2]) == CONST_INT
2953 && ! logical_operand (operands[2], SImode))
2955 HOST_WIDE_INT value = INTVAL (operands[2]);
2956 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2957 ? operands[0] : gen_reg_rtx (SImode));
2959 emit_insn (gen_xorsi3 (tmp, operands[1],
2960 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2961 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2966 (define_insn "*boolsi3_internal1"
2967 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2968 (match_operator:SI 3 "boolean_or_operator"
2969 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2970 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2974 {%q3il|%q3i} %0,%1,%b2
2975 {%q3iu|%q3is} %0,%1,%u2")
2977 (define_insn "*boolsi3_internal2"
2978 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2979 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2980 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2981 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2983 (clobber (match_scratch:SI 3 "=r,r"))]
2988 [(set_attr "type" "compare")
2989 (set_attr "length" "4,8")])
2992 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2993 (compare:CC (match_operator:SI 4 "boolean_operator"
2994 [(match_operand:SI 1 "gpc_reg_operand" "")
2995 (match_operand:SI 2 "gpc_reg_operand" "")])
2997 (clobber (match_scratch:SI 3 ""))]
2998 "TARGET_32BIT && reload_completed"
2999 [(set (match_dup 3) (match_dup 4))
3001 (compare:CC (match_dup 3)
3005 (define_insn "*boolsi3_internal3"
3006 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3007 (compare:CC (match_operator:SI 4 "boolean_operator"
3008 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3009 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3011 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3017 [(set_attr "type" "compare")
3018 (set_attr "length" "4,8")])
3021 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3022 (compare:CC (match_operator:SI 4 "boolean_operator"
3023 [(match_operand:SI 1 "gpc_reg_operand" "")
3024 (match_operand:SI 2 "gpc_reg_operand" "")])
3026 (set (match_operand:SI 0 "gpc_reg_operand" "")
3028 "TARGET_32BIT && reload_completed"
3029 [(set (match_dup 0) (match_dup 4))
3031 (compare:CC (match_dup 0)
3035 ;; Split a logical operation that we can't do in one insn into two insns,
3036 ;; each of which does one 16-bit part. This is used by combine.
3039 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3040 (match_operator:SI 3 "boolean_or_operator"
3041 [(match_operand:SI 1 "gpc_reg_operand" "")
3042 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3044 [(set (match_dup 0) (match_dup 4))
3045 (set (match_dup 0) (match_dup 5))]
3049 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3050 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3052 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3053 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3057 (define_insn "*boolcsi3_internal1"
3058 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3059 (match_operator:SI 3 "boolean_operator"
3060 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3061 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3065 (define_insn "*boolcsi3_internal2"
3066 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3067 (compare:CC (match_operator:SI 4 "boolean_operator"
3068 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3069 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3071 (clobber (match_scratch:SI 3 "=r,r"))]
3076 [(set_attr "type" "compare")
3077 (set_attr "length" "4,8")])
3080 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3081 (compare:CC (match_operator:SI 4 "boolean_operator"
3082 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3083 (match_operand:SI 2 "gpc_reg_operand" "")])
3085 (clobber (match_scratch:SI 3 ""))]
3086 "TARGET_32BIT && reload_completed"
3087 [(set (match_dup 3) (match_dup 4))
3089 (compare:CC (match_dup 3)
3093 (define_insn "*boolcsi3_internal3"
3094 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3095 (compare:CC (match_operator:SI 4 "boolean_operator"
3096 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3097 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3099 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3105 [(set_attr "type" "compare")
3106 (set_attr "length" "4,8")])
3109 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3110 (compare:CC (match_operator:SI 4 "boolean_operator"
3111 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3112 (match_operand:SI 2 "gpc_reg_operand" "")])
3114 (set (match_operand:SI 0 "gpc_reg_operand" "")
3116 "TARGET_32BIT && reload_completed"
3117 [(set (match_dup 0) (match_dup 4))
3119 (compare:CC (match_dup 0)
3123 (define_insn "*boolccsi3_internal1"
3124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3125 (match_operator:SI 3 "boolean_operator"
3126 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3127 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3131 (define_insn "*boolccsi3_internal2"
3132 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3133 (compare:CC (match_operator:SI 4 "boolean_operator"
3134 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3135 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3137 (clobber (match_scratch:SI 3 "=r,r"))]
3142 [(set_attr "type" "compare")
3143 (set_attr "length" "4,8")])
3146 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3147 (compare:CC (match_operator:SI 4 "boolean_operator"
3148 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3149 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3151 (clobber (match_scratch:SI 3 ""))]
3152 "TARGET_32BIT && reload_completed"
3153 [(set (match_dup 3) (match_dup 4))
3155 (compare:CC (match_dup 3)
3159 (define_insn "*boolccsi3_internal3"
3160 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3161 (compare:CC (match_operator:SI 4 "boolean_operator"
3162 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3163 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3165 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3171 [(set_attr "type" "compare")
3172 (set_attr "length" "4,8")])
3175 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3176 (compare:CC (match_operator:SI 4 "boolean_operator"
3177 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3178 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3180 (set (match_operand:SI 0 "gpc_reg_operand" "")
3182 "TARGET_32BIT && reload_completed"
3183 [(set (match_dup 0) (match_dup 4))
3185 (compare:CC (match_dup 0)
3189 ;; maskir insn. We need four forms because things might be in arbitrary
3190 ;; orders. Don't define forms that only set CR fields because these
3191 ;; would modify an input register.
3193 (define_insn "*maskir_internal1"
3194 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3195 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3196 (match_operand:SI 1 "gpc_reg_operand" "0"))
3197 (and:SI (match_dup 2)
3198 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3202 (define_insn "*maskir_internal2"
3203 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3204 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3205 (match_operand:SI 1 "gpc_reg_operand" "0"))
3206 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3211 (define_insn "*maskir_internal3"
3212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3213 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3214 (match_operand:SI 3 "gpc_reg_operand" "r"))
3215 (and:SI (not:SI (match_dup 2))
3216 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3220 (define_insn "*maskir_internal4"
3221 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3222 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3223 (match_operand:SI 2 "gpc_reg_operand" "r"))
3224 (and:SI (not:SI (match_dup 2))
3225 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3229 (define_insn "*maskir_internal5"
3230 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3232 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3233 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3234 (and:SI (match_dup 2)
3235 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3237 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3238 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3239 (and:SI (match_dup 2) (match_dup 3))))]
3244 [(set_attr "type" "compare")
3245 (set_attr "length" "4,8")])
3248 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3250 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3251 (match_operand:SI 1 "gpc_reg_operand" ""))
3252 (and:SI (match_dup 2)
3253 (match_operand:SI 3 "gpc_reg_operand" "")))
3255 (set (match_operand:SI 0 "gpc_reg_operand" "")
3256 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3257 (and:SI (match_dup 2) (match_dup 3))))]
3258 "TARGET_POWER && reload_completed"
3260 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3261 (and:SI (match_dup 2) (match_dup 3))))
3263 (compare:CC (match_dup 0)
3267 (define_insn "*maskir_internal6"
3268 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3270 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3271 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3272 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3275 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3276 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3277 (and:SI (match_dup 3) (match_dup 2))))]
3282 [(set_attr "type" "compare")
3283 (set_attr "length" "4,8")])
3286 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3288 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3289 (match_operand:SI 1 "gpc_reg_operand" ""))
3290 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3293 (set (match_operand:SI 0 "gpc_reg_operand" "")
3294 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3295 (and:SI (match_dup 3) (match_dup 2))))]
3296 "TARGET_POWER && reload_completed"
3298 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3299 (and:SI (match_dup 3) (match_dup 2))))
3301 (compare:CC (match_dup 0)
3305 (define_insn "*maskir_internal7"
3306 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3308 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3309 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3310 (and:SI (not:SI (match_dup 2))
3311 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3313 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3314 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3315 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3320 [(set_attr "type" "compare")
3321 (set_attr "length" "4,8")])
3324 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3326 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3327 (match_operand:SI 3 "gpc_reg_operand" ""))
3328 (and:SI (not:SI (match_dup 2))
3329 (match_operand:SI 1 "gpc_reg_operand" "")))
3331 (set (match_operand:SI 0 "gpc_reg_operand" "")
3332 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3333 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3334 "TARGET_POWER && reload_completed"
3336 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3337 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3339 (compare:CC (match_dup 0)
3343 (define_insn "*maskir_internal8"
3344 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3346 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3347 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3348 (and:SI (not:SI (match_dup 2))
3349 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3351 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3352 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3353 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3358 [(set_attr "type" "compare")
3359 (set_attr "length" "4,8")])
3362 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3364 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3365 (match_operand:SI 2 "gpc_reg_operand" ""))
3366 (and:SI (not:SI (match_dup 2))
3367 (match_operand:SI 1 "gpc_reg_operand" "")))
3369 (set (match_operand:SI 0 "gpc_reg_operand" "")
3370 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3371 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3372 "TARGET_POWER && reload_completed"
3374 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3375 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3377 (compare:CC (match_dup 0)
3381 ;; Rotate and shift insns, in all their variants. These support shifts,
3382 ;; field inserts and extracts, and various combinations thereof.
3383 (define_expand "insv"
3384 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3385 (match_operand:SI 1 "const_int_operand" "")
3386 (match_operand:SI 2 "const_int_operand" ""))
3387 (match_operand 3 "gpc_reg_operand" ""))]
3391 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3392 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3393 compiler if the address of the structure is taken later. */
3394 if (GET_CODE (operands[0]) == SUBREG
3395 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3398 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3399 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3401 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3405 (define_insn "insvsi"
3406 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3407 (match_operand:SI 1 "const_int_operand" "i")
3408 (match_operand:SI 2 "const_int_operand" "i"))
3409 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3413 int start = INTVAL (operands[2]) & 31;
3414 int size = INTVAL (operands[1]) & 31;
3416 operands[4] = GEN_INT (32 - start - size);
3417 operands[1] = GEN_INT (start + size - 1);
3418 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3420 [(set_attr "type" "insert_word")])
3422 (define_insn "*insvsi_internal1"
3423 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3424 (match_operand:SI 1 "const_int_operand" "i")
3425 (match_operand:SI 2 "const_int_operand" "i"))
3426 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3427 (match_operand:SI 4 "const_int_operand" "i")))]
3428 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3431 int shift = INTVAL (operands[4]) & 31;
3432 int start = INTVAL (operands[2]) & 31;
3433 int size = INTVAL (operands[1]) & 31;
3435 operands[4] = GEN_INT (shift - start - size);
3436 operands[1] = GEN_INT (start + size - 1);
3437 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3439 [(set_attr "type" "insert_word")])
3441 (define_insn "*insvsi_internal2"
3442 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3443 (match_operand:SI 1 "const_int_operand" "i")
3444 (match_operand:SI 2 "const_int_operand" "i"))
3445 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3446 (match_operand:SI 4 "const_int_operand" "i")))]
3447 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3450 int shift = INTVAL (operands[4]) & 31;
3451 int start = INTVAL (operands[2]) & 31;
3452 int size = INTVAL (operands[1]) & 31;
3454 operands[4] = GEN_INT (32 - shift - start - size);
3455 operands[1] = GEN_INT (start + size - 1);
3456 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3458 [(set_attr "type" "insert_word")])
3460 (define_insn "*insvsi_internal3"
3461 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3462 (match_operand:SI 1 "const_int_operand" "i")
3463 (match_operand:SI 2 "const_int_operand" "i"))
3464 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3465 (match_operand:SI 4 "const_int_operand" "i")))]
3466 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3469 int shift = INTVAL (operands[4]) & 31;
3470 int start = INTVAL (operands[2]) & 31;
3471 int size = INTVAL (operands[1]) & 31;
3473 operands[4] = GEN_INT (32 - shift - start - size);
3474 operands[1] = GEN_INT (start + size - 1);
3475 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3477 [(set_attr "type" "insert_word")])
3479 (define_insn "*insvsi_internal4"
3480 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3481 (match_operand:SI 1 "const_int_operand" "i")
3482 (match_operand:SI 2 "const_int_operand" "i"))
3483 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3484 (match_operand:SI 4 "const_int_operand" "i")
3485 (match_operand:SI 5 "const_int_operand" "i")))]
3486 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3489 int extract_start = INTVAL (operands[5]) & 31;
3490 int extract_size = INTVAL (operands[4]) & 31;
3491 int insert_start = INTVAL (operands[2]) & 31;
3492 int insert_size = INTVAL (operands[1]) & 31;
3494 /* Align extract field with insert field */
3495 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3496 operands[1] = GEN_INT (insert_start + insert_size - 1);
3497 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3499 [(set_attr "type" "insert_word")])
3501 ;; combine patterns for rlwimi
3502 (define_insn "*insvsi_internal5"
3503 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3504 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3505 (match_operand:SI 1 "mask_operand" "i"))
3506 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3507 (match_operand:SI 2 "const_int_operand" "i"))
3508 (match_operand:SI 5 "mask_operand" "i"))))]
3509 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3512 int me = extract_ME(operands[5]);
3513 int mb = extract_MB(operands[5]);
3514 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3515 operands[2] = GEN_INT(mb);
3516 operands[1] = GEN_INT(me);
3517 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3519 [(set_attr "type" "insert_word")])
3521 (define_insn "*insvsi_internal6"
3522 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3523 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3524 (match_operand:SI 2 "const_int_operand" "i"))
3525 (match_operand:SI 5 "mask_operand" "i"))
3526 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3527 (match_operand:SI 1 "mask_operand" "i"))))]
3528 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3531 int me = extract_ME(operands[5]);
3532 int mb = extract_MB(operands[5]);
3533 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3534 operands[2] = GEN_INT(mb);
3535 operands[1] = GEN_INT(me);
3536 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3538 [(set_attr "type" "insert_word")])
3540 (define_insn "insvdi"
3541 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3542 (match_operand:SI 1 "const_int_operand" "i")
3543 (match_operand:SI 2 "const_int_operand" "i"))
3544 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3548 int start = INTVAL (operands[2]) & 63;
3549 int size = INTVAL (operands[1]) & 63;
3551 operands[1] = GEN_INT (64 - start - size);
3552 return \"rldimi %0,%3,%H1,%H2\";
3555 (define_insn "*insvdi_internal2"
3556 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3557 (match_operand:SI 1 "const_int_operand" "i")
3558 (match_operand:SI 2 "const_int_operand" "i"))
3559 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3560 (match_operand:SI 4 "const_int_operand" "i")))]
3562 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3565 int shift = INTVAL (operands[4]) & 63;
3566 int start = (INTVAL (operands[2]) & 63) - 32;
3567 int size = INTVAL (operands[1]) & 63;
3569 operands[4] = GEN_INT (64 - shift - start - size);
3570 operands[2] = GEN_INT (start);
3571 operands[1] = GEN_INT (start + size - 1);
3572 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3575 (define_insn "*insvdi_internal3"
3576 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3577 (match_operand:SI 1 "const_int_operand" "i")
3578 (match_operand:SI 2 "const_int_operand" "i"))
3579 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3580 (match_operand:SI 4 "const_int_operand" "i")))]
3582 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3585 int shift = INTVAL (operands[4]) & 63;
3586 int start = (INTVAL (operands[2]) & 63) - 32;
3587 int size = INTVAL (operands[1]) & 63;
3589 operands[4] = GEN_INT (64 - shift - start - size);
3590 operands[2] = GEN_INT (start);
3591 operands[1] = GEN_INT (start + size - 1);
3592 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3595 (define_expand "extzv"
3596 [(set (match_operand 0 "gpc_reg_operand" "")
3597 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3598 (match_operand:SI 2 "const_int_operand" "")
3599 (match_operand:SI 3 "const_int_operand" "")))]
3603 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3604 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3605 compiler if the address of the structure is taken later. */
3606 if (GET_CODE (operands[0]) == SUBREG
3607 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3610 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3611 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3613 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3617 (define_insn "extzvsi"
3618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3619 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3620 (match_operand:SI 2 "const_int_operand" "i")
3621 (match_operand:SI 3 "const_int_operand" "i")))]
3625 int start = INTVAL (operands[3]) & 31;
3626 int size = INTVAL (operands[2]) & 31;
3628 if (start + size >= 32)
3629 operands[3] = const0_rtx;
3631 operands[3] = GEN_INT (start + size);
3632 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3635 (define_insn "*extzvsi_internal1"
3636 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3637 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3638 (match_operand:SI 2 "const_int_operand" "i,i")
3639 (match_operand:SI 3 "const_int_operand" "i,i"))
3641 (clobber (match_scratch:SI 4 "=r,r"))]
3645 int start = INTVAL (operands[3]) & 31;
3646 int size = INTVAL (operands[2]) & 31;
3648 /* Force split for non-cc0 compare. */
3649 if (which_alternative == 1)
3652 /* If the bit-field being tested fits in the upper or lower half of a
3653 word, it is possible to use andiu. or andil. to test it. This is
3654 useful because the condition register set-use delay is smaller for
3655 andi[ul]. than for rlinm. This doesn't work when the starting bit
3656 position is 0 because the LT and GT bits may be set wrong. */
3658 if ((start > 0 && start + size <= 16) || start >= 16)
3660 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3661 - (1 << (16 - (start & 15) - size))));
3663 return \"{andiu.|andis.} %4,%1,%3\";
3665 return \"{andil.|andi.} %4,%1,%3\";
3668 if (start + size >= 32)
3669 operands[3] = const0_rtx;
3671 operands[3] = GEN_INT (start + size);
3672 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3674 [(set_attr "type" "compare")
3675 (set_attr "length" "4,8")])
3678 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3679 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3680 (match_operand:SI 2 "const_int_operand" "")
3681 (match_operand:SI 3 "const_int_operand" ""))
3683 (clobber (match_scratch:SI 4 ""))]
3686 (zero_extract:SI (match_dup 1) (match_dup 2)
3689 (compare:CC (match_dup 4)
3693 (define_insn "*extzvsi_internal2"
3694 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3695 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3696 (match_operand:SI 2 "const_int_operand" "i,i")
3697 (match_operand:SI 3 "const_int_operand" "i,i"))
3699 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3700 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3704 int start = INTVAL (operands[3]) & 31;
3705 int size = INTVAL (operands[2]) & 31;
3707 /* Force split for non-cc0 compare. */
3708 if (which_alternative == 1)
3711 /* Since we are using the output value, we can't ignore any need for
3712 a shift. The bit-field must end at the LSB. */
3713 if (start >= 16 && start + size == 32)
3715 operands[3] = GEN_INT ((1 << size) - 1);
3716 return \"{andil.|andi.} %0,%1,%3\";
3719 if (start + size >= 32)
3720 operands[3] = const0_rtx;
3722 operands[3] = GEN_INT (start + size);
3723 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3725 [(set_attr "type" "compare")
3726 (set_attr "length" "4,8")])
3729 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3730 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3731 (match_operand:SI 2 "const_int_operand" "")
3732 (match_operand:SI 3 "const_int_operand" ""))
3734 (set (match_operand:SI 0 "gpc_reg_operand" "")
3735 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3738 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3740 (compare:CC (match_dup 0)
3744 (define_insn "extzvdi"
3745 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3746 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3747 (match_operand:SI 2 "const_int_operand" "i")
3748 (match_operand:SI 3 "const_int_operand" "i")))]
3752 int start = INTVAL (operands[3]) & 63;
3753 int size = INTVAL (operands[2]) & 63;
3755 if (start + size >= 64)
3756 operands[3] = const0_rtx;
3758 operands[3] = GEN_INT (start + size);
3759 operands[2] = GEN_INT (64 - size);
3760 return \"rldicl %0,%1,%3,%2\";
3763 (define_insn "*extzvdi_internal1"
3764 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3765 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3766 (match_operand:SI 2 "const_int_operand" "i")
3767 (match_operand:SI 3 "const_int_operand" "i"))
3769 (clobber (match_scratch:DI 4 "=r"))]
3773 int start = INTVAL (operands[3]) & 63;
3774 int size = INTVAL (operands[2]) & 63;
3776 if (start + size >= 64)
3777 operands[3] = const0_rtx;
3779 operands[3] = GEN_INT (start + size);
3780 operands[2] = GEN_INT (64 - size);
3781 return \"rldicl. %4,%1,%3,%2\";
3783 [(set_attr "type" "compare")])
3785 (define_insn "*extzvdi_internal2"
3786 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3787 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3788 (match_operand:SI 2 "const_int_operand" "i")
3789 (match_operand:SI 3 "const_int_operand" "i"))
3791 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3792 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3796 int start = INTVAL (operands[3]) & 63;
3797 int size = INTVAL (operands[2]) & 63;
3799 if (start + size >= 64)
3800 operands[3] = const0_rtx;
3802 operands[3] = GEN_INT (start + size);
3803 operands[2] = GEN_INT (64 - size);
3804 return \"rldicl. %0,%1,%3,%2\";
3806 [(set_attr "type" "compare")])
3808 (define_insn "rotlsi3"
3809 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3810 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3811 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3813 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3815 (define_insn "*rotlsi3_internal2"
3816 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3817 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3818 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3820 (clobber (match_scratch:SI 3 "=r,r"))]
3823 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3825 [(set_attr "type" "delayed_compare")
3826 (set_attr "length" "4,8")])
3829 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3830 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3831 (match_operand:SI 2 "reg_or_cint_operand" ""))
3833 (clobber (match_scratch:SI 3 ""))]
3836 (rotate:SI (match_dup 1) (match_dup 2)))
3838 (compare:CC (match_dup 3)
3842 (define_insn "*rotlsi3_internal3"
3843 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3844 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3845 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3847 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3848 (rotate:SI (match_dup 1) (match_dup 2)))]
3851 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3853 [(set_attr "type" "delayed_compare")
3854 (set_attr "length" "4,8")])
3857 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3858 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3859 (match_operand:SI 2 "reg_or_cint_operand" ""))
3861 (set (match_operand:SI 0 "gpc_reg_operand" "")
3862 (rotate:SI (match_dup 1) (match_dup 2)))]
3865 (rotate:SI (match_dup 1) (match_dup 2)))
3867 (compare:CC (match_dup 0)
3871 (define_insn "*rotlsi3_internal4"
3872 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3873 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3874 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3875 (match_operand:SI 3 "mask_operand" "n")))]
3877 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3879 (define_insn "*rotlsi3_internal5"
3880 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3882 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3883 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3884 (match_operand:SI 3 "mask_operand" "n,n"))
3886 (clobber (match_scratch:SI 4 "=r,r"))]
3889 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3891 [(set_attr "type" "delayed_compare")
3892 (set_attr "length" "4,8")])
3895 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3897 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3898 (match_operand:SI 2 "reg_or_cint_operand" ""))
3899 (match_operand:SI 3 "mask_operand" ""))
3901 (clobber (match_scratch:SI 4 ""))]
3904 (and:SI (rotate:SI (match_dup 1)
3908 (compare:CC (match_dup 4)
3912 (define_insn "*rotlsi3_internal6"
3913 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3915 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3916 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3917 (match_operand:SI 3 "mask_operand" "n,n"))
3919 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3920 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3923 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3925 [(set_attr "type" "delayed_compare")
3926 (set_attr "length" "4,8")])
3929 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3931 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3932 (match_operand:SI 2 "reg_or_cint_operand" ""))
3933 (match_operand:SI 3 "mask_operand" ""))
3935 (set (match_operand:SI 0 "gpc_reg_operand" "")
3936 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3939 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3941 (compare:CC (match_dup 0)
3945 (define_insn "*rotlsi3_internal7"
3946 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3949 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3950 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3952 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3954 (define_insn "*rotlsi3_internal8"
3955 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3956 (compare:CC (zero_extend:SI
3958 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3959 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3961 (clobber (match_scratch:SI 3 "=r,r"))]
3964 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3966 [(set_attr "type" "delayed_compare")
3967 (set_attr "length" "4,8")])
3970 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3971 (compare:CC (zero_extend:SI
3973 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3974 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3976 (clobber (match_scratch:SI 3 ""))]
3979 (zero_extend:SI (subreg:QI
3980 (rotate:SI (match_dup 1)
3983 (compare:CC (match_dup 3)
3987 (define_insn "*rotlsi3_internal9"
3988 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3989 (compare:CC (zero_extend:SI
3991 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3992 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3994 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3995 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3998 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
4000 [(set_attr "type" "delayed_compare")
4001 (set_attr "length" "4,8")])
4004 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4005 (compare:CC (zero_extend:SI
4007 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4008 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4010 (set (match_operand:SI 0 "gpc_reg_operand" "")
4011 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4014 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4016 (compare:CC (match_dup 0)
4020 (define_insn "*rotlsi3_internal10"
4021 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4024 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4025 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4027 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
4029 (define_insn "*rotlsi3_internal11"
4030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4031 (compare:CC (zero_extend:SI
4033 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4034 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4036 (clobber (match_scratch:SI 3 "=r,r"))]
4039 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
4041 [(set_attr "type" "delayed_compare")
4042 (set_attr "length" "4,8")])
4045 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4046 (compare:CC (zero_extend:SI
4048 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4049 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4051 (clobber (match_scratch:SI 3 ""))]
4054 (zero_extend:SI (subreg:HI
4055 (rotate:SI (match_dup 1)
4058 (compare:CC (match_dup 3)
4062 (define_insn "*rotlsi3_internal12"
4063 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4064 (compare:CC (zero_extend:SI
4066 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4067 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4069 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4070 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4073 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
4075 [(set_attr "type" "delayed_compare")
4076 (set_attr "length" "4,8")])
4079 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4080 (compare:CC (zero_extend:SI
4082 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4083 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4085 (set (match_operand:SI 0 "gpc_reg_operand" "")
4086 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4089 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4091 (compare:CC (match_dup 0)
4095 ;; Note that we use "sle." instead of "sl." so that we can set
4096 ;; SHIFT_COUNT_TRUNCATED.
4098 (define_expand "ashlsi3"
4099 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4100 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4101 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4106 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4108 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4112 (define_insn "ashlsi3_power"
4113 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4114 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4115 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4116 (clobber (match_scratch:SI 3 "=q,X"))]
4120 {sli|slwi} %0,%1,%h2")
4122 (define_insn "ashlsi3_no_power"
4123 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4124 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4125 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4127 "{sl|slw}%I2 %0,%1,%h2")
4130 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4131 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4132 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4134 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4135 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4139 {sli.|slwi.} %3,%1,%h2
4142 [(set_attr "type" "delayed_compare")
4143 (set_attr "length" "4,4,8,8")])
4146 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4147 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4148 (match_operand:SI 2 "reg_or_cint_operand" ""))
4150 (clobber (match_scratch:SI 3 ""))
4151 (clobber (match_scratch:SI 4 ""))]
4152 "TARGET_POWER && reload_completed"
4153 [(parallel [(set (match_dup 3)
4154 (ashift:SI (match_dup 1) (match_dup 2)))
4155 (clobber (match_dup 4))])
4157 (compare:CC (match_dup 3)
4162 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4163 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4164 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4166 (clobber (match_scratch:SI 3 "=r,r"))]
4167 "! TARGET_POWER && TARGET_32BIT"
4169 {sl|slw}%I2. %3,%1,%h2
4171 [(set_attr "type" "delayed_compare")
4172 (set_attr "length" "4,8")])
4175 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4176 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4177 (match_operand:SI 2 "reg_or_cint_operand" ""))
4179 (clobber (match_scratch:SI 3 ""))]
4180 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4182 (ashift:SI (match_dup 1) (match_dup 2)))
4184 (compare:CC (match_dup 3)
4189 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4190 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4191 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4193 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4194 (ashift:SI (match_dup 1) (match_dup 2)))
4195 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4199 {sli.|slwi.} %0,%1,%h2
4202 [(set_attr "type" "delayed_compare")
4203 (set_attr "length" "4,4,8,8")])
4206 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4207 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4208 (match_operand:SI 2 "reg_or_cint_operand" ""))
4210 (set (match_operand:SI 0 "gpc_reg_operand" "")
4211 (ashift:SI (match_dup 1) (match_dup 2)))
4212 (clobber (match_scratch:SI 4 ""))]
4213 "TARGET_POWER && reload_completed"
4214 [(parallel [(set (match_dup 0)
4215 (ashift:SI (match_dup 1) (match_dup 2)))
4216 (clobber (match_dup 4))])
4218 (compare:CC (match_dup 0)
4223 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4224 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4225 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4227 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4228 (ashift:SI (match_dup 1) (match_dup 2)))]
4229 "! TARGET_POWER && TARGET_32BIT"
4231 {sl|slw}%I2. %0,%1,%h2
4233 [(set_attr "type" "delayed_compare")
4234 (set_attr "length" "4,8")])
4237 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4238 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4239 (match_operand:SI 2 "reg_or_cint_operand" ""))
4241 (set (match_operand:SI 0 "gpc_reg_operand" "")
4242 (ashift:SI (match_dup 1) (match_dup 2)))]
4243 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4245 (ashift:SI (match_dup 1) (match_dup 2)))
4247 (compare:CC (match_dup 0)
4251 (define_insn "rlwinm"
4252 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4253 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4254 (match_operand:SI 2 "const_int_operand" "i"))
4255 (match_operand:SI 3 "mask_operand" "n")))]
4256 "includes_lshift_p (operands[2], operands[3])"
4257 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4260 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4262 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4263 (match_operand:SI 2 "const_int_operand" "i,i"))
4264 (match_operand:SI 3 "mask_operand" "n,n"))
4266 (clobber (match_scratch:SI 4 "=r,r"))]
4267 "includes_lshift_p (operands[2], operands[3])"
4269 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4271 [(set_attr "type" "delayed_compare")
4272 (set_attr "length" "4,8")])
4275 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4277 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4278 (match_operand:SI 2 "const_int_operand" ""))
4279 (match_operand:SI 3 "mask_operand" ""))
4281 (clobber (match_scratch:SI 4 ""))]
4282 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4284 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4287 (compare:CC (match_dup 4)
4292 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4294 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4295 (match_operand:SI 2 "const_int_operand" "i,i"))
4296 (match_operand:SI 3 "mask_operand" "n,n"))
4298 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4299 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4300 "includes_lshift_p (operands[2], operands[3])"
4302 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4304 [(set_attr "type" "delayed_compare")
4305 (set_attr "length" "4,8")])
4308 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4310 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4311 (match_operand:SI 2 "const_int_operand" ""))
4312 (match_operand:SI 3 "mask_operand" ""))
4314 (set (match_operand:SI 0 "gpc_reg_operand" "")
4315 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4316 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4318 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4320 (compare:CC (match_dup 0)
4324 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4326 (define_expand "lshrsi3"
4327 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4328 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4329 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4334 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4336 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4340 (define_insn "lshrsi3_power"
4341 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4342 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4343 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4344 (clobber (match_scratch:SI 3 "=q,X,X"))]
4349 {s%A2i|s%A2wi} %0,%1,%h2")
4351 (define_insn "lshrsi3_no_power"
4352 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4353 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4354 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
4358 {sr|srw}%I2 %0,%1,%h2")
4361 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4362 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4363 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4365 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4366 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4371 {s%A2i.|s%A2wi.} %3,%1,%h2
4375 [(set_attr "type" "delayed_compare")
4376 (set_attr "length" "4,4,4,8,8,8")])
4379 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4380 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4381 (match_operand:SI 2 "reg_or_cint_operand" ""))
4383 (clobber (match_scratch:SI 3 ""))
4384 (clobber (match_scratch:SI 4 ""))]
4385 "TARGET_POWER && reload_completed"
4386 [(parallel [(set (match_dup 3)
4387 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4388 (clobber (match_dup 4))])
4390 (compare:CC (match_dup 3)
4395 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4396 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4397 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4399 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
4400 "! TARGET_POWER && TARGET_32BIT"
4403 {sr|srw}%I2. %3,%1,%h2
4406 [(set_attr "type" "delayed_compare")
4407 (set_attr "length" "4,4,8,8")])
4410 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4411 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4412 (match_operand:SI 2 "reg_or_cint_operand" ""))
4414 (clobber (match_scratch:SI 3 ""))]
4415 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4417 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4419 (compare:CC (match_dup 3)
4424 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4425 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4426 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4428 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4429 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4430 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4435 {s%A2i.|s%A2wi.} %0,%1,%h2
4439 [(set_attr "type" "delayed_compare")
4440 (set_attr "length" "4,4,4,8,8,8")])
4443 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4444 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4445 (match_operand:SI 2 "reg_or_cint_operand" ""))
4447 (set (match_operand:SI 0 "gpc_reg_operand" "")
4448 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4449 (clobber (match_scratch:SI 4 ""))]
4450 "TARGET_POWER && reload_completed"
4451 [(parallel [(set (match_dup 0)
4452 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4453 (clobber (match_dup 4))])
4455 (compare:CC (match_dup 0)
4460 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4461 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4462 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4464 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4465 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4466 "! TARGET_POWER && TARGET_32BIT"
4469 {sr|srw}%I2. %0,%1,%h2
4472 [(set_attr "type" "delayed_compare")
4473 (set_attr "length" "4,4,8,8")])
4476 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4477 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4478 (match_operand:SI 2 "reg_or_cint_operand" ""))
4480 (set (match_operand:SI 0 "gpc_reg_operand" "")
4481 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4482 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4484 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4486 (compare:CC (match_dup 0)
4491 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4492 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4493 (match_operand:SI 2 "const_int_operand" "i"))
4494 (match_operand:SI 3 "mask_operand" "n")))]
4495 "includes_rshift_p (operands[2], operands[3])"
4496 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4499 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4501 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4502 (match_operand:SI 2 "const_int_operand" "i,i"))
4503 (match_operand:SI 3 "mask_operand" "n,n"))
4505 (clobber (match_scratch:SI 4 "=r,r"))]
4506 "includes_rshift_p (operands[2], operands[3])"
4508 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4510 [(set_attr "type" "delayed_compare")
4511 (set_attr "length" "4,8")])
4514 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4516 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4517 (match_operand:SI 2 "const_int_operand" ""))
4518 (match_operand:SI 3 "mask_operand" ""))
4520 (clobber (match_scratch:SI 4 ""))]
4521 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4523 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4526 (compare:CC (match_dup 4)
4531 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4533 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4534 (match_operand:SI 2 "const_int_operand" "i,i"))
4535 (match_operand:SI 3 "mask_operand" "n,n"))
4537 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4538 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4539 "includes_rshift_p (operands[2], operands[3])"
4541 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4543 [(set_attr "type" "delayed_compare")
4544 (set_attr "length" "4,8")])
4547 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4549 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4550 (match_operand:SI 2 "const_int_operand" ""))
4551 (match_operand:SI 3 "mask_operand" ""))
4553 (set (match_operand:SI 0 "gpc_reg_operand" "")
4554 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4555 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4557 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4559 (compare:CC (match_dup 0)
4564 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4567 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4568 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4569 "includes_rshift_p (operands[2], GEN_INT (255))"
4570 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4573 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4577 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4578 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4580 (clobber (match_scratch:SI 3 "=r,r"))]
4581 "includes_rshift_p (operands[2], GEN_INT (255))"
4583 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4585 [(set_attr "type" "delayed_compare")
4586 (set_attr "length" "4,8")])
4589 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4593 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4594 (match_operand:SI 2 "const_int_operand" "")) 0))
4596 (clobber (match_scratch:SI 3 ""))]
4597 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4599 (zero_extend:SI (subreg:QI
4600 (lshiftrt:SI (match_dup 1)
4603 (compare:CC (match_dup 3)
4608 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4612 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4613 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4615 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4616 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4617 "includes_rshift_p (operands[2], GEN_INT (255))"
4619 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4621 [(set_attr "type" "delayed_compare")
4622 (set_attr "length" "4,8")])
4625 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4629 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4630 (match_operand:SI 2 "const_int_operand" "")) 0))
4632 (set (match_operand:SI 0 "gpc_reg_operand" "")
4633 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4634 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4636 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4638 (compare:CC (match_dup 0)
4643 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4646 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4647 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4648 "includes_rshift_p (operands[2], GEN_INT (65535))"
4649 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4652 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4656 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4657 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4659 (clobber (match_scratch:SI 3 "=r,r"))]
4660 "includes_rshift_p (operands[2], GEN_INT (65535))"
4662 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4664 [(set_attr "type" "delayed_compare")
4665 (set_attr "length" "4,8")])
4668 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4672 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4673 (match_operand:SI 2 "const_int_operand" "")) 0))
4675 (clobber (match_scratch:SI 3 ""))]
4676 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4678 (zero_extend:SI (subreg:HI
4679 (lshiftrt:SI (match_dup 1)
4682 (compare:CC (match_dup 3)
4687 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4691 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4692 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4694 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4695 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4696 "includes_rshift_p (operands[2], GEN_INT (65535))"
4698 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4700 [(set_attr "type" "delayed_compare")
4701 (set_attr "length" "4,8")])
4704 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4708 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4709 (match_operand:SI 2 "const_int_operand" "")) 0))
4711 (set (match_operand:SI 0 "gpc_reg_operand" "")
4712 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4713 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4715 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4717 (compare:CC (match_dup 0)
4722 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4724 (match_operand:SI 1 "gpc_reg_operand" "r"))
4725 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4731 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4733 (match_operand:SI 1 "gpc_reg_operand" "r"))
4734 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4740 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4742 (match_operand:SI 1 "gpc_reg_operand" "r"))
4743 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4749 (define_expand "ashrsi3"
4750 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4751 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4752 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4757 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4759 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4763 (define_insn "ashrsi3_power"
4764 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4765 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4766 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4767 (clobber (match_scratch:SI 3 "=q,X"))]
4771 {srai|srawi} %0,%1,%h2")
4773 (define_insn "ashrsi3_no_power"
4774 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4775 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4776 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4778 "{sra|sraw}%I2 %0,%1,%h2")
4781 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4782 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4783 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4785 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4786 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4790 {srai.|srawi.} %3,%1,%h2
4793 [(set_attr "type" "delayed_compare")
4794 (set_attr "length" "4,4,8,8")])
4797 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4798 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4799 (match_operand:SI 2 "reg_or_cint_operand" ""))
4801 (clobber (match_scratch:SI 3 ""))
4802 (clobber (match_scratch:SI 4 ""))]
4803 "TARGET_POWER && reload_completed"
4804 [(parallel [(set (match_dup 3)
4805 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4806 (clobber (match_dup 4))])
4808 (compare:CC (match_dup 3)
4813 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4814 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4815 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4817 (clobber (match_scratch:SI 3 "=r,r"))]
4820 {sra|sraw}%I2. %3,%1,%h2
4822 [(set_attr "type" "delayed_compare")
4823 (set_attr "length" "4,8")])
4826 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4827 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4828 (match_operand:SI 2 "reg_or_cint_operand" ""))
4830 (clobber (match_scratch:SI 3 ""))]
4831 "! TARGET_POWER && reload_completed"
4833 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4835 (compare:CC (match_dup 3)
4840 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4841 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4842 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4844 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4845 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4846 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4850 {srai.|srawi.} %0,%1,%h2
4853 [(set_attr "type" "delayed_compare")
4854 (set_attr "length" "4,4,8,8")])
4857 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4858 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4859 (match_operand:SI 2 "reg_or_cint_operand" ""))
4861 (set (match_operand:SI 0 "gpc_reg_operand" "")
4862 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4863 (clobber (match_scratch:SI 4 ""))]
4864 "TARGET_POWER && reload_completed"
4865 [(parallel [(set (match_dup 0)
4866 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4867 (clobber (match_dup 4))])
4869 (compare:CC (match_dup 0)
4874 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4875 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4876 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4878 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4879 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4882 {sra|sraw}%I2. %0,%1,%h2
4884 [(set_attr "type" "delayed_compare")
4885 (set_attr "length" "4,8")])
4888 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4889 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4890 (match_operand:SI 2 "reg_or_cint_operand" ""))
4892 (set (match_operand:SI 0 "gpc_reg_operand" "")
4893 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4894 "! TARGET_POWER && reload_completed"
4896 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4898 (compare:CC (match_dup 0)
4902 ;; Floating-point insns, excluding normal data motion.
4904 ;; PowerPC has a full set of single-precision floating point instructions.
4906 ;; For the POWER architecture, we pretend that we have both SFmode and
4907 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4908 ;; The only conversions we will do will be when storing to memory. In that
4909 ;; case, we will use the "frsp" instruction before storing.
4911 ;; Note that when we store into a single-precision memory location, we need to
4912 ;; use the frsp insn first. If the register being stored isn't dead, we
4913 ;; need a scratch register for the frsp. But this is difficult when the store
4914 ;; is done by reload. It is not incorrect to do the frsp on the register in
4915 ;; this case, we just lose precision that we would have otherwise gotten but
4916 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4918 (define_expand "extendsfdf2"
4919 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4920 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4921 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4924 (define_insn_and_split "*extendsfdf2_fpr"
4925 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4926 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4927 "TARGET_HARD_FLOAT && TARGET_FPRS"
4932 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4935 emit_note (NOTE_INSN_DELETED);
4938 [(set_attr "type" "fp,fp,fpload")])
4940 (define_expand "truncdfsf2"
4941 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4942 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4943 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4946 (define_insn "*truncdfsf2_fpr"
4947 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4948 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4949 "TARGET_HARD_FLOAT && TARGET_FPRS"
4951 [(set_attr "type" "fp")])
4953 (define_insn "aux_truncdfsf2"
4954 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4955 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4956 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4958 [(set_attr "type" "fp")])
4960 (define_expand "negsf2"
4961 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4962 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4966 (define_insn "*negsf2"
4967 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4968 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4969 "TARGET_HARD_FLOAT && TARGET_FPRS"
4971 [(set_attr "type" "fp")])
4973 (define_expand "abssf2"
4974 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4975 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4979 (define_insn "*abssf2"
4980 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4981 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4982 "TARGET_HARD_FLOAT && TARGET_FPRS"
4984 [(set_attr "type" "fp")])
4987 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4988 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4989 "TARGET_HARD_FLOAT && TARGET_FPRS"
4991 [(set_attr "type" "fp")])
4993 (define_expand "addsf3"
4994 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4995 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4996 (match_operand:SF 2 "gpc_reg_operand" "")))]
5001 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5002 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5003 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5004 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5006 [(set_attr "type" "fp")])
5009 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5010 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5011 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5012 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5013 "{fa|fadd} %0,%1,%2"
5014 [(set_attr "type" "fp")])
5016 (define_expand "subsf3"
5017 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5018 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5019 (match_operand:SF 2 "gpc_reg_operand" "")))]
5024 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5025 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5026 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5027 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5029 [(set_attr "type" "fp")])
5032 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5033 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5034 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5035 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5036 "{fs|fsub} %0,%1,%2"
5037 [(set_attr "type" "fp")])
5039 (define_expand "mulsf3"
5040 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5041 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5042 (match_operand:SF 2 "gpc_reg_operand" "")))]
5047 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5048 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5049 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5050 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5052 [(set_attr "type" "fp")])
5055 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5056 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5057 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5058 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5059 "{fm|fmul} %0,%1,%2"
5060 [(set_attr "type" "dmul")])
5063 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5064 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5065 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5067 [(set_attr "type" "fp")])
5069 (define_expand "divsf3"
5070 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5071 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5072 (match_operand:SF 2 "gpc_reg_operand" "")))]
5075 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
5076 && flag_finite_math_only && !flag_trapping_math)
5078 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5084 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5085 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5086 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5087 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5089 [(set_attr "type" "sdiv")])
5092 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5093 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5094 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5095 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5096 "{fd|fdiv} %0,%1,%2"
5097 [(set_attr "type" "ddiv")])
5100 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5101 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5102 (match_operand:SF 2 "gpc_reg_operand" "f"))
5103 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5104 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5105 "fmadds %0,%1,%2,%3"
5106 [(set_attr "type" "fp")])
5109 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5110 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5111 (match_operand:SF 2 "gpc_reg_operand" "f"))
5112 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5113 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5114 "{fma|fmadd} %0,%1,%2,%3"
5115 [(set_attr "type" "dmul")])
5118 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5119 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5120 (match_operand:SF 2 "gpc_reg_operand" "f"))
5121 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5122 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5123 "fmsubs %0,%1,%2,%3"
5124 [(set_attr "type" "fp")])
5127 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5128 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5129 (match_operand:SF 2 "gpc_reg_operand" "f"))
5130 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5131 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5132 "{fms|fmsub} %0,%1,%2,%3"
5133 [(set_attr "type" "dmul")])
5136 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5137 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5138 (match_operand:SF 2 "gpc_reg_operand" "f"))
5139 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5140 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5141 && HONOR_SIGNED_ZEROS (SFmode)"
5142 "fnmadds %0,%1,%2,%3"
5143 [(set_attr "type" "fp")])
5146 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5147 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5148 (match_operand:SF 2 "gpc_reg_operand" "f"))
5149 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5150 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5151 && ! HONOR_SIGNED_ZEROS (SFmode)"
5152 "fnmadds %0,%1,%2,%3"
5153 [(set_attr "type" "fp")])
5156 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5157 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5158 (match_operand:SF 2 "gpc_reg_operand" "f"))
5159 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5160 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5161 "{fnma|fnmadd} %0,%1,%2,%3"
5162 [(set_attr "type" "dmul")])
5165 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5166 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5167 (match_operand:SF 2 "gpc_reg_operand" "f"))
5168 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5169 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5170 && ! HONOR_SIGNED_ZEROS (SFmode)"
5171 "{fnma|fnmadd} %0,%1,%2,%3"
5172 [(set_attr "type" "dmul")])
5175 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5176 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5177 (match_operand:SF 2 "gpc_reg_operand" "f"))
5178 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5179 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5180 && HONOR_SIGNED_ZEROS (SFmode)"
5181 "fnmsubs %0,%1,%2,%3"
5182 [(set_attr "type" "fp")])
5185 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5186 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5187 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5188 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5189 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5190 && ! HONOR_SIGNED_ZEROS (SFmode)"
5191 "fnmsubs %0,%1,%2,%3"
5192 [(set_attr "type" "fp")])
5195 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5196 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5197 (match_operand:SF 2 "gpc_reg_operand" "f"))
5198 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5199 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5200 "{fnms|fnmsub} %0,%1,%2,%3"
5201 [(set_attr "type" "dmul")])
5204 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5205 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5206 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5207 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5208 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5209 && ! HONOR_SIGNED_ZEROS (SFmode)"
5210 "{fnms|fnmsub} %0,%1,%2,%3"
5211 [(set_attr "type" "dmul")])
5213 (define_expand "sqrtsf2"
5214 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5215 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5216 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5220 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5221 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5222 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5224 [(set_attr "type" "ssqrt")])
5227 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5228 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5229 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5231 [(set_attr "type" "dsqrt")])
5233 (define_expand "copysignsf3"
5235 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5237 (neg:SF (abs:SF (match_dup 1))))
5238 (set (match_operand:SF 0 "gpc_reg_operand" "")
5239 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5243 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5244 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5246 operands[3] = gen_reg_rtx (SFmode);
5247 operands[4] = gen_reg_rtx (SFmode);
5248 operands[5] = CONST0_RTX (SFmode);
5251 (define_expand "copysigndf3"
5253 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5255 (neg:DF (abs:DF (match_dup 1))))
5256 (set (match_operand:DF 0 "gpc_reg_operand" "")
5257 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5261 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5262 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5264 operands[3] = gen_reg_rtx (DFmode);
5265 operands[4] = gen_reg_rtx (DFmode);
5266 operands[5] = CONST0_RTX (DFmode);
5269 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5270 ;; fsel instruction and some auxiliary computations. Then we just have a
5271 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5273 (define_expand "smaxsf3"
5274 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5275 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5276 (match_operand:SF 2 "gpc_reg_operand" ""))
5279 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5280 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5282 (define_expand "sminsf3"
5283 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5284 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5285 (match_operand:SF 2 "gpc_reg_operand" ""))
5288 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5289 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5292 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5293 (match_operator:SF 3 "min_max_operator"
5294 [(match_operand:SF 1 "gpc_reg_operand" "")
5295 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5296 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5299 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5300 operands[1], operands[2]);
5304 (define_expand "movsicc"
5305 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5306 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5307 (match_operand:SI 2 "gpc_reg_operand" "")
5308 (match_operand:SI 3 "gpc_reg_operand" "")))]
5312 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5318 ;; We use the BASE_REGS for the isel input operands because, if rA is
5319 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5320 ;; because we may switch the operands and rB may end up being rA.
5322 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5323 ;; leave out the mode in operand 4 and use one pattern, but reload can
5324 ;; change the mode underneath our feet and then gets confused trying
5325 ;; to reload the value.
5326 (define_insn "isel_signed"
5327 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5329 (match_operator 1 "comparison_operator"
5330 [(match_operand:CC 4 "cc_reg_operand" "y")
5332 (match_operand:SI 2 "gpc_reg_operand" "b")
5333 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5336 { return output_isel (operands); }"
5337 [(set_attr "length" "4")])
5339 (define_insn "isel_unsigned"
5340 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5342 (match_operator 1 "comparison_operator"
5343 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5345 (match_operand:SI 2 "gpc_reg_operand" "b")
5346 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5349 { return output_isel (operands); }"
5350 [(set_attr "length" "4")])
5352 (define_expand "movsfcc"
5353 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5354 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5355 (match_operand:SF 2 "gpc_reg_operand" "")
5356 (match_operand:SF 3 "gpc_reg_operand" "")))]
5357 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5360 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5366 (define_insn "*fselsfsf4"
5367 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5368 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5369 (match_operand:SF 4 "zero_fp_constant" "F"))
5370 (match_operand:SF 2 "gpc_reg_operand" "f")
5371 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5372 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5374 [(set_attr "type" "fp")])
5376 (define_insn "*fseldfsf4"
5377 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5378 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5379 (match_operand:DF 4 "zero_fp_constant" "F"))
5380 (match_operand:SF 2 "gpc_reg_operand" "f")
5381 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5382 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5384 [(set_attr "type" "fp")])
5386 (define_expand "negdf2"
5387 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5388 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5389 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5392 (define_insn "*negdf2_fpr"
5393 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5394 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5395 "TARGET_HARD_FLOAT && TARGET_FPRS"
5397 [(set_attr "type" "fp")])
5399 (define_expand "absdf2"
5400 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5401 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5402 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5405 (define_insn "*absdf2_fpr"
5406 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5407 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5408 "TARGET_HARD_FLOAT && TARGET_FPRS"
5410 [(set_attr "type" "fp")])
5412 (define_insn "*nabsdf2_fpr"
5413 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5414 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5415 "TARGET_HARD_FLOAT && TARGET_FPRS"
5417 [(set_attr "type" "fp")])
5419 (define_expand "adddf3"
5420 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5421 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5422 (match_operand:DF 2 "gpc_reg_operand" "")))]
5423 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5426 (define_insn "*adddf3_fpr"
5427 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5428 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5429 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5430 "TARGET_HARD_FLOAT && TARGET_FPRS"
5431 "{fa|fadd} %0,%1,%2"
5432 [(set_attr "type" "fp")])
5434 (define_expand "subdf3"
5435 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5436 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5437 (match_operand:DF 2 "gpc_reg_operand" "")))]
5438 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5441 (define_insn "*subdf3_fpr"
5442 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5443 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5444 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5445 "TARGET_HARD_FLOAT && TARGET_FPRS"
5446 "{fs|fsub} %0,%1,%2"
5447 [(set_attr "type" "fp")])
5449 (define_expand "muldf3"
5450 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5451 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5452 (match_operand:DF 2 "gpc_reg_operand" "")))]
5453 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5456 (define_insn "*muldf3_fpr"
5457 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5458 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5459 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5460 "TARGET_HARD_FLOAT && TARGET_FPRS"
5461 "{fm|fmul} %0,%1,%2"
5462 [(set_attr "type" "dmul")])
5465 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5466 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5467 "TARGET_POPCNTB && flag_finite_math_only"
5469 [(set_attr "type" "fp")])
5471 (define_expand "divdf3"
5472 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5473 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5474 (match_operand:DF 2 "gpc_reg_operand" "")))]
5475 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5477 if (swdiv && !optimize_size && TARGET_POPCNTB
5478 && flag_finite_math_only && !flag_trapping_math)
5480 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5485 (define_insn "*divdf3_fpr"
5486 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5487 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5488 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5489 "TARGET_HARD_FLOAT && TARGET_FPRS"
5490 "{fd|fdiv} %0,%1,%2"
5491 [(set_attr "type" "ddiv")])
5494 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5495 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5496 (match_operand:DF 2 "gpc_reg_operand" "f"))
5497 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5498 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5499 "{fma|fmadd} %0,%1,%2,%3"
5500 [(set_attr "type" "dmul")])
5503 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5504 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5505 (match_operand:DF 2 "gpc_reg_operand" "f"))
5506 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5507 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5508 "{fms|fmsub} %0,%1,%2,%3"
5509 [(set_attr "type" "dmul")])
5512 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5513 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5514 (match_operand:DF 2 "gpc_reg_operand" "f"))
5515 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5516 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5517 && HONOR_SIGNED_ZEROS (DFmode)"
5518 "{fnma|fnmadd} %0,%1,%2,%3"
5519 [(set_attr "type" "dmul")])
5522 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5523 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5524 (match_operand:DF 2 "gpc_reg_operand" "f"))
5525 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5526 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5527 && ! HONOR_SIGNED_ZEROS (DFmode)"
5528 "{fnma|fnmadd} %0,%1,%2,%3"
5529 [(set_attr "type" "dmul")])
5532 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5533 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5534 (match_operand:DF 2 "gpc_reg_operand" "f"))
5535 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5536 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5537 && HONOR_SIGNED_ZEROS (DFmode)"
5538 "{fnms|fnmsub} %0,%1,%2,%3"
5539 [(set_attr "type" "dmul")])
5542 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5543 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5544 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5545 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5546 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5547 && ! HONOR_SIGNED_ZEROS (DFmode)"
5548 "{fnms|fnmsub} %0,%1,%2,%3"
5549 [(set_attr "type" "dmul")])
5551 (define_insn "sqrtdf2"
5552 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5553 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5554 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5556 [(set_attr "type" "dsqrt")])
5558 ;; The conditional move instructions allow us to perform max and min
5559 ;; operations even when
5561 (define_expand "smaxdf3"
5562 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5563 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5564 (match_operand:DF 2 "gpc_reg_operand" ""))
5567 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5568 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5570 (define_expand "smindf3"
5571 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5572 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5573 (match_operand:DF 2 "gpc_reg_operand" ""))
5576 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5577 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5580 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5581 (match_operator:DF 3 "min_max_operator"
5582 [(match_operand:DF 1 "gpc_reg_operand" "")
5583 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5584 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5587 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5588 operands[1], operands[2]);
5592 (define_expand "movdfcc"
5593 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5594 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5595 (match_operand:DF 2 "gpc_reg_operand" "")
5596 (match_operand:DF 3 "gpc_reg_operand" "")))]
5597 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5600 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5606 (define_insn "*fseldfdf4"
5607 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5608 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5609 (match_operand:DF 4 "zero_fp_constant" "F"))
5610 (match_operand:DF 2 "gpc_reg_operand" "f")
5611 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5612 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5614 [(set_attr "type" "fp")])
5616 (define_insn "*fselsfdf4"
5617 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5618 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5619 (match_operand:SF 4 "zero_fp_constant" "F"))
5620 (match_operand:DF 2 "gpc_reg_operand" "f")
5621 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5624 [(set_attr "type" "fp")])
5626 ;; Conversions to and from floating-point.
5628 (define_expand "fixuns_truncsfsi2"
5629 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5630 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5631 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5634 (define_expand "fix_truncsfsi2"
5635 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5636 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5637 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5640 ; For each of these conversions, there is a define_expand, a define_insn
5641 ; with a '#' template, and a define_split (with C code). The idea is
5642 ; to allow constant folding with the template of the define_insn,
5643 ; then to have the insns split later (between sched1 and final).
5645 (define_expand "floatsidf2"
5646 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5647 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5650 (clobber (match_dup 4))
5651 (clobber (match_dup 5))
5652 (clobber (match_dup 6))])]
5653 "TARGET_HARD_FLOAT && TARGET_FPRS"
5656 if (TARGET_E500_DOUBLE)
5658 emit_insn (gen_spe_floatsidf2 (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_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5670 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5671 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5672 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5673 operands[5] = gen_reg_rtx (DFmode);
5674 operands[6] = gen_reg_rtx (SImode);
5677 (define_insn_and_split "*floatsidf2_internal"
5678 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5679 (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 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5685 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5687 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5691 rtx lowword, highword;
5692 gcc_assert (MEM_P (operands[4]));
5693 highword = adjust_address (operands[4], SImode, 0);
5694 lowword = adjust_address (operands[4], SImode, 4);
5695 if (! WORDS_BIG_ENDIAN)
5698 tmp = highword; highword = lowword; lowword = tmp;
5701 emit_insn (gen_xorsi3 (operands[6], operands[1],
5702 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5703 emit_move_insn (lowword, operands[6]);
5704 emit_move_insn (highword, operands[2]);
5705 emit_move_insn (operands[5], operands[4]);
5706 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5709 [(set_attr "length" "24")])
5711 (define_expand "floatunssisf2"
5712 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5713 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5714 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5717 (define_expand "floatunssidf2"
5718 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5719 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5722 (clobber (match_dup 4))
5723 (clobber (match_dup 5))])]
5724 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5727 if (TARGET_E500_DOUBLE)
5729 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5732 if (TARGET_POWERPC64)
5734 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5735 rtx t1 = gen_reg_rtx (DImode);
5736 rtx t2 = gen_reg_rtx (DImode);
5737 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5742 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5743 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5744 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5745 operands[5] = gen_reg_rtx (DFmode);
5748 (define_insn_and_split "*floatunssidf2_internal"
5749 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5750 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5751 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5752 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5753 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5754 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5755 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5757 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5761 rtx lowword, highword;
5762 gcc_assert (MEM_P (operands[4]));
5763 highword = adjust_address (operands[4], SImode, 0);
5764 lowword = adjust_address (operands[4], SImode, 4);
5765 if (! WORDS_BIG_ENDIAN)
5768 tmp = highword; highword = lowword; lowword = tmp;
5771 emit_move_insn (lowword, operands[1]);
5772 emit_move_insn (highword, operands[2]);
5773 emit_move_insn (operands[5], operands[4]);
5774 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5777 [(set_attr "length" "20")])
5779 (define_expand "fix_truncdfsi2"
5780 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5781 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5782 (clobber (match_dup 2))
5783 (clobber (match_dup 3))])]
5784 "(TARGET_POWER2 || TARGET_POWERPC)
5785 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5788 if (TARGET_E500_DOUBLE)
5790 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5793 operands[2] = gen_reg_rtx (DImode);
5794 if (TARGET_PPC_GFXOPT)
5796 rtx orig_dest = operands[0];
5797 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5798 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5799 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5801 if (operands[0] != orig_dest)
5802 emit_move_insn (orig_dest, operands[0]);
5805 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5808 (define_insn_and_split "*fix_truncdfsi2_internal"
5809 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5810 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5811 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5812 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5813 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5815 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[3]))"
5820 gcc_assert (MEM_P (operands[3]));
5821 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5823 emit_insn (gen_fctiwz (operands[2], operands[1]));
5824 emit_move_insn (operands[3], operands[2]);
5825 emit_move_insn (operands[0], lowword);
5828 [(set_attr "length" "16")])
5830 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5831 [(set (match_operand:SI 0 "memory_operand" "=Z")
5832 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5833 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5834 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5835 && TARGET_PPC_GFXOPT"
5841 emit_insn (gen_fctiwz (operands[2], operands[1]));
5842 emit_insn (gen_stfiwx (operands[0], operands[2]));
5845 [(set_attr "length" "16")])
5847 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5848 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5849 ; because the first makes it clear that operand 0 is not live
5850 ; before the instruction.
5851 (define_insn "fctiwz"
5852 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5853 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5855 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5856 "{fcirz|fctiwz} %0,%1"
5857 [(set_attr "type" "fp")])
5859 (define_insn "btruncdf2"
5860 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5861 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5862 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5864 [(set_attr "type" "fp")])
5866 (define_insn "btruncsf2"
5867 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5868 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5869 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5871 [(set_attr "type" "fp")])
5873 (define_insn "ceildf2"
5874 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5875 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5876 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5878 [(set_attr "type" "fp")])
5880 (define_insn "ceilsf2"
5881 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5882 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5883 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5885 [(set_attr "type" "fp")])
5887 (define_insn "floordf2"
5888 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5889 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5890 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5892 [(set_attr "type" "fp")])
5894 (define_insn "floorsf2"
5895 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5896 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5897 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5899 [(set_attr "type" "fp")])
5901 (define_insn "rounddf2"
5902 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5903 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
5904 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5906 [(set_attr "type" "fp")])
5908 (define_insn "roundsf2"
5909 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5910 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
5911 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5913 [(set_attr "type" "fp")])
5915 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5916 (define_insn "stfiwx"
5917 [(set (match_operand:SI 0 "memory_operand" "=Z")
5918 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
5922 [(set_attr "type" "fpstore")])
5924 (define_expand "floatsisf2"
5925 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5926 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5927 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5930 (define_insn "floatdidf2"
5931 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5932 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5933 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5935 [(set_attr "type" "fp")])
5937 (define_insn_and_split "floatsidf_ppc64"
5938 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5939 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5940 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5941 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5942 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5943 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5946 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5947 (set (match_dup 2) (match_dup 3))
5948 (set (match_dup 4) (match_dup 2))
5949 (set (match_dup 0) (float:DF (match_dup 4)))]
5952 (define_insn_and_split "floatunssidf_ppc64"
5953 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5954 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5955 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5956 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5957 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5958 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5961 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5962 (set (match_dup 2) (match_dup 3))
5963 (set (match_dup 4) (match_dup 2))
5964 (set (match_dup 0) (float:DF (match_dup 4)))]
5967 (define_insn "fix_truncdfdi2"
5968 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5969 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5970 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5972 [(set_attr "type" "fp")])
5974 (define_expand "floatdisf2"
5975 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5976 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5977 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5980 rtx val = operands[1];
5981 if (!flag_unsafe_math_optimizations)
5983 rtx label = gen_label_rtx ();
5984 val = gen_reg_rtx (DImode);
5985 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5988 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5992 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5993 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5994 ;; from double rounding.
5995 (define_insn_and_split "floatdisf2_internal1"
5996 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5997 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5998 (clobber (match_scratch:DF 2 "=f"))]
5999 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6001 "&& reload_completed"
6003 (float:DF (match_dup 1)))
6005 (float_truncate:SF (match_dup 2)))]
6008 ;; Twiddles bits to avoid double rounding.
6009 ;; Bits that might be truncated when converting to DFmode are replaced
6010 ;; by a bit that won't be lost at that stage, but is below the SFmode
6011 ;; rounding position.
6012 (define_expand "floatdisf2_internal2"
6013 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6015 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6017 (clobber (scratch:CC))])
6018 (set (match_dup 3) (plus:DI (match_dup 3)
6020 (set (match_dup 0) (plus:DI (match_dup 0)
6022 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6024 (set (match_dup 0) (ior:DI (match_dup 0)
6026 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6028 (clobber (scratch:CC))])
6029 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6030 (label_ref (match_operand:DI 2 "" ""))
6032 (set (match_dup 0) (match_dup 1))]
6033 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6036 operands[3] = gen_reg_rtx (DImode);
6037 operands[4] = gen_reg_rtx (CCUNSmode);
6040 ;; Define the DImode operations that can be done in a small number
6041 ;; of instructions. The & constraints are to prevent the register
6042 ;; allocator from allocating registers that overlap with the inputs
6043 ;; (for example, having an input in 7,8 and an output in 6,7). We
6044 ;; also allow for the output being the same as one of the inputs.
6046 (define_insn "*adddi3_noppc64"
6047 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6048 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6049 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6050 "! TARGET_POWERPC64"
6053 if (WORDS_BIG_ENDIAN)
6054 return (GET_CODE (operands[2])) != CONST_INT
6055 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6056 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6058 return (GET_CODE (operands[2])) != CONST_INT
6059 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6060 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6062 [(set_attr "type" "two")
6063 (set_attr "length" "8")])
6065 (define_insn "*subdi3_noppc64"
6066 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6067 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6068 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6069 "! TARGET_POWERPC64"
6072 if (WORDS_BIG_ENDIAN)
6073 return (GET_CODE (operands[1]) != CONST_INT)
6074 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6075 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6077 return (GET_CODE (operands[1]) != CONST_INT)
6078 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6079 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6081 [(set_attr "type" "two")
6082 (set_attr "length" "8")])
6084 (define_insn "*negdi2_noppc64"
6085 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6086 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6087 "! TARGET_POWERPC64"
6090 return (WORDS_BIG_ENDIAN)
6091 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6092 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6094 [(set_attr "type" "two")
6095 (set_attr "length" "8")])
6097 (define_expand "mulsidi3"
6098 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6099 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6100 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6101 "! TARGET_POWERPC64"
6104 if (! TARGET_POWER && ! TARGET_POWERPC)
6106 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6107 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6108 emit_insn (gen_mull_call ());
6109 if (WORDS_BIG_ENDIAN)
6110 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6113 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6114 gen_rtx_REG (SImode, 3));
6115 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6116 gen_rtx_REG (SImode, 4));
6120 else if (TARGET_POWER)
6122 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6127 (define_insn "mulsidi3_mq"
6128 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6129 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6130 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6131 (clobber (match_scratch:SI 3 "=q"))]
6133 "mul %0,%1,%2\;mfmq %L0"
6134 [(set_attr "type" "imul")
6135 (set_attr "length" "8")])
6137 (define_insn "*mulsidi3_no_mq"
6138 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6139 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6140 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6141 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6144 return (WORDS_BIG_ENDIAN)
6145 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6146 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6148 [(set_attr "type" "imul")
6149 (set_attr "length" "8")])
6152 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6153 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6154 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6155 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6158 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6159 (sign_extend:DI (match_dup 2)))
6162 (mult:SI (match_dup 1)
6166 int endian = (WORDS_BIG_ENDIAN == 0);
6167 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6168 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6171 (define_expand "umulsidi3"
6172 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6173 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6174 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6175 "TARGET_POWERPC && ! TARGET_POWERPC64"
6180 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6185 (define_insn "umulsidi3_mq"
6186 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6187 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6188 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6189 (clobber (match_scratch:SI 3 "=q"))]
6190 "TARGET_POWERPC && TARGET_POWER"
6193 return (WORDS_BIG_ENDIAN)
6194 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6195 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6197 [(set_attr "type" "imul")
6198 (set_attr "length" "8")])
6200 (define_insn "*umulsidi3_no_mq"
6201 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6202 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6203 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6204 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6207 return (WORDS_BIG_ENDIAN)
6208 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6209 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6211 [(set_attr "type" "imul")
6212 (set_attr "length" "8")])
6215 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6216 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6217 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6218 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6221 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6222 (zero_extend:DI (match_dup 2)))
6225 (mult:SI (match_dup 1)
6229 int endian = (WORDS_BIG_ENDIAN == 0);
6230 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6231 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6234 (define_expand "smulsi3_highpart"
6235 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6237 (lshiftrt:DI (mult:DI (sign_extend:DI
6238 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6240 (match_operand:SI 2 "gpc_reg_operand" "r")))
6245 if (! TARGET_POWER && ! TARGET_POWERPC)
6247 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6248 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6249 emit_insn (gen_mulh_call ());
6250 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6253 else if (TARGET_POWER)
6255 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6260 (define_insn "smulsi3_highpart_mq"
6261 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6263 (lshiftrt:DI (mult:DI (sign_extend:DI
6264 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6266 (match_operand:SI 2 "gpc_reg_operand" "r")))
6268 (clobber (match_scratch:SI 3 "=q"))]
6271 [(set_attr "type" "imul")])
6273 (define_insn "*smulsi3_highpart_no_mq"
6274 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6276 (lshiftrt:DI (mult:DI (sign_extend:DI
6277 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6279 (match_operand:SI 2 "gpc_reg_operand" "r")))
6281 "TARGET_POWERPC && ! TARGET_POWER"
6283 [(set_attr "type" "imul")])
6285 (define_expand "umulsi3_highpart"
6286 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6288 (lshiftrt:DI (mult:DI (zero_extend:DI
6289 (match_operand:SI 1 "gpc_reg_operand" ""))
6291 (match_operand:SI 2 "gpc_reg_operand" "")))
6298 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6303 (define_insn "umulsi3_highpart_mq"
6304 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6306 (lshiftrt:DI (mult:DI (zero_extend:DI
6307 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6309 (match_operand:SI 2 "gpc_reg_operand" "r")))
6311 (clobber (match_scratch:SI 3 "=q"))]
6312 "TARGET_POWERPC && TARGET_POWER"
6314 [(set_attr "type" "imul")])
6316 (define_insn "*umulsi3_highpart_no_mq"
6317 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6319 (lshiftrt:DI (mult:DI (zero_extend:DI
6320 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6322 (match_operand:SI 2 "gpc_reg_operand" "r")))
6324 "TARGET_POWERPC && ! TARGET_POWER"
6326 [(set_attr "type" "imul")])
6328 ;; If operands 0 and 2 are in the same register, we have a problem. But
6329 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6330 ;; why we have the strange constraints below.
6331 (define_insn "ashldi3_power"
6332 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6333 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6334 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6335 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6338 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6339 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6340 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6341 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6342 [(set_attr "length" "8")])
6344 (define_insn "lshrdi3_power"
6345 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6346 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6347 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6348 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6351 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6352 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6353 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6354 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6355 [(set_attr "length" "8")])
6357 ;; Shift by a variable amount is too complex to be worth open-coding. We
6358 ;; just handle shifts by constants.
6359 (define_insn "ashrdi3_power"
6360 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6361 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6362 (match_operand:SI 2 "const_int_operand" "M,i")))
6363 (clobber (match_scratch:SI 3 "=X,q"))]
6366 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6367 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6368 [(set_attr "length" "8")])
6370 (define_insn "ashrdi3_no_power"
6371 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6372 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6373 (match_operand:SI 2 "const_int_operand" "M,i")))]
6374 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6376 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6377 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6378 [(set_attr "type" "two,three")
6379 (set_attr "length" "8,12")])
6381 (define_insn "*ashrdisi3_noppc64"
6382 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6383 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6384 (const_int 32)) 4))]
6385 "TARGET_32BIT && !TARGET_POWERPC64"
6388 if (REGNO (operands[0]) == REGNO (operands[1]))
6391 return \"mr %0,%1\";
6393 [(set_attr "length" "4")])
6396 ;; PowerPC64 DImode operations.
6398 (define_insn_and_split "absdi2"
6399 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6400 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6401 (clobber (match_scratch:DI 2 "=&r,&r"))]
6404 "&& reload_completed"
6405 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6406 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6407 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6410 (define_insn_and_split "*nabsdi2"
6411 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6412 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6413 (clobber (match_scratch:DI 2 "=&r,&r"))]
6416 "&& reload_completed"
6417 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6418 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6419 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6422 (define_insn "muldi3"
6423 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6424 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6425 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6431 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6432 (const_string "imul3")
6433 (match_operand:SI 2 "short_cint_operand" "")
6434 (const_string "imul2")]
6435 (const_string "lmul")))])
6437 (define_insn "*muldi3_internal1"
6438 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6439 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6440 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6442 (clobber (match_scratch:DI 3 "=r,r"))]
6447 [(set_attr "type" "lmul_compare")
6448 (set_attr "length" "4,8")])
6451 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6452 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6453 (match_operand:DI 2 "gpc_reg_operand" ""))
6455 (clobber (match_scratch:DI 3 ""))]
6456 "TARGET_POWERPC64 && reload_completed"
6458 (mult:DI (match_dup 1) (match_dup 2)))
6460 (compare:CC (match_dup 3)
6464 (define_insn "*muldi3_internal2"
6465 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6466 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6467 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6469 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6470 (mult:DI (match_dup 1) (match_dup 2)))]
6475 [(set_attr "type" "lmul_compare")
6476 (set_attr "length" "4,8")])
6479 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6480 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6481 (match_operand:DI 2 "gpc_reg_operand" ""))
6483 (set (match_operand:DI 0 "gpc_reg_operand" "")
6484 (mult:DI (match_dup 1) (match_dup 2)))]
6485 "TARGET_POWERPC64 && reload_completed"
6487 (mult:DI (match_dup 1) (match_dup 2)))
6489 (compare:CC (match_dup 0)
6493 (define_insn "smuldi3_highpart"
6494 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6496 (lshiftrt:TI (mult:TI (sign_extend:TI
6497 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6499 (match_operand:DI 2 "gpc_reg_operand" "r")))
6503 [(set_attr "type" "lmul")])
6505 (define_insn "umuldi3_highpart"
6506 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6508 (lshiftrt:TI (mult:TI (zero_extend:TI
6509 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6511 (match_operand:DI 2 "gpc_reg_operand" "r")))
6515 [(set_attr "type" "lmul")])
6517 (define_insn "rotldi3"
6518 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6519 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6520 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6522 "rld%I2cl %0,%1,%H2,0")
6524 (define_insn "*rotldi3_internal2"
6525 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6526 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6527 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6529 (clobber (match_scratch:DI 3 "=r,r"))]
6532 rld%I2cl. %3,%1,%H2,0
6534 [(set_attr "type" "delayed_compare")
6535 (set_attr "length" "4,8")])
6538 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6539 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6540 (match_operand:DI 2 "reg_or_cint_operand" ""))
6542 (clobber (match_scratch:DI 3 ""))]
6543 "TARGET_POWERPC64 && reload_completed"
6545 (rotate:DI (match_dup 1) (match_dup 2)))
6547 (compare:CC (match_dup 3)
6551 (define_insn "*rotldi3_internal3"
6552 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6553 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6554 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6556 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6557 (rotate:DI (match_dup 1) (match_dup 2)))]
6560 rld%I2cl. %0,%1,%H2,0
6562 [(set_attr "type" "delayed_compare")
6563 (set_attr "length" "4,8")])
6566 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6567 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6568 (match_operand:DI 2 "reg_or_cint_operand" ""))
6570 (set (match_operand:DI 0 "gpc_reg_operand" "")
6571 (rotate:DI (match_dup 1) (match_dup 2)))]
6572 "TARGET_POWERPC64 && reload_completed"
6574 (rotate:DI (match_dup 1) (match_dup 2)))
6576 (compare:CC (match_dup 0)
6580 (define_insn "*rotldi3_internal4"
6581 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6582 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6583 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6584 (match_operand:DI 3 "mask64_operand" "n")))]
6586 "rld%I2c%B3 %0,%1,%H2,%S3")
6588 (define_insn "*rotldi3_internal5"
6589 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6591 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6592 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6593 (match_operand:DI 3 "mask64_operand" "n,n"))
6595 (clobber (match_scratch:DI 4 "=r,r"))]
6598 rld%I2c%B3. %4,%1,%H2,%S3
6600 [(set_attr "type" "delayed_compare")
6601 (set_attr "length" "4,8")])
6604 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6606 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6607 (match_operand:DI 2 "reg_or_cint_operand" ""))
6608 (match_operand:DI 3 "mask64_operand" ""))
6610 (clobber (match_scratch:DI 4 ""))]
6611 "TARGET_POWERPC64 && reload_completed"
6613 (and:DI (rotate:DI (match_dup 1)
6617 (compare:CC (match_dup 4)
6621 (define_insn "*rotldi3_internal6"
6622 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6624 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6625 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6626 (match_operand:DI 3 "mask64_operand" "n,n"))
6628 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6629 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6632 rld%I2c%B3. %0,%1,%H2,%S3
6634 [(set_attr "type" "delayed_compare")
6635 (set_attr "length" "4,8")])
6638 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6640 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6641 (match_operand:DI 2 "reg_or_cint_operand" ""))
6642 (match_operand:DI 3 "mask64_operand" ""))
6644 (set (match_operand:DI 0 "gpc_reg_operand" "")
6645 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6646 "TARGET_POWERPC64 && reload_completed"
6648 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6650 (compare:CC (match_dup 0)
6654 (define_insn "*rotldi3_internal7"
6655 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6658 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6659 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6661 "rld%I2cl %0,%1,%H2,56")
6663 (define_insn "*rotldi3_internal8"
6664 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6665 (compare:CC (zero_extend:DI
6667 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6668 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6670 (clobber (match_scratch:DI 3 "=r,r"))]
6673 rld%I2cl. %3,%1,%H2,56
6675 [(set_attr "type" "delayed_compare")
6676 (set_attr "length" "4,8")])
6679 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6680 (compare:CC (zero_extend:DI
6682 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6683 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6685 (clobber (match_scratch:DI 3 ""))]
6686 "TARGET_POWERPC64 && reload_completed"
6688 (zero_extend:DI (subreg:QI
6689 (rotate:DI (match_dup 1)
6692 (compare:CC (match_dup 3)
6696 (define_insn "*rotldi3_internal9"
6697 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6698 (compare:CC (zero_extend:DI
6700 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6701 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6703 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6704 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6707 rld%I2cl. %0,%1,%H2,56
6709 [(set_attr "type" "delayed_compare")
6710 (set_attr "length" "4,8")])
6713 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6714 (compare:CC (zero_extend:DI
6716 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6717 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6719 (set (match_operand:DI 0 "gpc_reg_operand" "")
6720 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6721 "TARGET_POWERPC64 && reload_completed"
6723 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6725 (compare:CC (match_dup 0)
6729 (define_insn "*rotldi3_internal10"
6730 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6733 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6734 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6736 "rld%I2cl %0,%1,%H2,48")
6738 (define_insn "*rotldi3_internal11"
6739 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6740 (compare:CC (zero_extend:DI
6742 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6743 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6745 (clobber (match_scratch:DI 3 "=r,r"))]
6748 rld%I2cl. %3,%1,%H2,48
6750 [(set_attr "type" "delayed_compare")
6751 (set_attr "length" "4,8")])
6754 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6755 (compare:CC (zero_extend:DI
6757 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6758 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6760 (clobber (match_scratch:DI 3 ""))]
6761 "TARGET_POWERPC64 && reload_completed"
6763 (zero_extend:DI (subreg:HI
6764 (rotate:DI (match_dup 1)
6767 (compare:CC (match_dup 3)
6771 (define_insn "*rotldi3_internal12"
6772 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6773 (compare:CC (zero_extend:DI
6775 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6776 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6778 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6779 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6782 rld%I2cl. %0,%1,%H2,48
6784 [(set_attr "type" "delayed_compare")
6785 (set_attr "length" "4,8")])
6788 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6789 (compare:CC (zero_extend:DI
6791 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6792 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6794 (set (match_operand:DI 0 "gpc_reg_operand" "")
6795 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6796 "TARGET_POWERPC64 && reload_completed"
6798 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6800 (compare:CC (match_dup 0)
6804 (define_insn "*rotldi3_internal13"
6805 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6808 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6809 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6811 "rld%I2cl %0,%1,%H2,32")
6813 (define_insn "*rotldi3_internal14"
6814 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6815 (compare:CC (zero_extend:DI
6817 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6818 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6820 (clobber (match_scratch:DI 3 "=r,r"))]
6823 rld%I2cl. %3,%1,%H2,32
6825 [(set_attr "type" "delayed_compare")
6826 (set_attr "length" "4,8")])
6829 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6830 (compare:CC (zero_extend:DI
6832 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6833 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6835 (clobber (match_scratch:DI 3 ""))]
6836 "TARGET_POWERPC64 && reload_completed"
6838 (zero_extend:DI (subreg:SI
6839 (rotate:DI (match_dup 1)
6842 (compare:CC (match_dup 3)
6846 (define_insn "*rotldi3_internal15"
6847 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6848 (compare:CC (zero_extend:DI
6850 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6851 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6853 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6854 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6857 rld%I2cl. %0,%1,%H2,32
6859 [(set_attr "type" "delayed_compare")
6860 (set_attr "length" "4,8")])
6863 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6864 (compare:CC (zero_extend:DI
6866 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6867 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6869 (set (match_operand:DI 0 "gpc_reg_operand" "")
6870 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6871 "TARGET_POWERPC64 && reload_completed"
6873 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6875 (compare:CC (match_dup 0)
6879 (define_expand "ashldi3"
6880 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6881 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6882 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6883 "TARGET_POWERPC64 || TARGET_POWER"
6886 if (TARGET_POWERPC64)
6888 else if (TARGET_POWER)
6890 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6897 (define_insn "*ashldi3_internal1"
6898 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6899 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6900 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6904 (define_insn "*ashldi3_internal2"
6905 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6906 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6907 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6909 (clobber (match_scratch:DI 3 "=r,r"))]
6914 [(set_attr "type" "delayed_compare")
6915 (set_attr "length" "4,8")])
6918 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6919 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6920 (match_operand:SI 2 "reg_or_cint_operand" ""))
6922 (clobber (match_scratch:DI 3 ""))]
6923 "TARGET_POWERPC64 && reload_completed"
6925 (ashift:DI (match_dup 1) (match_dup 2)))
6927 (compare:CC (match_dup 3)
6931 (define_insn "*ashldi3_internal3"
6932 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6933 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6934 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6936 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6937 (ashift:DI (match_dup 1) (match_dup 2)))]
6942 [(set_attr "type" "delayed_compare")
6943 (set_attr "length" "4,8")])
6946 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6947 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6948 (match_operand:SI 2 "reg_or_cint_operand" ""))
6950 (set (match_operand:DI 0 "gpc_reg_operand" "")
6951 (ashift:DI (match_dup 1) (match_dup 2)))]
6952 "TARGET_POWERPC64 && reload_completed"
6954 (ashift:DI (match_dup 1) (match_dup 2)))
6956 (compare:CC (match_dup 0)
6960 (define_insn "*ashldi3_internal4"
6961 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6962 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6963 (match_operand:SI 2 "const_int_operand" "i"))
6964 (match_operand:DI 3 "const_int_operand" "n")))]
6965 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6966 "rldic %0,%1,%H2,%W3")
6968 (define_insn "ashldi3_internal5"
6969 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6971 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6972 (match_operand:SI 2 "const_int_operand" "i,i"))
6973 (match_operand:DI 3 "const_int_operand" "n,n"))
6975 (clobber (match_scratch:DI 4 "=r,r"))]
6976 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6978 rldic. %4,%1,%H2,%W3
6980 [(set_attr "type" "compare")
6981 (set_attr "length" "4,8")])
6984 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6986 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6987 (match_operand:SI 2 "const_int_operand" ""))
6988 (match_operand:DI 3 "const_int_operand" ""))
6990 (clobber (match_scratch:DI 4 ""))]
6991 "TARGET_POWERPC64 && reload_completed
6992 && includes_rldic_lshift_p (operands[2], operands[3])"
6994 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6997 (compare:CC (match_dup 4)
7001 (define_insn "*ashldi3_internal6"
7002 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7004 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7005 (match_operand:SI 2 "const_int_operand" "i,i"))
7006 (match_operand:DI 3 "const_int_operand" "n,n"))
7008 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7009 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7010 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7012 rldic. %0,%1,%H2,%W3
7014 [(set_attr "type" "compare")
7015 (set_attr "length" "4,8")])
7018 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7020 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7021 (match_operand:SI 2 "const_int_operand" ""))
7022 (match_operand:DI 3 "const_int_operand" ""))
7024 (set (match_operand:DI 0 "gpc_reg_operand" "")
7025 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7026 "TARGET_POWERPC64 && reload_completed
7027 && includes_rldic_lshift_p (operands[2], operands[3])"
7029 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7032 (compare:CC (match_dup 0)
7036 (define_insn "*ashldi3_internal7"
7037 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7038 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7039 (match_operand:SI 2 "const_int_operand" "i"))
7040 (match_operand:DI 3 "mask64_operand" "n")))]
7041 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7042 "rldicr %0,%1,%H2,%S3")
7044 (define_insn "ashldi3_internal8"
7045 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7047 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7048 (match_operand:SI 2 "const_int_operand" "i,i"))
7049 (match_operand:DI 3 "mask64_operand" "n,n"))
7051 (clobber (match_scratch:DI 4 "=r,r"))]
7052 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7054 rldicr. %4,%1,%H2,%S3
7056 [(set_attr "type" "compare")
7057 (set_attr "length" "4,8")])
7060 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7062 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7063 (match_operand:SI 2 "const_int_operand" ""))
7064 (match_operand:DI 3 "mask64_operand" ""))
7066 (clobber (match_scratch:DI 4 ""))]
7067 "TARGET_POWERPC64 && reload_completed
7068 && includes_rldicr_lshift_p (operands[2], operands[3])"
7070 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7073 (compare:CC (match_dup 4)
7077 (define_insn "*ashldi3_internal9"
7078 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7080 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7081 (match_operand:SI 2 "const_int_operand" "i,i"))
7082 (match_operand:DI 3 "mask64_operand" "n,n"))
7084 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7085 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7086 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7088 rldicr. %0,%1,%H2,%S3
7090 [(set_attr "type" "compare")
7091 (set_attr "length" "4,8")])
7094 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7096 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7097 (match_operand:SI 2 "const_int_operand" ""))
7098 (match_operand:DI 3 "mask64_operand" ""))
7100 (set (match_operand:DI 0 "gpc_reg_operand" "")
7101 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7102 "TARGET_POWERPC64 && reload_completed
7103 && includes_rldicr_lshift_p (operands[2], operands[3])"
7105 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7108 (compare:CC (match_dup 0)
7112 (define_expand "lshrdi3"
7113 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7114 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7115 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7116 "TARGET_POWERPC64 || TARGET_POWER"
7119 if (TARGET_POWERPC64)
7121 else if (TARGET_POWER)
7123 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7130 (define_insn "*lshrdi3_internal1"
7131 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7132 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7133 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7137 (define_insn "*lshrdi3_internal2"
7138 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7139 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7140 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7142 (clobber (match_scratch:DI 3 "=r,r"))]
7147 [(set_attr "type" "delayed_compare")
7148 (set_attr "length" "4,8")])
7151 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7152 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7153 (match_operand:SI 2 "reg_or_cint_operand" ""))
7155 (clobber (match_scratch:DI 3 ""))]
7156 "TARGET_POWERPC64 && reload_completed"
7158 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7160 (compare:CC (match_dup 3)
7164 (define_insn "*lshrdi3_internal3"
7165 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7166 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7167 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7169 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7170 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7175 [(set_attr "type" "delayed_compare")
7176 (set_attr "length" "4,8")])
7179 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7180 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7181 (match_operand:SI 2 "reg_or_cint_operand" ""))
7183 (set (match_operand:DI 0 "gpc_reg_operand" "")
7184 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7185 "TARGET_POWERPC64 && reload_completed"
7187 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7189 (compare:CC (match_dup 0)
7193 (define_expand "ashrdi3"
7194 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7195 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7196 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7200 if (TARGET_POWERPC64)
7202 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7204 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7207 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7208 && WORDS_BIG_ENDIAN)
7210 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7217 (define_insn "*ashrdi3_internal1"
7218 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7219 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7220 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7222 "srad%I2 %0,%1,%H2")
7224 (define_insn "*ashrdi3_internal2"
7225 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7226 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7227 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7229 (clobber (match_scratch:DI 3 "=r,r"))]
7234 [(set_attr "type" "delayed_compare")
7235 (set_attr "length" "4,8")])
7238 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7239 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7240 (match_operand:SI 2 "reg_or_cint_operand" ""))
7242 (clobber (match_scratch:DI 3 ""))]
7243 "TARGET_POWERPC64 && reload_completed"
7245 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7247 (compare:CC (match_dup 3)
7251 (define_insn "*ashrdi3_internal3"
7252 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7253 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7254 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7256 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7257 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7262 [(set_attr "type" "delayed_compare")
7263 (set_attr "length" "4,8")])
7266 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7267 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7268 (match_operand:SI 2 "reg_or_cint_operand" ""))
7270 (set (match_operand:DI 0 "gpc_reg_operand" "")
7271 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7272 "TARGET_POWERPC64 && reload_completed"
7274 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7276 (compare:CC (match_dup 0)
7280 (define_insn "anddi3"
7281 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7282 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7283 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7284 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7288 rldic%B2 %0,%1,0,%S2
7289 rlwinm %0,%1,0,%m2,%M2
7293 [(set_attr "type" "*,*,*,compare,compare,*")
7294 (set_attr "length" "4,4,4,4,4,8")])
7297 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7298 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7299 (match_operand:DI 2 "mask64_2_operand" "")))
7300 (clobber (match_scratch:CC 3 ""))]
7302 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7303 && !mask_operand (operands[2], DImode)
7304 && !mask64_operand (operands[2], DImode)"
7306 (and:DI (rotate:DI (match_dup 1)
7310 (and:DI (rotate:DI (match_dup 0)
7314 build_mask64_2_operands (operands[2], &operands[4]);
7317 (define_insn "*anddi3_internal2"
7318 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7319 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7320 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7322 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7323 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7327 rldic%B2. %3,%1,0,%S2
7328 rlwinm. %3,%1,0,%m2,%M2
7338 [(set_attr "type" "compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7339 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7342 [(set (match_operand:CC 0 "cc_reg_operand" "")
7343 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7344 (match_operand:DI 2 "mask64_2_operand" ""))
7346 (clobber (match_scratch:DI 3 ""))
7347 (clobber (match_scratch:CC 4 ""))]
7348 "TARGET_64BIT && reload_completed
7349 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7350 && !mask_operand (operands[2], DImode)
7351 && !mask64_operand (operands[2], DImode)"
7353 (and:DI (rotate:DI (match_dup 1)
7356 (parallel [(set (match_dup 0)
7357 (compare:CC (and:DI (rotate:DI (match_dup 3)
7361 (clobber (match_dup 3))])]
7364 build_mask64_2_operands (operands[2], &operands[5]);
7367 (define_insn "*anddi3_internal3"
7368 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7369 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7370 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7372 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7373 (and:DI (match_dup 1) (match_dup 2)))
7374 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7378 rldic%B2. %0,%1,0,%S2
7379 rlwinm. %0,%1,0,%m2,%M2
7389 [(set_attr "type" "compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7390 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7393 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7394 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7395 (match_operand:DI 2 "and64_2_operand" ""))
7397 (set (match_operand:DI 0 "gpc_reg_operand" "")
7398 (and:DI (match_dup 1) (match_dup 2)))
7399 (clobber (match_scratch:CC 4 ""))]
7400 "TARGET_64BIT && reload_completed"
7401 [(parallel [(set (match_dup 0)
7402 (and:DI (match_dup 1) (match_dup 2)))
7403 (clobber (match_dup 4))])
7405 (compare:CC (match_dup 0)
7410 [(set (match_operand:CC 3 "cc_reg_operand" "")
7411 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7412 (match_operand:DI 2 "mask64_2_operand" ""))
7414 (set (match_operand:DI 0 "gpc_reg_operand" "")
7415 (and:DI (match_dup 1) (match_dup 2)))
7416 (clobber (match_scratch:CC 4 ""))]
7417 "TARGET_64BIT && reload_completed
7418 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7419 && !mask_operand (operands[2], DImode)
7420 && !mask64_operand (operands[2], DImode)"
7422 (and:DI (rotate:DI (match_dup 1)
7425 (parallel [(set (match_dup 3)
7426 (compare:CC (and:DI (rotate:DI (match_dup 0)
7431 (and:DI (rotate:DI (match_dup 0)
7436 build_mask64_2_operands (operands[2], &operands[5]);
7439 (define_expand "iordi3"
7440 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7441 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7442 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7446 if (non_logical_cint_operand (operands[2], DImode))
7448 HOST_WIDE_INT value;
7449 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7450 ? operands[0] : gen_reg_rtx (DImode));
7452 if (GET_CODE (operands[2]) == CONST_INT)
7454 value = INTVAL (operands[2]);
7455 emit_insn (gen_iordi3 (tmp, operands[1],
7456 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7460 value = CONST_DOUBLE_LOW (operands[2]);
7461 emit_insn (gen_iordi3 (tmp, operands[1],
7462 immed_double_const (value
7463 & (~ (HOST_WIDE_INT) 0xffff),
7467 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7472 (define_expand "xordi3"
7473 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7474 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7475 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7479 if (non_logical_cint_operand (operands[2], DImode))
7481 HOST_WIDE_INT value;
7482 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7483 ? operands[0] : gen_reg_rtx (DImode));
7485 if (GET_CODE (operands[2]) == CONST_INT)
7487 value = INTVAL (operands[2]);
7488 emit_insn (gen_xordi3 (tmp, operands[1],
7489 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7493 value = CONST_DOUBLE_LOW (operands[2]);
7494 emit_insn (gen_xordi3 (tmp, operands[1],
7495 immed_double_const (value
7496 & (~ (HOST_WIDE_INT) 0xffff),
7500 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7505 (define_insn "*booldi3_internal1"
7506 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7507 (match_operator:DI 3 "boolean_or_operator"
7508 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7509 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7516 (define_insn "*booldi3_internal2"
7517 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7518 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7519 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7520 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7522 (clobber (match_scratch:DI 3 "=r,r"))]
7527 [(set_attr "type" "compare")
7528 (set_attr "length" "4,8")])
7531 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7532 (compare:CC (match_operator:DI 4 "boolean_operator"
7533 [(match_operand:DI 1 "gpc_reg_operand" "")
7534 (match_operand:DI 2 "gpc_reg_operand" "")])
7536 (clobber (match_scratch:DI 3 ""))]
7537 "TARGET_POWERPC64 && reload_completed"
7538 [(set (match_dup 3) (match_dup 4))
7540 (compare:CC (match_dup 3)
7544 (define_insn "*booldi3_internal3"
7545 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7546 (compare:CC (match_operator:DI 4 "boolean_operator"
7547 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7548 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7550 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7556 [(set_attr "type" "compare")
7557 (set_attr "length" "4,8")])
7560 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7561 (compare:CC (match_operator:DI 4 "boolean_operator"
7562 [(match_operand:DI 1 "gpc_reg_operand" "")
7563 (match_operand:DI 2 "gpc_reg_operand" "")])
7565 (set (match_operand:DI 0 "gpc_reg_operand" "")
7567 "TARGET_POWERPC64 && reload_completed"
7568 [(set (match_dup 0) (match_dup 4))
7570 (compare:CC (match_dup 0)
7574 ;; Split a logical operation that we can't do in one insn into two insns,
7575 ;; each of which does one 16-bit part. This is used by combine.
7578 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7579 (match_operator:DI 3 "boolean_or_operator"
7580 [(match_operand:DI 1 "gpc_reg_operand" "")
7581 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7583 [(set (match_dup 0) (match_dup 4))
7584 (set (match_dup 0) (match_dup 5))]
7589 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7591 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7592 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7594 i4 = GEN_INT (value & 0xffff);
7598 i3 = GEN_INT (INTVAL (operands[2])
7599 & (~ (HOST_WIDE_INT) 0xffff));
7600 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7602 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7604 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7608 (define_insn "*boolcdi3_internal1"
7609 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7610 (match_operator:DI 3 "boolean_operator"
7611 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7612 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7616 (define_insn "*boolcdi3_internal2"
7617 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7618 (compare:CC (match_operator:DI 4 "boolean_operator"
7619 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7620 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7622 (clobber (match_scratch:DI 3 "=r,r"))]
7627 [(set_attr "type" "compare")
7628 (set_attr "length" "4,8")])
7631 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7632 (compare:CC (match_operator:DI 4 "boolean_operator"
7633 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7634 (match_operand:DI 2 "gpc_reg_operand" "")])
7636 (clobber (match_scratch:DI 3 ""))]
7637 "TARGET_POWERPC64 && reload_completed"
7638 [(set (match_dup 3) (match_dup 4))
7640 (compare:CC (match_dup 3)
7644 (define_insn "*boolcdi3_internal3"
7645 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7646 (compare:CC (match_operator:DI 4 "boolean_operator"
7647 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7648 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7650 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7656 [(set_attr "type" "compare")
7657 (set_attr "length" "4,8")])
7660 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7661 (compare:CC (match_operator:DI 4 "boolean_operator"
7662 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7663 (match_operand:DI 2 "gpc_reg_operand" "")])
7665 (set (match_operand:DI 0 "gpc_reg_operand" "")
7667 "TARGET_POWERPC64 && reload_completed"
7668 [(set (match_dup 0) (match_dup 4))
7670 (compare:CC (match_dup 0)
7674 (define_insn "*boolccdi3_internal1"
7675 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7676 (match_operator:DI 3 "boolean_operator"
7677 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7678 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7682 (define_insn "*boolccdi3_internal2"
7683 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7684 (compare:CC (match_operator:DI 4 "boolean_operator"
7685 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7686 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7688 (clobber (match_scratch:DI 3 "=r,r"))]
7693 [(set_attr "type" "compare")
7694 (set_attr "length" "4,8")])
7697 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7698 (compare:CC (match_operator:DI 4 "boolean_operator"
7699 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7700 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7702 (clobber (match_scratch:DI 3 ""))]
7703 "TARGET_POWERPC64 && reload_completed"
7704 [(set (match_dup 3) (match_dup 4))
7706 (compare:CC (match_dup 3)
7710 (define_insn "*boolccdi3_internal3"
7711 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7712 (compare:CC (match_operator:DI 4 "boolean_operator"
7713 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7714 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7716 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7722 [(set_attr "type" "compare")
7723 (set_attr "length" "4,8")])
7726 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7727 (compare:CC (match_operator:DI 4 "boolean_operator"
7728 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7729 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7731 (set (match_operand:DI 0 "gpc_reg_operand" "")
7733 "TARGET_POWERPC64 && reload_completed"
7734 [(set (match_dup 0) (match_dup 4))
7736 (compare:CC (match_dup 0)
7740 ;; Now define ways of moving data around.
7742 ;; Set up a register with a value from the GOT table
7744 (define_expand "movsi_got"
7745 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7746 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7747 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7748 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7751 if (GET_CODE (operands[1]) == CONST)
7753 rtx offset = const0_rtx;
7754 HOST_WIDE_INT value;
7756 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7757 value = INTVAL (offset);
7760 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7761 emit_insn (gen_movsi_got (tmp, operands[1]));
7762 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7767 operands[2] = rs6000_got_register (operands[1]);
7770 (define_insn "*movsi_got_internal"
7771 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7772 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7773 (match_operand:SI 2 "gpc_reg_operand" "b")]
7775 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7776 "{l|lwz} %0,%a1@got(%2)"
7777 [(set_attr "type" "load")])
7779 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7780 ;; didn't get allocated to a hard register.
7782 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7783 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7784 (match_operand:SI 2 "memory_operand" "")]
7786 "DEFAULT_ABI == ABI_V4
7788 && (reload_in_progress || reload_completed)"
7789 [(set (match_dup 0) (match_dup 2))
7790 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7794 ;; For SI, we special-case integers that can't be loaded in one insn. We
7795 ;; do the load 16-bits at a time. We could do this by loading from memory,
7796 ;; and this is even supposed to be faster, but it is simpler not to get
7797 ;; integers in the TOC.
7798 (define_insn "movsi_low"
7799 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7800 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7801 (match_operand 2 "" ""))))]
7802 "TARGET_MACHO && ! TARGET_64BIT"
7803 "{l|lwz} %0,lo16(%2)(%1)"
7804 [(set_attr "type" "load")
7805 (set_attr "length" "4")])
7807 (define_insn "*movsi_internal1"
7808 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7809 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7810 "gpc_reg_operand (operands[0], SImode)
7811 || gpc_reg_operand (operands[1], SImode)"
7815 {l%U1%X1|lwz%U1%X1} %0,%1
7816 {st%U0%X0|stw%U0%X0} %1,%0
7826 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7827 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7829 ;; Split a load of a large constant into the appropriate two-insn
7833 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7834 (match_operand:SI 1 "const_int_operand" ""))]
7835 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7836 && (INTVAL (operands[1]) & 0xffff) != 0"
7840 (ior:SI (match_dup 0)
7843 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7845 if (tem == operands[0])
7851 (define_insn "*mov<mode>_internal2"
7852 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7853 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7855 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7858 {cmpi|cmp<wd>i} %2,%0,0
7861 [(set_attr "type" "cmp,compare,cmp")
7862 (set_attr "length" "4,4,8")])
7865 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7866 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7868 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7870 [(set (match_dup 0) (match_dup 1))
7872 (compare:CC (match_dup 0)
7876 (define_insn "*movhi_internal"
7877 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7878 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7879 "gpc_reg_operand (operands[0], HImode)
7880 || gpc_reg_operand (operands[1], HImode)"
7890 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7892 (define_expand "mov<mode>"
7893 [(set (match_operand:INT 0 "general_operand" "")
7894 (match_operand:INT 1 "any_operand" ""))]
7896 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7898 (define_insn "*movqi_internal"
7899 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7900 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7901 "gpc_reg_operand (operands[0], QImode)
7902 || gpc_reg_operand (operands[1], QImode)"
7912 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7914 ;; Here is how to move condition codes around. When we store CC data in
7915 ;; an integer register or memory, we store just the high-order 4 bits.
7916 ;; This lets us not shift in the most common case of CR0.
7917 (define_expand "movcc"
7918 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7919 (match_operand:CC 1 "nonimmediate_operand" ""))]
7923 (define_insn "*movcc_internal1"
7924 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7925 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7926 "register_operand (operands[0], CCmode)
7927 || register_operand (operands[1], CCmode)"
7931 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7933 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7938 {l%U1%X1|lwz%U1%X1} %0,%1
7939 {st%U0%U1|stw%U0%U1} %1,%0"
7941 (cond [(eq_attr "alternative" "0")
7942 (const_string "cr_logical")
7943 (eq_attr "alternative" "1,2")
7944 (const_string "mtcr")
7945 (eq_attr "alternative" "5,7")
7946 (const_string "integer")
7947 (eq_attr "alternative" "6")
7948 (const_string "mfjmpr")
7949 (eq_attr "alternative" "8")
7950 (const_string "mtjmpr")
7951 (eq_attr "alternative" "9")
7952 (const_string "load")
7953 (eq_attr "alternative" "10")
7954 (const_string "store")
7955 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7956 (const_string "mfcrf")
7958 (const_string "mfcr")))
7959 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7961 ;; For floating-point, we normally deal with the floating-point registers
7962 ;; unless -msoft-float is used. The sole exception is that parameter passing
7963 ;; can produce floating-point values in fixed-point registers. Unless the
7964 ;; value is a simple constant or already in memory, we deal with this by
7965 ;; allocating memory and copying the value explicitly via that memory location.
7966 (define_expand "movsf"
7967 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7968 (match_operand:SF 1 "any_operand" ""))]
7970 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7973 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7974 (match_operand:SF 1 "const_double_operand" ""))]
7976 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7977 || (GET_CODE (operands[0]) == SUBREG
7978 && GET_CODE (SUBREG_REG (operands[0])) == REG
7979 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7980 [(set (match_dup 2) (match_dup 3))]
7986 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7987 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7989 if (! TARGET_POWERPC64)
7990 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7992 operands[2] = gen_lowpart (SImode, operands[0]);
7994 operands[3] = gen_int_mode (l, SImode);
7997 (define_insn "*movsf_hardfloat"
7998 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
7999 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8000 "(gpc_reg_operand (operands[0], SFmode)
8001 || gpc_reg_operand (operands[1], SFmode))
8002 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
8005 {l%U1%X1|lwz%U1%X1} %0,%1
8006 {st%U0%X0|stw%U0%X0} %1,%0
8016 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8017 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8019 (define_insn "*movsf_softfloat"
8020 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8021 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8022 "(gpc_reg_operand (operands[0], SFmode)
8023 || gpc_reg_operand (operands[1], SFmode))
8024 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8030 {l%U1%X1|lwz%U1%X1} %0,%1
8031 {st%U0%X0|stw%U0%X0} %1,%0
8038 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8039 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8042 (define_expand "movdf"
8043 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8044 (match_operand:DF 1 "any_operand" ""))]
8046 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8049 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8050 (match_operand:DF 1 "const_int_operand" ""))]
8051 "! TARGET_POWERPC64 && reload_completed
8052 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8053 || (GET_CODE (operands[0]) == SUBREG
8054 && GET_CODE (SUBREG_REG (operands[0])) == REG
8055 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8056 [(set (match_dup 2) (match_dup 4))
8057 (set (match_dup 3) (match_dup 1))]
8060 int endian = (WORDS_BIG_ENDIAN == 0);
8061 HOST_WIDE_INT value = INTVAL (operands[1]);
8063 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8064 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8065 #if HOST_BITS_PER_WIDE_INT == 32
8066 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8068 operands[4] = GEN_INT (value >> 32);
8069 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8074 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8075 (match_operand:DF 1 "const_double_operand" ""))]
8076 "! TARGET_POWERPC64 && reload_completed
8077 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8078 || (GET_CODE (operands[0]) == SUBREG
8079 && GET_CODE (SUBREG_REG (operands[0])) == REG
8080 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8081 [(set (match_dup 2) (match_dup 4))
8082 (set (match_dup 3) (match_dup 5))]
8085 int endian = (WORDS_BIG_ENDIAN == 0);
8089 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8090 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8092 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8093 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8094 operands[4] = gen_int_mode (l[endian], SImode);
8095 operands[5] = gen_int_mode (l[1 - endian], SImode);
8099 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8100 (match_operand:DF 1 "const_double_operand" ""))]
8101 "TARGET_POWERPC64 && reload_completed
8102 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8103 || (GET_CODE (operands[0]) == SUBREG
8104 && GET_CODE (SUBREG_REG (operands[0])) == REG
8105 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8106 [(set (match_dup 2) (match_dup 3))]
8109 int endian = (WORDS_BIG_ENDIAN == 0);
8112 #if HOST_BITS_PER_WIDE_INT >= 64
8116 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8117 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8119 operands[2] = gen_lowpart (DImode, operands[0]);
8120 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8121 #if HOST_BITS_PER_WIDE_INT >= 64
8122 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8123 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8125 operands[3] = gen_int_mode (val, DImode);
8127 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8131 ;; Don't have reload use general registers to load a constant. First,
8132 ;; it might not work if the output operand is the equivalent of
8133 ;; a non-offsettable memref, but also it is less efficient than loading
8134 ;; the constant into an FP register, since it will probably be used there.
8135 ;; The "??" is a kludge until we can figure out a more reasonable way
8136 ;; of handling these non-offsettable values.
8137 (define_insn "*movdf_hardfloat32"
8138 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8139 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8140 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8141 && (gpc_reg_operand (operands[0], DFmode)
8142 || gpc_reg_operand (operands[1], DFmode))"
8145 switch (which_alternative)
8150 /* We normally copy the low-numbered register first. However, if
8151 the first register operand 0 is the same as the second register
8152 of operand 1, we must copy in the opposite order. */
8153 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8154 return \"mr %L0,%L1\;mr %0,%1\";
8156 return \"mr %0,%1\;mr %L0,%L1\";
8158 if (rs6000_offsettable_memref_p (operands[1])
8159 || (GET_CODE (operands[1]) == MEM
8160 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8161 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8162 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8164 /* If the low-address word is used in the address, we must load
8165 it last. Otherwise, load it first. Note that we cannot have
8166 auto-increment in that case since the address register is
8167 known to be dead. */
8168 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8170 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8172 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8178 addreg = find_addr_reg (XEXP (operands[1], 0));
8179 if (refers_to_regno_p (REGNO (operands[0]),
8180 REGNO (operands[0]) + 1,
8183 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8184 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8185 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8186 return \"{lx|lwzx} %0,%1\";
8190 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8191 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8192 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8193 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8198 if (rs6000_offsettable_memref_p (operands[0])
8199 || (GET_CODE (operands[0]) == MEM
8200 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8201 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8202 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8203 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8208 addreg = find_addr_reg (XEXP (operands[0], 0));
8209 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8210 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8211 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8212 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8216 return \"fmr %0,%1\";
8218 return \"lfd%U1%X1 %0,%1\";
8220 return \"stfd%U0%X0 %1,%0\";
8227 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8228 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8230 (define_insn "*movdf_softfloat32"
8231 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8232 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8233 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8234 && (gpc_reg_operand (operands[0], DFmode)
8235 || gpc_reg_operand (operands[1], DFmode))"
8238 switch (which_alternative)
8243 /* We normally copy the low-numbered register first. However, if
8244 the first register operand 0 is the same as the second register of
8245 operand 1, we must copy in the opposite order. */
8246 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8247 return \"mr %L0,%L1\;mr %0,%1\";
8249 return \"mr %0,%1\;mr %L0,%L1\";
8251 /* If the low-address word is used in the address, we must load
8252 it last. Otherwise, load it first. Note that we cannot have
8253 auto-increment in that case since the address register is
8254 known to be dead. */
8255 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8257 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8259 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8261 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8268 [(set_attr "type" "two,load,store,*,*,*")
8269 (set_attr "length" "8,8,8,8,12,16")])
8271 ; ld/std require word-aligned displacements -> 'Y' constraint.
8272 ; List Y->r and r->Y before r->r for reload.
8273 (define_insn "*movdf_hardfloat64"
8274 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8275 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8276 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8277 && (gpc_reg_operand (operands[0], DFmode)
8278 || gpc_reg_operand (operands[1], DFmode))"
8292 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8293 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8295 (define_insn "*movdf_softfloat64"
8296 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8297 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8298 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8299 && (gpc_reg_operand (operands[0], DFmode)
8300 || gpc_reg_operand (operands[1], DFmode))"
8311 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8312 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8314 (define_expand "movtf"
8315 [(set (match_operand:TF 0 "general_operand" "")
8316 (match_operand:TF 1 "any_operand" ""))]
8318 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8319 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8321 ; It's important to list the o->f and f->o moves before f->f because
8322 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8323 ; which doesn't make progress. Likewise r->Y must be before r->r.
8324 (define_insn_and_split "*movtf_internal"
8325 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8326 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8328 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8329 && (gpc_reg_operand (operands[0], TFmode)
8330 || gpc_reg_operand (operands[1], TFmode))"
8332 "&& reload_completed"
8334 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8335 [(set_attr "length" "8,8,8,20,20,16")])
8337 (define_expand "extenddftf2"
8338 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8339 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8340 (use (match_dup 2))])]
8342 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8344 operands[2] = CONST0_RTX (DFmode);
8345 /* Generate GOT reference early for SVR4 PIC. */
8346 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8347 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8350 (define_insn_and_split "*extenddftf2_internal"
8351 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8352 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8353 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8355 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8357 "&& reload_completed"
8360 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8361 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8362 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8364 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8369 (define_expand "extendsftf2"
8370 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8371 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8373 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8375 rtx tmp = gen_reg_rtx (DFmode);
8376 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8377 emit_insn (gen_extenddftf2 (operands[0], tmp));
8381 (define_expand "trunctfdf2"
8382 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8383 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8385 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8388 (define_insn_and_split "trunctfdf2_internal1"
8389 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8390 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8391 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8392 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8396 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8399 emit_note (NOTE_INSN_DELETED);
8402 [(set_attr "type" "fp")])
8404 (define_insn "trunctfdf2_internal2"
8405 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8406 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8407 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8408 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8410 [(set_attr "type" "fp")])
8412 (define_insn_and_split "trunctfsf2"
8413 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8414 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8415 (clobber (match_scratch:DF 2 "=f"))]
8417 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8419 "&& reload_completed"
8421 (float_truncate:DF (match_dup 1)))
8423 (float_truncate:SF (match_dup 2)))]
8426 (define_expand "floatsitf2"
8427 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8428 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8430 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8432 rtx tmp = gen_reg_rtx (DFmode);
8433 expand_float (tmp, operands[1], false);
8434 emit_insn (gen_extenddftf2 (operands[0], tmp));
8438 ; fadd, but rounding towards zero.
8439 ; This is probably not the optimal code sequence.
8440 (define_insn "fix_trunc_helper"
8441 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8442 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8443 UNSPEC_FIX_TRUNC_TF))
8444 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8445 "TARGET_HARD_FLOAT && TARGET_FPRS"
8446 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8447 [(set_attr "type" "fp")
8448 (set_attr "length" "20")])
8450 (define_expand "fix_trunctfsi2"
8451 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8452 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8453 (clobber (match_dup 2))
8454 (clobber (match_dup 3))
8455 (clobber (match_dup 4))
8456 (clobber (match_dup 5))])]
8458 && (TARGET_POWER2 || TARGET_POWERPC)
8459 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8461 operands[2] = gen_reg_rtx (DFmode);
8462 operands[3] = gen_reg_rtx (DFmode);
8463 operands[4] = gen_reg_rtx (DImode);
8464 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8467 (define_insn_and_split "*fix_trunctfsi2_internal"
8468 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8469 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8470 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8471 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8472 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8473 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8475 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8477 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[5]))"
8481 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8483 gcc_assert (MEM_P (operands[5]));
8484 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8486 emit_insn (gen_fctiwz (operands[4], operands[2]));
8487 emit_move_insn (operands[5], operands[4]);
8488 emit_move_insn (operands[0], lowword);
8492 (define_insn "negtf2"
8493 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8494 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8496 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8499 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8500 return \"fneg %L0,%L1\;fneg %0,%1\";
8502 return \"fneg %0,%1\;fneg %L0,%L1\";
8504 [(set_attr "type" "fp")
8505 (set_attr "length" "8")])
8507 (define_expand "abstf2"
8508 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8509 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8511 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8514 rtx label = gen_label_rtx ();
8515 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8520 (define_expand "abstf2_internal"
8521 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8522 (match_operand:TF 1 "gpc_reg_operand" "f"))
8523 (set (match_dup 3) (match_dup 5))
8524 (set (match_dup 5) (abs:DF (match_dup 5)))
8525 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8526 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8527 (label_ref (match_operand 2 "" ""))
8529 (set (match_dup 6) (neg:DF (match_dup 6)))]
8531 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8534 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8535 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8536 operands[3] = gen_reg_rtx (DFmode);
8537 operands[4] = gen_reg_rtx (CCFPmode);
8538 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8539 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8542 ;; Next come the multi-word integer load and store and the load and store
8545 ; List r->r after r->"o<>", otherwise reload will try to reload a
8546 ; non-offsettable address by using r->r which won't make progress.
8547 (define_insn "*movdi_internal32"
8548 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8549 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8551 && (gpc_reg_operand (operands[0], DImode)
8552 || gpc_reg_operand (operands[1], DImode))"
8561 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8564 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8565 (match_operand:DI 1 "const_int_operand" ""))]
8566 "! TARGET_POWERPC64 && reload_completed"
8567 [(set (match_dup 2) (match_dup 4))
8568 (set (match_dup 3) (match_dup 1))]
8571 HOST_WIDE_INT value = INTVAL (operands[1]);
8572 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8574 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8576 #if HOST_BITS_PER_WIDE_INT == 32
8577 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8579 operands[4] = GEN_INT (value >> 32);
8580 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8585 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8586 (match_operand:DI 1 "input_operand" ""))]
8587 "reload_completed && !TARGET_POWERPC64
8588 && gpr_or_gpr_p (operands[0], operands[1])"
8590 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8592 (define_insn "*movdi_internal64"
8593 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8594 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8596 && (gpc_reg_operand (operands[0], DImode)
8597 || gpc_reg_operand (operands[1], DImode))"
8612 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8613 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8615 ;; immediate value valid for a single instruction hiding in a const_double
8617 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8618 (match_operand:DI 1 "const_double_operand" "F"))]
8619 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8620 && GET_CODE (operands[1]) == CONST_DOUBLE
8621 && num_insns_constant (operands[1], DImode) == 1"
8624 return ((unsigned HOST_WIDE_INT)
8625 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8626 ? \"li %0,%1\" : \"lis %0,%v1\";
8629 ;; Generate all one-bits and clear left or right.
8630 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8632 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8633 (match_operand:DI 1 "mask64_operand" ""))]
8634 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8635 [(set (match_dup 0) (const_int -1))
8637 (and:DI (rotate:DI (match_dup 0)
8642 ;; Split a load of a large constant into the appropriate five-instruction
8643 ;; sequence. Handle anything in a constant number of insns.
8644 ;; When non-easy constants can go in the TOC, this should use
8645 ;; easy_fp_constant predicate.
8647 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8648 (match_operand:DI 1 "const_int_operand" ""))]
8649 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8650 [(set (match_dup 0) (match_dup 2))
8651 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8653 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8655 if (tem == operands[0])
8662 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8663 (match_operand:DI 1 "const_double_operand" ""))]
8664 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8665 [(set (match_dup 0) (match_dup 2))
8666 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8668 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8670 if (tem == operands[0])
8676 ;; TImode is similar, except that we usually want to compute the address into
8677 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8678 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8680 ;; We say that MQ is clobbered in the last alternative because the first
8681 ;; alternative would never get used otherwise since it would need a reload
8682 ;; while the 2nd alternative would not. We put memory cases first so they
8683 ;; are preferred. Otherwise, we'd try to reload the output instead of
8684 ;; giving the SCRATCH mq.
8686 (define_insn "*movti_power"
8687 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8688 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8689 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8690 "TARGET_POWER && ! TARGET_POWERPC64
8691 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8694 switch (which_alternative)
8701 return \"{stsi|stswi} %1,%P0,16\";
8706 /* If the address is not used in the output, we can use lsi. Otherwise,
8707 fall through to generating four loads. */
8709 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8710 return \"{lsi|lswi} %0,%P1,16\";
8711 /* ... fall through ... */
8717 [(set_attr "type" "store,store,*,load,load,*")])
8719 (define_insn "*movti_string"
8720 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8721 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8722 "! TARGET_POWER && ! TARGET_POWERPC64
8723 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8726 switch (which_alternative)
8732 return \"{stsi|stswi} %1,%P0,16\";
8737 /* If the address is not used in the output, we can use lsi. Otherwise,
8738 fall through to generating four loads. */
8740 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8741 return \"{lsi|lswi} %0,%P1,16\";
8742 /* ... fall through ... */
8748 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
8750 (define_insn "*movti_ppc64"
8751 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8752 (match_operand:TI 1 "input_operand" "r,r,m"))]
8753 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8754 || gpc_reg_operand (operands[1], TImode))"
8756 [(set_attr "type" "*,load,store")])
8759 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8760 (match_operand:TI 1 "const_double_operand" ""))]
8762 [(set (match_dup 2) (match_dup 4))
8763 (set (match_dup 3) (match_dup 5))]
8766 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8768 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8770 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8772 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8773 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8775 else if (GET_CODE (operands[1]) == CONST_INT)
8777 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8778 operands[5] = operands[1];
8785 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8786 (match_operand:TI 1 "input_operand" ""))]
8788 && gpr_or_gpr_p (operands[0], operands[1])"
8790 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8792 (define_expand "load_multiple"
8793 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8794 (match_operand:SI 1 "" ""))
8795 (use (match_operand:SI 2 "" ""))])]
8796 "TARGET_STRING && !TARGET_POWERPC64"
8804 /* Support only loading a constant number of fixed-point registers from
8805 memory and only bother with this if more than two; the machine
8806 doesn't support more than eight. */
8807 if (GET_CODE (operands[2]) != CONST_INT
8808 || INTVAL (operands[2]) <= 2
8809 || INTVAL (operands[2]) > 8
8810 || GET_CODE (operands[1]) != MEM
8811 || GET_CODE (operands[0]) != REG
8812 || REGNO (operands[0]) >= 32)
8815 count = INTVAL (operands[2]);
8816 regno = REGNO (operands[0]);
8818 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8819 op1 = replace_equiv_address (operands[1],
8820 force_reg (SImode, XEXP (operands[1], 0)));
8822 for (i = 0; i < count; i++)
8823 XVECEXP (operands[3], 0, i)
8824 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8825 adjust_address_nv (op1, SImode, i * 4));
8828 (define_insn "*ldmsi8"
8829 [(match_parallel 0 "load_multiple_operation"
8830 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8831 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8832 (set (match_operand:SI 3 "gpc_reg_operand" "")
8833 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8834 (set (match_operand:SI 4 "gpc_reg_operand" "")
8835 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8836 (set (match_operand:SI 5 "gpc_reg_operand" "")
8837 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8838 (set (match_operand:SI 6 "gpc_reg_operand" "")
8839 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8840 (set (match_operand:SI 7 "gpc_reg_operand" "")
8841 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8842 (set (match_operand:SI 8 "gpc_reg_operand" "")
8843 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8844 (set (match_operand:SI 9 "gpc_reg_operand" "")
8845 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8846 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8848 { return rs6000_output_load_multiple (operands); }"
8849 [(set_attr "type" "load_ux")
8850 (set_attr "length" "32")])
8852 (define_insn "*ldmsi7"
8853 [(match_parallel 0 "load_multiple_operation"
8854 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8855 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8856 (set (match_operand:SI 3 "gpc_reg_operand" "")
8857 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8858 (set (match_operand:SI 4 "gpc_reg_operand" "")
8859 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8860 (set (match_operand:SI 5 "gpc_reg_operand" "")
8861 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8862 (set (match_operand:SI 6 "gpc_reg_operand" "")
8863 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8864 (set (match_operand:SI 7 "gpc_reg_operand" "")
8865 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8866 (set (match_operand:SI 8 "gpc_reg_operand" "")
8867 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8868 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8870 { return rs6000_output_load_multiple (operands); }"
8871 [(set_attr "type" "load_ux")
8872 (set_attr "length" "32")])
8874 (define_insn "*ldmsi6"
8875 [(match_parallel 0 "load_multiple_operation"
8876 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8877 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8878 (set (match_operand:SI 3 "gpc_reg_operand" "")
8879 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8880 (set (match_operand:SI 4 "gpc_reg_operand" "")
8881 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8882 (set (match_operand:SI 5 "gpc_reg_operand" "")
8883 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8884 (set (match_operand:SI 6 "gpc_reg_operand" "")
8885 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8886 (set (match_operand:SI 7 "gpc_reg_operand" "")
8887 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8888 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8890 { return rs6000_output_load_multiple (operands); }"
8891 [(set_attr "type" "load_ux")
8892 (set_attr "length" "32")])
8894 (define_insn "*ldmsi5"
8895 [(match_parallel 0 "load_multiple_operation"
8896 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8897 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8898 (set (match_operand:SI 3 "gpc_reg_operand" "")
8899 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8900 (set (match_operand:SI 4 "gpc_reg_operand" "")
8901 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8902 (set (match_operand:SI 5 "gpc_reg_operand" "")
8903 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8904 (set (match_operand:SI 6 "gpc_reg_operand" "")
8905 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8906 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8908 { return rs6000_output_load_multiple (operands); }"
8909 [(set_attr "type" "load_ux")
8910 (set_attr "length" "32")])
8912 (define_insn "*ldmsi4"
8913 [(match_parallel 0 "load_multiple_operation"
8914 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8915 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8916 (set (match_operand:SI 3 "gpc_reg_operand" "")
8917 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8918 (set (match_operand:SI 4 "gpc_reg_operand" "")
8919 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8920 (set (match_operand:SI 5 "gpc_reg_operand" "")
8921 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8922 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8924 { return rs6000_output_load_multiple (operands); }"
8925 [(set_attr "type" "load_ux")
8926 (set_attr "length" "32")])
8928 (define_insn "*ldmsi3"
8929 [(match_parallel 0 "load_multiple_operation"
8930 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8931 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8932 (set (match_operand:SI 3 "gpc_reg_operand" "")
8933 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8934 (set (match_operand:SI 4 "gpc_reg_operand" "")
8935 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8936 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8938 { return rs6000_output_load_multiple (operands); }"
8939 [(set_attr "type" "load_ux")
8940 (set_attr "length" "32")])
8942 (define_expand "store_multiple"
8943 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8944 (match_operand:SI 1 "" ""))
8945 (clobber (scratch:SI))
8946 (use (match_operand:SI 2 "" ""))])]
8947 "TARGET_STRING && !TARGET_POWERPC64"
8956 /* Support only storing a constant number of fixed-point registers to
8957 memory and only bother with this if more than two; the machine
8958 doesn't support more than eight. */
8959 if (GET_CODE (operands[2]) != CONST_INT
8960 || INTVAL (operands[2]) <= 2
8961 || INTVAL (operands[2]) > 8
8962 || GET_CODE (operands[0]) != MEM
8963 || GET_CODE (operands[1]) != REG
8964 || REGNO (operands[1]) >= 32)
8967 count = INTVAL (operands[2]);
8968 regno = REGNO (operands[1]);
8970 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8971 to = force_reg (SImode, XEXP (operands[0], 0));
8972 op0 = replace_equiv_address (operands[0], to);
8974 XVECEXP (operands[3], 0, 0)
8975 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8976 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8977 gen_rtx_SCRATCH (SImode));
8979 for (i = 1; i < count; i++)
8980 XVECEXP (operands[3], 0, i + 1)
8981 = gen_rtx_SET (VOIDmode,
8982 adjust_address_nv (op0, SImode, i * 4),
8983 gen_rtx_REG (SImode, regno + i));
8986 (define_insn "*stmsi8"
8987 [(match_parallel 0 "store_multiple_operation"
8988 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8989 (match_operand:SI 2 "gpc_reg_operand" "r"))
8990 (clobber (match_scratch:SI 3 "X"))
8991 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8992 (match_operand:SI 4 "gpc_reg_operand" "r"))
8993 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8994 (match_operand:SI 5 "gpc_reg_operand" "r"))
8995 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8996 (match_operand:SI 6 "gpc_reg_operand" "r"))
8997 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8998 (match_operand:SI 7 "gpc_reg_operand" "r"))
8999 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9000 (match_operand:SI 8 "gpc_reg_operand" "r"))
9001 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9002 (match_operand:SI 9 "gpc_reg_operand" "r"))
9003 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9004 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9005 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9006 "{stsi|stswi} %2,%1,%O0"
9007 [(set_attr "type" "store_ux")])
9009 (define_insn "*stmsi7"
9010 [(match_parallel 0 "store_multiple_operation"
9011 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9012 (match_operand:SI 2 "gpc_reg_operand" "r"))
9013 (clobber (match_scratch:SI 3 "X"))
9014 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9015 (match_operand:SI 4 "gpc_reg_operand" "r"))
9016 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9017 (match_operand:SI 5 "gpc_reg_operand" "r"))
9018 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9019 (match_operand:SI 6 "gpc_reg_operand" "r"))
9020 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9021 (match_operand:SI 7 "gpc_reg_operand" "r"))
9022 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9023 (match_operand:SI 8 "gpc_reg_operand" "r"))
9024 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9025 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9026 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9027 "{stsi|stswi} %2,%1,%O0"
9028 [(set_attr "type" "store_ux")])
9030 (define_insn "*stmsi6"
9031 [(match_parallel 0 "store_multiple_operation"
9032 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9033 (match_operand:SI 2 "gpc_reg_operand" "r"))
9034 (clobber (match_scratch:SI 3 "X"))
9035 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9036 (match_operand:SI 4 "gpc_reg_operand" "r"))
9037 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9038 (match_operand:SI 5 "gpc_reg_operand" "r"))
9039 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9040 (match_operand:SI 6 "gpc_reg_operand" "r"))
9041 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9042 (match_operand:SI 7 "gpc_reg_operand" "r"))
9043 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9044 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9045 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9046 "{stsi|stswi} %2,%1,%O0"
9047 [(set_attr "type" "store_ux")])
9049 (define_insn "*stmsi5"
9050 [(match_parallel 0 "store_multiple_operation"
9051 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9052 (match_operand:SI 2 "gpc_reg_operand" "r"))
9053 (clobber (match_scratch:SI 3 "X"))
9054 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9055 (match_operand:SI 4 "gpc_reg_operand" "r"))
9056 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9057 (match_operand:SI 5 "gpc_reg_operand" "r"))
9058 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9059 (match_operand:SI 6 "gpc_reg_operand" "r"))
9060 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9061 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9062 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9063 "{stsi|stswi} %2,%1,%O0"
9064 [(set_attr "type" "store_ux")])
9066 (define_insn "*stmsi4"
9067 [(match_parallel 0 "store_multiple_operation"
9068 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9069 (match_operand:SI 2 "gpc_reg_operand" "r"))
9070 (clobber (match_scratch:SI 3 "X"))
9071 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9072 (match_operand:SI 4 "gpc_reg_operand" "r"))
9073 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9074 (match_operand:SI 5 "gpc_reg_operand" "r"))
9075 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9076 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9077 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9078 "{stsi|stswi} %2,%1,%O0"
9079 [(set_attr "type" "store_ux")])
9081 (define_insn "*stmsi3"
9082 [(match_parallel 0 "store_multiple_operation"
9083 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9084 (match_operand:SI 2 "gpc_reg_operand" "r"))
9085 (clobber (match_scratch:SI 3 "X"))
9086 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9087 (match_operand:SI 4 "gpc_reg_operand" "r"))
9088 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9089 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9090 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9091 "{stsi|stswi} %2,%1,%O0"
9092 [(set_attr "type" "store_ux")])
9094 (define_insn "*stmsi8_power"
9095 [(match_parallel 0 "store_multiple_operation"
9096 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9097 (match_operand:SI 2 "gpc_reg_operand" "r"))
9098 (clobber (match_scratch:SI 3 "q"))
9099 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9100 (match_operand:SI 4 "gpc_reg_operand" "r"))
9101 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9102 (match_operand:SI 5 "gpc_reg_operand" "r"))
9103 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9104 (match_operand:SI 6 "gpc_reg_operand" "r"))
9105 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9106 (match_operand:SI 7 "gpc_reg_operand" "r"))
9107 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9108 (match_operand:SI 8 "gpc_reg_operand" "r"))
9109 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9110 (match_operand:SI 9 "gpc_reg_operand" "r"))
9111 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9112 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9113 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9114 "{stsi|stswi} %2,%1,%O0"
9115 [(set_attr "type" "store_ux")])
9117 (define_insn "*stmsi7_power"
9118 [(match_parallel 0 "store_multiple_operation"
9119 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9120 (match_operand:SI 2 "gpc_reg_operand" "r"))
9121 (clobber (match_scratch:SI 3 "q"))
9122 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9123 (match_operand:SI 4 "gpc_reg_operand" "r"))
9124 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9125 (match_operand:SI 5 "gpc_reg_operand" "r"))
9126 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9127 (match_operand:SI 6 "gpc_reg_operand" "r"))
9128 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9129 (match_operand:SI 7 "gpc_reg_operand" "r"))
9130 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9131 (match_operand:SI 8 "gpc_reg_operand" "r"))
9132 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9133 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9134 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9135 "{stsi|stswi} %2,%1,%O0"
9136 [(set_attr "type" "store_ux")])
9138 (define_insn "*stmsi6_power"
9139 [(match_parallel 0 "store_multiple_operation"
9140 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9141 (match_operand:SI 2 "gpc_reg_operand" "r"))
9142 (clobber (match_scratch:SI 3 "q"))
9143 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9144 (match_operand:SI 4 "gpc_reg_operand" "r"))
9145 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9146 (match_operand:SI 5 "gpc_reg_operand" "r"))
9147 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9148 (match_operand:SI 6 "gpc_reg_operand" "r"))
9149 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9150 (match_operand:SI 7 "gpc_reg_operand" "r"))
9151 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9152 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9153 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9154 "{stsi|stswi} %2,%1,%O0"
9155 [(set_attr "type" "store_ux")])
9157 (define_insn "*stmsi5_power"
9158 [(match_parallel 0 "store_multiple_operation"
9159 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9160 (match_operand:SI 2 "gpc_reg_operand" "r"))
9161 (clobber (match_scratch:SI 3 "q"))
9162 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9163 (match_operand:SI 4 "gpc_reg_operand" "r"))
9164 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9165 (match_operand:SI 5 "gpc_reg_operand" "r"))
9166 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9167 (match_operand:SI 6 "gpc_reg_operand" "r"))
9168 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9169 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9170 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9171 "{stsi|stswi} %2,%1,%O0"
9172 [(set_attr "type" "store_ux")])
9174 (define_insn "*stmsi4_power"
9175 [(match_parallel 0 "store_multiple_operation"
9176 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9177 (match_operand:SI 2 "gpc_reg_operand" "r"))
9178 (clobber (match_scratch:SI 3 "q"))
9179 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9180 (match_operand:SI 4 "gpc_reg_operand" "r"))
9181 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9182 (match_operand:SI 5 "gpc_reg_operand" "r"))
9183 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9184 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9185 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9186 "{stsi|stswi} %2,%1,%O0"
9187 [(set_attr "type" "store_ux")])
9189 (define_insn "*stmsi3_power"
9190 [(match_parallel 0 "store_multiple_operation"
9191 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9192 (match_operand:SI 2 "gpc_reg_operand" "r"))
9193 (clobber (match_scratch:SI 3 "q"))
9194 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9195 (match_operand:SI 4 "gpc_reg_operand" "r"))
9196 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9197 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9198 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9199 "{stsi|stswi} %2,%1,%O0"
9200 [(set_attr "type" "store_ux")])
9202 (define_expand "setmemsi"
9203 [(parallel [(set (match_operand:BLK 0 "" "")
9204 (match_operand 2 "const_int_operand" ""))
9205 (use (match_operand:SI 1 "" ""))
9206 (use (match_operand:SI 3 "" ""))])]
9210 /* If value to set is not zero, use the library routine. */
9211 if (operands[2] != const0_rtx)
9214 if (expand_block_clear (operands))
9220 ;; String/block move insn.
9221 ;; Argument 0 is the destination
9222 ;; Argument 1 is the source
9223 ;; Argument 2 is the length
9224 ;; Argument 3 is the alignment
9226 (define_expand "movmemsi"
9227 [(parallel [(set (match_operand:BLK 0 "" "")
9228 (match_operand:BLK 1 "" ""))
9229 (use (match_operand:SI 2 "" ""))
9230 (use (match_operand:SI 3 "" ""))])]
9234 if (expand_block_move (operands))
9240 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9241 ;; register allocator doesn't have a clue about allocating 8 word registers.
9242 ;; rD/rS = r5 is preferred, efficient form.
9243 (define_expand "movmemsi_8reg"
9244 [(parallel [(set (match_operand 0 "" "")
9245 (match_operand 1 "" ""))
9246 (use (match_operand 2 "" ""))
9247 (use (match_operand 3 "" ""))
9248 (clobber (reg:SI 5))
9249 (clobber (reg:SI 6))
9250 (clobber (reg:SI 7))
9251 (clobber (reg:SI 8))
9252 (clobber (reg:SI 9))
9253 (clobber (reg:SI 10))
9254 (clobber (reg:SI 11))
9255 (clobber (reg:SI 12))
9256 (clobber (match_scratch:SI 4 ""))])]
9261 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9262 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9263 (use (match_operand:SI 2 "immediate_operand" "i"))
9264 (use (match_operand:SI 3 "immediate_operand" "i"))
9265 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9266 (clobber (reg:SI 6))
9267 (clobber (reg:SI 7))
9268 (clobber (reg:SI 8))
9269 (clobber (reg:SI 9))
9270 (clobber (reg:SI 10))
9271 (clobber (reg:SI 11))
9272 (clobber (reg:SI 12))
9273 (clobber (match_scratch:SI 5 "=q"))]
9274 "TARGET_STRING && TARGET_POWER
9275 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9276 || INTVAL (operands[2]) == 0)
9277 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9278 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9279 && REGNO (operands[4]) == 5"
9280 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9281 [(set_attr "type" "store_ux")
9282 (set_attr "length" "8")])
9285 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9286 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9287 (use (match_operand:SI 2 "immediate_operand" "i"))
9288 (use (match_operand:SI 3 "immediate_operand" "i"))
9289 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9290 (clobber (reg:SI 6))
9291 (clobber (reg:SI 7))
9292 (clobber (reg:SI 8))
9293 (clobber (reg:SI 9))
9294 (clobber (reg:SI 10))
9295 (clobber (reg:SI 11))
9296 (clobber (reg:SI 12))
9297 (clobber (match_scratch:SI 5 "X"))]
9298 "TARGET_STRING && ! TARGET_POWER
9299 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9300 || INTVAL (operands[2]) == 0)
9301 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9302 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9303 && REGNO (operands[4]) == 5"
9304 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9305 [(set_attr "type" "store_ux")
9306 (set_attr "length" "8")])
9308 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9309 ;; register allocator doesn't have a clue about allocating 6 word registers.
9310 ;; rD/rS = r5 is preferred, efficient form.
9311 (define_expand "movmemsi_6reg"
9312 [(parallel [(set (match_operand 0 "" "")
9313 (match_operand 1 "" ""))
9314 (use (match_operand 2 "" ""))
9315 (use (match_operand 3 "" ""))
9316 (clobber (reg:SI 5))
9317 (clobber (reg:SI 6))
9318 (clobber (reg:SI 7))
9319 (clobber (reg:SI 8))
9320 (clobber (reg:SI 9))
9321 (clobber (reg:SI 10))
9322 (clobber (match_scratch:SI 4 ""))])]
9327 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9328 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9329 (use (match_operand:SI 2 "immediate_operand" "i"))
9330 (use (match_operand:SI 3 "immediate_operand" "i"))
9331 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9332 (clobber (reg:SI 6))
9333 (clobber (reg:SI 7))
9334 (clobber (reg:SI 8))
9335 (clobber (reg:SI 9))
9336 (clobber (reg:SI 10))
9337 (clobber (match_scratch:SI 5 "=q"))]
9338 "TARGET_STRING && TARGET_POWER
9339 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9340 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9341 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9342 && REGNO (operands[4]) == 5"
9343 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9344 [(set_attr "type" "store_ux")
9345 (set_attr "length" "8")])
9348 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9349 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9350 (use (match_operand:SI 2 "immediate_operand" "i"))
9351 (use (match_operand:SI 3 "immediate_operand" "i"))
9352 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9353 (clobber (reg:SI 6))
9354 (clobber (reg:SI 7))
9355 (clobber (reg:SI 8))
9356 (clobber (reg:SI 9))
9357 (clobber (reg:SI 10))
9358 (clobber (match_scratch:SI 5 "X"))]
9359 "TARGET_STRING && ! TARGET_POWER
9360 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9361 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9362 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9363 && REGNO (operands[4]) == 5"
9364 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9365 [(set_attr "type" "store_ux")
9366 (set_attr "length" "8")])
9368 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9369 ;; problems with TImode.
9370 ;; rD/rS = r5 is preferred, efficient form.
9371 (define_expand "movmemsi_4reg"
9372 [(parallel [(set (match_operand 0 "" "")
9373 (match_operand 1 "" ""))
9374 (use (match_operand 2 "" ""))
9375 (use (match_operand 3 "" ""))
9376 (clobber (reg:SI 5))
9377 (clobber (reg:SI 6))
9378 (clobber (reg:SI 7))
9379 (clobber (reg:SI 8))
9380 (clobber (match_scratch:SI 4 ""))])]
9385 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9386 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9387 (use (match_operand:SI 2 "immediate_operand" "i"))
9388 (use (match_operand:SI 3 "immediate_operand" "i"))
9389 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9390 (clobber (reg:SI 6))
9391 (clobber (reg:SI 7))
9392 (clobber (reg:SI 8))
9393 (clobber (match_scratch:SI 5 "=q"))]
9394 "TARGET_STRING && TARGET_POWER
9395 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9396 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9397 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9398 && REGNO (operands[4]) == 5"
9399 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9400 [(set_attr "type" "store_ux")
9401 (set_attr "length" "8")])
9404 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9405 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9406 (use (match_operand:SI 2 "immediate_operand" "i"))
9407 (use (match_operand:SI 3 "immediate_operand" "i"))
9408 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9409 (clobber (reg:SI 6))
9410 (clobber (reg:SI 7))
9411 (clobber (reg:SI 8))
9412 (clobber (match_scratch:SI 5 "X"))]
9413 "TARGET_STRING && ! TARGET_POWER
9414 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9415 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9416 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9417 && REGNO (operands[4]) == 5"
9418 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9419 [(set_attr "type" "store_ux")
9420 (set_attr "length" "8")])
9422 ;; Move up to 8 bytes at a time.
9423 (define_expand "movmemsi_2reg"
9424 [(parallel [(set (match_operand 0 "" "")
9425 (match_operand 1 "" ""))
9426 (use (match_operand 2 "" ""))
9427 (use (match_operand 3 "" ""))
9428 (clobber (match_scratch:DI 4 ""))
9429 (clobber (match_scratch:SI 5 ""))])]
9430 "TARGET_STRING && ! TARGET_POWERPC64"
9434 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9435 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9436 (use (match_operand:SI 2 "immediate_operand" "i"))
9437 (use (match_operand:SI 3 "immediate_operand" "i"))
9438 (clobber (match_scratch:DI 4 "=&r"))
9439 (clobber (match_scratch:SI 5 "=q"))]
9440 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9441 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9442 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9443 [(set_attr "type" "store_ux")
9444 (set_attr "length" "8")])
9447 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9448 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9449 (use (match_operand:SI 2 "immediate_operand" "i"))
9450 (use (match_operand:SI 3 "immediate_operand" "i"))
9451 (clobber (match_scratch:DI 4 "=&r"))
9452 (clobber (match_scratch:SI 5 "X"))]
9453 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9454 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9455 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9456 [(set_attr "type" "store_ux")
9457 (set_attr "length" "8")])
9459 ;; Move up to 4 bytes at a time.
9460 (define_expand "movmemsi_1reg"
9461 [(parallel [(set (match_operand 0 "" "")
9462 (match_operand 1 "" ""))
9463 (use (match_operand 2 "" ""))
9464 (use (match_operand 3 "" ""))
9465 (clobber (match_scratch:SI 4 ""))
9466 (clobber (match_scratch:SI 5 ""))])]
9471 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9472 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9473 (use (match_operand:SI 2 "immediate_operand" "i"))
9474 (use (match_operand:SI 3 "immediate_operand" "i"))
9475 (clobber (match_scratch:SI 4 "=&r"))
9476 (clobber (match_scratch:SI 5 "=q"))]
9477 "TARGET_STRING && TARGET_POWER
9478 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9479 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9480 [(set_attr "type" "store_ux")
9481 (set_attr "length" "8")])
9484 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9485 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9486 (use (match_operand:SI 2 "immediate_operand" "i"))
9487 (use (match_operand:SI 3 "immediate_operand" "i"))
9488 (clobber (match_scratch:SI 4 "=&r"))
9489 (clobber (match_scratch:SI 5 "X"))]
9490 "TARGET_STRING && ! TARGET_POWER
9491 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9492 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9493 [(set_attr "type" "store_ux")
9494 (set_attr "length" "8")])
9496 ;; Define insns that do load or store with update. Some of these we can
9497 ;; get by using pre-decrement or pre-increment, but the hardware can also
9498 ;; do cases where the increment is not the size of the object.
9500 ;; In all these cases, we use operands 0 and 1 for the register being
9501 ;; incremented because those are the operands that local-alloc will
9502 ;; tie and these are the pair most likely to be tieable (and the ones
9503 ;; that will benefit the most).
9505 (define_insn "*movdi_update1"
9506 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9507 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9508 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9509 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9510 (plus:DI (match_dup 1) (match_dup 2)))]
9511 "TARGET_POWERPC64 && TARGET_UPDATE"
9515 [(set_attr "type" "load_ux,load_u")])
9517 (define_insn "movdi_<mode>_update"
9518 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9519 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9520 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9521 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9522 (plus:P (match_dup 1) (match_dup 2)))]
9523 "TARGET_POWERPC64 && TARGET_UPDATE"
9527 [(set_attr "type" "store_ux,store_u")])
9529 (define_insn "*movsi_update1"
9530 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9531 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9532 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9533 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9534 (plus:SI (match_dup 1) (match_dup 2)))]
9537 {lux|lwzux} %3,%0,%2
9538 {lu|lwzu} %3,%2(%0)"
9539 [(set_attr "type" "load_ux,load_u")])
9541 (define_insn "*movsi_update2"
9542 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9544 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9545 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9546 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9547 (plus:DI (match_dup 1) (match_dup 2)))]
9550 [(set_attr "type" "load_ext_ux")])
9552 (define_insn "movsi_update"
9553 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9554 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9555 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9556 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9557 (plus:SI (match_dup 1) (match_dup 2)))]
9560 {stux|stwux} %3,%0,%2
9561 {stu|stwu} %3,%2(%0)"
9562 [(set_attr "type" "store_ux,store_u")])
9564 (define_insn "*movhi_update1"
9565 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9566 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9567 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9568 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9569 (plus:SI (match_dup 1) (match_dup 2)))]
9574 [(set_attr "type" "load_ux,load_u")])
9576 (define_insn "*movhi_update2"
9577 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9579 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9580 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9581 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9582 (plus:SI (match_dup 1) (match_dup 2)))]
9587 [(set_attr "type" "load_ux,load_u")])
9589 (define_insn "*movhi_update3"
9590 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9592 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9593 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9594 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9595 (plus:SI (match_dup 1) (match_dup 2)))]
9600 [(set_attr "type" "load_ext_ux,load_ext_u")])
9602 (define_insn "*movhi_update4"
9603 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9604 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9605 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9606 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9607 (plus:SI (match_dup 1) (match_dup 2)))]
9612 [(set_attr "type" "store_ux,store_u")])
9614 (define_insn "*movqi_update1"
9615 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9616 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9617 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9618 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9619 (plus:SI (match_dup 1) (match_dup 2)))]
9624 [(set_attr "type" "load_ux,load_u")])
9626 (define_insn "*movqi_update2"
9627 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9629 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9630 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9631 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9632 (plus:SI (match_dup 1) (match_dup 2)))]
9637 [(set_attr "type" "load_ux,load_u")])
9639 (define_insn "*movqi_update3"
9640 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9641 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9642 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9643 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9644 (plus:SI (match_dup 1) (match_dup 2)))]
9649 [(set_attr "type" "store_ux,store_u")])
9651 (define_insn "*movsf_update1"
9652 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9653 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9654 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9655 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9656 (plus:SI (match_dup 1) (match_dup 2)))]
9657 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9661 [(set_attr "type" "fpload_ux,fpload_u")])
9663 (define_insn "*movsf_update2"
9664 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9665 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9666 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9667 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9668 (plus:SI (match_dup 1) (match_dup 2)))]
9669 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9673 [(set_attr "type" "fpstore_ux,fpstore_u")])
9675 (define_insn "*movsf_update3"
9676 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9677 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9678 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9679 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9680 (plus:SI (match_dup 1) (match_dup 2)))]
9681 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9683 {lux|lwzux} %3,%0,%2
9684 {lu|lwzu} %3,%2(%0)"
9685 [(set_attr "type" "load_ux,load_u")])
9687 (define_insn "*movsf_update4"
9688 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9689 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9690 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9691 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9692 (plus:SI (match_dup 1) (match_dup 2)))]
9693 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9695 {stux|stwux} %3,%0,%2
9696 {stu|stwu} %3,%2(%0)"
9697 [(set_attr "type" "store_ux,store_u")])
9699 (define_insn "*movdf_update1"
9700 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9701 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9702 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9703 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9704 (plus:SI (match_dup 1) (match_dup 2)))]
9705 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9709 [(set_attr "type" "fpload_ux,fpload_u")])
9711 (define_insn "*movdf_update2"
9712 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9713 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9714 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9715 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9716 (plus:SI (match_dup 1) (match_dup 2)))]
9717 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9721 [(set_attr "type" "fpstore_ux,fpstore_u")])
9723 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9725 (define_insn "*lfq_power2"
9726 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
9727 (match_operand:V2DF 1 "memory_operand" ""))]
9729 && TARGET_HARD_FLOAT && TARGET_FPRS"
9733 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9734 (match_operand:DF 1 "memory_operand" ""))
9735 (set (match_operand:DF 2 "gpc_reg_operand" "")
9736 (match_operand:DF 3 "memory_operand" ""))]
9738 && TARGET_HARD_FLOAT && TARGET_FPRS
9739 && registers_ok_for_quad_peep (operands[0], operands[2])
9740 && mems_ok_for_quad_peep (operands[1], operands[3])"
9743 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
9744 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
9746 (define_insn "*stfq_power2"
9747 [(set (match_operand:V2DF 0 "memory_operand" "")
9748 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
9750 && TARGET_HARD_FLOAT && TARGET_FPRS"
9755 [(set (match_operand:DF 0 "memory_operand" "")
9756 (match_operand:DF 1 "gpc_reg_operand" ""))
9757 (set (match_operand:DF 2 "memory_operand" "")
9758 (match_operand:DF 3 "gpc_reg_operand" ""))]
9760 && TARGET_HARD_FLOAT && TARGET_FPRS
9761 && registers_ok_for_quad_peep (operands[1], operands[3])
9762 && mems_ok_for_quad_peep (operands[0], operands[2])"
9765 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
9766 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
9768 ;; After inserting conditional returns we can sometimes have
9769 ;; unnecessary register moves. Unfortunately we cannot have a
9770 ;; modeless peephole here, because some single SImode sets have early
9771 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9772 ;; sequences, using get_attr_length here will smash the operands
9773 ;; array. Neither is there an early_cobbler_p predicate.
9774 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
9776 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9777 (match_operand:DF 1 "any_operand" ""))
9778 (set (match_operand:DF 2 "gpc_reg_operand" "")
9780 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
9781 && peep2_reg_dead_p (2, operands[0])"
9782 [(set (match_dup 2) (match_dup 1))])
9785 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9786 (match_operand:SF 1 "any_operand" ""))
9787 (set (match_operand:SF 2 "gpc_reg_operand" "")
9789 "peep2_reg_dead_p (2, operands[0])"
9790 [(set (match_dup 2) (match_dup 1))])
9795 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9796 (define_insn "tls_gd_32"
9797 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9798 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9799 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9801 "HAVE_AS_TLS && !TARGET_64BIT"
9802 "addi %0,%1,%2@got@tlsgd")
9804 (define_insn "tls_gd_64"
9805 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9806 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9807 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9809 "HAVE_AS_TLS && TARGET_64BIT"
9810 "addi %0,%1,%2@got@tlsgd")
9812 (define_insn "tls_ld_32"
9813 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9814 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9816 "HAVE_AS_TLS && !TARGET_64BIT"
9817 "addi %0,%1,%&@got@tlsld")
9819 (define_insn "tls_ld_64"
9820 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9821 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9823 "HAVE_AS_TLS && TARGET_64BIT"
9824 "addi %0,%1,%&@got@tlsld")
9826 (define_insn "tls_dtprel_32"
9827 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9828 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9829 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9831 "HAVE_AS_TLS && !TARGET_64BIT"
9832 "addi %0,%1,%2@dtprel")
9834 (define_insn "tls_dtprel_64"
9835 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9836 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9837 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9839 "HAVE_AS_TLS && TARGET_64BIT"
9840 "addi %0,%1,%2@dtprel")
9842 (define_insn "tls_dtprel_ha_32"
9843 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9844 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9845 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9846 UNSPEC_TLSDTPRELHA))]
9847 "HAVE_AS_TLS && !TARGET_64BIT"
9848 "addis %0,%1,%2@dtprel@ha")
9850 (define_insn "tls_dtprel_ha_64"
9851 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9852 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9853 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9854 UNSPEC_TLSDTPRELHA))]
9855 "HAVE_AS_TLS && TARGET_64BIT"
9856 "addis %0,%1,%2@dtprel@ha")
9858 (define_insn "tls_dtprel_lo_32"
9859 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9860 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9861 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9862 UNSPEC_TLSDTPRELLO))]
9863 "HAVE_AS_TLS && !TARGET_64BIT"
9864 "addi %0,%1,%2@dtprel@l")
9866 (define_insn "tls_dtprel_lo_64"
9867 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9868 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9869 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9870 UNSPEC_TLSDTPRELLO))]
9871 "HAVE_AS_TLS && TARGET_64BIT"
9872 "addi %0,%1,%2@dtprel@l")
9874 (define_insn "tls_got_dtprel_32"
9875 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9876 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9877 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9878 UNSPEC_TLSGOTDTPREL))]
9879 "HAVE_AS_TLS && !TARGET_64BIT"
9880 "lwz %0,%2@got@dtprel(%1)")
9882 (define_insn "tls_got_dtprel_64"
9883 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9884 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9885 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9886 UNSPEC_TLSGOTDTPREL))]
9887 "HAVE_AS_TLS && TARGET_64BIT"
9888 "ld %0,%2@got@dtprel(%1)")
9890 (define_insn "tls_tprel_32"
9891 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9892 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9893 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9895 "HAVE_AS_TLS && !TARGET_64BIT"
9896 "addi %0,%1,%2@tprel")
9898 (define_insn "tls_tprel_64"
9899 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9900 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9901 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9903 "HAVE_AS_TLS && TARGET_64BIT"
9904 "addi %0,%1,%2@tprel")
9906 (define_insn "tls_tprel_ha_32"
9907 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9908 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9909 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9910 UNSPEC_TLSTPRELHA))]
9911 "HAVE_AS_TLS && !TARGET_64BIT"
9912 "addis %0,%1,%2@tprel@ha")
9914 (define_insn "tls_tprel_ha_64"
9915 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9916 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9917 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9918 UNSPEC_TLSTPRELHA))]
9919 "HAVE_AS_TLS && TARGET_64BIT"
9920 "addis %0,%1,%2@tprel@ha")
9922 (define_insn "tls_tprel_lo_32"
9923 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9924 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9925 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9926 UNSPEC_TLSTPRELLO))]
9927 "HAVE_AS_TLS && !TARGET_64BIT"
9928 "addi %0,%1,%2@tprel@l")
9930 (define_insn "tls_tprel_lo_64"
9931 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9932 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9933 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9934 UNSPEC_TLSTPRELLO))]
9935 "HAVE_AS_TLS && TARGET_64BIT"
9936 "addi %0,%1,%2@tprel@l")
9938 ;; "b" output constraint here and on tls_tls input to support linker tls
9939 ;; optimization. The linker may edit the instructions emitted by a
9940 ;; tls_got_tprel/tls_tls pair to addis,addi.
9941 (define_insn "tls_got_tprel_32"
9942 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9943 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9944 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9945 UNSPEC_TLSGOTTPREL))]
9946 "HAVE_AS_TLS && !TARGET_64BIT"
9947 "lwz %0,%2@got@tprel(%1)")
9949 (define_insn "tls_got_tprel_64"
9950 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9951 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9952 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9953 UNSPEC_TLSGOTTPREL))]
9954 "HAVE_AS_TLS && TARGET_64BIT"
9955 "ld %0,%2@got@tprel(%1)")
9957 (define_insn "tls_tls_32"
9958 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9959 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9960 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9962 "HAVE_AS_TLS && !TARGET_64BIT"
9965 (define_insn "tls_tls_64"
9966 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9967 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9968 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9970 "HAVE_AS_TLS && TARGET_64BIT"
9973 ;; Next come insns related to the calling sequence.
9975 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9976 ;; We move the back-chain and decrement the stack pointer.
9978 (define_expand "allocate_stack"
9979 [(set (match_operand 0 "gpc_reg_operand" "=r")
9980 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9982 (minus (reg 1) (match_dup 1)))]
9985 { rtx chain = gen_reg_rtx (Pmode);
9986 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9989 emit_move_insn (chain, stack_bot);
9991 /* Check stack bounds if necessary. */
9992 if (current_function_limit_stack)
9995 available = expand_binop (Pmode, sub_optab,
9996 stack_pointer_rtx, stack_limit_rtx,
9997 NULL_RTX, 1, OPTAB_WIDEN);
9998 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10001 if (GET_CODE (operands[1]) != CONST_INT
10002 || INTVAL (operands[1]) < -32767
10003 || INTVAL (operands[1]) > 32768)
10005 neg_op0 = gen_reg_rtx (Pmode);
10007 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10009 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10012 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10015 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
10016 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10020 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10021 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10022 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10025 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10029 ;; These patterns say how to save and restore the stack pointer. We need not
10030 ;; save the stack pointer at function level since we are careful to
10031 ;; preserve the backchain. At block level, we have to restore the backchain
10032 ;; when we restore the stack pointer.
10034 ;; For nonlocal gotos, we must save both the stack pointer and its
10035 ;; backchain and restore both. Note that in the nonlocal case, the
10036 ;; save area is a memory location.
10038 (define_expand "save_stack_function"
10039 [(match_operand 0 "any_operand" "")
10040 (match_operand 1 "any_operand" "")]
10044 (define_expand "restore_stack_function"
10045 [(match_operand 0 "any_operand" "")
10046 (match_operand 1 "any_operand" "")]
10050 ;; Adjust stack pointer (op0) to a new value (op1).
10051 ;; First copy old stack backchain to new location, and ensure that the
10052 ;; scheduler won't reorder the sp assignment before the backchain write.
10053 (define_expand "restore_stack_block"
10054 [(set (match_dup 2) (match_dup 3))
10055 (set (match_dup 4) (match_dup 2))
10056 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10057 (set (match_operand 0 "register_operand" "")
10058 (match_operand 1 "register_operand" ""))]
10062 operands[2] = gen_reg_rtx (Pmode);
10063 operands[3] = gen_frame_mem (Pmode, operands[0]);
10064 operands[4] = gen_frame_mem (Pmode, operands[1]);
10065 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10068 (define_expand "save_stack_nonlocal"
10069 [(set (match_dup 3) (match_dup 4))
10070 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10071 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10075 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10077 /* Copy the backchain to the first word, sp to the second. */
10078 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10079 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10080 operands[3] = gen_reg_rtx (Pmode);
10081 operands[4] = gen_frame_mem (Pmode, operands[1]);
10084 (define_expand "restore_stack_nonlocal"
10085 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10086 (set (match_dup 3) (match_dup 4))
10087 (set (match_dup 5) (match_dup 2))
10088 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10089 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10093 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10095 /* Restore the backchain from the first word, sp from the second. */
10096 operands[2] = gen_reg_rtx (Pmode);
10097 operands[3] = gen_reg_rtx (Pmode);
10098 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10099 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10100 operands[5] = gen_frame_mem (Pmode, operands[3]);
10101 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10104 ;; TOC register handling.
10106 ;; Code to initialize the TOC register...
10108 (define_insn "load_toc_aix_si"
10109 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10110 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10111 (use (reg:SI 2))])]
10112 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10116 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10117 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10118 operands[2] = gen_rtx_REG (Pmode, 2);
10119 return \"{l|lwz} %0,%1(%2)\";
10121 [(set_attr "type" "load")])
10123 (define_insn "load_toc_aix_di"
10124 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10125 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10126 (use (reg:DI 2))])]
10127 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10131 #ifdef TARGET_RELOCATABLE
10132 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10133 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10135 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10138 strcat (buf, \"@toc\");
10139 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10140 operands[2] = gen_rtx_REG (Pmode, 2);
10141 return \"ld %0,%1(%2)\";
10143 [(set_attr "type" "load")])
10145 (define_insn "load_toc_v4_pic_si"
10146 [(set (match_operand:SI 0 "register_operand" "=l")
10147 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10148 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10149 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10150 [(set_attr "type" "branch")
10151 (set_attr "length" "4")])
10153 (define_insn "load_toc_v4_PIC_1"
10154 [(set (match_operand:SI 0 "register_operand" "=l")
10155 (match_operand:SI 1 "immediate_operand" "s"))
10156 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
10157 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10158 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10159 "bcl 20,31,%1\\n%1:"
10160 [(set_attr "type" "branch")
10161 (set_attr "length" "4")])
10163 (define_insn "load_toc_v4_PIC_1b"
10164 [(set (match_operand:SI 0 "register_operand" "=l")
10165 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
10167 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10168 "bcl 20,31,$+8\\n\\t.long %1-$"
10169 [(set_attr "type" "branch")
10170 (set_attr "length" "8")])
10172 (define_insn "load_toc_v4_PIC_2"
10173 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10174 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10175 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10176 (match_operand:SI 3 "immediate_operand" "s")))))]
10177 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10178 "{l|lwz} %0,%2-%3(%1)"
10179 [(set_attr "type" "load")])
10181 (define_insn "load_toc_v4_PIC_3b"
10182 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10183 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10185 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10186 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10187 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10188 "{cau|addis} %0,%1,%2-%3@ha")
10190 (define_insn "load_toc_v4_PIC_3c"
10191 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10192 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10193 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10194 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10195 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10196 "{cal|addi} %0,%1,%2-%3@l")
10198 ;; If the TOC is shared over a translation unit, as happens with all
10199 ;; the kinds of PIC that we support, we need to restore the TOC
10200 ;; pointer only when jumping over units of translation.
10201 ;; On Darwin, we need to reload the picbase.
10203 (define_expand "builtin_setjmp_receiver"
10204 [(use (label_ref (match_operand 0 "" "")))]
10205 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10206 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10207 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10211 if (DEFAULT_ABI == ABI_DARWIN)
10213 const char *picbase = machopic_function_base_name ();
10214 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10215 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10219 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10220 CODE_LABEL_NUMBER (operands[0]));
10221 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10223 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10224 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10228 rs6000_emit_load_toc_table (FALSE);
10232 ;; Elf specific ways of loading addresses for non-PIC code.
10233 ;; The output of this could be r0, but we make a very strong
10234 ;; preference for a base register because it will usually
10235 ;; be needed there.
10236 (define_insn "elf_high"
10237 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10238 (high:SI (match_operand 1 "" "")))]
10239 "TARGET_ELF && ! TARGET_64BIT"
10240 "{liu|lis} %0,%1@ha")
10242 (define_insn "elf_low"
10243 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10244 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10245 (match_operand 2 "" "")))]
10246 "TARGET_ELF && ! TARGET_64BIT"
10248 {cal|la} %0,%2@l(%1)
10249 {ai|addic} %0,%1,%K2")
10251 ;; A function pointer under AIX is a pointer to a data area whose first word
10252 ;; contains the actual address of the function, whose second word contains a
10253 ;; pointer to its TOC, and whose third word contains a value to place in the
10254 ;; static chain register (r11). Note that if we load the static chain, our
10255 ;; "trampoline" need not have any executable code.
10257 (define_expand "call_indirect_aix32"
10258 [(set (match_dup 2)
10259 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10260 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10263 (mem:SI (plus:SI (match_dup 0)
10266 (mem:SI (plus:SI (match_dup 0)
10268 (parallel [(call (mem:SI (match_dup 2))
10269 (match_operand 1 "" ""))
10273 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10274 (clobber (scratch:SI))])]
10277 { operands[2] = gen_reg_rtx (SImode); }")
10279 (define_expand "call_indirect_aix64"
10280 [(set (match_dup 2)
10281 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10282 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10285 (mem:DI (plus:DI (match_dup 0)
10288 (mem:DI (plus:DI (match_dup 0)
10290 (parallel [(call (mem:SI (match_dup 2))
10291 (match_operand 1 "" ""))
10295 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10296 (clobber (scratch:SI))])]
10299 { operands[2] = gen_reg_rtx (DImode); }")
10301 (define_expand "call_value_indirect_aix32"
10302 [(set (match_dup 3)
10303 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10304 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10307 (mem:SI (plus:SI (match_dup 1)
10310 (mem:SI (plus:SI (match_dup 1)
10312 (parallel [(set (match_operand 0 "" "")
10313 (call (mem:SI (match_dup 3))
10314 (match_operand 2 "" "")))
10318 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10319 (clobber (scratch:SI))])]
10322 { operands[3] = gen_reg_rtx (SImode); }")
10324 (define_expand "call_value_indirect_aix64"
10325 [(set (match_dup 3)
10326 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10327 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10330 (mem:DI (plus:DI (match_dup 1)
10333 (mem:DI (plus:DI (match_dup 1)
10335 (parallel [(set (match_operand 0 "" "")
10336 (call (mem:SI (match_dup 3))
10337 (match_operand 2 "" "")))
10341 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10342 (clobber (scratch:SI))])]
10345 { operands[3] = gen_reg_rtx (DImode); }")
10347 ;; Now the definitions for the call and call_value insns
10348 (define_expand "call"
10349 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10350 (match_operand 1 "" ""))
10351 (use (match_operand 2 "" ""))
10352 (clobber (scratch:SI))])]
10357 if (MACHOPIC_INDIRECT)
10358 operands[0] = machopic_indirect_call_target (operands[0]);
10361 gcc_assert (GET_CODE (operands[0]) == MEM);
10362 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10364 operands[0] = XEXP (operands[0], 0);
10366 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10368 && GET_CODE (operands[0]) == SYMBOL_REF
10369 && !SYMBOL_REF_LOCAL_P (operands[0]))
10374 tmp = gen_rtvec (3,
10375 gen_rtx_CALL (VOIDmode,
10376 gen_rtx_MEM (SImode, operands[0]),
10378 gen_rtx_USE (VOIDmode, operands[2]),
10379 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10380 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10381 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10385 if (GET_CODE (operands[0]) != SYMBOL_REF
10386 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10387 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10389 if (INTVAL (operands[2]) & CALL_LONG)
10390 operands[0] = rs6000_longcall_ref (operands[0]);
10392 switch (DEFAULT_ABI)
10396 operands[0] = force_reg (Pmode, operands[0]);
10400 /* AIX function pointers are really pointers to a three word
10402 emit_call_insn (TARGET_32BIT
10403 ? gen_call_indirect_aix32 (force_reg (SImode,
10406 : gen_call_indirect_aix64 (force_reg (DImode,
10412 gcc_unreachable ();
10417 (define_expand "call_value"
10418 [(parallel [(set (match_operand 0 "" "")
10419 (call (mem:SI (match_operand 1 "address_operand" ""))
10420 (match_operand 2 "" "")))
10421 (use (match_operand 3 "" ""))
10422 (clobber (scratch:SI))])]
10427 if (MACHOPIC_INDIRECT)
10428 operands[1] = machopic_indirect_call_target (operands[1]);
10431 gcc_assert (GET_CODE (operands[1]) == MEM);
10432 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10434 operands[1] = XEXP (operands[1], 0);
10436 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10438 && GET_CODE (operands[1]) == SYMBOL_REF
10439 && !SYMBOL_REF_LOCAL_P (operands[1]))
10444 tmp = gen_rtvec (3,
10445 gen_rtx_SET (VOIDmode,
10447 gen_rtx_CALL (VOIDmode,
10448 gen_rtx_MEM (SImode,
10451 gen_rtx_USE (VOIDmode, operands[3]),
10452 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10453 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10454 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10458 if (GET_CODE (operands[1]) != SYMBOL_REF
10459 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10460 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10462 if (INTVAL (operands[3]) & CALL_LONG)
10463 operands[1] = rs6000_longcall_ref (operands[1]);
10465 switch (DEFAULT_ABI)
10469 operands[1] = force_reg (Pmode, operands[1]);
10473 /* AIX function pointers are really pointers to a three word
10475 emit_call_insn (TARGET_32BIT
10476 ? gen_call_value_indirect_aix32 (operands[0],
10480 : gen_call_value_indirect_aix64 (operands[0],
10487 gcc_unreachable ();
10492 ;; Call to function in current module. No TOC pointer reload needed.
10493 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10494 ;; either the function was not prototyped, or it was prototyped as a
10495 ;; variable argument function. It is > 0 if FP registers were passed
10496 ;; and < 0 if they were not.
10498 (define_insn "*call_local32"
10499 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10500 (match_operand 1 "" "g,g"))
10501 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10502 (clobber (match_scratch:SI 3 "=l,l"))]
10503 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10506 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10507 output_asm_insn (\"crxor 6,6,6\", operands);
10509 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10510 output_asm_insn (\"creqv 6,6,6\", operands);
10512 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10514 [(set_attr "type" "branch")
10515 (set_attr "length" "4,8")])
10517 (define_insn "*call_local64"
10518 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10519 (match_operand 1 "" "g,g"))
10520 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10521 (clobber (match_scratch:SI 3 "=l,l"))]
10522 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10525 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10526 output_asm_insn (\"crxor 6,6,6\", operands);
10528 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10529 output_asm_insn (\"creqv 6,6,6\", operands);
10531 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10533 [(set_attr "type" "branch")
10534 (set_attr "length" "4,8")])
10536 (define_insn "*call_value_local32"
10537 [(set (match_operand 0 "" "")
10538 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10539 (match_operand 2 "" "g,g")))
10540 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10541 (clobber (match_scratch:SI 4 "=l,l"))]
10542 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10545 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10546 output_asm_insn (\"crxor 6,6,6\", operands);
10548 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10549 output_asm_insn (\"creqv 6,6,6\", operands);
10551 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10553 [(set_attr "type" "branch")
10554 (set_attr "length" "4,8")])
10557 (define_insn "*call_value_local64"
10558 [(set (match_operand 0 "" "")
10559 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10560 (match_operand 2 "" "g,g")))
10561 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10562 (clobber (match_scratch:SI 4 "=l,l"))]
10563 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10566 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10567 output_asm_insn (\"crxor 6,6,6\", operands);
10569 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10570 output_asm_insn (\"creqv 6,6,6\", operands);
10572 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10574 [(set_attr "type" "branch")
10575 (set_attr "length" "4,8")])
10577 ;; Call to function which may be in another module. Restore the TOC
10578 ;; pointer (r2) after the call unless this is System V.
10579 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10580 ;; either the function was not prototyped, or it was prototyped as a
10581 ;; variable argument function. It is > 0 if FP registers were passed
10582 ;; and < 0 if they were not.
10584 (define_insn "*call_indirect_nonlocal_aix32"
10585 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10586 (match_operand 1 "" "g,g"))
10590 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10591 (clobber (match_scratch:SI 2 "=l,l"))]
10592 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10593 "b%T0l\;{l|lwz} 2,20(1)"
10594 [(set_attr "type" "jmpreg")
10595 (set_attr "length" "8")])
10597 (define_insn "*call_nonlocal_aix32"
10598 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10599 (match_operand 1 "" "g"))
10600 (use (match_operand:SI 2 "immediate_operand" "O"))
10601 (clobber (match_scratch:SI 3 "=l"))]
10603 && DEFAULT_ABI == ABI_AIX
10604 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10606 [(set_attr "type" "branch")
10607 (set_attr "length" "8")])
10609 (define_insn "*call_indirect_nonlocal_aix64"
10610 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10611 (match_operand 1 "" "g,g"))
10615 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10616 (clobber (match_scratch:SI 2 "=l,l"))]
10617 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10618 "b%T0l\;ld 2,40(1)"
10619 [(set_attr "type" "jmpreg")
10620 (set_attr "length" "8")])
10622 (define_insn "*call_nonlocal_aix64"
10623 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10624 (match_operand 1 "" "g"))
10625 (use (match_operand:SI 2 "immediate_operand" "O"))
10626 (clobber (match_scratch:SI 3 "=l"))]
10628 && DEFAULT_ABI == ABI_AIX
10629 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10631 [(set_attr "type" "branch")
10632 (set_attr "length" "8")])
10634 (define_insn "*call_value_indirect_nonlocal_aix32"
10635 [(set (match_operand 0 "" "")
10636 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10637 (match_operand 2 "" "g,g")))
10641 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10642 (clobber (match_scratch:SI 3 "=l,l"))]
10643 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10644 "b%T1l\;{l|lwz} 2,20(1)"
10645 [(set_attr "type" "jmpreg")
10646 (set_attr "length" "8")])
10648 (define_insn "*call_value_nonlocal_aix32"
10649 [(set (match_operand 0 "" "")
10650 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10651 (match_operand 2 "" "g")))
10652 (use (match_operand:SI 3 "immediate_operand" "O"))
10653 (clobber (match_scratch:SI 4 "=l"))]
10655 && DEFAULT_ABI == ABI_AIX
10656 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10658 [(set_attr "type" "branch")
10659 (set_attr "length" "8")])
10661 (define_insn "*call_value_indirect_nonlocal_aix64"
10662 [(set (match_operand 0 "" "")
10663 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10664 (match_operand 2 "" "g,g")))
10668 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10669 (clobber (match_scratch:SI 3 "=l,l"))]
10670 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10671 "b%T1l\;ld 2,40(1)"
10672 [(set_attr "type" "jmpreg")
10673 (set_attr "length" "8")])
10675 (define_insn "*call_value_nonlocal_aix64"
10676 [(set (match_operand 0 "" "")
10677 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10678 (match_operand 2 "" "g")))
10679 (use (match_operand:SI 3 "immediate_operand" "O"))
10680 (clobber (match_scratch:SI 4 "=l"))]
10682 && DEFAULT_ABI == ABI_AIX
10683 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10685 [(set_attr "type" "branch")
10686 (set_attr "length" "8")])
10688 ;; A function pointer under System V is just a normal pointer
10689 ;; operands[0] is the function pointer
10690 ;; operands[1] is the stack size to clean up
10691 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10692 ;; which indicates how to set cr1
10694 (define_insn "*call_indirect_nonlocal_sysv"
10695 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
10696 (match_operand 1 "" "g,g,g,g"))
10697 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10698 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10699 "DEFAULT_ABI == ABI_V4
10700 || DEFAULT_ABI == ABI_DARWIN"
10702 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10703 output_asm_insn ("crxor 6,6,6", operands);
10705 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10706 output_asm_insn ("creqv 6,6,6", operands);
10710 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10711 (set_attr "length" "4,4,8,8")])
10713 (define_insn "*call_nonlocal_sysv"
10714 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10715 (match_operand 1 "" "g,g"))
10716 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10717 (clobber (match_scratch:SI 3 "=l,l"))]
10718 "(DEFAULT_ABI == ABI_DARWIN
10719 || (DEFAULT_ABI == ABI_V4
10720 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10722 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10723 output_asm_insn ("crxor 6,6,6", operands);
10725 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10726 output_asm_insn ("creqv 6,6,6", operands);
10729 return output_call(insn, operands, 0, 2);
10731 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10733 if (TARGET_SECURE_PLT && flag_pic == 2)
10734 /* The magic 32768 offset here and in the other sysv call insns
10735 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10736 See sysv4.h:toc_section. */
10737 return "bl %z0+32768@plt";
10739 return "bl %z0@plt";
10745 [(set_attr "type" "branch,branch")
10746 (set_attr "length" "4,8")])
10748 (define_insn "*call_value_indirect_nonlocal_sysv"
10749 [(set (match_operand 0 "" "")
10750 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
10751 (match_operand 2 "" "g,g,g,g")))
10752 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10753 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10754 "DEFAULT_ABI == ABI_V4
10755 || DEFAULT_ABI == ABI_DARWIN"
10757 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10758 output_asm_insn ("crxor 6,6,6", operands);
10760 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10761 output_asm_insn ("creqv 6,6,6", operands);
10765 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10766 (set_attr "length" "4,4,8,8")])
10768 (define_insn "*call_value_nonlocal_sysv"
10769 [(set (match_operand 0 "" "")
10770 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10771 (match_operand 2 "" "g,g")))
10772 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10773 (clobber (match_scratch:SI 4 "=l,l"))]
10774 "(DEFAULT_ABI == ABI_DARWIN
10775 || (DEFAULT_ABI == ABI_V4
10776 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10778 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10779 output_asm_insn ("crxor 6,6,6", operands);
10781 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10782 output_asm_insn ("creqv 6,6,6", operands);
10785 return output_call(insn, operands, 1, 3);
10787 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10789 if (TARGET_SECURE_PLT && flag_pic == 2)
10790 return "bl %z1+32768@plt";
10792 return "bl %z1@plt";
10798 [(set_attr "type" "branch,branch")
10799 (set_attr "length" "4,8")])
10801 ;; Call subroutine returning any type.
10802 (define_expand "untyped_call"
10803 [(parallel [(call (match_operand 0 "" "")
10805 (match_operand 1 "" "")
10806 (match_operand 2 "" "")])]
10812 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10814 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10816 rtx set = XVECEXP (operands[2], 0, i);
10817 emit_move_insn (SET_DEST (set), SET_SRC (set));
10820 /* The optimizer does not know that the call sets the function value
10821 registers we stored in the result block. We avoid problems by
10822 claiming that all hard registers are used and clobbered at this
10824 emit_insn (gen_blockage ());
10829 ;; sibling call patterns
10830 (define_expand "sibcall"
10831 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10832 (match_operand 1 "" ""))
10833 (use (match_operand 2 "" ""))
10834 (use (match_operand 3 "" ""))
10840 if (MACHOPIC_INDIRECT)
10841 operands[0] = machopic_indirect_call_target (operands[0]);
10844 gcc_assert (GET_CODE (operands[0]) == MEM);
10845 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10847 operands[0] = XEXP (operands[0], 0);
10848 operands[3] = gen_reg_rtx (SImode);
10852 ;; this and similar patterns must be marked as using LR, otherwise
10853 ;; dataflow will try to delete the store into it. This is true
10854 ;; even when the actual reg to jump to is in CTR, when LR was
10855 ;; saved and restored around the PIC-setting BCL.
10856 (define_insn "*sibcall_local32"
10857 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10858 (match_operand 1 "" "g,g"))
10859 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10860 (use (match_operand:SI 3 "register_operand" "l,l"))
10862 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10865 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10866 output_asm_insn (\"crxor 6,6,6\", operands);
10868 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10869 output_asm_insn (\"creqv 6,6,6\", operands);
10871 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10873 [(set_attr "type" "branch")
10874 (set_attr "length" "4,8")])
10876 (define_insn "*sibcall_local64"
10877 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10878 (match_operand 1 "" "g,g"))
10879 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10880 (use (match_operand:SI 3 "register_operand" "l,l"))
10882 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10885 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10886 output_asm_insn (\"crxor 6,6,6\", operands);
10888 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10889 output_asm_insn (\"creqv 6,6,6\", operands);
10891 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10893 [(set_attr "type" "branch")
10894 (set_attr "length" "4,8")])
10896 (define_insn "*sibcall_value_local32"
10897 [(set (match_operand 0 "" "")
10898 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10899 (match_operand 2 "" "g,g")))
10900 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10901 (use (match_operand:SI 4 "register_operand" "l,l"))
10903 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10906 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10907 output_asm_insn (\"crxor 6,6,6\", operands);
10909 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10910 output_asm_insn (\"creqv 6,6,6\", operands);
10912 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10914 [(set_attr "type" "branch")
10915 (set_attr "length" "4,8")])
10918 (define_insn "*sibcall_value_local64"
10919 [(set (match_operand 0 "" "")
10920 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10921 (match_operand 2 "" "g,g")))
10922 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10923 (use (match_operand:SI 4 "register_operand" "l,l"))
10925 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10928 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10929 output_asm_insn (\"crxor 6,6,6\", operands);
10931 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10932 output_asm_insn (\"creqv 6,6,6\", operands);
10934 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10936 [(set_attr "type" "branch")
10937 (set_attr "length" "4,8")])
10939 (define_insn "*sibcall_nonlocal_aix32"
10940 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10941 (match_operand 1 "" "g"))
10942 (use (match_operand:SI 2 "immediate_operand" "O"))
10943 (use (match_operand:SI 3 "register_operand" "l"))
10946 && DEFAULT_ABI == ABI_AIX
10947 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10949 [(set_attr "type" "branch")
10950 (set_attr "length" "4")])
10952 (define_insn "*sibcall_nonlocal_aix64"
10953 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10954 (match_operand 1 "" "g"))
10955 (use (match_operand:SI 2 "immediate_operand" "O"))
10956 (use (match_operand:SI 3 "register_operand" "l"))
10959 && DEFAULT_ABI == ABI_AIX
10960 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10962 [(set_attr "type" "branch")
10963 (set_attr "length" "4")])
10965 (define_insn "*sibcall_value_nonlocal_aix32"
10966 [(set (match_operand 0 "" "")
10967 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10968 (match_operand 2 "" "g")))
10969 (use (match_operand:SI 3 "immediate_operand" "O"))
10970 (use (match_operand:SI 4 "register_operand" "l"))
10973 && DEFAULT_ABI == ABI_AIX
10974 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10976 [(set_attr "type" "branch")
10977 (set_attr "length" "4")])
10979 (define_insn "*sibcall_value_nonlocal_aix64"
10980 [(set (match_operand 0 "" "")
10981 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10982 (match_operand 2 "" "g")))
10983 (use (match_operand:SI 3 "immediate_operand" "O"))
10984 (use (match_operand:SI 4 "register_operand" "l"))
10987 && DEFAULT_ABI == ABI_AIX
10988 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10990 [(set_attr "type" "branch")
10991 (set_attr "length" "4")])
10993 (define_insn "*sibcall_nonlocal_sysv"
10994 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10995 (match_operand 1 "" ""))
10996 (use (match_operand 2 "immediate_operand" "O,n"))
10997 (use (match_operand:SI 3 "register_operand" "l,l"))
10999 "(DEFAULT_ABI == ABI_DARWIN
11000 || DEFAULT_ABI == ABI_V4)
11001 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11004 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11005 output_asm_insn (\"crxor 6,6,6\", operands);
11007 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11008 output_asm_insn (\"creqv 6,6,6\", operands);
11010 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11012 if (TARGET_SECURE_PLT && flag_pic == 2)
11013 return \"b %z0+32768@plt\";
11015 return \"b %z0@plt\";
11020 [(set_attr "type" "branch,branch")
11021 (set_attr "length" "4,8")])
11023 (define_expand "sibcall_value"
11024 [(parallel [(set (match_operand 0 "register_operand" "")
11025 (call (mem:SI (match_operand 1 "address_operand" ""))
11026 (match_operand 2 "" "")))
11027 (use (match_operand 3 "" ""))
11028 (use (match_operand 4 "" ""))
11034 if (MACHOPIC_INDIRECT)
11035 operands[1] = machopic_indirect_call_target (operands[1]);
11038 gcc_assert (GET_CODE (operands[1]) == MEM);
11039 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11041 operands[1] = XEXP (operands[1], 0);
11042 operands[4] = gen_reg_rtx (SImode);
11046 (define_insn "*sibcall_value_nonlocal_sysv"
11047 [(set (match_operand 0 "" "")
11048 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
11049 (match_operand 2 "" "")))
11050 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11051 (use (match_operand:SI 4 "register_operand" "l,l"))
11053 "(DEFAULT_ABI == ABI_DARWIN
11054 || DEFAULT_ABI == ABI_V4)
11055 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11058 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11059 output_asm_insn (\"crxor 6,6,6\", operands);
11061 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11062 output_asm_insn (\"creqv 6,6,6\", operands);
11064 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11066 if (TARGET_SECURE_PLT && flag_pic == 2)
11067 return \"b %z1+32768@plt\";
11069 return \"b %z1@plt\";
11074 [(set_attr "type" "branch,branch")
11075 (set_attr "length" "4,8")])
11077 (define_expand "sibcall_epilogue"
11078 [(use (const_int 0))]
11079 "TARGET_SCHED_PROLOG"
11082 rs6000_emit_epilogue (TRUE);
11086 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11087 ;; all of memory. This blocks insns from being moved across this point.
11089 (define_insn "blockage"
11090 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11094 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11095 ;; signed & unsigned, and one type of branch.
11097 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11098 ;; insns, and branches. We store the operands of compares until we see
11100 (define_expand "cmp<mode>"
11102 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11103 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11107 /* Take care of the possibility that operands[1] might be negative but
11108 this might be a logical operation. That insn doesn't exist. */
11109 if (GET_CODE (operands[1]) == CONST_INT
11110 && INTVAL (operands[1]) < 0)
11111 operands[1] = force_reg (<MODE>mode, operands[1]);
11113 rs6000_compare_op0 = operands[0];
11114 rs6000_compare_op1 = operands[1];
11115 rs6000_compare_fp_p = 0;
11119 (define_expand "cmp<mode>"
11120 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11121 (match_operand:FP 1 "gpc_reg_operand" "")))]
11125 rs6000_compare_op0 = operands[0];
11126 rs6000_compare_op1 = operands[1];
11127 rs6000_compare_fp_p = 1;
11131 (define_expand "beq"
11132 [(use (match_operand 0 "" ""))]
11134 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11136 (define_expand "bne"
11137 [(use (match_operand 0 "" ""))]
11139 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11141 (define_expand "bge"
11142 [(use (match_operand 0 "" ""))]
11144 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11146 (define_expand "bgt"
11147 [(use (match_operand 0 "" ""))]
11149 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11151 (define_expand "ble"
11152 [(use (match_operand 0 "" ""))]
11154 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11156 (define_expand "blt"
11157 [(use (match_operand 0 "" ""))]
11159 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11161 (define_expand "bgeu"
11162 [(use (match_operand 0 "" ""))]
11164 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11166 (define_expand "bgtu"
11167 [(use (match_operand 0 "" ""))]
11169 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11171 (define_expand "bleu"
11172 [(use (match_operand 0 "" ""))]
11174 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11176 (define_expand "bltu"
11177 [(use (match_operand 0 "" ""))]
11179 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11181 (define_expand "bunordered"
11182 [(use (match_operand 0 "" ""))]
11183 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11184 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11186 (define_expand "bordered"
11187 [(use (match_operand 0 "" ""))]
11188 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11189 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11191 (define_expand "buneq"
11192 [(use (match_operand 0 "" ""))]
11194 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11196 (define_expand "bunge"
11197 [(use (match_operand 0 "" ""))]
11199 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11201 (define_expand "bungt"
11202 [(use (match_operand 0 "" ""))]
11204 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11206 (define_expand "bunle"
11207 [(use (match_operand 0 "" ""))]
11209 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11211 (define_expand "bunlt"
11212 [(use (match_operand 0 "" ""))]
11214 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11216 (define_expand "bltgt"
11217 [(use (match_operand 0 "" ""))]
11219 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11221 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11222 ;; For SEQ, likewise, except that comparisons with zero should be done
11223 ;; with an scc insns. However, due to the order that combine see the
11224 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11225 ;; the cases we don't want to handle.
11226 (define_expand "seq"
11227 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11229 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11231 (define_expand "sne"
11232 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11236 if (! rs6000_compare_fp_p)
11239 rs6000_emit_sCOND (NE, operands[0]);
11243 ;; A >= 0 is best done the portable way for A an integer.
11244 (define_expand "sge"
11245 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11249 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11252 rs6000_emit_sCOND (GE, operands[0]);
11256 ;; A > 0 is best done using the portable sequence, so fail in that case.
11257 (define_expand "sgt"
11258 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11262 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11265 rs6000_emit_sCOND (GT, operands[0]);
11269 ;; A <= 0 is best done the portable way for A an integer.
11270 (define_expand "sle"
11271 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11275 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11278 rs6000_emit_sCOND (LE, operands[0]);
11282 ;; A < 0 is best done in the portable way for A an integer.
11283 (define_expand "slt"
11284 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11288 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11291 rs6000_emit_sCOND (LT, operands[0]);
11295 (define_expand "sgeu"
11296 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11298 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11300 (define_expand "sgtu"
11301 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11303 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11305 (define_expand "sleu"
11306 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11308 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11310 (define_expand "sltu"
11311 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11313 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11315 (define_expand "sunordered"
11316 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11317 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11318 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11320 (define_expand "sordered"
11321 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11322 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
11323 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11325 (define_expand "suneq"
11326 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11328 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11330 (define_expand "sunge"
11331 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11333 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11335 (define_expand "sungt"
11336 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11338 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11340 (define_expand "sunle"
11341 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11343 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11345 (define_expand "sunlt"
11346 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11348 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11350 (define_expand "sltgt"
11351 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11353 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11355 (define_expand "stack_protect_set"
11356 [(match_operand 0 "memory_operand" "")
11357 (match_operand 1 "memory_operand" "")]
11360 #ifdef TARGET_THREAD_SSP_OFFSET
11361 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11362 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11363 operands[1] = gen_rtx_MEM (Pmode, addr);
11366 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11368 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11372 (define_insn "stack_protect_setsi"
11373 [(set (match_operand:SI 0 "memory_operand" "=m")
11374 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11375 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11377 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11378 [(set_attr "type" "three")
11379 (set_attr "length" "12")])
11381 (define_insn "stack_protect_setdi"
11382 [(set (match_operand:DI 0 "memory_operand" "=m")
11383 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11384 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11386 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11387 [(set_attr "type" "three")
11388 (set_attr "length" "12")])
11390 (define_expand "stack_protect_test"
11391 [(match_operand 0 "memory_operand" "")
11392 (match_operand 1 "memory_operand" "")
11393 (match_operand 2 "" "")]
11396 #ifdef TARGET_THREAD_SSP_OFFSET
11397 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11398 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11399 operands[1] = gen_rtx_MEM (Pmode, addr);
11401 rs6000_compare_op0 = operands[0];
11402 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11404 rs6000_compare_fp_p = 0;
11405 emit_jump_insn (gen_beq (operands[2]));
11409 (define_insn "stack_protect_testsi"
11410 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11411 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11412 (match_operand:SI 2 "memory_operand" "m,m")]
11414 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11415 (clobber (match_scratch:SI 3 "=&r,&r"))]
11418 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11419 {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"
11420 [(set_attr "length" "16,20")])
11422 (define_insn "stack_protect_testdi"
11423 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11424 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11425 (match_operand:DI 2 "memory_operand" "m,m")]
11427 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11428 (clobber (match_scratch:DI 3 "=&r,&r"))]
11431 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11432 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11433 [(set_attr "length" "16,20")])
11436 ;; Here are the actual compare insns.
11437 (define_insn "*cmp<mode>_internal1"
11438 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11439 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11440 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11442 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11443 [(set_attr "type" "cmp")])
11445 ;; If we are comparing a register for equality with a large constant,
11446 ;; we can do this with an XOR followed by a compare. But this is profitable
11447 ;; only if the large constant is only used for the comparison (and in this
11448 ;; case we already have a register to reuse as scratch).
11450 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11451 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11454 [(set (match_operand:SI 0 "register_operand")
11455 (match_operand:SI 1 "logical_const_operand" ""))
11456 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11458 (match_operand:SI 2 "logical_const_operand" "")]))
11459 (set (match_operand:CC 4 "cc_reg_operand" "")
11460 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11463 (if_then_else (match_operator 6 "equality_operator"
11464 [(match_dup 4) (const_int 0)])
11465 (match_operand 7 "" "")
11466 (match_operand 8 "" "")))]
11467 "peep2_reg_dead_p (3, operands[0])
11468 && peep2_reg_dead_p (4, operands[4])"
11469 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11470 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11471 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11474 /* Get the constant we are comparing against, and see what it looks like
11475 when sign-extended from 16 to 32 bits. Then see what constant we could
11476 XOR with SEXTC to get the sign-extended value. */
11477 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11479 operands[1], operands[2]);
11480 HOST_WIDE_INT c = INTVAL (cnst);
11481 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11482 HOST_WIDE_INT xorv = c ^ sextc;
11484 operands[9] = GEN_INT (xorv);
11485 operands[10] = GEN_INT (sextc);
11488 (define_insn "*cmpsi_internal2"
11489 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11490 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11491 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11493 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11494 [(set_attr "type" "cmp")])
11496 (define_insn "*cmpdi_internal2"
11497 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11498 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11499 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11501 "cmpld%I2 %0,%1,%b2"
11502 [(set_attr "type" "cmp")])
11504 ;; The following two insns don't exist as single insns, but if we provide
11505 ;; them, we can swap an add and compare, which will enable us to overlap more
11506 ;; of the required delay between a compare and branch. We generate code for
11507 ;; them by splitting.
11510 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11511 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11512 (match_operand:SI 2 "short_cint_operand" "i")))
11513 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11514 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11517 [(set_attr "length" "8")])
11520 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11521 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11522 (match_operand:SI 2 "u_short_cint_operand" "i")))
11523 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11524 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11527 [(set_attr "length" "8")])
11530 [(set (match_operand:CC 3 "cc_reg_operand" "")
11531 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11532 (match_operand:SI 2 "short_cint_operand" "")))
11533 (set (match_operand:SI 0 "gpc_reg_operand" "")
11534 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11536 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11537 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11540 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11541 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11542 (match_operand:SI 2 "u_short_cint_operand" "")))
11543 (set (match_operand:SI 0 "gpc_reg_operand" "")
11544 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11546 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11547 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11549 (define_insn "*cmpsf_internal1"
11550 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11551 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11552 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11553 "TARGET_HARD_FLOAT && TARGET_FPRS"
11555 [(set_attr "type" "fpcompare")])
11557 (define_insn "*cmpdf_internal1"
11558 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11559 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11560 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11561 "TARGET_HARD_FLOAT && TARGET_FPRS"
11563 [(set_attr "type" "fpcompare")])
11565 ;; Only need to compare second words if first words equal
11566 (define_insn "*cmptf_internal1"
11567 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11568 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11569 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11570 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11571 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11572 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11573 [(set_attr "type" "fpcompare")
11574 (set_attr "length" "12")])
11576 (define_insn_and_split "*cmptf_internal2"
11577 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11578 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11579 (match_operand:TF 2 "gpc_reg_operand" "f")))
11580 (clobber (match_scratch:DF 3 "=f"))
11581 (clobber (match_scratch:DF 4 "=f"))
11582 (clobber (match_scratch:DF 5 "=f"))
11583 (clobber (match_scratch:DF 6 "=f"))
11584 (clobber (match_scratch:DF 7 "=f"))
11585 (clobber (match_scratch:DF 8 "=f"))
11586 (clobber (match_scratch:DF 9 "=f"))
11587 (clobber (match_scratch:DF 10 "=f"))]
11588 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11589 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11591 "&& reload_completed"
11592 [(set (match_dup 3) (match_dup 13))
11593 (set (match_dup 4) (match_dup 14))
11594 (set (match_dup 9) (abs:DF (match_dup 5)))
11595 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11596 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11597 (label_ref (match_dup 11))
11599 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11600 (set (pc) (label_ref (match_dup 12)))
11602 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11603 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11604 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11605 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11608 REAL_VALUE_TYPE rv;
11609 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11610 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11612 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11613 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11614 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11615 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11616 operands[11] = gen_label_rtx ();
11617 operands[12] = gen_label_rtx ();
11619 operands[13] = force_const_mem (DFmode,
11620 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11621 operands[14] = force_const_mem (DFmode,
11622 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11626 operands[13] = gen_const_mem (DFmode,
11627 create_TOC_reference (XEXP (operands[13], 0)));
11628 operands[14] = gen_const_mem (DFmode,
11629 create_TOC_reference (XEXP (operands[14], 0)));
11630 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11631 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11635 ;; Now we have the scc insns. We can do some combinations because of the
11636 ;; way the machine works.
11638 ;; Note that this is probably faster if we can put an insn between the
11639 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11640 ;; cases the insns below which don't use an intermediate CR field will
11641 ;; be used instead.
11643 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11644 (match_operator:SI 1 "scc_comparison_operator"
11645 [(match_operand 2 "cc_reg_operand" "y")
11648 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11649 [(set (attr "type")
11650 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11651 (const_string "mfcrf")
11653 (const_string "mfcr")))
11654 (set_attr "length" "8")])
11656 ;; Same as above, but get the GT bit.
11657 (define_insn "move_from_CR_gt_bit"
11658 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11659 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11661 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11662 [(set_attr "type" "mfcr")
11663 (set_attr "length" "8")])
11665 ;; Same as above, but get the OV/ORDERED bit.
11666 (define_insn "move_from_CR_ov_bit"
11667 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11668 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11670 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11671 [(set_attr "type" "mfcr")
11672 (set_attr "length" "8")])
11675 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11676 (match_operator:DI 1 "scc_comparison_operator"
11677 [(match_operand 2 "cc_reg_operand" "y")
11680 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11681 [(set (attr "type")
11682 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11683 (const_string "mfcrf")
11685 (const_string "mfcr")))
11686 (set_attr "length" "8")])
11689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11690 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11691 [(match_operand 2 "cc_reg_operand" "y,y")
11694 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11695 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11698 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11700 [(set_attr "type" "delayed_compare")
11701 (set_attr "length" "8,16")])
11704 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11705 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11706 [(match_operand 2 "cc_reg_operand" "")
11709 (set (match_operand:SI 3 "gpc_reg_operand" "")
11710 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11711 "TARGET_32BIT && reload_completed"
11712 [(set (match_dup 3)
11713 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11715 (compare:CC (match_dup 3)
11720 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11721 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11722 [(match_operand 2 "cc_reg_operand" "y")
11724 (match_operand:SI 3 "const_int_operand" "n")))]
11728 int is_bit = ccr_bit (operands[1], 1);
11729 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11732 if (is_bit >= put_bit)
11733 count = is_bit - put_bit;
11735 count = 32 - (put_bit - is_bit);
11737 operands[4] = GEN_INT (count);
11738 operands[5] = GEN_INT (put_bit);
11740 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11742 [(set (attr "type")
11743 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11744 (const_string "mfcrf")
11746 (const_string "mfcr")))
11747 (set_attr "length" "8")])
11750 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11752 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11753 [(match_operand 2 "cc_reg_operand" "y,y")
11755 (match_operand:SI 3 "const_int_operand" "n,n"))
11757 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11758 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11763 int is_bit = ccr_bit (operands[1], 1);
11764 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11767 /* Force split for non-cc0 compare. */
11768 if (which_alternative == 1)
11771 if (is_bit >= put_bit)
11772 count = is_bit - put_bit;
11774 count = 32 - (put_bit - is_bit);
11776 operands[5] = GEN_INT (count);
11777 operands[6] = GEN_INT (put_bit);
11779 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11781 [(set_attr "type" "delayed_compare")
11782 (set_attr "length" "8,16")])
11785 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11787 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11788 [(match_operand 2 "cc_reg_operand" "")
11790 (match_operand:SI 3 "const_int_operand" ""))
11792 (set (match_operand:SI 4 "gpc_reg_operand" "")
11793 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11796 [(set (match_dup 4)
11797 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11800 (compare:CC (match_dup 4)
11804 ;; There is a 3 cycle delay between consecutive mfcr instructions
11805 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11808 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11809 (match_operator:SI 1 "scc_comparison_operator"
11810 [(match_operand 2 "cc_reg_operand" "y")
11812 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11813 (match_operator:SI 4 "scc_comparison_operator"
11814 [(match_operand 5 "cc_reg_operand" "y")
11816 "REGNO (operands[2]) != REGNO (operands[5])"
11817 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11818 [(set_attr "type" "mfcr")
11819 (set_attr "length" "12")])
11822 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11823 (match_operator:DI 1 "scc_comparison_operator"
11824 [(match_operand 2 "cc_reg_operand" "y")
11826 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11827 (match_operator:DI 4 "scc_comparison_operator"
11828 [(match_operand 5 "cc_reg_operand" "y")
11830 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11831 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11832 [(set_attr "type" "mfcr")
11833 (set_attr "length" "12")])
11835 ;; There are some scc insns that can be done directly, without a compare.
11836 ;; These are faster because they don't involve the communications between
11837 ;; the FXU and branch units. In fact, we will be replacing all of the
11838 ;; integer scc insns here or in the portable methods in emit_store_flag.
11840 ;; Also support (neg (scc ..)) since that construct is used to replace
11841 ;; branches, (plus (scc ..) ..) since that construct is common and
11842 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11843 ;; cases where it is no more expensive than (neg (scc ..)).
11845 ;; Have reload force a constant into a register for the simple insns that
11846 ;; otherwise won't accept constants. We do this because it is faster than
11847 ;; the cmp/mfcr sequence we would otherwise generate.
11849 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11852 (define_insn_and_split "*eq<mode>"
11853 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11854 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11855 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
11859 [(set (match_dup 0)
11860 (clz:GPR (match_dup 3)))
11862 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
11864 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11866 /* Use output operand as intermediate. */
11867 operands[3] = operands[0];
11869 if (logical_operand (operands[2], <MODE>mode))
11870 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11871 gen_rtx_XOR (<MODE>mode,
11872 operands[1], operands[2])));
11874 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11875 gen_rtx_PLUS (<MODE>mode, operands[1],
11876 negate_rtx (<MODE>mode,
11880 operands[3] = operands[1];
11882 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11885 (define_insn_and_split "*eq<mode>_compare"
11886 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11888 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11889 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11891 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11892 (eq:P (match_dup 1) (match_dup 2)))]
11893 "!TARGET_POWER && optimize_size"
11895 "!TARGET_POWER && optimize_size"
11896 [(set (match_dup 0)
11897 (clz:P (match_dup 4)))
11898 (parallel [(set (match_dup 3)
11899 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
11902 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
11904 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11906 /* Use output operand as intermediate. */
11907 operands[4] = operands[0];
11909 if (logical_operand (operands[2], <MODE>mode))
11910 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11911 gen_rtx_XOR (<MODE>mode,
11912 operands[1], operands[2])));
11914 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11915 gen_rtx_PLUS (<MODE>mode, operands[1],
11916 negate_rtx (<MODE>mode,
11920 operands[4] = operands[1];
11922 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11925 (define_insn "*eqsi_power"
11926 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11927 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11928 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11929 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11932 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11933 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11934 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11935 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11936 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11937 [(set_attr "type" "three,two,three,three,three")
11938 (set_attr "length" "12,8,12,12,12")])
11940 ;; We have insns of the form shown by the first define_insn below. If
11941 ;; there is something inside the comparison operation, we must split it.
11943 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11944 (plus:SI (match_operator 1 "comparison_operator"
11945 [(match_operand:SI 2 "" "")
11946 (match_operand:SI 3
11947 "reg_or_cint_operand" "")])
11948 (match_operand:SI 4 "gpc_reg_operand" "")))
11949 (clobber (match_operand:SI 5 "register_operand" ""))]
11950 "! gpc_reg_operand (operands[2], SImode)"
11951 [(set (match_dup 5) (match_dup 2))
11952 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11955 (define_insn "*plus_eqsi"
11956 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11957 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11958 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11959 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11962 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11963 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11964 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11965 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11966 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11967 [(set_attr "type" "three,two,three,three,three")
11968 (set_attr "length" "12,8,12,12,12")])
11970 (define_insn "*compare_plus_eqsi"
11971 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11974 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11975 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11976 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11978 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11979 "TARGET_32BIT && optimize_size"
11981 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11982 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11983 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11984 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11985 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11991 [(set_attr "type" "compare")
11992 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11995 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11998 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11999 (match_operand:SI 2 "scc_eq_operand" ""))
12000 (match_operand:SI 3 "gpc_reg_operand" ""))
12002 (clobber (match_scratch:SI 4 ""))]
12003 "TARGET_32BIT && optimize_size && reload_completed"
12004 [(set (match_dup 4)
12005 (plus:SI (eq:SI (match_dup 1)
12009 (compare:CC (match_dup 4)
12013 (define_insn "*plus_eqsi_compare"
12014 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12017 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12018 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12019 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12021 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12022 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12023 "TARGET_32BIT && optimize_size"
12025 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12026 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12027 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12028 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12029 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12035 [(set_attr "type" "compare")
12036 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12039 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12042 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12043 (match_operand:SI 2 "scc_eq_operand" ""))
12044 (match_operand:SI 3 "gpc_reg_operand" ""))
12046 (set (match_operand:SI 0 "gpc_reg_operand" "")
12047 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12048 "TARGET_32BIT && optimize_size && reload_completed"
12049 [(set (match_dup 0)
12050 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12052 (compare:CC (match_dup 0)
12056 (define_insn "*neg_eq0<mode>"
12057 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12058 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12061 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12062 [(set_attr "type" "two")
12063 (set_attr "length" "8")])
12065 (define_insn_and_split "*neg_eq<mode>"
12066 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12067 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12068 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12072 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12074 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12076 /* Use output operand as intermediate. */
12077 operands[3] = operands[0];
12079 if (logical_operand (operands[2], <MODE>mode))
12080 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12081 gen_rtx_XOR (<MODE>mode,
12082 operands[1], operands[2])));
12084 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12085 gen_rtx_PLUS (<MODE>mode, operands[1],
12086 negate_rtx (<MODE>mode,
12090 operands[3] = operands[1];
12093 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12094 ;; since it nabs/sr is just as fast.
12095 (define_insn "*ne0si"
12096 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12097 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12099 (clobber (match_scratch:SI 2 "=&r"))]
12100 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12101 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12102 [(set_attr "type" "two")
12103 (set_attr "length" "8")])
12105 (define_insn "*ne0di"
12106 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12107 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12109 (clobber (match_scratch:DI 2 "=&r"))]
12111 "addic %2,%1,-1\;subfe %0,%2,%1"
12112 [(set_attr "type" "two")
12113 (set_attr "length" "8")])
12115 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12116 (define_insn "*plus_ne0si"
12117 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12118 (plus:SI (lshiftrt:SI
12119 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12121 (match_operand:SI 2 "gpc_reg_operand" "r")))
12122 (clobber (match_scratch:SI 3 "=&r"))]
12124 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12125 [(set_attr "type" "two")
12126 (set_attr "length" "8")])
12128 (define_insn "*plus_ne0di"
12129 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12130 (plus:DI (lshiftrt:DI
12131 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12133 (match_operand:DI 2 "gpc_reg_operand" "r")))
12134 (clobber (match_scratch:DI 3 "=&r"))]
12136 "addic %3,%1,-1\;addze %0,%2"
12137 [(set_attr "type" "two")
12138 (set_attr "length" "8")])
12140 (define_insn "*compare_plus_ne0si"
12141 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12143 (plus:SI (lshiftrt:SI
12144 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12146 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12148 (clobber (match_scratch:SI 3 "=&r,&r"))
12149 (clobber (match_scratch:SI 4 "=X,&r"))]
12152 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12154 [(set_attr "type" "compare")
12155 (set_attr "length" "8,12")])
12158 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12160 (plus:SI (lshiftrt:SI
12161 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12163 (match_operand:SI 2 "gpc_reg_operand" ""))
12165 (clobber (match_scratch:SI 3 ""))
12166 (clobber (match_scratch:SI 4 ""))]
12167 "TARGET_32BIT && reload_completed"
12168 [(parallel [(set (match_dup 3)
12169 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12172 (clobber (match_dup 4))])
12174 (compare:CC (match_dup 3)
12178 (define_insn "*compare_plus_ne0di"
12179 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12181 (plus:DI (lshiftrt:DI
12182 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12184 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12186 (clobber (match_scratch:DI 3 "=&r,&r"))]
12189 addic %3,%1,-1\;addze. %3,%2
12191 [(set_attr "type" "compare")
12192 (set_attr "length" "8,12")])
12195 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12197 (plus:DI (lshiftrt:DI
12198 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12200 (match_operand:DI 2 "gpc_reg_operand" ""))
12202 (clobber (match_scratch:DI 3 ""))]
12203 "TARGET_64BIT && reload_completed"
12204 [(set (match_dup 3)
12205 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12209 (compare:CC (match_dup 3)
12213 (define_insn "*plus_ne0si_compare"
12214 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12216 (plus:SI (lshiftrt:SI
12217 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12219 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12221 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12222 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12224 (clobber (match_scratch:SI 3 "=&r,&r"))]
12227 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12229 [(set_attr "type" "compare")
12230 (set_attr "length" "8,12")])
12233 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12235 (plus:SI (lshiftrt:SI
12236 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12238 (match_operand:SI 2 "gpc_reg_operand" ""))
12240 (set (match_operand:SI 0 "gpc_reg_operand" "")
12241 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12243 (clobber (match_scratch:SI 3 ""))]
12244 "TARGET_32BIT && reload_completed"
12245 [(parallel [(set (match_dup 0)
12246 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12248 (clobber (match_dup 3))])
12250 (compare:CC (match_dup 0)
12254 (define_insn "*plus_ne0di_compare"
12255 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12257 (plus:DI (lshiftrt:DI
12258 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12260 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12262 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12263 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12265 (clobber (match_scratch:DI 3 "=&r,&r"))]
12268 addic %3,%1,-1\;addze. %0,%2
12270 [(set_attr "type" "compare")
12271 (set_attr "length" "8,12")])
12274 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12276 (plus:DI (lshiftrt:DI
12277 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12279 (match_operand:DI 2 "gpc_reg_operand" ""))
12281 (set (match_operand:DI 0 "gpc_reg_operand" "")
12282 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12284 (clobber (match_scratch:DI 3 ""))]
12285 "TARGET_64BIT && reload_completed"
12286 [(parallel [(set (match_dup 0)
12287 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12289 (clobber (match_dup 3))])
12291 (compare:CC (match_dup 0)
12296 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12297 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12298 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12299 (clobber (match_scratch:SI 3 "=r,X"))]
12302 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12303 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12304 [(set_attr "length" "12")])
12307 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12309 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12310 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12312 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12313 (le:SI (match_dup 1) (match_dup 2)))
12314 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12317 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12318 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12321 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12322 (set_attr "length" "12,12,16,16")])
12325 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12327 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12328 (match_operand:SI 2 "reg_or_short_operand" ""))
12330 (set (match_operand:SI 0 "gpc_reg_operand" "")
12331 (le:SI (match_dup 1) (match_dup 2)))
12332 (clobber (match_scratch:SI 3 ""))]
12333 "TARGET_POWER && reload_completed"
12334 [(parallel [(set (match_dup 0)
12335 (le:SI (match_dup 1) (match_dup 2)))
12336 (clobber (match_dup 3))])
12338 (compare:CC (match_dup 0)
12343 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12344 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12345 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12346 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12349 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12350 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12351 [(set_attr "length" "12")])
12354 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12356 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12357 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12358 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12360 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12363 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12364 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12367 [(set_attr "type" "compare")
12368 (set_attr "length" "12,12,16,16")])
12371 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12373 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12374 (match_operand:SI 2 "reg_or_short_operand" ""))
12375 (match_operand:SI 3 "gpc_reg_operand" ""))
12377 (clobber (match_scratch:SI 4 ""))]
12378 "TARGET_POWER && reload_completed"
12379 [(set (match_dup 4)
12380 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12383 (compare:CC (match_dup 4)
12388 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12390 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12391 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12392 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12394 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12395 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12398 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12399 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12402 [(set_attr "type" "compare")
12403 (set_attr "length" "12,12,16,16")])
12406 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12408 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12409 (match_operand:SI 2 "reg_or_short_operand" ""))
12410 (match_operand:SI 3 "gpc_reg_operand" ""))
12412 (set (match_operand:SI 0 "gpc_reg_operand" "")
12413 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12414 "TARGET_POWER && reload_completed"
12415 [(set (match_dup 0)
12416 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12418 (compare:CC (match_dup 0)
12423 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12424 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12425 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12428 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12429 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12430 [(set_attr "length" "12")])
12432 (define_insn "*leu<mode>"
12433 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12434 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12435 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12437 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12438 [(set_attr "type" "three")
12439 (set_attr "length" "12")])
12441 (define_insn "*leu<mode>_compare"
12442 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12444 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12445 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12447 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12448 (leu:P (match_dup 1) (match_dup 2)))]
12451 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12453 [(set_attr "type" "compare")
12454 (set_attr "length" "12,16")])
12457 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12459 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12460 (match_operand:P 2 "reg_or_short_operand" ""))
12462 (set (match_operand:P 0 "gpc_reg_operand" "")
12463 (leu:P (match_dup 1) (match_dup 2)))]
12465 [(set (match_dup 0)
12466 (leu:P (match_dup 1) (match_dup 2)))
12468 (compare:CC (match_dup 0)
12472 (define_insn "*plus_leu<mode>"
12473 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12474 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12475 (match_operand:P 2 "reg_or_short_operand" "rI"))
12476 (match_operand:P 3 "gpc_reg_operand" "r")))]
12478 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12479 [(set_attr "type" "two")
12480 (set_attr "length" "8")])
12483 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12485 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12486 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12487 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12489 (clobber (match_scratch:SI 4 "=&r,&r"))]
12492 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12494 [(set_attr "type" "compare")
12495 (set_attr "length" "8,12")])
12498 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12500 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12501 (match_operand:SI 2 "reg_or_short_operand" ""))
12502 (match_operand:SI 3 "gpc_reg_operand" ""))
12504 (clobber (match_scratch:SI 4 ""))]
12505 "TARGET_32BIT && reload_completed"
12506 [(set (match_dup 4)
12507 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12510 (compare:CC (match_dup 4)
12515 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12517 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12518 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12519 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12521 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12522 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12525 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12527 [(set_attr "type" "compare")
12528 (set_attr "length" "8,12")])
12531 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12533 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12534 (match_operand:SI 2 "reg_or_short_operand" ""))
12535 (match_operand:SI 3 "gpc_reg_operand" ""))
12537 (set (match_operand:SI 0 "gpc_reg_operand" "")
12538 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12539 "TARGET_32BIT && reload_completed"
12540 [(set (match_dup 0)
12541 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12543 (compare:CC (match_dup 0)
12547 (define_insn "*neg_leu<mode>"
12548 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12549 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12550 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12552 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12553 [(set_attr "type" "three")
12554 (set_attr "length" "12")])
12556 (define_insn "*and_neg_leu<mode>"
12557 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12559 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12560 (match_operand:P 2 "reg_or_short_operand" "rI")))
12561 (match_operand:P 3 "gpc_reg_operand" "r")))]
12563 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12564 [(set_attr "type" "three")
12565 (set_attr "length" "12")])
12568 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12571 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12572 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12573 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12575 (clobber (match_scratch:SI 4 "=&r,&r"))]
12578 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12580 [(set_attr "type" "compare")
12581 (set_attr "length" "12,16")])
12584 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12587 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12588 (match_operand:SI 2 "reg_or_short_operand" "")))
12589 (match_operand:SI 3 "gpc_reg_operand" ""))
12591 (clobber (match_scratch:SI 4 ""))]
12592 "TARGET_32BIT && reload_completed"
12593 [(set (match_dup 4)
12594 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12597 (compare:CC (match_dup 4)
12602 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12605 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12606 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12607 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12609 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12610 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12613 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12615 [(set_attr "type" "compare")
12616 (set_attr "length" "12,16")])
12619 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12622 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12623 (match_operand:SI 2 "reg_or_short_operand" "")))
12624 (match_operand:SI 3 "gpc_reg_operand" ""))
12626 (set (match_operand:SI 0 "gpc_reg_operand" "")
12627 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12628 "TARGET_32BIT && reload_completed"
12629 [(set (match_dup 0)
12630 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12633 (compare:CC (match_dup 0)
12638 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12639 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12640 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12642 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12643 [(set_attr "length" "12")])
12646 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12648 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12649 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12651 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12652 (lt:SI (match_dup 1) (match_dup 2)))]
12655 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12657 [(set_attr "type" "delayed_compare")
12658 (set_attr "length" "12,16")])
12661 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12663 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12664 (match_operand:SI 2 "reg_or_short_operand" ""))
12666 (set (match_operand:SI 0 "gpc_reg_operand" "")
12667 (lt:SI (match_dup 1) (match_dup 2)))]
12668 "TARGET_POWER && reload_completed"
12669 [(set (match_dup 0)
12670 (lt:SI (match_dup 1) (match_dup 2)))
12672 (compare:CC (match_dup 0)
12677 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12678 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12679 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12680 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12682 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12683 [(set_attr "length" "12")])
12686 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12688 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12689 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12690 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12692 (clobber (match_scratch:SI 4 "=&r,&r"))]
12695 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12697 [(set_attr "type" "compare")
12698 (set_attr "length" "12,16")])
12701 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12703 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12704 (match_operand:SI 2 "reg_or_short_operand" ""))
12705 (match_operand:SI 3 "gpc_reg_operand" ""))
12707 (clobber (match_scratch:SI 4 ""))]
12708 "TARGET_POWER && reload_completed"
12709 [(set (match_dup 4)
12710 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12713 (compare:CC (match_dup 4)
12718 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12720 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12721 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12722 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12724 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12725 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12728 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12730 [(set_attr "type" "compare")
12731 (set_attr "length" "12,16")])
12734 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12736 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12737 (match_operand:SI 2 "reg_or_short_operand" ""))
12738 (match_operand:SI 3 "gpc_reg_operand" ""))
12740 (set (match_operand:SI 0 "gpc_reg_operand" "")
12741 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12742 "TARGET_POWER && reload_completed"
12743 [(set (match_dup 0)
12744 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12746 (compare:CC (match_dup 0)
12751 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12752 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12753 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12755 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12756 [(set_attr "length" "12")])
12758 (define_insn_and_split "*ltu<mode>"
12759 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12760 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12761 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12765 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12766 (set (match_dup 0) (neg:P (match_dup 0)))]
12769 (define_insn_and_split "*ltu<mode>_compare"
12770 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12772 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12773 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12775 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12776 (ltu:P (match_dup 1) (match_dup 2)))]
12780 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12781 (parallel [(set (match_dup 3)
12782 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12783 (set (match_dup 0) (neg:P (match_dup 0)))])]
12786 (define_insn_and_split "*plus_ltu<mode>"
12787 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
12788 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12789 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12790 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
12793 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12794 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12795 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
12798 (define_insn_and_split "*plus_ltu<mode>_compare"
12799 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12801 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12802 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12803 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
12805 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12806 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
12809 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12810 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12811 (parallel [(set (match_dup 4)
12812 (compare:CC (minus:P (match_dup 3) (match_dup 0))
12814 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
12817 (define_insn "*neg_ltu<mode>"
12818 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12819 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12820 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
12823 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12824 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12825 [(set_attr "type" "two")
12826 (set_attr "length" "8")])
12829 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12830 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12831 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12832 (clobber (match_scratch:SI 3 "=r"))]
12834 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12835 [(set_attr "length" "12")])
12838 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12840 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12841 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12843 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12844 (ge:SI (match_dup 1) (match_dup 2)))
12845 (clobber (match_scratch:SI 3 "=r,r"))]
12848 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12850 [(set_attr "type" "compare")
12851 (set_attr "length" "12,16")])
12854 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12856 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12857 (match_operand:SI 2 "reg_or_short_operand" ""))
12859 (set (match_operand:SI 0 "gpc_reg_operand" "")
12860 (ge:SI (match_dup 1) (match_dup 2)))
12861 (clobber (match_scratch:SI 3 ""))]
12862 "TARGET_POWER && reload_completed"
12863 [(parallel [(set (match_dup 0)
12864 (ge:SI (match_dup 1) (match_dup 2)))
12865 (clobber (match_dup 3))])
12867 (compare:CC (match_dup 0)
12872 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12873 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12874 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12875 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12877 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12878 [(set_attr "length" "12")])
12881 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12883 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12884 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12885 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12887 (clobber (match_scratch:SI 4 "=&r,&r"))]
12890 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12892 [(set_attr "type" "compare")
12893 (set_attr "length" "12,16")])
12896 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12898 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12899 (match_operand:SI 2 "reg_or_short_operand" ""))
12900 (match_operand:SI 3 "gpc_reg_operand" ""))
12902 (clobber (match_scratch:SI 4 ""))]
12903 "TARGET_POWER && reload_completed"
12904 [(set (match_dup 4)
12905 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12908 (compare:CC (match_dup 4)
12913 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12915 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12916 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12917 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12919 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12920 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12923 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12925 [(set_attr "type" "compare")
12926 (set_attr "length" "12,16")])
12929 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12931 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12932 (match_operand:SI 2 "reg_or_short_operand" ""))
12933 (match_operand:SI 3 "gpc_reg_operand" ""))
12935 (set (match_operand:SI 0 "gpc_reg_operand" "")
12936 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12937 "TARGET_POWER && reload_completed"
12938 [(set (match_dup 0)
12939 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12941 (compare:CC (match_dup 0)
12946 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12947 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12948 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12950 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12951 [(set_attr "length" "12")])
12953 (define_insn "*geu<mode>"
12954 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12955 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12956 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12959 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12960 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12961 [(set_attr "type" "three")
12962 (set_attr "length" "12")])
12964 (define_insn "*geu<mode>_compare"
12965 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12967 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12968 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12970 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12971 (geu:P (match_dup 1) (match_dup 2)))]
12974 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12975 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12978 [(set_attr "type" "compare")
12979 (set_attr "length" "12,12,16,16")])
12982 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12984 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
12985 (match_operand:P 2 "reg_or_neg_short_operand" ""))
12987 (set (match_operand:P 0 "gpc_reg_operand" "")
12988 (geu:P (match_dup 1) (match_dup 2)))]
12990 [(set (match_dup 0)
12991 (geu:P (match_dup 1) (match_dup 2)))
12993 (compare:CC (match_dup 0)
12997 (define_insn "*plus_geu<mode>"
12998 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12999 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13000 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13001 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13004 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13005 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13006 [(set_attr "type" "two")
13007 (set_attr "length" "8")])
13010 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13012 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13013 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13014 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13016 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13019 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13020 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13023 [(set_attr "type" "compare")
13024 (set_attr "length" "8,8,12,12")])
13027 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13029 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13030 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13031 (match_operand:SI 3 "gpc_reg_operand" ""))
13033 (clobber (match_scratch:SI 4 ""))]
13034 "TARGET_32BIT && reload_completed"
13035 [(set (match_dup 4)
13036 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13039 (compare:CC (match_dup 4)
13044 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13046 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13047 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13048 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13050 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13051 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13054 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13055 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13058 [(set_attr "type" "compare")
13059 (set_attr "length" "8,8,12,12")])
13062 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13064 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13065 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13066 (match_operand:SI 3 "gpc_reg_operand" ""))
13068 (set (match_operand:SI 0 "gpc_reg_operand" "")
13069 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13070 "TARGET_32BIT && reload_completed"
13071 [(set (match_dup 0)
13072 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13074 (compare:CC (match_dup 0)
13078 (define_insn "*neg_geu<mode>"
13079 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13080 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13081 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13084 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13085 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13086 [(set_attr "type" "three")
13087 (set_attr "length" "12")])
13089 (define_insn "*and_neg_geu<mode>"
13090 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13092 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13093 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13094 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13097 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13098 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13099 [(set_attr "type" "three")
13100 (set_attr "length" "12")])
13103 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13106 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13107 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13108 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13110 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13113 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13114 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13117 [(set_attr "type" "compare")
13118 (set_attr "length" "12,12,16,16")])
13121 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13124 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13125 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13126 (match_operand:SI 3 "gpc_reg_operand" ""))
13128 (clobber (match_scratch:SI 4 ""))]
13129 "TARGET_32BIT && reload_completed"
13130 [(set (match_dup 4)
13131 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13134 (compare:CC (match_dup 4)
13139 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13142 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13143 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13144 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13146 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13147 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13150 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13151 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13154 [(set_attr "type" "compare")
13155 (set_attr "length" "12,12,16,16")])
13158 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13161 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13162 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13163 (match_operand:SI 3 "gpc_reg_operand" ""))
13165 (set (match_operand:SI 0 "gpc_reg_operand" "")
13166 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13167 "TARGET_32BIT && reload_completed"
13168 [(set (match_dup 0)
13169 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13171 (compare:CC (match_dup 0)
13176 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13177 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13178 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13180 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13181 [(set_attr "length" "12")])
13184 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13186 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13187 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13189 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13190 (gt:SI (match_dup 1) (match_dup 2)))]
13193 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13195 [(set_attr "type" "delayed_compare")
13196 (set_attr "length" "12,16")])
13199 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13201 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13202 (match_operand:SI 2 "reg_or_short_operand" ""))
13204 (set (match_operand:SI 0 "gpc_reg_operand" "")
13205 (gt:SI (match_dup 1) (match_dup 2)))]
13206 "TARGET_POWER && reload_completed"
13207 [(set (match_dup 0)
13208 (gt:SI (match_dup 1) (match_dup 2)))
13210 (compare:CC (match_dup 0)
13214 (define_insn "*plus_gt0<mode>"
13215 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13216 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13218 (match_operand:P 2 "gpc_reg_operand" "r")))]
13220 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13221 [(set_attr "type" "three")
13222 (set_attr "length" "12")])
13225 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13227 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13229 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13231 (clobber (match_scratch:SI 3 "=&r,&r"))]
13234 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13236 [(set_attr "type" "compare")
13237 (set_attr "length" "12,16")])
13240 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13242 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13244 (match_operand:SI 2 "gpc_reg_operand" ""))
13246 (clobber (match_scratch:SI 3 ""))]
13247 "TARGET_32BIT && reload_completed"
13248 [(set (match_dup 3)
13249 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13252 (compare:CC (match_dup 3)
13257 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13259 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13261 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13263 (clobber (match_scratch:DI 3 "=&r,&r"))]
13266 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13268 [(set_attr "type" "compare")
13269 (set_attr "length" "12,16")])
13272 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13274 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13276 (match_operand:DI 2 "gpc_reg_operand" ""))
13278 (clobber (match_scratch:DI 3 ""))]
13279 "TARGET_64BIT && reload_completed"
13280 [(set (match_dup 3)
13281 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13284 (compare:CC (match_dup 3)
13289 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13291 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13293 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13295 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13296 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13299 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13301 [(set_attr "type" "compare")
13302 (set_attr "length" "12,16")])
13305 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13307 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13309 (match_operand:SI 2 "gpc_reg_operand" ""))
13311 (set (match_operand:SI 0 "gpc_reg_operand" "")
13312 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13313 "TARGET_32BIT && reload_completed"
13314 [(set (match_dup 0)
13315 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13317 (compare:CC (match_dup 0)
13322 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13324 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13326 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13328 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13329 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13332 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13334 [(set_attr "type" "compare")
13335 (set_attr "length" "12,16")])
13338 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13340 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13342 (match_operand:DI 2 "gpc_reg_operand" ""))
13344 (set (match_operand:DI 0 "gpc_reg_operand" "")
13345 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13346 "TARGET_64BIT && reload_completed"
13347 [(set (match_dup 0)
13348 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13350 (compare:CC (match_dup 0)
13355 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13356 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13357 (match_operand:SI 2 "reg_or_short_operand" "r"))
13358 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13360 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13361 [(set_attr "length" "12")])
13364 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13366 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13367 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13368 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13370 (clobber (match_scratch:SI 4 "=&r,&r"))]
13373 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13375 [(set_attr "type" "compare")
13376 (set_attr "length" "12,16")])
13379 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13381 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13382 (match_operand:SI 2 "reg_or_short_operand" ""))
13383 (match_operand:SI 3 "gpc_reg_operand" ""))
13385 (clobber (match_scratch:SI 4 ""))]
13386 "TARGET_POWER && reload_completed"
13387 [(set (match_dup 4)
13388 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13390 (compare:CC (match_dup 4)
13395 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13397 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13398 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13399 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13401 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13402 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13405 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13407 [(set_attr "type" "compare")
13408 (set_attr "length" "12,16")])
13411 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13413 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13414 (match_operand:SI 2 "reg_or_short_operand" ""))
13415 (match_operand:SI 3 "gpc_reg_operand" ""))
13417 (set (match_operand:SI 0 "gpc_reg_operand" "")
13418 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13419 "TARGET_POWER && reload_completed"
13420 [(set (match_dup 0)
13421 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13423 (compare:CC (match_dup 0)
13428 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13429 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13430 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13432 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13433 [(set_attr "length" "12")])
13435 (define_insn_and_split "*gtu<mode>"
13436 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13437 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13438 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13442 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13443 (set (match_dup 0) (neg:P (match_dup 0)))]
13446 (define_insn_and_split "*gtu<mode>_compare"
13447 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13449 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13450 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13452 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13453 (gtu:P (match_dup 1) (match_dup 2)))]
13457 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13458 (parallel [(set (match_dup 3)
13459 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13460 (set (match_dup 0) (neg:P (match_dup 0)))])]
13463 (define_insn_and_split "*plus_gtu<mode>"
13464 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13465 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13466 (match_operand:P 2 "reg_or_short_operand" "rI"))
13467 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13470 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13471 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13472 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13475 (define_insn_and_split "*plus_gtu<mode>_compare"
13476 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13478 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13479 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13480 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13482 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13483 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13486 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13487 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13488 (parallel [(set (match_dup 4)
13489 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13491 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13494 (define_insn "*neg_gtu<mode>"
13495 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13496 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13497 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13499 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13500 [(set_attr "type" "two")
13501 (set_attr "length" "8")])
13504 ;; Define both directions of branch and return. If we need a reload
13505 ;; register, we'd rather use CR0 since it is much easier to copy a
13506 ;; register CC value to there.
13510 (if_then_else (match_operator 1 "branch_comparison_operator"
13512 "cc_reg_operand" "y")
13514 (label_ref (match_operand 0 "" ""))
13519 return output_cbranch (operands[1], \"%l0\", 0, insn);
13521 [(set_attr "type" "branch")])
13525 (if_then_else (match_operator 0 "branch_comparison_operator"
13527 "cc_reg_operand" "y")
13534 return output_cbranch (operands[0], NULL, 0, insn);
13536 [(set_attr "type" "jmpreg")
13537 (set_attr "length" "4")])
13541 (if_then_else (match_operator 1 "branch_comparison_operator"
13543 "cc_reg_operand" "y")
13546 (label_ref (match_operand 0 "" ""))))]
13550 return output_cbranch (operands[1], \"%l0\", 1, insn);
13552 [(set_attr "type" "branch")])
13556 (if_then_else (match_operator 0 "branch_comparison_operator"
13558 "cc_reg_operand" "y")
13565 return output_cbranch (operands[0], NULL, 1, insn);
13567 [(set_attr "type" "jmpreg")
13568 (set_attr "length" "4")])
13570 ;; Logic on condition register values.
13572 ; This pattern matches things like
13573 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13574 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13576 ; which are generated by the branch logic.
13577 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13579 (define_insn "*cceq_ior_compare"
13580 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13581 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13582 [(match_operator:SI 2
13583 "branch_positive_comparison_operator"
13585 "cc_reg_operand" "y,y")
13587 (match_operator:SI 4
13588 "branch_positive_comparison_operator"
13590 "cc_reg_operand" "0,y")
13594 "cr%q1 %E0,%j2,%j4"
13595 [(set_attr "type" "cr_logical,delayed_cr")])
13597 ; Why is the constant -1 here, but 1 in the previous pattern?
13598 ; Because ~1 has all but the low bit set.
13600 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13601 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13602 [(not:SI (match_operator:SI 2
13603 "branch_positive_comparison_operator"
13605 "cc_reg_operand" "y,y")
13607 (match_operator:SI 4
13608 "branch_positive_comparison_operator"
13610 "cc_reg_operand" "0,y")
13614 "cr%q1 %E0,%j2,%j4"
13615 [(set_attr "type" "cr_logical,delayed_cr")])
13617 (define_insn "*cceq_rev_compare"
13618 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13619 (compare:CCEQ (match_operator:SI 1
13620 "branch_positive_comparison_operator"
13622 "cc_reg_operand" "0,y")
13626 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13627 [(set_attr "type" "cr_logical,delayed_cr")])
13629 ;; If we are comparing the result of two comparisons, this can be done
13630 ;; using creqv or crxor.
13632 (define_insn_and_split ""
13633 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13634 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13635 [(match_operand 2 "cc_reg_operand" "y")
13637 (match_operator 3 "branch_comparison_operator"
13638 [(match_operand 4 "cc_reg_operand" "y")
13643 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13647 int positive_1, positive_2;
13649 positive_1 = branch_positive_comparison_operator (operands[1],
13650 GET_MODE (operands[1]));
13651 positive_2 = branch_positive_comparison_operator (operands[3],
13652 GET_MODE (operands[3]));
13655 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13656 GET_CODE (operands[1])),
13658 operands[2], const0_rtx);
13659 else if (GET_MODE (operands[1]) != SImode)
13660 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13661 operands[2], const0_rtx);
13664 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13665 GET_CODE (operands[3])),
13667 operands[4], const0_rtx);
13668 else if (GET_MODE (operands[3]) != SImode)
13669 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13670 operands[4], const0_rtx);
13672 if (positive_1 == positive_2)
13674 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13675 operands[5] = constm1_rtx;
13679 operands[5] = const1_rtx;
13683 ;; Unconditional branch and return.
13685 (define_insn "jump"
13687 (label_ref (match_operand 0 "" "")))]
13690 [(set_attr "type" "branch")])
13692 (define_insn "return"
13696 [(set_attr "type" "jmpreg")])
13698 (define_expand "indirect_jump"
13699 [(set (pc) (match_operand 0 "register_operand" ""))])
13701 (define_insn "*indirect_jump<mode>"
13702 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13707 [(set_attr "type" "jmpreg")])
13709 ;; Table jump for switch statements:
13710 (define_expand "tablejump"
13711 [(use (match_operand 0 "" ""))
13712 (use (label_ref (match_operand 1 "" "")))]
13717 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13719 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13723 (define_expand "tablejumpsi"
13724 [(set (match_dup 3)
13725 (plus:SI (match_operand:SI 0 "" "")
13727 (parallel [(set (pc) (match_dup 3))
13728 (use (label_ref (match_operand 1 "" "")))])]
13731 { operands[0] = force_reg (SImode, operands[0]);
13732 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13733 operands[3] = gen_reg_rtx (SImode);
13736 (define_expand "tablejumpdi"
13737 [(set (match_dup 4)
13738 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13740 (plus:DI (match_dup 4)
13742 (parallel [(set (pc) (match_dup 3))
13743 (use (label_ref (match_operand 1 "" "")))])]
13746 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13747 operands[3] = gen_reg_rtx (DImode);
13748 operands[4] = gen_reg_rtx (DImode);
13751 (define_insn "*tablejump<mode>_internal1"
13753 (match_operand:P 0 "register_operand" "c,*l"))
13754 (use (label_ref (match_operand 1 "" "")))]
13759 [(set_attr "type" "jmpreg")])
13764 "{cror 0,0,0|nop}")
13766 ;; Define the subtract-one-and-jump insns, starting with the template
13767 ;; so loop.c knows what to generate.
13769 (define_expand "doloop_end"
13770 [(use (match_operand 0 "" "")) ; loop pseudo
13771 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13772 (use (match_operand 2 "" "")) ; max iterations
13773 (use (match_operand 3 "" "")) ; loop level
13774 (use (match_operand 4 "" ""))] ; label
13778 /* Only use this on innermost loops. */
13779 if (INTVAL (operands[3]) > 1)
13783 if (GET_MODE (operands[0]) != DImode)
13785 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13789 if (GET_MODE (operands[0]) != SImode)
13791 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13796 (define_expand "ctr<mode>"
13797 [(parallel [(set (pc)
13798 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13800 (label_ref (match_operand 1 "" ""))
13803 (plus:P (match_dup 0)
13805 (clobber (match_scratch:CC 2 ""))
13806 (clobber (match_scratch:P 3 ""))])]
13810 ;; We need to be able to do this for any operand, including MEM, or we
13811 ;; will cause reload to blow up since we don't allow output reloads on
13813 ;; For the length attribute to be calculated correctly, the
13814 ;; label MUST be operand 0.
13816 (define_insn "*ctr<mode>_internal1"
13818 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13820 (label_ref (match_operand 0 "" ""))
13822 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13823 (plus:P (match_dup 1)
13825 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13826 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13830 if (which_alternative != 0)
13832 else if (get_attr_length (insn) == 4)
13833 return \"{bdn|bdnz} %l0\";
13835 return \"bdz $+8\;b %l0\";
13837 [(set_attr "type" "branch")
13838 (set_attr "length" "*,12,16,16")])
13840 (define_insn "*ctr<mode>_internal2"
13842 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13845 (label_ref (match_operand 0 "" ""))))
13846 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13847 (plus:P (match_dup 1)
13849 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13850 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13854 if (which_alternative != 0)
13856 else if (get_attr_length (insn) == 4)
13857 return \"bdz %l0\";
13859 return \"{bdn|bdnz} $+8\;b %l0\";
13861 [(set_attr "type" "branch")
13862 (set_attr "length" "*,12,16,16")])
13864 ;; Similar but use EQ
13866 (define_insn "*ctr<mode>_internal5"
13868 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13870 (label_ref (match_operand 0 "" ""))
13872 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13873 (plus:P (match_dup 1)
13875 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13876 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13880 if (which_alternative != 0)
13882 else if (get_attr_length (insn) == 4)
13883 return \"bdz %l0\";
13885 return \"{bdn|bdnz} $+8\;b %l0\";
13887 [(set_attr "type" "branch")
13888 (set_attr "length" "*,12,16,16")])
13890 (define_insn "*ctr<mode>_internal6"
13892 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13895 (label_ref (match_operand 0 "" ""))))
13896 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13897 (plus:P (match_dup 1)
13899 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13900 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13904 if (which_alternative != 0)
13906 else if (get_attr_length (insn) == 4)
13907 return \"{bdn|bdnz} %l0\";
13909 return \"bdz $+8\;b %l0\";
13911 [(set_attr "type" "branch")
13912 (set_attr "length" "*,12,16,16")])
13914 ;; Now the splitters if we could not allocate the CTR register
13918 (if_then_else (match_operator 2 "comparison_operator"
13919 [(match_operand:P 1 "gpc_reg_operand" "")
13921 (match_operand 5 "" "")
13922 (match_operand 6 "" "")))
13923 (set (match_operand:P 0 "gpc_reg_operand" "")
13924 (plus:P (match_dup 1) (const_int -1)))
13925 (clobber (match_scratch:CC 3 ""))
13926 (clobber (match_scratch:P 4 ""))]
13928 [(parallel [(set (match_dup 3)
13929 (compare:CC (plus:P (match_dup 1)
13933 (plus:P (match_dup 1)
13935 (set (pc) (if_then_else (match_dup 7)
13939 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13940 operands[3], const0_rtx); }")
13944 (if_then_else (match_operator 2 "comparison_operator"
13945 [(match_operand:P 1 "gpc_reg_operand" "")
13947 (match_operand 5 "" "")
13948 (match_operand 6 "" "")))
13949 (set (match_operand:P 0 "nonimmediate_operand" "")
13950 (plus:P (match_dup 1) (const_int -1)))
13951 (clobber (match_scratch:CC 3 ""))
13952 (clobber (match_scratch:P 4 ""))]
13953 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13954 [(parallel [(set (match_dup 3)
13955 (compare:CC (plus:P (match_dup 1)
13959 (plus:P (match_dup 1)
13963 (set (pc) (if_then_else (match_dup 7)
13967 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13968 operands[3], const0_rtx); }")
13970 (define_insn "trap"
13971 [(trap_if (const_int 1) (const_int 0))]
13975 (define_expand "conditional_trap"
13976 [(trap_if (match_operator 0 "trap_comparison_operator"
13977 [(match_dup 2) (match_dup 3)])
13978 (match_operand 1 "const_int_operand" ""))]
13980 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
13981 operands[2] = rs6000_compare_op0;
13982 operands[3] = rs6000_compare_op1;")
13985 [(trap_if (match_operator 0 "trap_comparison_operator"
13986 [(match_operand:GPR 1 "register_operand" "r")
13987 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13990 "{t|t<wd>}%V0%I2 %1,%2")
13992 ;; Insns related to generating the function prologue and epilogue.
13994 (define_expand "prologue"
13995 [(use (const_int 0))]
13996 "TARGET_SCHED_PROLOG"
13999 rs6000_emit_prologue ();
14003 (define_insn "*movesi_from_cr_one"
14004 [(match_parallel 0 "mfcr_operation"
14005 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14006 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14007 (match_operand 3 "immediate_operand" "n")]
14008 UNSPEC_MOVESI_FROM_CR))])]
14014 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14016 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14017 operands[4] = GEN_INT (mask);
14018 output_asm_insn (\"mfcr %1,%4\", operands);
14022 [(set_attr "type" "mfcrf")])
14024 (define_insn "movesi_from_cr"
14025 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14026 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14027 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14028 UNSPEC_MOVESI_FROM_CR))]
14031 [(set_attr "type" "mfcr")])
14033 (define_insn "*stmw"
14034 [(match_parallel 0 "stmw_operation"
14035 [(set (match_operand:SI 1 "memory_operand" "=m")
14036 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14039 [(set_attr "type" "store_ux")])
14041 (define_insn "*save_fpregs_<mode>"
14042 [(match_parallel 0 "any_parallel_operand"
14043 [(clobber (match_operand:P 1 "register_operand" "=l"))
14044 (use (match_operand:P 2 "call_operand" "s"))
14045 (set (match_operand:DF 3 "memory_operand" "=m")
14046 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14049 [(set_attr "type" "branch")
14050 (set_attr "length" "4")])
14052 ; These are to explain that changes to the stack pointer should
14053 ; not be moved over stores to stack memory.
14054 (define_insn "stack_tie"
14055 [(set (match_operand:BLK 0 "memory_operand" "+m")
14056 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14059 [(set_attr "length" "0")])
14062 (define_expand "epilogue"
14063 [(use (const_int 0))]
14064 "TARGET_SCHED_PROLOG"
14067 rs6000_emit_epilogue (FALSE);
14071 ; On some processors, doing the mtcrf one CC register at a time is
14072 ; faster (like on the 604e). On others, doing them all at once is
14073 ; faster; for instance, on the 601 and 750.
14075 (define_expand "movsi_to_cr_one"
14076 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14077 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14078 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14080 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14082 (define_insn "*movsi_to_cr"
14083 [(match_parallel 0 "mtcrf_operation"
14084 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14085 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14086 (match_operand 3 "immediate_operand" "n")]
14087 UNSPEC_MOVESI_TO_CR))])]
14093 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14094 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14095 operands[4] = GEN_INT (mask);
14096 return \"mtcrf %4,%2\";
14098 [(set_attr "type" "mtcr")])
14100 (define_insn "*mtcrfsi"
14101 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14102 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14103 (match_operand 2 "immediate_operand" "n")]
14104 UNSPEC_MOVESI_TO_CR))]
14105 "GET_CODE (operands[0]) == REG
14106 && CR_REGNO_P (REGNO (operands[0]))
14107 && GET_CODE (operands[2]) == CONST_INT
14108 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14110 [(set_attr "type" "mtcr")])
14112 ; The load-multiple instructions have similar properties.
14113 ; Note that "load_multiple" is a name known to the machine-independent
14114 ; code that actually corresponds to the PowerPC load-string.
14116 (define_insn "*lmw"
14117 [(match_parallel 0 "lmw_operation"
14118 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14119 (match_operand:SI 2 "memory_operand" "m"))])]
14122 [(set_attr "type" "load_ux")])
14124 (define_insn "*return_internal_<mode>"
14126 (use (match_operand:P 0 "register_operand" "lc"))]
14129 [(set_attr "type" "jmpreg")])
14131 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14132 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14134 (define_insn "*return_and_restore_fpregs_<mode>"
14135 [(match_parallel 0 "any_parallel_operand"
14137 (use (match_operand:P 1 "register_operand" "l"))
14138 (use (match_operand:P 2 "call_operand" "s"))
14139 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14140 (match_operand:DF 4 "memory_operand" "m"))])]
14144 ; This is used in compiling the unwind routines.
14145 (define_expand "eh_return"
14146 [(use (match_operand 0 "general_operand" ""))]
14151 emit_insn (gen_eh_set_lr_si (operands[0]));
14153 emit_insn (gen_eh_set_lr_di (operands[0]));
14157 ; We can't expand this before we know where the link register is stored.
14158 (define_insn "eh_set_lr_<mode>"
14159 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14161 (clobber (match_scratch:P 1 "=&b"))]
14166 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14167 (clobber (match_scratch 1 ""))]
14172 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14176 (define_insn "prefetch"
14177 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14178 (match_operand:SI 1 "const_int_operand" "n")
14179 (match_operand:SI 2 "const_int_operand" "n"))]
14183 if (GET_CODE (operands[0]) == REG)
14184 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14185 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14187 [(set_attr "type" "load")])
14190 (include "sync.md")
14191 (include "altivec.md")