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, 2007
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 3, 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 COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
43 (FIRST_ALTIVEC_REGNO 77)
44 (LAST_ALTIVEC_REGNO 108)
57 [(UNSPEC_FRSP 0) ; frsp for POWER machines
58 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
59 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
60 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
62 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
68 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
69 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
72 (UNSPEC_MOVESI_FROM_CR 19)
73 (UNSPEC_MOVESI_TO_CR 20)
75 (UNSPEC_TLSDTPRELHA 22)
76 (UNSPEC_TLSDTPRELLO 23)
77 (UNSPEC_TLSGOTDTPREL 24)
79 (UNSPEC_TLSTPRELHA 26)
80 (UNSPEC_TLSTPRELLO 27)
81 (UNSPEC_TLSGOTTPREL 28)
83 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
84 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
100 (UNSPEC_DLMZB_STRLEN 47)
106 ;; UNSPEC_VOLATILE usage
111 (UNSPECV_LL 1) ; load-locked
112 (UNSPECV_SC 2) ; store-conditional
113 (UNSPECV_EH_RR 9) ; eh_reg_restore
116 ;; Define an insn type attribute. This is used in function unit delay
118 (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,var_delayed_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,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr"
119 (const_string "integer"))
121 ;; Length (in bytes).
122 ; '(pc)' in the following doesn't include the instruction itself; it is
123 ; calculated as if the instruction had zero size.
124 (define_attr "length" ""
125 (if_then_else (eq_attr "type" "branch")
126 (if_then_else (and (ge (minus (match_dup 0) (pc))
128 (lt (minus (match_dup 0) (pc))
134 ;; Processor type -- this attribute must exactly match the processor_type
135 ;; enumeration in rs6000.h.
137 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,power4,power5,power6,cell"
138 (const (symbol_ref "rs6000_cpu_attr")))
141 ;; If this instruction is microcoded on the CELL processor
142 ; The default for load and stores is conditional
143 ; The default for load extended and the recorded instructions is always microcoded
144 (define_attr "cell_micro" "not,conditional,always"
145 (if_then_else (ior (ior (eq_attr "type" "load")
146 (eq_attr "type" "store"))
147 (ior (eq_attr "type" "fpload")
148 (eq_attr "type" "fpstore")))
149 (const_string "conditional")
150 (if_then_else (ior (eq_attr "type" "load_ext")
151 (ior (eq_attr "type" "compare")
152 (eq_attr "type" "delayed_compare")))
153 (const_string "always")
154 (const_string "not"))))
157 (automata_option "ndfa")
170 (include "e300c2c3.md")
171 (include "e500mc.md")
172 (include "power4.md")
173 (include "power5.md")
174 (include "power6.md")
177 (include "predicates.md")
178 (include "constraints.md")
180 (include "darwin.md")
185 ; This mode iterator allows :GPR to be used to indicate the allowable size
186 ; of whole values in GPRs.
187 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
189 ; Any supported integer mode.
190 (define_mode_iterator INT [QI HI SI DI TI])
192 ; Any supported integer mode that fits in one register.
193 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
195 ; extend modes for DImode
196 (define_mode_iterator QHSI [QI HI SI])
198 ; SImode or DImode, even if DImode doesn't fit in GPRs.
199 (define_mode_iterator SDI [SI DI])
201 ; The size of a pointer. Also, the size of the value that a record-condition
202 ; (one with a '.') will compare.
203 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
205 ; Any hardware-supported floating-point mode
206 (define_mode_iterator FP [
207 (SF "TARGET_HARD_FLOAT
208 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
209 (DF "TARGET_HARD_FLOAT
210 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
211 (TF "!TARGET_IEEEQUAD
213 && (TARGET_FPRS || TARGET_E500_DOUBLE)
214 && TARGET_LONG_DOUBLE_128")
218 ; Various instructions that come in SI and DI forms.
219 ; A generic w/d attribute, for things like cmpw/cmpd.
220 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
223 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
226 ;; Start with fixed-point load and store insns. Here we put only the more
227 ;; complex forms. Basic data transfer is done later.
229 (define_expand "zero_extend<mode>di2"
230 [(set (match_operand:DI 0 "gpc_reg_operand" "")
231 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
235 (define_insn "*zero_extend<mode>di2_internal1"
236 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
237 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
241 rldicl %0,%1,0,<dbits>"
242 [(set_attr "type" "load,*")])
244 (define_insn "*zero_extend<mode>di2_internal2"
245 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
246 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
248 (clobber (match_scratch:DI 2 "=r,r"))]
251 rldicl. %2,%1,0,<dbits>
253 [(set_attr "type" "compare")
254 (set_attr "length" "4,8")])
257 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
258 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
260 (clobber (match_scratch:DI 2 ""))]
261 "TARGET_POWERPC64 && reload_completed"
263 (zero_extend:DI (match_dup 1)))
265 (compare:CC (match_dup 2)
269 (define_insn "*zero_extend<mode>di2_internal3"
270 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
271 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
273 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
274 (zero_extend:DI (match_dup 1)))]
277 rldicl. %0,%1,0,<dbits>
279 [(set_attr "type" "compare")
280 (set_attr "length" "4,8")])
283 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
284 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
286 (set (match_operand:DI 0 "gpc_reg_operand" "")
287 (zero_extend:DI (match_dup 1)))]
288 "TARGET_POWERPC64 && reload_completed"
290 (zero_extend:DI (match_dup 1)))
292 (compare:CC (match_dup 0)
296 (define_insn "extendqidi2"
297 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
298 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
301 [(set_attr "type" "exts")])
304 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
305 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
307 (clobber (match_scratch:DI 2 "=r,r"))]
312 [(set_attr "type" "compare")
313 (set_attr "length" "4,8")])
316 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
317 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
319 (clobber (match_scratch:DI 2 ""))]
320 "TARGET_POWERPC64 && reload_completed"
322 (sign_extend:DI (match_dup 1)))
324 (compare:CC (match_dup 2)
329 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
330 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
332 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
333 (sign_extend:DI (match_dup 1)))]
338 [(set_attr "type" "compare")
339 (set_attr "length" "4,8")])
342 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
343 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
345 (set (match_operand:DI 0 "gpc_reg_operand" "")
346 (sign_extend:DI (match_dup 1)))]
347 "TARGET_POWERPC64 && reload_completed"
349 (sign_extend:DI (match_dup 1)))
351 (compare:CC (match_dup 0)
355 (define_expand "extendhidi2"
356 [(set (match_operand:DI 0 "gpc_reg_operand" "")
357 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
362 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
363 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
368 [(set_attr "type" "load_ext,exts")])
371 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
372 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
374 (clobber (match_scratch:DI 2 "=r,r"))]
379 [(set_attr "type" "compare")
380 (set_attr "length" "4,8")])
383 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
384 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
386 (clobber (match_scratch:DI 2 ""))]
387 "TARGET_POWERPC64 && reload_completed"
389 (sign_extend:DI (match_dup 1)))
391 (compare:CC (match_dup 2)
396 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
397 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
399 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
400 (sign_extend:DI (match_dup 1)))]
405 [(set_attr "type" "compare")
406 (set_attr "length" "4,8")])
409 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
410 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
412 (set (match_operand:DI 0 "gpc_reg_operand" "")
413 (sign_extend:DI (match_dup 1)))]
414 "TARGET_POWERPC64 && reload_completed"
416 (sign_extend:DI (match_dup 1)))
418 (compare:CC (match_dup 0)
422 (define_expand "extendsidi2"
423 [(set (match_operand:DI 0 "gpc_reg_operand" "")
424 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
429 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
430 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
435 [(set_attr "type" "load_ext,exts")])
438 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
439 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
441 (clobber (match_scratch:DI 2 "=r,r"))]
446 [(set_attr "type" "compare")
447 (set_attr "length" "4,8")])
450 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
451 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
453 (clobber (match_scratch:DI 2 ""))]
454 "TARGET_POWERPC64 && reload_completed"
456 (sign_extend:DI (match_dup 1)))
458 (compare:CC (match_dup 2)
463 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
464 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
466 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
467 (sign_extend:DI (match_dup 1)))]
472 [(set_attr "type" "compare")
473 (set_attr "length" "4,8")])
476 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
477 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
479 (set (match_operand:DI 0 "gpc_reg_operand" "")
480 (sign_extend:DI (match_dup 1)))]
481 "TARGET_POWERPC64 && reload_completed"
483 (sign_extend:DI (match_dup 1)))
485 (compare:CC (match_dup 0)
489 (define_expand "zero_extendqisi2"
490 [(set (match_operand:SI 0 "gpc_reg_operand" "")
491 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
496 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
497 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
501 {rlinm|rlwinm} %0,%1,0,0xff"
502 [(set_attr "type" "load,*")])
505 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
506 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
508 (clobber (match_scratch:SI 2 "=r,r"))]
511 {andil.|andi.} %2,%1,0xff
513 [(set_attr "type" "compare")
514 (set_attr "length" "4,8")])
517 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
518 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
520 (clobber (match_scratch:SI 2 ""))]
523 (zero_extend:SI (match_dup 1)))
525 (compare:CC (match_dup 2)
530 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
531 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
533 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
534 (zero_extend:SI (match_dup 1)))]
537 {andil.|andi.} %0,%1,0xff
539 [(set_attr "type" "compare")
540 (set_attr "length" "4,8")])
543 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
544 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
546 (set (match_operand:SI 0 "gpc_reg_operand" "")
547 (zero_extend:SI (match_dup 1)))]
550 (zero_extend:SI (match_dup 1)))
552 (compare:CC (match_dup 0)
556 (define_expand "extendqisi2"
557 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
558 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
563 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
564 else if (TARGET_POWER)
565 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
567 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
571 (define_insn "extendqisi2_ppc"
572 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
573 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
576 [(set_attr "type" "exts")])
579 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
580 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
582 (clobber (match_scratch:SI 2 "=r,r"))]
587 [(set_attr "type" "compare")
588 (set_attr "length" "4,8")])
591 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
592 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
594 (clobber (match_scratch:SI 2 ""))]
595 "TARGET_POWERPC && reload_completed"
597 (sign_extend:SI (match_dup 1)))
599 (compare:CC (match_dup 2)
604 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
605 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
607 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
608 (sign_extend:SI (match_dup 1)))]
613 [(set_attr "type" "compare")
614 (set_attr "length" "4,8")])
617 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
618 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
620 (set (match_operand:SI 0 "gpc_reg_operand" "")
621 (sign_extend:SI (match_dup 1)))]
622 "TARGET_POWERPC && reload_completed"
624 (sign_extend:SI (match_dup 1)))
626 (compare:CC (match_dup 0)
630 (define_expand "extendqisi2_power"
631 [(parallel [(set (match_dup 2)
632 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
634 (clobber (scratch:SI))])
635 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
636 (ashiftrt:SI (match_dup 2)
638 (clobber (scratch:SI))])]
641 { operands[1] = gen_lowpart (SImode, operands[1]);
642 operands[2] = gen_reg_rtx (SImode); }")
644 (define_expand "extendqisi2_no_power"
646 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
648 (set (match_operand:SI 0 "gpc_reg_operand" "")
649 (ashiftrt:SI (match_dup 2)
651 "! TARGET_POWER && ! TARGET_POWERPC"
653 { operands[1] = gen_lowpart (SImode, operands[1]);
654 operands[2] = gen_reg_rtx (SImode); }")
656 (define_expand "zero_extendqihi2"
657 [(set (match_operand:HI 0 "gpc_reg_operand" "")
658 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
663 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
664 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
668 {rlinm|rlwinm} %0,%1,0,0xff"
669 [(set_attr "type" "load,*")])
672 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
673 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
675 (clobber (match_scratch:HI 2 "=r,r"))]
678 {andil.|andi.} %2,%1,0xff
680 [(set_attr "type" "compare")
681 (set_attr "length" "4,8")])
684 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
685 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
687 (clobber (match_scratch:HI 2 ""))]
690 (zero_extend:HI (match_dup 1)))
692 (compare:CC (match_dup 2)
697 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
698 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
700 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
701 (zero_extend:HI (match_dup 1)))]
704 {andil.|andi.} %0,%1,0xff
706 [(set_attr "type" "compare")
707 (set_attr "length" "4,8")])
710 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
711 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
713 (set (match_operand:HI 0 "gpc_reg_operand" "")
714 (zero_extend:HI (match_dup 1)))]
717 (zero_extend:HI (match_dup 1)))
719 (compare:CC (match_dup 0)
723 (define_expand "extendqihi2"
724 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
725 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
730 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
731 else if (TARGET_POWER)
732 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
734 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
738 (define_insn "extendqihi2_ppc"
739 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
740 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
743 [(set_attr "type" "exts")])
746 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
747 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
749 (clobber (match_scratch:HI 2 "=r,r"))]
754 [(set_attr "type" "compare")
755 (set_attr "length" "4,8")])
758 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
759 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
761 (clobber (match_scratch:HI 2 ""))]
762 "TARGET_POWERPC && reload_completed"
764 (sign_extend:HI (match_dup 1)))
766 (compare:CC (match_dup 2)
771 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
772 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
774 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
775 (sign_extend:HI (match_dup 1)))]
780 [(set_attr "type" "compare")
781 (set_attr "length" "4,8")])
784 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
785 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
787 (set (match_operand:HI 0 "gpc_reg_operand" "")
788 (sign_extend:HI (match_dup 1)))]
789 "TARGET_POWERPC && reload_completed"
791 (sign_extend:HI (match_dup 1)))
793 (compare:CC (match_dup 0)
797 (define_expand "extendqihi2_power"
798 [(parallel [(set (match_dup 2)
799 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
801 (clobber (scratch:SI))])
802 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
803 (ashiftrt:SI (match_dup 2)
805 (clobber (scratch:SI))])]
808 { operands[0] = gen_lowpart (SImode, operands[0]);
809 operands[1] = gen_lowpart (SImode, operands[1]);
810 operands[2] = gen_reg_rtx (SImode); }")
812 (define_expand "extendqihi2_no_power"
814 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
816 (set (match_operand:HI 0 "gpc_reg_operand" "")
817 (ashiftrt:SI (match_dup 2)
819 "! TARGET_POWER && ! TARGET_POWERPC"
821 { operands[0] = gen_lowpart (SImode, operands[0]);
822 operands[1] = gen_lowpart (SImode, operands[1]);
823 operands[2] = gen_reg_rtx (SImode); }")
825 (define_expand "zero_extendhisi2"
826 [(set (match_operand:SI 0 "gpc_reg_operand" "")
827 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
833 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
837 {rlinm|rlwinm} %0,%1,0,0xffff"
838 [(set_attr "type" "load,*")])
841 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
842 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
844 (clobber (match_scratch:SI 2 "=r,r"))]
847 {andil.|andi.} %2,%1,0xffff
849 [(set_attr "type" "compare")
850 (set_attr "length" "4,8")])
853 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
854 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
856 (clobber (match_scratch:SI 2 ""))]
859 (zero_extend:SI (match_dup 1)))
861 (compare:CC (match_dup 2)
866 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
867 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
869 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
870 (zero_extend:SI (match_dup 1)))]
873 {andil.|andi.} %0,%1,0xffff
875 [(set_attr "type" "compare")
876 (set_attr "length" "4,8")])
879 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
880 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
882 (set (match_operand:SI 0 "gpc_reg_operand" "")
883 (zero_extend:SI (match_dup 1)))]
886 (zero_extend:SI (match_dup 1)))
888 (compare:CC (match_dup 0)
892 (define_expand "extendhisi2"
893 [(set (match_operand:SI 0 "gpc_reg_operand" "")
894 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
899 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
900 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
905 [(set_attr "type" "load_ext,exts")])
908 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
909 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
911 (clobber (match_scratch:SI 2 "=r,r"))]
916 [(set_attr "type" "compare")
917 (set_attr "length" "4,8")])
920 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
921 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
923 (clobber (match_scratch:SI 2 ""))]
926 (sign_extend:SI (match_dup 1)))
928 (compare:CC (match_dup 2)
933 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
934 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
936 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
937 (sign_extend:SI (match_dup 1)))]
942 [(set_attr "type" "compare")
943 (set_attr "length" "4,8")])
945 ;; IBM 405, 440 and 464 half-word multiplication operations.
947 (define_insn "*macchwc"
948 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
949 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
950 (match_operand:SI 2 "gpc_reg_operand" "r")
953 (match_operand:HI 1 "gpc_reg_operand" "r")))
954 (match_operand:SI 4 "gpc_reg_operand" "0"))
956 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
957 (plus:SI (mult:SI (ashiftrt:SI
965 [(set_attr "type" "imul3")])
967 (define_insn "*macchw"
968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
969 (plus:SI (mult:SI (ashiftrt:SI
970 (match_operand:SI 2 "gpc_reg_operand" "r")
973 (match_operand:HI 1 "gpc_reg_operand" "r")))
974 (match_operand:SI 3 "gpc_reg_operand" "0")))]
977 [(set_attr "type" "imul3")])
979 (define_insn "*macchwuc"
980 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
981 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
982 (match_operand:SI 2 "gpc_reg_operand" "r")
985 (match_operand:HI 1 "gpc_reg_operand" "r")))
986 (match_operand:SI 4 "gpc_reg_operand" "0"))
988 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
989 (plus:SI (mult:SI (lshiftrt:SI
996 "macchwu. %0, %1, %2"
997 [(set_attr "type" "imul3")])
999 (define_insn "*macchwu"
1000 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1001 (plus:SI (mult:SI (lshiftrt:SI
1002 (match_operand:SI 2 "gpc_reg_operand" "r")
1005 (match_operand:HI 1 "gpc_reg_operand" "r")))
1006 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1008 "macchwu %0, %1, %2"
1009 [(set_attr "type" "imul3")])
1011 (define_insn "*machhwc"
1012 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1013 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1014 (match_operand:SI 1 "gpc_reg_operand" "%r")
1017 (match_operand:SI 2 "gpc_reg_operand" "r")
1019 (match_operand:SI 4 "gpc_reg_operand" "0"))
1021 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1022 (plus:SI (mult:SI (ashiftrt:SI
1030 "machhw. %0, %1, %2"
1031 [(set_attr "type" "imul3")])
1033 (define_insn "*machhw"
1034 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1035 (plus:SI (mult:SI (ashiftrt:SI
1036 (match_operand:SI 1 "gpc_reg_operand" "%r")
1039 (match_operand:SI 2 "gpc_reg_operand" "r")
1041 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1044 [(set_attr "type" "imul3")])
1046 (define_insn "*machhwuc"
1047 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1048 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1049 (match_operand:SI 1 "gpc_reg_operand" "%r")
1052 (match_operand:SI 2 "gpc_reg_operand" "r")
1054 (match_operand:SI 4 "gpc_reg_operand" "0"))
1056 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1057 (plus:SI (mult:SI (lshiftrt:SI
1065 "machhwu. %0, %1, %2"
1066 [(set_attr "type" "imul3")])
1068 (define_insn "*machhwu"
1069 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1070 (plus:SI (mult:SI (lshiftrt:SI
1071 (match_operand:SI 1 "gpc_reg_operand" "%r")
1074 (match_operand:SI 2 "gpc_reg_operand" "r")
1076 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1078 "machhwu %0, %1, %2"
1079 [(set_attr "type" "imul3")])
1081 (define_insn "*maclhwc"
1082 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1083 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1084 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1086 (match_operand:HI 2 "gpc_reg_operand" "r")))
1087 (match_operand:SI 4 "gpc_reg_operand" "0"))
1089 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1090 (plus:SI (mult:SI (sign_extend:SI
1096 "maclhw. %0, %1, %2"
1097 [(set_attr "type" "imul3")])
1099 (define_insn "*maclhw"
1100 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1101 (plus:SI (mult:SI (sign_extend:SI
1102 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1104 (match_operand:HI 2 "gpc_reg_operand" "r")))
1105 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1108 [(set_attr "type" "imul3")])
1110 (define_insn "*maclhwuc"
1111 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1112 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1113 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1115 (match_operand:HI 2 "gpc_reg_operand" "r")))
1116 (match_operand:SI 4 "gpc_reg_operand" "0"))
1118 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1119 (plus:SI (mult:SI (zero_extend:SI
1125 "maclhwu. %0, %1, %2"
1126 [(set_attr "type" "imul3")])
1128 (define_insn "*maclhwu"
1129 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1130 (plus:SI (mult:SI (zero_extend:SI
1131 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1133 (match_operand:HI 2 "gpc_reg_operand" "r")))
1134 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1136 "maclhwu %0, %1, %2"
1137 [(set_attr "type" "imul3")])
1139 (define_insn "*nmacchwc"
1140 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1141 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1142 (mult:SI (ashiftrt:SI
1143 (match_operand:SI 2 "gpc_reg_operand" "r")
1146 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1148 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1149 (minus:SI (match_dup 4)
1150 (mult:SI (ashiftrt:SI
1156 "nmacchw. %0, %1, %2"
1157 [(set_attr "type" "imul3")])
1159 (define_insn "*nmacchw"
1160 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1161 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1162 (mult:SI (ashiftrt:SI
1163 (match_operand:SI 2 "gpc_reg_operand" "r")
1166 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1168 "nmacchw %0, %1, %2"
1169 [(set_attr "type" "imul3")])
1171 (define_insn "*nmachhwc"
1172 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1173 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1174 (mult:SI (ashiftrt:SI
1175 (match_operand:SI 1 "gpc_reg_operand" "%r")
1178 (match_operand:SI 2 "gpc_reg_operand" "r")
1181 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1182 (minus:SI (match_dup 4)
1183 (mult:SI (ashiftrt:SI
1190 "nmachhw. %0, %1, %2"
1191 [(set_attr "type" "imul3")])
1193 (define_insn "*nmachhw"
1194 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1195 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1196 (mult:SI (ashiftrt:SI
1197 (match_operand:SI 1 "gpc_reg_operand" "%r")
1200 (match_operand:SI 2 "gpc_reg_operand" "r")
1203 "nmachhw %0, %1, %2"
1204 [(set_attr "type" "imul3")])
1206 (define_insn "*nmaclhwc"
1207 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1208 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1209 (mult:SI (sign_extend:SI
1210 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1212 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1214 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1215 (minus:SI (match_dup 4)
1216 (mult:SI (sign_extend:SI
1221 "nmaclhw. %0, %1, %2"
1222 [(set_attr "type" "imul3")])
1224 (define_insn "*nmaclhw"
1225 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1226 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1227 (mult:SI (sign_extend:SI
1228 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1230 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1232 "nmaclhw %0, %1, %2"
1233 [(set_attr "type" "imul3")])
1235 (define_insn "*mulchwc"
1236 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1237 (compare:CC (mult:SI (ashiftrt:SI
1238 (match_operand:SI 2 "gpc_reg_operand" "r")
1241 (match_operand:HI 1 "gpc_reg_operand" "r")))
1243 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1244 (mult:SI (ashiftrt:SI
1250 "mulchw. %0, %1, %2"
1251 [(set_attr "type" "imul3")])
1253 (define_insn "*mulchw"
1254 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1255 (mult:SI (ashiftrt:SI
1256 (match_operand:SI 2 "gpc_reg_operand" "r")
1259 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1262 [(set_attr "type" "imul3")])
1264 (define_insn "*mulchwuc"
1265 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1266 (compare:CC (mult:SI (lshiftrt:SI
1267 (match_operand:SI 2 "gpc_reg_operand" "r")
1270 (match_operand:HI 1 "gpc_reg_operand" "r")))
1272 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1273 (mult:SI (lshiftrt:SI
1279 "mulchwu. %0, %1, %2"
1280 [(set_attr "type" "imul3")])
1282 (define_insn "*mulchwu"
1283 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1284 (mult:SI (lshiftrt:SI
1285 (match_operand:SI 2 "gpc_reg_operand" "r")
1288 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1290 "mulchwu %0, %1, %2"
1291 [(set_attr "type" "imul3")])
1293 (define_insn "*mulhhwc"
1294 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1295 (compare:CC (mult:SI (ashiftrt:SI
1296 (match_operand:SI 1 "gpc_reg_operand" "%r")
1299 (match_operand:SI 2 "gpc_reg_operand" "r")
1302 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1303 (mult:SI (ashiftrt:SI
1310 "mulhhw. %0, %1, %2"
1311 [(set_attr "type" "imul3")])
1313 (define_insn "*mulhhw"
1314 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1315 (mult:SI (ashiftrt:SI
1316 (match_operand:SI 1 "gpc_reg_operand" "%r")
1319 (match_operand:SI 2 "gpc_reg_operand" "r")
1323 [(set_attr "type" "imul3")])
1325 (define_insn "*mulhhwuc"
1326 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1327 (compare:CC (mult:SI (lshiftrt:SI
1328 (match_operand:SI 1 "gpc_reg_operand" "%r")
1331 (match_operand:SI 2 "gpc_reg_operand" "r")
1334 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1335 (mult:SI (lshiftrt:SI
1342 "mulhhwu. %0, %1, %2"
1343 [(set_attr "type" "imul3")])
1345 (define_insn "*mulhhwu"
1346 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1347 (mult:SI (lshiftrt:SI
1348 (match_operand:SI 1 "gpc_reg_operand" "%r")
1351 (match_operand:SI 2 "gpc_reg_operand" "r")
1354 "mulhhwu %0, %1, %2"
1355 [(set_attr "type" "imul3")])
1357 (define_insn "*mullhwc"
1358 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1359 (compare:CC (mult:SI (sign_extend:SI
1360 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1362 (match_operand:HI 2 "gpc_reg_operand" "r")))
1364 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1365 (mult:SI (sign_extend:SI
1370 "mullhw. %0, %1, %2"
1371 [(set_attr "type" "imul3")])
1373 (define_insn "*mullhw"
1374 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1375 (mult:SI (sign_extend:SI
1376 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1378 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1381 [(set_attr "type" "imul3")])
1383 (define_insn "*mullhwuc"
1384 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1385 (compare:CC (mult:SI (zero_extend:SI
1386 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1388 (match_operand:HI 2 "gpc_reg_operand" "r")))
1390 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1391 (mult:SI (zero_extend:SI
1396 "mullhwu. %0, %1, %2"
1397 [(set_attr "type" "imul3")])
1399 (define_insn "*mullhwu"
1400 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1401 (mult:SI (zero_extend:SI
1402 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1404 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1406 "mullhwu %0, %1, %2"
1407 [(set_attr "type" "imul3")])
1409 ;; IBM 405, 440 and 464 string-search dlmzb instruction support.
1410 (define_insn "dlmzb"
1411 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1412 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1413 (match_operand:SI 2 "gpc_reg_operand" "r")]
1415 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1416 (unspec:SI [(match_dup 1)
1420 "dlmzb. %0, %1, %2")
1422 (define_expand "strlensi"
1423 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1424 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1425 (match_operand:QI 2 "const_int_operand" "")
1426 (match_operand 3 "const_int_operand" "")]
1427 UNSPEC_DLMZB_STRLEN))
1428 (clobber (match_scratch:CC 4 "=x"))]
1429 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1431 rtx result = operands[0];
1432 rtx src = operands[1];
1433 rtx search_char = operands[2];
1434 rtx align = operands[3];
1435 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1436 rtx loop_label, end_label, mem, cr0, cond;
1437 if (search_char != const0_rtx
1438 || GET_CODE (align) != CONST_INT
1439 || INTVAL (align) < 8)
1441 word1 = gen_reg_rtx (SImode);
1442 word2 = gen_reg_rtx (SImode);
1443 scratch_dlmzb = gen_reg_rtx (SImode);
1444 scratch_string = gen_reg_rtx (Pmode);
1445 loop_label = gen_label_rtx ();
1446 end_label = gen_label_rtx ();
1447 addr = force_reg (Pmode, XEXP (src, 0));
1448 emit_move_insn (scratch_string, addr);
1449 emit_label (loop_label);
1450 mem = change_address (src, SImode, scratch_string);
1451 emit_move_insn (word1, mem);
1452 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1453 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1454 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1455 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1456 emit_jump_insn (gen_rtx_SET (VOIDmode,
1458 gen_rtx_IF_THEN_ELSE (VOIDmode,
1464 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1465 emit_jump_insn (gen_rtx_SET (VOIDmode,
1467 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1469 emit_label (end_label);
1470 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1471 emit_insn (gen_subsi3 (result, scratch_string, addr));
1472 emit_insn (gen_subsi3 (result, result, const1_rtx));
1477 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1478 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1480 (set (match_operand:SI 0 "gpc_reg_operand" "")
1481 (sign_extend:SI (match_dup 1)))]
1484 (sign_extend:SI (match_dup 1)))
1486 (compare:CC (match_dup 0)
1490 ;; Fixed-point arithmetic insns.
1492 (define_expand "add<mode>3"
1493 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1494 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1495 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1498 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1500 if (non_short_cint_operand (operands[2], DImode))
1503 else if (GET_CODE (operands[2]) == CONST_INT
1504 && ! add_operand (operands[2], <MODE>mode))
1506 rtx tmp = ((!can_create_pseudo_p ()
1507 || rtx_equal_p (operands[0], operands[1]))
1508 ? operands[0] : gen_reg_rtx (<MODE>mode));
1510 HOST_WIDE_INT val = INTVAL (operands[2]);
1511 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1512 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1514 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1517 /* The ordering here is important for the prolog expander.
1518 When space is allocated from the stack, adding 'low' first may
1519 produce a temporary deallocation (which would be bad). */
1520 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1521 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1526 ;; Discourage ai/addic because of carry but provide it in an alternative
1527 ;; allowing register zero as source.
1528 (define_insn "*add<mode>3_internal1"
1529 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1530 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1531 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1532 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1535 {cal %0,%2(%1)|addi %0,%1,%2}
1537 {cau|addis} %0,%1,%v2"
1538 [(set_attr "length" "4,4,4,4")])
1540 (define_insn "addsi3_high"
1541 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1542 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1543 (high:SI (match_operand 2 "" ""))))]
1544 "TARGET_MACHO && !TARGET_64BIT"
1545 "{cau|addis} %0,%1,ha16(%2)"
1546 [(set_attr "length" "4")])
1548 (define_insn "*add<mode>3_internal2"
1549 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1550 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1551 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1553 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1556 {cax.|add.} %3,%1,%2
1557 {ai.|addic.} %3,%1,%2
1560 [(set_attr "type" "fast_compare,compare,compare,compare")
1561 (set_attr "length" "4,4,8,8")])
1564 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1565 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1566 (match_operand:GPR 2 "reg_or_short_operand" ""))
1568 (clobber (match_scratch:GPR 3 ""))]
1571 (plus:GPR (match_dup 1)
1574 (compare:CC (match_dup 3)
1578 (define_insn "*add<mode>3_internal3"
1579 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1580 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1581 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1583 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1584 (plus:P (match_dup 1)
1588 {cax.|add.} %0,%1,%2
1589 {ai.|addic.} %0,%1,%2
1592 [(set_attr "type" "fast_compare,compare,compare,compare")
1593 (set_attr "length" "4,4,8,8")])
1596 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1597 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1598 (match_operand:P 2 "reg_or_short_operand" ""))
1600 (set (match_operand:P 0 "gpc_reg_operand" "")
1601 (plus:P (match_dup 1) (match_dup 2)))]
1604 (plus:P (match_dup 1)
1607 (compare:CC (match_dup 0)
1611 ;; Split an add that we can't do in one insn into two insns, each of which
1612 ;; does one 16-bit part. This is used by combine. Note that the low-order
1613 ;; add should be last in case the result gets used in an address.
1616 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1617 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1618 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1620 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1621 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1623 HOST_WIDE_INT val = INTVAL (operands[2]);
1624 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1625 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1627 operands[4] = GEN_INT (low);
1628 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1629 operands[3] = GEN_INT (rest);
1630 else if (can_create_pseudo_p ())
1632 operands[3] = gen_reg_rtx (DImode);
1633 emit_move_insn (operands[3], operands[2]);
1634 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1641 (define_insn "one_cmpl<mode>2"
1642 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1643 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1648 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1649 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1651 (clobber (match_scratch:P 2 "=r,r"))]
1656 [(set_attr "type" "compare")
1657 (set_attr "length" "4,8")])
1660 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1661 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1663 (clobber (match_scratch:P 2 ""))]
1666 (not:P (match_dup 1)))
1668 (compare:CC (match_dup 2)
1673 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1674 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1676 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1677 (not:P (match_dup 1)))]
1682 [(set_attr "type" "compare")
1683 (set_attr "length" "4,8")])
1686 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1687 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1689 (set (match_operand:P 0 "gpc_reg_operand" "")
1690 (not:P (match_dup 1)))]
1693 (not:P (match_dup 1)))
1695 (compare:CC (match_dup 0)
1700 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1701 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1702 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1704 "{sf%I1|subf%I1c} %0,%2,%1")
1707 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1708 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1709 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1716 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1717 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1718 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1720 (clobber (match_scratch:SI 3 "=r,r"))]
1723 {sf.|subfc.} %3,%2,%1
1725 [(set_attr "type" "compare")
1726 (set_attr "length" "4,8")])
1729 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1730 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1731 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1733 (clobber (match_scratch:P 3 "=r,r"))]
1738 [(set_attr "type" "fast_compare")
1739 (set_attr "length" "4,8")])
1742 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1743 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1744 (match_operand:P 2 "gpc_reg_operand" ""))
1746 (clobber (match_scratch:P 3 ""))]
1749 (minus:P (match_dup 1)
1752 (compare:CC (match_dup 3)
1757 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1758 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1759 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1761 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1762 (minus:SI (match_dup 1) (match_dup 2)))]
1765 {sf.|subfc.} %0,%2,%1
1767 [(set_attr "type" "compare")
1768 (set_attr "length" "4,8")])
1771 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1772 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1773 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1775 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1776 (minus:P (match_dup 1)
1782 [(set_attr "type" "fast_compare")
1783 (set_attr "length" "4,8")])
1786 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1787 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1788 (match_operand:P 2 "gpc_reg_operand" ""))
1790 (set (match_operand:P 0 "gpc_reg_operand" "")
1791 (minus:P (match_dup 1)
1795 (minus:P (match_dup 1)
1798 (compare:CC (match_dup 0)
1802 (define_expand "sub<mode>3"
1803 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1804 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1805 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1809 if (GET_CODE (operands[2]) == CONST_INT)
1811 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1812 negate_rtx (<MODE>mode, operands[2])));
1817 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1818 ;; instruction and some auxiliary computations. Then we just have a single
1819 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1822 (define_expand "sminsi3"
1824 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1825 (match_operand:SI 2 "reg_or_short_operand" ""))
1827 (minus:SI (match_dup 2) (match_dup 1))))
1828 (set (match_operand:SI 0 "gpc_reg_operand" "")
1829 (minus:SI (match_dup 2) (match_dup 3)))]
1830 "TARGET_POWER || TARGET_ISEL"
1835 operands[2] = force_reg (SImode, operands[2]);
1836 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1840 operands[3] = gen_reg_rtx (SImode);
1844 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1845 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1846 (match_operand:SI 2 "reg_or_short_operand" "")))
1847 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1850 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1852 (minus:SI (match_dup 2) (match_dup 1))))
1853 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1856 (define_expand "smaxsi3"
1858 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1859 (match_operand:SI 2 "reg_or_short_operand" ""))
1861 (minus:SI (match_dup 2) (match_dup 1))))
1862 (set (match_operand:SI 0 "gpc_reg_operand" "")
1863 (plus:SI (match_dup 3) (match_dup 1)))]
1864 "TARGET_POWER || TARGET_ISEL"
1869 operands[2] = force_reg (SImode, operands[2]);
1870 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1873 operands[3] = gen_reg_rtx (SImode);
1877 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1878 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1879 (match_operand:SI 2 "reg_or_short_operand" "")))
1880 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1883 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1885 (minus:SI (match_dup 2) (match_dup 1))))
1886 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1889 (define_expand "uminsi3"
1890 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1892 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1894 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1896 (minus:SI (match_dup 4) (match_dup 3))))
1897 (set (match_operand:SI 0 "gpc_reg_operand" "")
1898 (minus:SI (match_dup 2) (match_dup 3)))]
1899 "TARGET_POWER || TARGET_ISEL"
1904 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1907 operands[3] = gen_reg_rtx (SImode);
1908 operands[4] = gen_reg_rtx (SImode);
1909 operands[5] = GEN_INT (-2147483647 - 1);
1912 (define_expand "umaxsi3"
1913 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1915 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1917 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1919 (minus:SI (match_dup 4) (match_dup 3))))
1920 (set (match_operand:SI 0 "gpc_reg_operand" "")
1921 (plus:SI (match_dup 3) (match_dup 1)))]
1922 "TARGET_POWER || TARGET_ISEL"
1927 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1930 operands[3] = gen_reg_rtx (SImode);
1931 operands[4] = gen_reg_rtx (SImode);
1932 operands[5] = GEN_INT (-2147483647 - 1);
1936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1937 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1938 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1940 (minus:SI (match_dup 2) (match_dup 1))))]
1945 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1947 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1948 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1950 (minus:SI (match_dup 2) (match_dup 1)))
1952 (clobber (match_scratch:SI 3 "=r,r"))]
1957 [(set_attr "type" "delayed_compare")
1958 (set_attr "length" "4,8")])
1961 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1963 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1964 (match_operand:SI 2 "reg_or_short_operand" ""))
1966 (minus:SI (match_dup 2) (match_dup 1)))
1968 (clobber (match_scratch:SI 3 ""))]
1969 "TARGET_POWER && reload_completed"
1971 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1973 (minus:SI (match_dup 2) (match_dup 1))))
1975 (compare:CC (match_dup 3)
1980 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1982 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1983 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1985 (minus:SI (match_dup 2) (match_dup 1)))
1987 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1988 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1990 (minus:SI (match_dup 2) (match_dup 1))))]
1995 [(set_attr "type" "delayed_compare")
1996 (set_attr "length" "4,8")])
1999 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2001 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2002 (match_operand:SI 2 "reg_or_short_operand" ""))
2004 (minus:SI (match_dup 2) (match_dup 1)))
2006 (set (match_operand:SI 0 "gpc_reg_operand" "")
2007 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2009 (minus:SI (match_dup 2) (match_dup 1))))]
2010 "TARGET_POWER && reload_completed"
2012 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2014 (minus:SI (match_dup 2) (match_dup 1))))
2016 (compare:CC (match_dup 0)
2020 ;; We don't need abs with condition code because such comparisons should
2022 (define_expand "abssi2"
2023 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2024 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2030 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2033 else if (! TARGET_POWER)
2035 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2040 (define_insn "*abssi2_power"
2041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2042 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2046 (define_insn_and_split "abssi2_isel"
2047 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2048 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2049 (clobber (match_scratch:SI 2 "=&b"))
2050 (clobber (match_scratch:CC 3 "=y"))]
2053 "&& reload_completed"
2054 [(set (match_dup 2) (neg:SI (match_dup 1)))
2056 (compare:CC (match_dup 1)
2059 (if_then_else:SI (ge (match_dup 3)
2065 (define_insn_and_split "abssi2_nopower"
2066 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2067 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2068 (clobber (match_scratch:SI 2 "=&r,&r"))]
2069 "! TARGET_POWER && ! TARGET_ISEL"
2071 "&& reload_completed"
2072 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2073 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2074 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2077 (define_insn "*nabs_power"
2078 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2079 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2083 (define_insn_and_split "*nabs_nopower"
2084 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2085 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2086 (clobber (match_scratch:SI 2 "=&r,&r"))]
2089 "&& reload_completed"
2090 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2091 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2092 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2095 (define_expand "neg<mode>2"
2096 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2097 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2101 (define_insn "*neg<mode>2_internal"
2102 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2103 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2108 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2109 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2111 (clobber (match_scratch:P 2 "=r,r"))]
2116 [(set_attr "type" "fast_compare")
2117 (set_attr "length" "4,8")])
2120 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2121 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2123 (clobber (match_scratch:P 2 ""))]
2126 (neg:P (match_dup 1)))
2128 (compare:CC (match_dup 2)
2133 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2134 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2136 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2137 (neg:P (match_dup 1)))]
2142 [(set_attr "type" "fast_compare")
2143 (set_attr "length" "4,8")])
2146 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2147 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2149 (set (match_operand:P 0 "gpc_reg_operand" "")
2150 (neg:P (match_dup 1)))]
2153 (neg:P (match_dup 1)))
2155 (compare:CC (match_dup 0)
2159 (define_insn "clz<mode>2"
2160 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2161 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2163 "{cntlz|cntlz<wd>} %0,%1"
2164 [(set_attr "type" "cntlz")])
2166 (define_expand "ctz<mode>2"
2168 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2169 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2171 (clobber (scratch:CC))])
2172 (set (match_dup 4) (clz:GPR (match_dup 3)))
2173 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2174 (minus:GPR (match_dup 5) (match_dup 4)))]
2177 operands[2] = gen_reg_rtx (<MODE>mode);
2178 operands[3] = gen_reg_rtx (<MODE>mode);
2179 operands[4] = gen_reg_rtx (<MODE>mode);
2180 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2183 (define_expand "ffs<mode>2"
2185 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2186 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2188 (clobber (scratch:CC))])
2189 (set (match_dup 4) (clz:GPR (match_dup 3)))
2190 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2191 (minus:GPR (match_dup 5) (match_dup 4)))]
2194 operands[2] = gen_reg_rtx (<MODE>mode);
2195 operands[3] = gen_reg_rtx (<MODE>mode);
2196 operands[4] = gen_reg_rtx (<MODE>mode);
2197 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2200 (define_insn "popcntb<mode>2"
2201 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2202 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2207 (define_expand "popcount<mode>2"
2208 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2209 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2212 rs6000_emit_popcount (operands[0], operands[1]);
2216 (define_expand "parity<mode>2"
2217 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2218 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2221 rs6000_emit_parity (operands[0], operands[1]);
2225 (define_insn "bswapsi2"
2226 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2227 (bswap:SI (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2231 {stbrx|stwbrx} %1,%y0
2233 [(set_attr "length" "4,4,12")])
2236 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2237 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2240 (rotate:SI (match_dup 1) (const_int 8)))
2241 (set (zero_extract:SI (match_dup 0)
2245 (set (zero_extract:SI (match_dup 0)
2248 (rotate:SI (match_dup 1)
2252 (define_expand "mulsi3"
2253 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2254 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2255 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2260 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2262 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2266 (define_insn "mulsi3_mq"
2267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2268 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2269 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2270 (clobber (match_scratch:SI 3 "=q,q"))]
2273 {muls|mullw} %0,%1,%2
2274 {muli|mulli} %0,%1,%2"
2276 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2277 (const_string "imul3")
2278 (match_operand:SI 2 "short_cint_operand" "")
2279 (const_string "imul2")]
2280 (const_string "imul")))])
2282 (define_insn "mulsi3_no_mq"
2283 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2284 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2285 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2288 {muls|mullw} %0,%1,%2
2289 {muli|mulli} %0,%1,%2"
2291 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2292 (const_string "imul3")
2293 (match_operand:SI 2 "short_cint_operand" "")
2294 (const_string "imul2")]
2295 (const_string "imul")))])
2297 (define_insn "*mulsi3_mq_internal1"
2298 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2299 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2300 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2302 (clobber (match_scratch:SI 3 "=r,r"))
2303 (clobber (match_scratch:SI 4 "=q,q"))]
2306 {muls.|mullw.} %3,%1,%2
2308 [(set_attr "type" "imul_compare")
2309 (set_attr "length" "4,8")])
2312 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2313 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2314 (match_operand:SI 2 "gpc_reg_operand" ""))
2316 (clobber (match_scratch:SI 3 ""))
2317 (clobber (match_scratch:SI 4 ""))]
2318 "TARGET_POWER && reload_completed"
2319 [(parallel [(set (match_dup 3)
2320 (mult:SI (match_dup 1) (match_dup 2)))
2321 (clobber (match_dup 4))])
2323 (compare:CC (match_dup 3)
2327 (define_insn "*mulsi3_no_mq_internal1"
2328 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2329 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2330 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2332 (clobber (match_scratch:SI 3 "=r,r"))]
2335 {muls.|mullw.} %3,%1,%2
2337 [(set_attr "type" "imul_compare")
2338 (set_attr "length" "4,8")])
2341 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2342 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2343 (match_operand:SI 2 "gpc_reg_operand" ""))
2345 (clobber (match_scratch:SI 3 ""))]
2346 "! TARGET_POWER && reload_completed"
2348 (mult:SI (match_dup 1) (match_dup 2)))
2350 (compare:CC (match_dup 3)
2354 (define_insn "*mulsi3_mq_internal2"
2355 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2356 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2357 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2359 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2360 (mult:SI (match_dup 1) (match_dup 2)))
2361 (clobber (match_scratch:SI 4 "=q,q"))]
2364 {muls.|mullw.} %0,%1,%2
2366 [(set_attr "type" "imul_compare")
2367 (set_attr "length" "4,8")])
2370 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2371 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2372 (match_operand:SI 2 "gpc_reg_operand" ""))
2374 (set (match_operand:SI 0 "gpc_reg_operand" "")
2375 (mult:SI (match_dup 1) (match_dup 2)))
2376 (clobber (match_scratch:SI 4 ""))]
2377 "TARGET_POWER && reload_completed"
2378 [(parallel [(set (match_dup 0)
2379 (mult:SI (match_dup 1) (match_dup 2)))
2380 (clobber (match_dup 4))])
2382 (compare:CC (match_dup 0)
2386 (define_insn "*mulsi3_no_mq_internal2"
2387 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2388 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2389 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2391 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2392 (mult:SI (match_dup 1) (match_dup 2)))]
2395 {muls.|mullw.} %0,%1,%2
2397 [(set_attr "type" "imul_compare")
2398 (set_attr "length" "4,8")])
2401 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2402 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2403 (match_operand:SI 2 "gpc_reg_operand" ""))
2405 (set (match_operand:SI 0 "gpc_reg_operand" "")
2406 (mult:SI (match_dup 1) (match_dup 2)))]
2407 "! TARGET_POWER && reload_completed"
2409 (mult:SI (match_dup 1) (match_dup 2)))
2411 (compare:CC (match_dup 0)
2415 ;; Operand 1 is divided by operand 2; quotient goes to operand
2416 ;; 0 and remainder to operand 3.
2417 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2419 (define_expand "divmodsi4"
2420 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2421 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2422 (match_operand:SI 2 "gpc_reg_operand" "")))
2423 (set (match_operand:SI 3 "register_operand" "")
2424 (mod:SI (match_dup 1) (match_dup 2)))])]
2425 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2428 if (! TARGET_POWER && ! TARGET_POWERPC)
2430 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2431 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2432 emit_insn (gen_divss_call ());
2433 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2434 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2439 (define_insn "*divmodsi4_internal"
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 (set (match_operand:SI 3 "register_operand" "=q")
2444 (mod:SI (match_dup 1) (match_dup 2)))]
2447 [(set_attr "type" "idiv")])
2449 (define_expand "udiv<mode>3"
2450 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2451 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2452 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2453 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2456 if (! TARGET_POWER && ! TARGET_POWERPC)
2458 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2459 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2460 emit_insn (gen_quous_call ());
2461 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2464 else if (TARGET_POWER)
2466 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2471 (define_insn "udivsi3_mq"
2472 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2473 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2474 (match_operand:SI 2 "gpc_reg_operand" "r")))
2475 (clobber (match_scratch:SI 3 "=q"))]
2476 "TARGET_POWERPC && TARGET_POWER"
2478 [(set_attr "type" "idiv")])
2480 (define_insn "*udivsi3_no_mq"
2481 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2482 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2483 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2484 "TARGET_POWERPC && ! TARGET_POWER"
2487 (cond [(match_operand:SI 0 "" "")
2488 (const_string "idiv")]
2489 (const_string "ldiv")))])
2492 ;; For powers of two we can do srai/aze for divide and then adjust for
2493 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2494 ;; used; for PowerPC, force operands into register and do a normal divide;
2495 ;; for AIX common-mode, use quoss call on register operands.
2496 (define_expand "div<mode>3"
2497 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2498 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2499 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2503 if (GET_CODE (operands[2]) == CONST_INT
2504 && INTVAL (operands[2]) > 0
2505 && exact_log2 (INTVAL (operands[2])) >= 0)
2507 else if (TARGET_POWERPC)
2509 operands[2] = force_reg (<MODE>mode, operands[2]);
2512 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2516 else if (TARGET_POWER)
2520 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2521 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2522 emit_insn (gen_quoss_call ());
2523 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2528 (define_insn "divsi3_mq"
2529 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2530 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2531 (match_operand:SI 2 "gpc_reg_operand" "r")))
2532 (clobber (match_scratch:SI 3 "=q"))]
2533 "TARGET_POWERPC && TARGET_POWER"
2535 [(set_attr "type" "idiv")])
2537 (define_insn "*div<mode>3_no_mq"
2538 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2539 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2540 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2541 "TARGET_POWERPC && ! TARGET_POWER"
2544 (cond [(match_operand:SI 0 "" "")
2545 (const_string "idiv")]
2546 (const_string "ldiv")))])
2548 (define_expand "mod<mode>3"
2549 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2550 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2551 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2559 if (GET_CODE (operands[2]) != CONST_INT
2560 || INTVAL (operands[2]) <= 0
2561 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2564 temp1 = gen_reg_rtx (<MODE>mode);
2565 temp2 = gen_reg_rtx (<MODE>mode);
2567 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2568 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2569 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2574 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2575 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2576 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2578 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2579 [(set_attr "type" "two")
2580 (set_attr "length" "8")])
2583 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2584 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2585 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2587 (clobber (match_scratch:P 3 "=r,r"))]
2590 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2592 [(set_attr "type" "compare")
2593 (set_attr "length" "8,12")])
2596 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2597 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2598 (match_operand:GPR 2 "exact_log2_cint_operand"
2601 (clobber (match_scratch:GPR 3 ""))]
2604 (div:<MODE> (match_dup 1) (match_dup 2)))
2606 (compare:CC (match_dup 3)
2611 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2612 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2613 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2615 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2616 (div:P (match_dup 1) (match_dup 2)))]
2619 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2621 [(set_attr "type" "compare")
2622 (set_attr "length" "8,12")])
2625 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2626 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2627 (match_operand:GPR 2 "exact_log2_cint_operand"
2630 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2631 (div:GPR (match_dup 1) (match_dup 2)))]
2634 (div:<MODE> (match_dup 1) (match_dup 2)))
2636 (compare:CC (match_dup 0)
2641 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2644 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2646 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2647 (match_operand:SI 3 "gpc_reg_operand" "r")))
2648 (set (match_operand:SI 2 "register_operand" "=*q")
2651 (zero_extend:DI (match_dup 1)) (const_int 32))
2652 (zero_extend:DI (match_dup 4)))
2656 [(set_attr "type" "idiv")])
2658 ;; To do unsigned divide we handle the cases of the divisor looking like a
2659 ;; negative number. If it is a constant that is less than 2**31, we don't
2660 ;; have to worry about the branches. So make a few subroutines here.
2662 ;; First comes the normal case.
2663 (define_expand "udivmodsi4_normal"
2664 [(set (match_dup 4) (const_int 0))
2665 (parallel [(set (match_operand:SI 0 "" "")
2666 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2668 (zero_extend:DI (match_operand:SI 1 "" "")))
2669 (match_operand:SI 2 "" "")))
2670 (set (match_operand:SI 3 "" "")
2671 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2673 (zero_extend:DI (match_dup 1)))
2677 { operands[4] = gen_reg_rtx (SImode); }")
2679 ;; This handles the branches.
2680 (define_expand "udivmodsi4_tests"
2681 [(set (match_operand:SI 0 "" "") (const_int 0))
2682 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2683 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2684 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2685 (label_ref (match_operand:SI 4 "" "")) (pc)))
2686 (set (match_dup 0) (const_int 1))
2687 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2688 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2689 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2690 (label_ref (match_dup 4)) (pc)))]
2693 { operands[5] = gen_reg_rtx (CCUNSmode);
2694 operands[6] = gen_reg_rtx (CCmode);
2697 (define_expand "udivmodsi4"
2698 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2699 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2700 (match_operand:SI 2 "reg_or_cint_operand" "")))
2701 (set (match_operand:SI 3 "gpc_reg_operand" "")
2702 (umod:SI (match_dup 1) (match_dup 2)))])]
2710 if (! TARGET_POWERPC)
2712 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2713 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2714 emit_insn (gen_divus_call ());
2715 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2716 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2723 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2725 operands[2] = force_reg (SImode, operands[2]);
2726 label = gen_label_rtx ();
2727 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2728 operands[3], label));
2731 operands[2] = force_reg (SImode, operands[2]);
2733 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2741 ;; AIX architecture-independent common-mode multiply (DImode),
2742 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2743 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2744 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2745 ;; assumed unused if generating common-mode, so ignore.
2746 (define_insn "mulh_call"
2749 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2750 (sign_extend:DI (reg:SI 4)))
2752 (clobber (reg:SI LR_REGNO))]
2753 "! TARGET_POWER && ! TARGET_POWERPC"
2755 [(set_attr "type" "imul")])
2757 (define_insn "mull_call"
2759 (mult:DI (sign_extend:DI (reg:SI 3))
2760 (sign_extend:DI (reg:SI 4))))
2761 (clobber (reg:SI LR_REGNO))
2762 (clobber (reg:SI 0))]
2763 "! TARGET_POWER && ! TARGET_POWERPC"
2765 [(set_attr "type" "imul")])
2767 (define_insn "divss_call"
2769 (div:SI (reg:SI 3) (reg:SI 4)))
2771 (mod:SI (reg:SI 3) (reg:SI 4)))
2772 (clobber (reg:SI LR_REGNO))
2773 (clobber (reg:SI 0))]
2774 "! TARGET_POWER && ! TARGET_POWERPC"
2776 [(set_attr "type" "idiv")])
2778 (define_insn "divus_call"
2780 (udiv:SI (reg:SI 3) (reg:SI 4)))
2782 (umod:SI (reg:SI 3) (reg:SI 4)))
2783 (clobber (reg:SI LR_REGNO))
2784 (clobber (reg:SI 0))
2785 (clobber (match_scratch:CC 0 "=x"))
2786 (clobber (reg:CC CR1_REGNO))]
2787 "! TARGET_POWER && ! TARGET_POWERPC"
2789 [(set_attr "type" "idiv")])
2791 (define_insn "quoss_call"
2793 (div:SI (reg:SI 3) (reg:SI 4)))
2794 (clobber (reg:SI LR_REGNO))]
2795 "! TARGET_POWER && ! TARGET_POWERPC"
2797 [(set_attr "type" "idiv")])
2799 (define_insn "quous_call"
2801 (udiv:SI (reg:SI 3) (reg:SI 4)))
2802 (clobber (reg:SI LR_REGNO))
2803 (clobber (reg:SI 0))
2804 (clobber (match_scratch:CC 0 "=x"))
2805 (clobber (reg:CC CR1_REGNO))]
2806 "! TARGET_POWER && ! TARGET_POWERPC"
2808 [(set_attr "type" "idiv")])
2810 ;; Logical instructions
2811 ;; The logical instructions are mostly combined by using match_operator,
2812 ;; but the plain AND insns are somewhat different because there is no
2813 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2814 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2816 (define_insn "andsi3"
2817 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2818 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2819 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2820 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2824 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2825 {andil.|andi.} %0,%1,%b2
2826 {andiu.|andis.} %0,%1,%u2"
2827 [(set_attr "type" "*,*,compare,compare")])
2829 ;; Note to set cr's other than cr0 we do the and immediate and then
2830 ;; the test again -- this avoids a mfcr which on the higher end
2831 ;; machines causes an execution serialization
2833 (define_insn "*andsi3_internal2"
2834 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2835 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2836 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2838 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2839 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2843 {andil.|andi.} %3,%1,%b2
2844 {andiu.|andis.} %3,%1,%u2
2845 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2850 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2851 (set_attr "length" "4,4,4,4,8,8,8,8")])
2853 (define_insn "*andsi3_internal3"
2854 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2855 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2856 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2858 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2859 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2863 {andil.|andi.} %3,%1,%b2
2864 {andiu.|andis.} %3,%1,%u2
2865 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2870 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2871 (set_attr "length" "8,4,4,4,8,8,8,8")])
2874 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2875 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2876 (match_operand:GPR 2 "and_operand" ""))
2878 (clobber (match_scratch:GPR 3 ""))
2879 (clobber (match_scratch:CC 4 ""))]
2881 [(parallel [(set (match_dup 3)
2882 (and:<MODE> (match_dup 1)
2884 (clobber (match_dup 4))])
2886 (compare:CC (match_dup 3)
2890 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2891 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2894 [(set (match_operand:CC 0 "cc_reg_operand" "")
2895 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2896 (match_operand:SI 2 "gpc_reg_operand" ""))
2898 (clobber (match_scratch:SI 3 ""))
2899 (clobber (match_scratch:CC 4 ""))]
2900 "TARGET_POWERPC64 && reload_completed"
2901 [(parallel [(set (match_dup 3)
2902 (and:SI (match_dup 1)
2904 (clobber (match_dup 4))])
2906 (compare:CC (match_dup 3)
2910 (define_insn "*andsi3_internal4"
2911 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2912 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2913 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2915 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2916 (and:SI (match_dup 1)
2918 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2922 {andil.|andi.} %0,%1,%b2
2923 {andiu.|andis.} %0,%1,%u2
2924 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2929 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2930 (set_attr "length" "4,4,4,4,8,8,8,8")])
2932 (define_insn "*andsi3_internal5"
2933 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2934 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2935 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2937 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2938 (and:SI (match_dup 1)
2940 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2944 {andil.|andi.} %0,%1,%b2
2945 {andiu.|andis.} %0,%1,%u2
2946 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2951 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2952 (set_attr "length" "8,4,4,4,8,8,8,8")])
2955 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2956 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2957 (match_operand:SI 2 "and_operand" ""))
2959 (set (match_operand:SI 0 "gpc_reg_operand" "")
2960 (and:SI (match_dup 1)
2962 (clobber (match_scratch:CC 4 ""))]
2964 [(parallel [(set (match_dup 0)
2965 (and:SI (match_dup 1)
2967 (clobber (match_dup 4))])
2969 (compare:CC (match_dup 0)
2974 [(set (match_operand:CC 3 "cc_reg_operand" "")
2975 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2976 (match_operand:SI 2 "gpc_reg_operand" ""))
2978 (set (match_operand:SI 0 "gpc_reg_operand" "")
2979 (and:SI (match_dup 1)
2981 (clobber (match_scratch:CC 4 ""))]
2982 "TARGET_POWERPC64 && reload_completed"
2983 [(parallel [(set (match_dup 0)
2984 (and:SI (match_dup 1)
2986 (clobber (match_dup 4))])
2988 (compare:CC (match_dup 0)
2992 ;; Handle the PowerPC64 rlwinm corner case
2994 (define_insn_and_split "*andsi3_internal6"
2995 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2996 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2997 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3002 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3005 (rotate:SI (match_dup 0) (match_dup 5)))]
3008 int mb = extract_MB (operands[2]);
3009 int me = extract_ME (operands[2]);
3010 operands[3] = GEN_INT (me + 1);
3011 operands[5] = GEN_INT (32 - (me + 1));
3012 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3014 [(set_attr "length" "8")])
3016 (define_expand "iorsi3"
3017 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3018 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3019 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3023 if (GET_CODE (operands[2]) == CONST_INT
3024 && ! logical_operand (operands[2], SImode))
3026 HOST_WIDE_INT value = INTVAL (operands[2]);
3027 rtx tmp = ((!can_create_pseudo_p ()
3028 || rtx_equal_p (operands[0], operands[1]))
3029 ? operands[0] : gen_reg_rtx (SImode));
3031 emit_insn (gen_iorsi3 (tmp, operands[1],
3032 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3033 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3038 (define_expand "xorsi3"
3039 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3040 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3041 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3045 if (GET_CODE (operands[2]) == CONST_INT
3046 && ! logical_operand (operands[2], SImode))
3048 HOST_WIDE_INT value = INTVAL (operands[2]);
3049 rtx tmp = ((!can_create_pseudo_p ()
3050 || rtx_equal_p (operands[0], operands[1]))
3051 ? operands[0] : gen_reg_rtx (SImode));
3053 emit_insn (gen_xorsi3 (tmp, operands[1],
3054 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3055 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3060 (define_insn "*boolsi3_internal1"
3061 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3062 (match_operator:SI 3 "boolean_or_operator"
3063 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3064 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3068 {%q3il|%q3i} %0,%1,%b2
3069 {%q3iu|%q3is} %0,%1,%u2")
3071 (define_insn "*boolsi3_internal2"
3072 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3073 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3074 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3075 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3077 (clobber (match_scratch:SI 3 "=r,r"))]
3082 [(set_attr "type" "compare")
3083 (set_attr "length" "4,8")])
3086 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3087 (compare:CC (match_operator:SI 4 "boolean_operator"
3088 [(match_operand:SI 1 "gpc_reg_operand" "")
3089 (match_operand:SI 2 "gpc_reg_operand" "")])
3091 (clobber (match_scratch:SI 3 ""))]
3092 "TARGET_32BIT && reload_completed"
3093 [(set (match_dup 3) (match_dup 4))
3095 (compare:CC (match_dup 3)
3099 (define_insn "*boolsi3_internal3"
3100 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3101 (compare:CC (match_operator:SI 4 "boolean_operator"
3102 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3103 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3105 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3111 [(set_attr "type" "compare")
3112 (set_attr "length" "4,8")])
3115 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3116 (compare:CC (match_operator:SI 4 "boolean_operator"
3117 [(match_operand:SI 1 "gpc_reg_operand" "")
3118 (match_operand:SI 2 "gpc_reg_operand" "")])
3120 (set (match_operand:SI 0 "gpc_reg_operand" "")
3122 "TARGET_32BIT && reload_completed"
3123 [(set (match_dup 0) (match_dup 4))
3125 (compare:CC (match_dup 0)
3129 ;; Split a logical operation that we can't do in one insn into two insns,
3130 ;; each of which does one 16-bit part. This is used by combine.
3133 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3134 (match_operator:SI 3 "boolean_or_operator"
3135 [(match_operand:SI 1 "gpc_reg_operand" "")
3136 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3138 [(set (match_dup 0) (match_dup 4))
3139 (set (match_dup 0) (match_dup 5))]
3143 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3144 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3146 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3147 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3151 (define_insn "*boolcsi3_internal1"
3152 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3153 (match_operator:SI 3 "boolean_operator"
3154 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3155 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3159 (define_insn "*boolcsi3_internal2"
3160 [(set (match_operand:CC 0 "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 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3165 (clobber (match_scratch:SI 3 "=r,r"))]
3170 [(set_attr "type" "compare")
3171 (set_attr "length" "4,8")])
3174 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3175 (compare:CC (match_operator:SI 4 "boolean_operator"
3176 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3177 (match_operand:SI 2 "gpc_reg_operand" "")])
3179 (clobber (match_scratch:SI 3 ""))]
3180 "TARGET_32BIT && reload_completed"
3181 [(set (match_dup 3) (match_dup 4))
3183 (compare:CC (match_dup 3)
3187 (define_insn "*boolcsi3_internal3"
3188 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3189 (compare:CC (match_operator:SI 4 "boolean_operator"
3190 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3191 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3193 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3199 [(set_attr "type" "compare")
3200 (set_attr "length" "4,8")])
3203 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3204 (compare:CC (match_operator:SI 4 "boolean_operator"
3205 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3206 (match_operand:SI 2 "gpc_reg_operand" "")])
3208 (set (match_operand:SI 0 "gpc_reg_operand" "")
3210 "TARGET_32BIT && reload_completed"
3211 [(set (match_dup 0) (match_dup 4))
3213 (compare:CC (match_dup 0)
3217 (define_insn "*boolccsi3_internal1"
3218 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3219 (match_operator:SI 3 "boolean_operator"
3220 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3221 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3225 (define_insn "*boolccsi3_internal2"
3226 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3227 (compare:CC (match_operator:SI 4 "boolean_operator"
3228 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3229 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3231 (clobber (match_scratch:SI 3 "=r,r"))]
3236 [(set_attr "type" "compare")
3237 (set_attr "length" "4,8")])
3240 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3241 (compare:CC (match_operator:SI 4 "boolean_operator"
3242 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3243 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3245 (clobber (match_scratch:SI 3 ""))]
3246 "TARGET_32BIT && reload_completed"
3247 [(set (match_dup 3) (match_dup 4))
3249 (compare:CC (match_dup 3)
3253 (define_insn "*boolccsi3_internal3"
3254 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3255 (compare:CC (match_operator:SI 4 "boolean_operator"
3256 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3257 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3259 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3265 [(set_attr "type" "compare")
3266 (set_attr "length" "4,8")])
3269 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3270 (compare:CC (match_operator:SI 4 "boolean_operator"
3271 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3272 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3274 (set (match_operand:SI 0 "gpc_reg_operand" "")
3276 "TARGET_32BIT && reload_completed"
3277 [(set (match_dup 0) (match_dup 4))
3279 (compare:CC (match_dup 0)
3283 ;; maskir insn. We need four forms because things might be in arbitrary
3284 ;; orders. Don't define forms that only set CR fields because these
3285 ;; would modify an input register.
3287 (define_insn "*maskir_internal1"
3288 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3289 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3290 (match_operand:SI 1 "gpc_reg_operand" "0"))
3291 (and:SI (match_dup 2)
3292 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3296 (define_insn "*maskir_internal2"
3297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3298 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3299 (match_operand:SI 1 "gpc_reg_operand" "0"))
3300 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3305 (define_insn "*maskir_internal3"
3306 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3307 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3308 (match_operand:SI 3 "gpc_reg_operand" "r"))
3309 (and:SI (not:SI (match_dup 2))
3310 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3314 (define_insn "*maskir_internal4"
3315 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3316 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3317 (match_operand:SI 2 "gpc_reg_operand" "r"))
3318 (and:SI (not:SI (match_dup 2))
3319 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3323 (define_insn "*maskir_internal5"
3324 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3326 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3327 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3328 (and:SI (match_dup 2)
3329 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3331 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3332 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3333 (and:SI (match_dup 2) (match_dup 3))))]
3338 [(set_attr "type" "compare")
3339 (set_attr "length" "4,8")])
3342 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3344 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3345 (match_operand:SI 1 "gpc_reg_operand" ""))
3346 (and:SI (match_dup 2)
3347 (match_operand:SI 3 "gpc_reg_operand" "")))
3349 (set (match_operand:SI 0 "gpc_reg_operand" "")
3350 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3351 (and:SI (match_dup 2) (match_dup 3))))]
3352 "TARGET_POWER && reload_completed"
3354 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3355 (and:SI (match_dup 2) (match_dup 3))))
3357 (compare:CC (match_dup 0)
3361 (define_insn "*maskir_internal6"
3362 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3364 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3365 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3366 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3369 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3370 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3371 (and:SI (match_dup 3) (match_dup 2))))]
3376 [(set_attr "type" "compare")
3377 (set_attr "length" "4,8")])
3380 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3382 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3383 (match_operand:SI 1 "gpc_reg_operand" ""))
3384 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3387 (set (match_operand:SI 0 "gpc_reg_operand" "")
3388 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3389 (and:SI (match_dup 3) (match_dup 2))))]
3390 "TARGET_POWER && reload_completed"
3392 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3393 (and:SI (match_dup 3) (match_dup 2))))
3395 (compare:CC (match_dup 0)
3399 (define_insn "*maskir_internal7"
3400 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3402 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3403 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3404 (and:SI (not:SI (match_dup 2))
3405 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3407 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3408 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3409 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3414 [(set_attr "type" "compare")
3415 (set_attr "length" "4,8")])
3418 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3420 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3421 (match_operand:SI 3 "gpc_reg_operand" ""))
3422 (and:SI (not:SI (match_dup 2))
3423 (match_operand:SI 1 "gpc_reg_operand" "")))
3425 (set (match_operand:SI 0 "gpc_reg_operand" "")
3426 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3427 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3428 "TARGET_POWER && reload_completed"
3430 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3431 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3433 (compare:CC (match_dup 0)
3437 (define_insn "*maskir_internal8"
3438 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3440 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3441 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3442 (and:SI (not:SI (match_dup 2))
3443 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3445 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3446 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3447 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3452 [(set_attr "type" "compare")
3453 (set_attr "length" "4,8")])
3456 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3458 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3459 (match_operand:SI 2 "gpc_reg_operand" ""))
3460 (and:SI (not:SI (match_dup 2))
3461 (match_operand:SI 1 "gpc_reg_operand" "")))
3463 (set (match_operand:SI 0 "gpc_reg_operand" "")
3464 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3465 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3466 "TARGET_POWER && reload_completed"
3468 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3469 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3471 (compare:CC (match_dup 0)
3475 ;; Rotate and shift insns, in all their variants. These support shifts,
3476 ;; field inserts and extracts, and various combinations thereof.
3477 (define_expand "insv"
3478 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3479 (match_operand:SI 1 "const_int_operand" "")
3480 (match_operand:SI 2 "const_int_operand" ""))
3481 (match_operand 3 "gpc_reg_operand" ""))]
3485 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3486 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3487 compiler if the address of the structure is taken later. Likewise, do
3488 not handle invalid E500 subregs. */
3489 if (GET_CODE (operands[0]) == SUBREG
3490 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3491 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3492 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3495 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3496 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3498 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3502 (define_insn "insvsi"
3503 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3504 (match_operand:SI 1 "const_int_operand" "i")
3505 (match_operand:SI 2 "const_int_operand" "i"))
3506 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3510 int start = INTVAL (operands[2]) & 31;
3511 int size = INTVAL (operands[1]) & 31;
3513 operands[4] = GEN_INT (32 - start - size);
3514 operands[1] = GEN_INT (start + size - 1);
3515 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3517 [(set_attr "type" "insert_word")])
3519 (define_insn "*insvsi_internal1"
3520 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3521 (match_operand:SI 1 "const_int_operand" "i")
3522 (match_operand:SI 2 "const_int_operand" "i"))
3523 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3524 (match_operand:SI 4 "const_int_operand" "i")))]
3525 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3528 int shift = INTVAL (operands[4]) & 31;
3529 int start = INTVAL (operands[2]) & 31;
3530 int size = INTVAL (operands[1]) & 31;
3532 operands[4] = GEN_INT (shift - start - size);
3533 operands[1] = GEN_INT (start + size - 1);
3534 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3536 [(set_attr "type" "insert_word")])
3538 (define_insn "*insvsi_internal2"
3539 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3540 (match_operand:SI 1 "const_int_operand" "i")
3541 (match_operand:SI 2 "const_int_operand" "i"))
3542 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3543 (match_operand:SI 4 "const_int_operand" "i")))]
3544 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3547 int shift = INTVAL (operands[4]) & 31;
3548 int start = INTVAL (operands[2]) & 31;
3549 int size = INTVAL (operands[1]) & 31;
3551 operands[4] = GEN_INT (32 - shift - start - size);
3552 operands[1] = GEN_INT (start + size - 1);
3553 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3555 [(set_attr "type" "insert_word")])
3557 (define_insn "*insvsi_internal3"
3558 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3559 (match_operand:SI 1 "const_int_operand" "i")
3560 (match_operand:SI 2 "const_int_operand" "i"))
3561 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3562 (match_operand:SI 4 "const_int_operand" "i")))]
3563 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3566 int shift = INTVAL (operands[4]) & 31;
3567 int start = INTVAL (operands[2]) & 31;
3568 int size = INTVAL (operands[1]) & 31;
3570 operands[4] = GEN_INT (32 - shift - start - size);
3571 operands[1] = GEN_INT (start + size - 1);
3572 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3574 [(set_attr "type" "insert_word")])
3576 (define_insn "*insvsi_internal4"
3577 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3578 (match_operand:SI 1 "const_int_operand" "i")
3579 (match_operand:SI 2 "const_int_operand" "i"))
3580 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3581 (match_operand:SI 4 "const_int_operand" "i")
3582 (match_operand:SI 5 "const_int_operand" "i")))]
3583 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3586 int extract_start = INTVAL (operands[5]) & 31;
3587 int extract_size = INTVAL (operands[4]) & 31;
3588 int insert_start = INTVAL (operands[2]) & 31;
3589 int insert_size = INTVAL (operands[1]) & 31;
3591 /* Align extract field with insert field */
3592 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3593 operands[1] = GEN_INT (insert_start + insert_size - 1);
3594 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3596 [(set_attr "type" "insert_word")])
3598 ;; combine patterns for rlwimi
3599 (define_insn "*insvsi_internal5"
3600 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3601 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3602 (match_operand:SI 1 "mask_operand" "i"))
3603 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3604 (match_operand:SI 2 "const_int_operand" "i"))
3605 (match_operand:SI 5 "mask_operand" "i"))))]
3606 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3609 int me = extract_ME(operands[5]);
3610 int mb = extract_MB(operands[5]);
3611 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3612 operands[2] = GEN_INT(mb);
3613 operands[1] = GEN_INT(me);
3614 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3616 [(set_attr "type" "insert_word")])
3618 (define_insn "*insvsi_internal6"
3619 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3620 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3621 (match_operand:SI 2 "const_int_operand" "i"))
3622 (match_operand:SI 5 "mask_operand" "i"))
3623 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3624 (match_operand:SI 1 "mask_operand" "i"))))]
3625 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3628 int me = extract_ME(operands[5]);
3629 int mb = extract_MB(operands[5]);
3630 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3631 operands[2] = GEN_INT(mb);
3632 operands[1] = GEN_INT(me);
3633 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3635 [(set_attr "type" "insert_word")])
3637 (define_insn "insvdi"
3638 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3639 (match_operand:SI 1 "const_int_operand" "i")
3640 (match_operand:SI 2 "const_int_operand" "i"))
3641 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3645 int start = INTVAL (operands[2]) & 63;
3646 int size = INTVAL (operands[1]) & 63;
3648 operands[1] = GEN_INT (64 - start - size);
3649 return \"rldimi %0,%3,%H1,%H2\";
3651 [(set_attr "type" "insert_dword")])
3653 (define_insn "*insvdi_internal2"
3654 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3655 (match_operand:SI 1 "const_int_operand" "i")
3656 (match_operand:SI 2 "const_int_operand" "i"))
3657 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3658 (match_operand:SI 4 "const_int_operand" "i")))]
3660 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3663 int shift = INTVAL (operands[4]) & 63;
3664 int start = (INTVAL (operands[2]) & 63) - 32;
3665 int size = INTVAL (operands[1]) & 63;
3667 operands[4] = GEN_INT (64 - shift - start - size);
3668 operands[2] = GEN_INT (start);
3669 operands[1] = GEN_INT (start + size - 1);
3670 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3673 (define_insn "*insvdi_internal3"
3674 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3675 (match_operand:SI 1 "const_int_operand" "i")
3676 (match_operand:SI 2 "const_int_operand" "i"))
3677 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3678 (match_operand:SI 4 "const_int_operand" "i")))]
3680 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3683 int shift = INTVAL (operands[4]) & 63;
3684 int start = (INTVAL (operands[2]) & 63) - 32;
3685 int size = INTVAL (operands[1]) & 63;
3687 operands[4] = GEN_INT (64 - shift - start - size);
3688 operands[2] = GEN_INT (start);
3689 operands[1] = GEN_INT (start + size - 1);
3690 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3693 (define_expand "extzv"
3694 [(set (match_operand 0 "gpc_reg_operand" "")
3695 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3696 (match_operand:SI 2 "const_int_operand" "")
3697 (match_operand:SI 3 "const_int_operand" "")))]
3701 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3702 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3703 compiler if the address of the structure is taken later. */
3704 if (GET_CODE (operands[0]) == SUBREG
3705 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3708 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3709 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3711 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3715 (define_insn "extzvsi"
3716 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3717 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3718 (match_operand:SI 2 "const_int_operand" "i")
3719 (match_operand:SI 3 "const_int_operand" "i")))]
3723 int start = INTVAL (operands[3]) & 31;
3724 int size = INTVAL (operands[2]) & 31;
3726 if (start + size >= 32)
3727 operands[3] = const0_rtx;
3729 operands[3] = GEN_INT (start + size);
3730 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3733 (define_insn "*extzvsi_internal1"
3734 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3735 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3736 (match_operand:SI 2 "const_int_operand" "i,i")
3737 (match_operand:SI 3 "const_int_operand" "i,i"))
3739 (clobber (match_scratch:SI 4 "=r,r"))]
3743 int start = INTVAL (operands[3]) & 31;
3744 int size = INTVAL (operands[2]) & 31;
3746 /* Force split for non-cc0 compare. */
3747 if (which_alternative == 1)
3750 /* If the bit-field being tested fits in the upper or lower half of a
3751 word, it is possible to use andiu. or andil. to test it. This is
3752 useful because the condition register set-use delay is smaller for
3753 andi[ul]. than for rlinm. This doesn't work when the starting bit
3754 position is 0 because the LT and GT bits may be set wrong. */
3756 if ((start > 0 && start + size <= 16) || start >= 16)
3758 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3759 - (1 << (16 - (start & 15) - size))));
3761 return \"{andiu.|andis.} %4,%1,%3\";
3763 return \"{andil.|andi.} %4,%1,%3\";
3766 if (start + size >= 32)
3767 operands[3] = const0_rtx;
3769 operands[3] = GEN_INT (start + size);
3770 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3772 [(set_attr "type" "delayed_compare")
3773 (set_attr "length" "4,8")])
3776 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3777 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3778 (match_operand:SI 2 "const_int_operand" "")
3779 (match_operand:SI 3 "const_int_operand" ""))
3781 (clobber (match_scratch:SI 4 ""))]
3784 (zero_extract:SI (match_dup 1) (match_dup 2)
3787 (compare:CC (match_dup 4)
3791 (define_insn "*extzvsi_internal2"
3792 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3793 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3794 (match_operand:SI 2 "const_int_operand" "i,i")
3795 (match_operand:SI 3 "const_int_operand" "i,i"))
3797 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3798 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3802 int start = INTVAL (operands[3]) & 31;
3803 int size = INTVAL (operands[2]) & 31;
3805 /* Force split for non-cc0 compare. */
3806 if (which_alternative == 1)
3809 /* Since we are using the output value, we can't ignore any need for
3810 a shift. The bit-field must end at the LSB. */
3811 if (start >= 16 && start + size == 32)
3813 operands[3] = GEN_INT ((1 << size) - 1);
3814 return \"{andil.|andi.} %0,%1,%3\";
3817 if (start + size >= 32)
3818 operands[3] = const0_rtx;
3820 operands[3] = GEN_INT (start + size);
3821 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3823 [(set_attr "type" "delayed_compare")
3824 (set_attr "length" "4,8")])
3827 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3828 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3829 (match_operand:SI 2 "const_int_operand" "")
3830 (match_operand:SI 3 "const_int_operand" ""))
3832 (set (match_operand:SI 0 "gpc_reg_operand" "")
3833 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3836 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3838 (compare:CC (match_dup 0)
3842 (define_insn "extzvdi"
3843 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3844 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3845 (match_operand:SI 2 "const_int_operand" "i")
3846 (match_operand:SI 3 "const_int_operand" "i")))]
3850 int start = INTVAL (operands[3]) & 63;
3851 int size = INTVAL (operands[2]) & 63;
3853 if (start + size >= 64)
3854 operands[3] = const0_rtx;
3856 operands[3] = GEN_INT (start + size);
3857 operands[2] = GEN_INT (64 - size);
3858 return \"rldicl %0,%1,%3,%2\";
3861 (define_insn "*extzvdi_internal1"
3862 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3863 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3864 (match_operand:SI 2 "const_int_operand" "i")
3865 (match_operand:SI 3 "const_int_operand" "i"))
3867 (clobber (match_scratch:DI 4 "=r"))]
3871 int start = INTVAL (operands[3]) & 63;
3872 int size = INTVAL (operands[2]) & 63;
3874 if (start + size >= 64)
3875 operands[3] = const0_rtx;
3877 operands[3] = GEN_INT (start + size);
3878 operands[2] = GEN_INT (64 - size);
3879 return \"rldicl. %4,%1,%3,%2\";
3881 [(set_attr "type" "compare")])
3883 (define_insn "*extzvdi_internal2"
3884 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3885 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3886 (match_operand:SI 2 "const_int_operand" "i")
3887 (match_operand:SI 3 "const_int_operand" "i"))
3889 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3890 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3894 int start = INTVAL (operands[3]) & 63;
3895 int size = INTVAL (operands[2]) & 63;
3897 if (start + size >= 64)
3898 operands[3] = const0_rtx;
3900 operands[3] = GEN_INT (start + size);
3901 operands[2] = GEN_INT (64 - size);
3902 return \"rldicl. %0,%1,%3,%2\";
3904 [(set_attr "type" "compare")])
3906 (define_insn "rotlsi3"
3907 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3908 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3909 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3912 {rlnm|rlwnm} %0,%1,%2,0xffffffff
3913 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
3914 [(set_attr "type" "var_shift_rotate,integer")])
3916 (define_insn "*rotlsi3_internal2"
3917 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3918 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3919 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3921 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3924 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
3925 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
3928 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3929 (set_attr "length" "4,4,8,8")])
3932 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3933 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3934 (match_operand:SI 2 "reg_or_cint_operand" ""))
3936 (clobber (match_scratch:SI 3 ""))]
3939 (rotate:SI (match_dup 1) (match_dup 2)))
3941 (compare:CC (match_dup 3)
3945 (define_insn "*rotlsi3_internal3"
3946 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3947 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3948 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3950 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3951 (rotate:SI (match_dup 1) (match_dup 2)))]
3954 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
3955 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
3958 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3959 (set_attr "length" "4,4,8,8")])
3962 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3963 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3964 (match_operand:SI 2 "reg_or_cint_operand" ""))
3966 (set (match_operand:SI 0 "gpc_reg_operand" "")
3967 (rotate:SI (match_dup 1) (match_dup 2)))]
3970 (rotate:SI (match_dup 1) (match_dup 2)))
3972 (compare:CC (match_dup 0)
3976 (define_insn "*rotlsi3_internal4"
3977 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3978 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3979 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3980 (match_operand:SI 3 "mask_operand" "n,n")))]
3983 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
3984 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
3985 [(set_attr "type" "var_shift_rotate,integer")])
3987 (define_insn "*rotlsi3_internal5"
3988 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3990 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3991 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3992 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3994 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3997 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
3998 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4001 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4002 (set_attr "length" "4,4,8,8")])
4005 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4007 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4008 (match_operand:SI 2 "reg_or_cint_operand" ""))
4009 (match_operand:SI 3 "mask_operand" ""))
4011 (clobber (match_scratch:SI 4 ""))]
4014 (and:SI (rotate:SI (match_dup 1)
4018 (compare:CC (match_dup 4)
4022 (define_insn "*rotlsi3_internal6"
4023 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4025 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4026 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4027 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4029 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4030 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4033 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4034 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4037 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4038 (set_attr "length" "4,4,8,8")])
4041 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4043 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4044 (match_operand:SI 2 "reg_or_cint_operand" ""))
4045 (match_operand:SI 3 "mask_operand" ""))
4047 (set (match_operand:SI 0 "gpc_reg_operand" "")
4048 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4051 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4053 (compare:CC (match_dup 0)
4057 (define_insn "*rotlsi3_internal7"
4058 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4061 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4062 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4064 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
4066 (define_insn "*rotlsi3_internal8"
4067 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4068 (compare:CC (zero_extend:SI
4070 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4071 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4073 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4076 {rlnm.|rlwnm.} %3,%1,%2,0xff
4077 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4080 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4081 (set_attr "length" "4,4,8,8")])
4084 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4085 (compare:CC (zero_extend:SI
4087 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4088 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4090 (clobber (match_scratch:SI 3 ""))]
4093 (zero_extend:SI (subreg:QI
4094 (rotate:SI (match_dup 1)
4097 (compare:CC (match_dup 3)
4101 (define_insn "*rotlsi3_internal9"
4102 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4103 (compare:CC (zero_extend:SI
4105 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4106 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4108 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4109 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4112 {rlnm.|rlwnm.} %0,%1,%2,0xff
4113 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4116 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4117 (set_attr "length" "4,4,8,8")])
4120 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4121 (compare:CC (zero_extend:SI
4123 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4124 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4126 (set (match_operand:SI 0 "gpc_reg_operand" "")
4127 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4130 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4132 (compare:CC (match_dup 0)
4136 (define_insn "*rotlsi3_internal10"
4137 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4140 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4141 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4144 {rlnm|rlwnm} %0,%1,%2,0xffff
4145 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4146 [(set_attr "type" "var_shift_rotate,integer")])
4149 (define_insn "*rotlsi3_internal11"
4150 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4151 (compare:CC (zero_extend:SI
4153 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4154 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4156 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4159 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4160 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4163 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4164 (set_attr "length" "4,4,8,8")])
4167 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4168 (compare:CC (zero_extend:SI
4170 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4171 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4173 (clobber (match_scratch:SI 3 ""))]
4176 (zero_extend:SI (subreg:HI
4177 (rotate:SI (match_dup 1)
4180 (compare:CC (match_dup 3)
4184 (define_insn "*rotlsi3_internal12"
4185 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4186 (compare:CC (zero_extend:SI
4188 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4189 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4191 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4192 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4195 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4196 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4199 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4200 (set_attr "length" "4,4,8,8")])
4203 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4204 (compare:CC (zero_extend:SI
4206 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4207 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4209 (set (match_operand:SI 0 "gpc_reg_operand" "")
4210 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4213 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4215 (compare:CC (match_dup 0)
4219 ;; Note that we use "sle." instead of "sl." so that we can set
4220 ;; SHIFT_COUNT_TRUNCATED.
4222 (define_expand "ashlsi3"
4223 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4224 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4225 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4230 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4232 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4236 (define_insn "ashlsi3_power"
4237 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4238 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4239 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4240 (clobber (match_scratch:SI 3 "=q,X"))]
4244 {sli|slwi} %0,%1,%h2")
4246 (define_insn "ashlsi3_no_power"
4247 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4248 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4249 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4253 {sli|slwi} %0,%1,%h2"
4254 [(set_attr "type" "var_shift_rotate,shift")])
4257 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4258 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4259 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4261 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4262 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4266 {sli.|slwi.} %3,%1,%h2
4269 [(set_attr "type" "delayed_compare")
4270 (set_attr "length" "4,4,8,8")])
4273 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4274 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4275 (match_operand:SI 2 "reg_or_cint_operand" ""))
4277 (clobber (match_scratch:SI 3 ""))
4278 (clobber (match_scratch:SI 4 ""))]
4279 "TARGET_POWER && reload_completed"
4280 [(parallel [(set (match_dup 3)
4281 (ashift:SI (match_dup 1) (match_dup 2)))
4282 (clobber (match_dup 4))])
4284 (compare:CC (match_dup 3)
4289 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4290 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4291 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4293 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4294 "! TARGET_POWER && TARGET_32BIT"
4297 {sli.|slwi.} %3,%1,%h2
4300 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4301 (set_attr "length" "4,4,8,8")])
4304 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4305 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4306 (match_operand:SI 2 "reg_or_cint_operand" ""))
4308 (clobber (match_scratch:SI 3 ""))]
4309 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4311 (ashift:SI (match_dup 1) (match_dup 2)))
4313 (compare:CC (match_dup 3)
4318 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4319 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4320 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4322 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4323 (ashift:SI (match_dup 1) (match_dup 2)))
4324 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4328 {sli.|slwi.} %0,%1,%h2
4331 [(set_attr "type" "delayed_compare")
4332 (set_attr "length" "4,4,8,8")])
4335 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4336 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4337 (match_operand:SI 2 "reg_or_cint_operand" ""))
4339 (set (match_operand:SI 0 "gpc_reg_operand" "")
4340 (ashift:SI (match_dup 1) (match_dup 2)))
4341 (clobber (match_scratch:SI 4 ""))]
4342 "TARGET_POWER && reload_completed"
4343 [(parallel [(set (match_dup 0)
4344 (ashift:SI (match_dup 1) (match_dup 2)))
4345 (clobber (match_dup 4))])
4347 (compare:CC (match_dup 0)
4352 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4353 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4354 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4356 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4357 (ashift:SI (match_dup 1) (match_dup 2)))]
4358 "! TARGET_POWER && TARGET_32BIT"
4361 {sli.|slwi.} %0,%1,%h2
4364 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4365 (set_attr "length" "4,4,8,8")])
4368 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4369 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4370 (match_operand:SI 2 "reg_or_cint_operand" ""))
4372 (set (match_operand:SI 0 "gpc_reg_operand" "")
4373 (ashift:SI (match_dup 1) (match_dup 2)))]
4374 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4376 (ashift:SI (match_dup 1) (match_dup 2)))
4378 (compare:CC (match_dup 0)
4382 (define_insn "rlwinm"
4383 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4384 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4385 (match_operand:SI 2 "const_int_operand" "i"))
4386 (match_operand:SI 3 "mask_operand" "n")))]
4387 "includes_lshift_p (operands[2], operands[3])"
4388 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4391 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4393 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4394 (match_operand:SI 2 "const_int_operand" "i,i"))
4395 (match_operand:SI 3 "mask_operand" "n,n"))
4397 (clobber (match_scratch:SI 4 "=r,r"))]
4398 "includes_lshift_p (operands[2], operands[3])"
4400 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4402 [(set_attr "type" "delayed_compare")
4403 (set_attr "length" "4,8")])
4406 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4408 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4409 (match_operand:SI 2 "const_int_operand" ""))
4410 (match_operand:SI 3 "mask_operand" ""))
4412 (clobber (match_scratch:SI 4 ""))]
4413 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4415 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4418 (compare:CC (match_dup 4)
4423 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4425 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4426 (match_operand:SI 2 "const_int_operand" "i,i"))
4427 (match_operand:SI 3 "mask_operand" "n,n"))
4429 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4430 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4431 "includes_lshift_p (operands[2], operands[3])"
4433 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4435 [(set_attr "type" "delayed_compare")
4436 (set_attr "length" "4,8")])
4439 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4441 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4442 (match_operand:SI 2 "const_int_operand" ""))
4443 (match_operand:SI 3 "mask_operand" ""))
4445 (set (match_operand:SI 0 "gpc_reg_operand" "")
4446 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4447 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4449 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4451 (compare:CC (match_dup 0)
4455 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4457 (define_expand "lshrsi3"
4458 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4459 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4460 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4465 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4467 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4471 (define_insn "lshrsi3_power"
4472 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4473 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4474 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4475 (clobber (match_scratch:SI 3 "=q,X,X"))]
4480 {s%A2i|s%A2wi} %0,%1,%h2")
4482 (define_insn "lshrsi3_no_power"
4483 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4484 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4485 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4490 {sri|srwi} %0,%1,%h2"
4491 [(set_attr "type" "integer,var_shift_rotate,shift")])
4494 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4495 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4496 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4498 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4499 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4504 {s%A2i.|s%A2wi.} %3,%1,%h2
4508 [(set_attr "type" "delayed_compare")
4509 (set_attr "length" "4,4,4,8,8,8")])
4512 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4513 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4514 (match_operand:SI 2 "reg_or_cint_operand" ""))
4516 (clobber (match_scratch:SI 3 ""))
4517 (clobber (match_scratch:SI 4 ""))]
4518 "TARGET_POWER && reload_completed"
4519 [(parallel [(set (match_dup 3)
4520 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4521 (clobber (match_dup 4))])
4523 (compare:CC (match_dup 3)
4528 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4529 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4530 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4532 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4533 "! TARGET_POWER && TARGET_32BIT"
4537 {sri.|srwi.} %3,%1,%h2
4541 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4542 (set_attr "length" "4,4,4,8,8,8")])
4545 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4546 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4547 (match_operand:SI 2 "reg_or_cint_operand" ""))
4549 (clobber (match_scratch:SI 3 ""))]
4550 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4552 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4554 (compare:CC (match_dup 3)
4559 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4560 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4561 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4563 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4564 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4565 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4570 {s%A2i.|s%A2wi.} %0,%1,%h2
4574 [(set_attr "type" "delayed_compare")
4575 (set_attr "length" "4,4,4,8,8,8")])
4578 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4579 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4580 (match_operand:SI 2 "reg_or_cint_operand" ""))
4582 (set (match_operand:SI 0 "gpc_reg_operand" "")
4583 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4584 (clobber (match_scratch:SI 4 ""))]
4585 "TARGET_POWER && reload_completed"
4586 [(parallel [(set (match_dup 0)
4587 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4588 (clobber (match_dup 4))])
4590 (compare:CC (match_dup 0)
4595 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4596 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4597 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4599 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4600 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4601 "! TARGET_POWER && TARGET_32BIT"
4605 {sri.|srwi.} %0,%1,%h2
4609 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4610 (set_attr "length" "4,4,4,8,8,8")])
4613 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4614 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4615 (match_operand:SI 2 "reg_or_cint_operand" ""))
4617 (set (match_operand:SI 0 "gpc_reg_operand" "")
4618 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4619 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4621 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4623 (compare:CC (match_dup 0)
4628 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4629 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4630 (match_operand:SI 2 "const_int_operand" "i"))
4631 (match_operand:SI 3 "mask_operand" "n")))]
4632 "includes_rshift_p (operands[2], operands[3])"
4633 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4636 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4638 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4639 (match_operand:SI 2 "const_int_operand" "i,i"))
4640 (match_operand:SI 3 "mask_operand" "n,n"))
4642 (clobber (match_scratch:SI 4 "=r,r"))]
4643 "includes_rshift_p (operands[2], operands[3])"
4645 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4647 [(set_attr "type" "delayed_compare")
4648 (set_attr "length" "4,8")])
4651 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4653 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4654 (match_operand:SI 2 "const_int_operand" ""))
4655 (match_operand:SI 3 "mask_operand" ""))
4657 (clobber (match_scratch:SI 4 ""))]
4658 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4660 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4663 (compare:CC (match_dup 4)
4668 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4670 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4671 (match_operand:SI 2 "const_int_operand" "i,i"))
4672 (match_operand:SI 3 "mask_operand" "n,n"))
4674 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4675 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4676 "includes_rshift_p (operands[2], operands[3])"
4678 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4680 [(set_attr "type" "delayed_compare")
4681 (set_attr "length" "4,8")])
4684 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4686 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4687 (match_operand:SI 2 "const_int_operand" ""))
4688 (match_operand:SI 3 "mask_operand" ""))
4690 (set (match_operand:SI 0 "gpc_reg_operand" "")
4691 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4692 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4694 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4696 (compare:CC (match_dup 0)
4701 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4704 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4705 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4706 "includes_rshift_p (operands[2], GEN_INT (255))"
4707 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4710 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4714 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4715 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4717 (clobber (match_scratch:SI 3 "=r,r"))]
4718 "includes_rshift_p (operands[2], GEN_INT (255))"
4720 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4722 [(set_attr "type" "delayed_compare")
4723 (set_attr "length" "4,8")])
4726 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4730 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4731 (match_operand:SI 2 "const_int_operand" "")) 0))
4733 (clobber (match_scratch:SI 3 ""))]
4734 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4736 (zero_extend:SI (subreg:QI
4737 (lshiftrt:SI (match_dup 1)
4740 (compare:CC (match_dup 3)
4745 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4749 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4750 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4752 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4753 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4754 "includes_rshift_p (operands[2], GEN_INT (255))"
4756 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4758 [(set_attr "type" "delayed_compare")
4759 (set_attr "length" "4,8")])
4762 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4766 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4767 (match_operand:SI 2 "const_int_operand" "")) 0))
4769 (set (match_operand:SI 0 "gpc_reg_operand" "")
4770 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4771 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4773 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4775 (compare:CC (match_dup 0)
4780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4783 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4784 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4785 "includes_rshift_p (operands[2], GEN_INT (65535))"
4786 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4789 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4793 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4794 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4796 (clobber (match_scratch:SI 3 "=r,r"))]
4797 "includes_rshift_p (operands[2], GEN_INT (65535))"
4799 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4801 [(set_attr "type" "delayed_compare")
4802 (set_attr "length" "4,8")])
4805 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4809 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4810 (match_operand:SI 2 "const_int_operand" "")) 0))
4812 (clobber (match_scratch:SI 3 ""))]
4813 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4815 (zero_extend:SI (subreg:HI
4816 (lshiftrt:SI (match_dup 1)
4819 (compare:CC (match_dup 3)
4824 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4828 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4829 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4831 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4832 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4833 "includes_rshift_p (operands[2], GEN_INT (65535))"
4835 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4837 [(set_attr "type" "delayed_compare")
4838 (set_attr "length" "4,8")])
4841 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4845 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4846 (match_operand:SI 2 "const_int_operand" "")) 0))
4848 (set (match_operand:SI 0 "gpc_reg_operand" "")
4849 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4850 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4852 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4854 (compare:CC (match_dup 0)
4859 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4861 (match_operand:SI 1 "gpc_reg_operand" "r"))
4862 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4868 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4870 (match_operand:SI 1 "gpc_reg_operand" "r"))
4871 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4877 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4879 (match_operand:SI 1 "gpc_reg_operand" "r"))
4880 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4886 (define_expand "ashrsi3"
4887 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4888 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4889 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4894 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4896 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4900 (define_insn "ashrsi3_power"
4901 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4902 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4903 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4904 (clobber (match_scratch:SI 3 "=q,X"))]
4908 {srai|srawi} %0,%1,%h2"
4909 [(set_attr "type" "shift")])
4911 (define_insn "ashrsi3_no_power"
4912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4913 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4914 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4918 {srai|srawi} %0,%1,%h2"
4919 [(set_attr "type" "var_shift_rotate,shift")])
4922 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4923 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4924 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4926 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4927 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4931 {srai.|srawi.} %3,%1,%h2
4934 [(set_attr "type" "delayed_compare")
4935 (set_attr "length" "4,4,8,8")])
4938 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4939 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4940 (match_operand:SI 2 "reg_or_cint_operand" ""))
4942 (clobber (match_scratch:SI 3 ""))
4943 (clobber (match_scratch:SI 4 ""))]
4944 "TARGET_POWER && reload_completed"
4945 [(parallel [(set (match_dup 3)
4946 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4947 (clobber (match_dup 4))])
4949 (compare:CC (match_dup 3)
4954 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4955 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4956 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4958 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4961 {sra.|sraw.} %3,%1,%2
4962 {srai.|srawi.} %3,%1,%h2
4965 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4966 (set_attr "length" "4,4,8,8")])
4969 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4970 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4971 (match_operand:SI 2 "reg_or_cint_operand" ""))
4973 (clobber (match_scratch:SI 3 ""))]
4974 "! TARGET_POWER && reload_completed"
4976 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4978 (compare:CC (match_dup 3)
4983 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4984 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4985 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4987 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4988 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4989 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4993 {srai.|srawi.} %0,%1,%h2
4996 [(set_attr "type" "delayed_compare")
4997 (set_attr "length" "4,4,8,8")])
5000 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5001 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5002 (match_operand:SI 2 "reg_or_cint_operand" ""))
5004 (set (match_operand:SI 0 "gpc_reg_operand" "")
5005 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5006 (clobber (match_scratch:SI 4 ""))]
5007 "TARGET_POWER && reload_completed"
5008 [(parallel [(set (match_dup 0)
5009 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5010 (clobber (match_dup 4))])
5012 (compare:CC (match_dup 0)
5017 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5018 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5019 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5021 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5022 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5025 {sra.|sraw.} %0,%1,%2
5026 {srai.|srawi.} %0,%1,%h2
5029 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5030 (set_attr "length" "4,4,8,8")])
5033 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5034 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5035 (match_operand:SI 2 "reg_or_cint_operand" ""))
5037 (set (match_operand:SI 0 "gpc_reg_operand" "")
5038 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5039 "! TARGET_POWER && reload_completed"
5041 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5043 (compare:CC (match_dup 0)
5047 ;; Floating-point insns, excluding normal data motion.
5049 ;; PowerPC has a full set of single-precision floating point instructions.
5051 ;; For the POWER architecture, we pretend that we have both SFmode and
5052 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5053 ;; The only conversions we will do will be when storing to memory. In that
5054 ;; case, we will use the "frsp" instruction before storing.
5056 ;; Note that when we store into a single-precision memory location, we need to
5057 ;; use the frsp insn first. If the register being stored isn't dead, we
5058 ;; need a scratch register for the frsp. But this is difficult when the store
5059 ;; is done by reload. It is not incorrect to do the frsp on the register in
5060 ;; this case, we just lose precision that we would have otherwise gotten but
5061 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5063 (define_expand "extendsfdf2"
5064 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5065 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5066 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5069 (define_insn_and_split "*extendsfdf2_fpr"
5070 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
5071 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5072 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5077 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5080 emit_note (NOTE_INSN_DELETED);
5083 [(set_attr "type" "fp,fp,fpload")])
5085 (define_expand "truncdfsf2"
5086 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5087 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5088 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5091 (define_insn "*truncdfsf2_fpr"
5092 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5093 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5094 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5096 [(set_attr "type" "fp")])
5098 (define_insn "aux_truncdfsf2"
5099 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5100 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5101 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5103 [(set_attr "type" "fp")])
5105 (define_expand "negsf2"
5106 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5107 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5108 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5111 (define_insn "*negsf2"
5112 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5113 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5114 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5116 [(set_attr "type" "fp")])
5118 (define_expand "abssf2"
5119 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5120 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5121 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5124 (define_insn "*abssf2"
5125 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5126 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5127 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5129 [(set_attr "type" "fp")])
5132 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5133 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5134 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5136 [(set_attr "type" "fp")])
5138 (define_expand "addsf3"
5139 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5140 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5141 (match_operand:SF 2 "gpc_reg_operand" "")))]
5142 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5146 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5147 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5148 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5149 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5151 [(set_attr "type" "fp")])
5154 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5155 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5156 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5157 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5158 "{fa|fadd} %0,%1,%2"
5159 [(set_attr "type" "fp")])
5161 (define_expand "subsf3"
5162 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5163 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5164 (match_operand:SF 2 "gpc_reg_operand" "")))]
5165 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5169 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5170 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5171 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5172 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5174 [(set_attr "type" "fp")])
5177 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5178 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5179 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5180 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5181 "{fs|fsub} %0,%1,%2"
5182 [(set_attr "type" "fp")])
5184 (define_expand "mulsf3"
5185 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5186 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5187 (match_operand:SF 2 "gpc_reg_operand" "")))]
5188 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5192 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5193 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5194 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5195 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5197 [(set_attr "type" "fp")])
5200 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5201 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5202 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5203 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5204 "{fm|fmul} %0,%1,%2"
5205 [(set_attr "type" "dmul")])
5207 (define_expand "divsf3"
5208 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5209 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5210 (match_operand:SF 2 "gpc_reg_operand" "")))]
5211 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5215 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5216 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5217 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5218 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5219 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5221 [(set_attr "type" "sdiv")])
5224 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5225 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5226 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5227 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5228 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5229 "{fd|fdiv} %0,%1,%2"
5230 [(set_attr "type" "ddiv")])
5232 (define_expand "recipsf3"
5233 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5234 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")
5235 (match_operand:SF 2 "gpc_reg_operand" "f")]
5237 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5238 && flag_finite_math_only && !flag_trapping_math"
5240 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5245 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5246 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5247 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5249 [(set_attr "type" "fp")])
5252 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5253 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5254 (match_operand:SF 2 "gpc_reg_operand" "f"))
5255 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5256 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5257 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5258 "fmadds %0,%1,%2,%3"
5259 [(set_attr "type" "fp")])
5262 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5263 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5264 (match_operand:SF 2 "gpc_reg_operand" "f"))
5265 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5266 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5267 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5268 "{fma|fmadd} %0,%1,%2,%3"
5269 [(set_attr "type" "dmul")])
5272 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5273 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5274 (match_operand:SF 2 "gpc_reg_operand" "f"))
5275 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5276 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5277 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5278 "fmsubs %0,%1,%2,%3"
5279 [(set_attr "type" "fp")])
5282 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5283 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5284 (match_operand:SF 2 "gpc_reg_operand" "f"))
5285 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5286 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5287 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5288 "{fms|fmsub} %0,%1,%2,%3"
5289 [(set_attr "type" "dmul")])
5292 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5293 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5294 (match_operand:SF 2 "gpc_reg_operand" "f"))
5295 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5296 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5297 && TARGET_SINGLE_FLOAT && HONOR_SIGNED_ZEROS (SFmode)"
5298 "fnmadds %0,%1,%2,%3"
5299 [(set_attr "type" "fp")])
5302 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5303 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5304 (match_operand:SF 2 "gpc_reg_operand" "f"))
5305 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5306 "TARGET_POWERPC && TARGET_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5307 && ! HONOR_SIGNED_ZEROS (SFmode)"
5308 "fnmadds %0,%1,%2,%3"
5309 [(set_attr "type" "fp")])
5312 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5313 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5314 (match_operand:SF 2 "gpc_reg_operand" "f"))
5315 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5316 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5317 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5318 "{fnma|fnmadd} %0,%1,%2,%3"
5319 [(set_attr "type" "dmul")])
5322 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5323 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5324 (match_operand:SF 2 "gpc_reg_operand" "f"))
5325 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5326 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5327 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5328 "{fnma|fnmadd} %0,%1,%2,%3"
5329 [(set_attr "type" "dmul")])
5332 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5333 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5334 (match_operand:SF 2 "gpc_reg_operand" "f"))
5335 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5336 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5337 && TARGET_SINGLE_FLOAT && HONOR_SIGNED_ZEROS (SFmode)"
5338 "fnmsubs %0,%1,%2,%3"
5339 [(set_attr "type" "fp")])
5342 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5343 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5344 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5345 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5346 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5347 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5348 "fnmsubs %0,%1,%2,%3"
5349 [(set_attr "type" "fp")])
5352 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5353 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5354 (match_operand:SF 2 "gpc_reg_operand" "f"))
5355 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5356 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5357 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5358 "{fnms|fnmsub} %0,%1,%2,%3"
5359 [(set_attr "type" "dmul")])
5362 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5363 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5364 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5365 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5366 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5367 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5368 "{fnms|fnmsub} %0,%1,%2,%3"
5369 [(set_attr "type" "dmul")])
5371 (define_expand "sqrtsf2"
5372 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5373 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5374 "(TARGET_PPC_GPOPT || TARGET_POWER2)
5375 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5376 && !TARGET_SIMPLE_FPU"
5380 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5381 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5382 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT
5383 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5385 [(set_attr "type" "ssqrt")])
5388 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5389 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5390 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5391 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5393 [(set_attr "type" "dsqrt")])
5395 (define_expand "rsqrtsf2"
5396 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5397 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5399 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5400 && flag_finite_math_only && !flag_trapping_math"
5402 rs6000_emit_swrsqrtsf (operands[0], operands[1]);
5406 (define_insn "*rsqrt_internal1"
5407 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5408 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5410 "TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT"
5412 [(set_attr "type" "fp")])
5414 (define_expand "copysignsf3"
5416 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5418 (neg:SF (abs:SF (match_dup 1))))
5419 (set (match_operand:SF 0 "gpc_reg_operand" "")
5420 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5424 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5425 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5427 operands[3] = gen_reg_rtx (SFmode);
5428 operands[4] = gen_reg_rtx (SFmode);
5429 operands[5] = CONST0_RTX (SFmode);
5432 (define_expand "copysigndf3"
5434 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5436 (neg:DF (abs:DF (match_dup 1))))
5437 (set (match_operand:DF 0 "gpc_reg_operand" "")
5438 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5442 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5443 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5445 operands[3] = gen_reg_rtx (DFmode);
5446 operands[4] = gen_reg_rtx (DFmode);
5447 operands[5] = CONST0_RTX (DFmode);
5450 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5451 ;; fsel instruction and some auxiliary computations. Then we just have a
5452 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5454 (define_expand "smaxsf3"
5455 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5456 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5457 (match_operand:SF 2 "gpc_reg_operand" ""))
5460 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5461 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5462 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5464 (define_expand "sminsf3"
5465 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5466 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5467 (match_operand:SF 2 "gpc_reg_operand" ""))
5470 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5471 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5472 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5475 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5476 (match_operator:SF 3 "min_max_operator"
5477 [(match_operand:SF 1 "gpc_reg_operand" "")
5478 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5479 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5480 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5483 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5484 operands[1], operands[2]);
5488 (define_expand "movsicc"
5489 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5490 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5491 (match_operand:SI 2 "gpc_reg_operand" "")
5492 (match_operand:SI 3 "gpc_reg_operand" "")))]
5496 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5502 ;; We use the BASE_REGS for the isel input operands because, if rA is
5503 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5504 ;; because we may switch the operands and rB may end up being rA.
5506 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5507 ;; leave out the mode in operand 4 and use one pattern, but reload can
5508 ;; change the mode underneath our feet and then gets confused trying
5509 ;; to reload the value.
5510 (define_insn "isel_signed"
5511 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5513 (match_operator 1 "comparison_operator"
5514 [(match_operand:CC 4 "cc_reg_operand" "y")
5516 (match_operand:SI 2 "gpc_reg_operand" "b")
5517 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5520 { return output_isel (operands); }"
5521 [(set_attr "length" "4")])
5523 (define_insn "isel_unsigned"
5524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5526 (match_operator 1 "comparison_operator"
5527 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5529 (match_operand:SI 2 "gpc_reg_operand" "b")
5530 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5533 { return output_isel (operands); }"
5534 [(set_attr "length" "4")])
5536 (define_expand "movsfcc"
5537 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5538 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5539 (match_operand:SF 2 "gpc_reg_operand" "")
5540 (match_operand:SF 3 "gpc_reg_operand" "")))]
5541 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5544 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5550 (define_insn "*fselsfsf4"
5551 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5552 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5553 (match_operand:SF 4 "zero_fp_constant" "F"))
5554 (match_operand:SF 2 "gpc_reg_operand" "f")
5555 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5556 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5558 [(set_attr "type" "fp")])
5560 (define_insn "*fseldfsf4"
5561 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5562 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5563 (match_operand:DF 4 "zero_fp_constant" "F"))
5564 (match_operand:SF 2 "gpc_reg_operand" "f")
5565 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5566 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5568 [(set_attr "type" "fp")])
5570 (define_expand "negdf2"
5571 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5572 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5573 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5576 (define_insn "*negdf2_fpr"
5577 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5578 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5579 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5581 [(set_attr "type" "fp")])
5583 (define_expand "absdf2"
5584 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5585 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5586 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5589 (define_insn "*absdf2_fpr"
5590 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5591 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5592 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5594 [(set_attr "type" "fp")])
5596 (define_insn "*nabsdf2_fpr"
5597 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5598 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5599 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5601 [(set_attr "type" "fp")])
5603 (define_expand "adddf3"
5604 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5605 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5606 (match_operand:DF 2 "gpc_reg_operand" "")))]
5607 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5610 (define_insn "*adddf3_fpr"
5611 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5612 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5613 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5614 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5615 "{fa|fadd} %0,%1,%2"
5616 [(set_attr "type" "fp")])
5618 (define_expand "subdf3"
5619 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5620 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5621 (match_operand:DF 2 "gpc_reg_operand" "")))]
5622 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5625 (define_insn "*subdf3_fpr"
5626 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5627 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5628 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5629 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5630 "{fs|fsub} %0,%1,%2"
5631 [(set_attr "type" "fp")])
5633 (define_expand "muldf3"
5634 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5635 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5636 (match_operand:DF 2 "gpc_reg_operand" "")))]
5637 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5640 (define_insn "*muldf3_fpr"
5641 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5642 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5643 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5644 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5645 "{fm|fmul} %0,%1,%2"
5646 [(set_attr "type" "dmul")])
5648 (define_expand "divdf3"
5649 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5650 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5651 (match_operand:DF 2 "gpc_reg_operand" "")))]
5652 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE) && !TARGET_SIMPLE_FPU"
5655 (define_insn "*divdf3_fpr"
5656 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5657 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5658 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5659 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU"
5660 "{fd|fdiv} %0,%1,%2"
5661 [(set_attr "type" "ddiv")])
5663 (define_expand "recipdf3"
5664 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5665 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")
5666 (match_operand:DF 2 "gpc_reg_operand" "f")]
5668 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_POPCNTB && !optimize_size
5669 && flag_finite_math_only && !flag_trapping_math"
5671 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5676 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5677 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5678 "TARGET_POPCNTB && flag_finite_math_only"
5680 [(set_attr "type" "fp")])
5683 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5684 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5685 (match_operand:DF 2 "gpc_reg_operand" "f"))
5686 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5687 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
5688 "{fma|fmadd} %0,%1,%2,%3"
5689 [(set_attr "type" "dmul")])
5692 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5693 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5694 (match_operand:DF 2 "gpc_reg_operand" "f"))
5695 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5696 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
5697 "{fms|fmsub} %0,%1,%2,%3"
5698 [(set_attr "type" "dmul")])
5701 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5702 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5703 (match_operand:DF 2 "gpc_reg_operand" "f"))
5704 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5705 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5706 && HONOR_SIGNED_ZEROS (DFmode)"
5707 "{fnma|fnmadd} %0,%1,%2,%3"
5708 [(set_attr "type" "dmul")])
5711 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5712 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5713 (match_operand:DF 2 "gpc_reg_operand" "f"))
5714 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5715 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5716 && ! HONOR_SIGNED_ZEROS (DFmode)"
5717 "{fnma|fnmadd} %0,%1,%2,%3"
5718 [(set_attr "type" "dmul")])
5721 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5722 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5723 (match_operand:DF 2 "gpc_reg_operand" "f"))
5724 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5725 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5726 && HONOR_SIGNED_ZEROS (DFmode)"
5727 "{fnms|fnmsub} %0,%1,%2,%3"
5728 [(set_attr "type" "dmul")])
5731 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5732 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5733 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5734 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5735 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5736 && ! HONOR_SIGNED_ZEROS (DFmode)"
5737 "{fnms|fnmsub} %0,%1,%2,%3"
5738 [(set_attr "type" "dmul")])
5740 (define_insn "sqrtdf2"
5741 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5742 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5743 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
5744 && TARGET_DOUBLE_FLOAT"
5746 [(set_attr "type" "dsqrt")])
5748 ;; The conditional move instructions allow us to perform max and min
5749 ;; operations even when
5751 (define_expand "smaxdf3"
5752 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5753 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5754 (match_operand:DF 2 "gpc_reg_operand" ""))
5757 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5758 && !flag_trapping_math"
5759 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5761 (define_expand "smindf3"
5762 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5763 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5764 (match_operand:DF 2 "gpc_reg_operand" ""))
5767 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5768 && !flag_trapping_math"
5769 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5772 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5773 (match_operator:DF 3 "min_max_operator"
5774 [(match_operand:DF 1 "gpc_reg_operand" "")
5775 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5776 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5777 && !flag_trapping_math"
5780 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5781 operands[1], operands[2]);
5785 (define_expand "movdfcc"
5786 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5787 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5788 (match_operand:DF 2 "gpc_reg_operand" "")
5789 (match_operand:DF 3 "gpc_reg_operand" "")))]
5790 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5793 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5799 (define_insn "*fseldfdf4"
5800 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5801 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5802 (match_operand:DF 4 "zero_fp_constant" "F"))
5803 (match_operand:DF 2 "gpc_reg_operand" "f")
5804 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5805 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5807 [(set_attr "type" "fp")])
5809 (define_insn "*fselsfdf4"
5810 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5811 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5812 (match_operand:SF 4 "zero_fp_constant" "F"))
5813 (match_operand:DF 2 "gpc_reg_operand" "f")
5814 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5815 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5817 [(set_attr "type" "fp")])
5819 ;; Conversions to and from floating-point.
5821 (define_expand "fixuns_truncsfsi2"
5822 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5823 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5824 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5827 (define_expand "fix_truncsfsi2"
5828 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5829 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5830 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5833 ; For each of these conversions, there is a define_expand, a define_insn
5834 ; with a '#' template, and a define_split (with C code). The idea is
5835 ; to allow constant folding with the template of the define_insn,
5836 ; then to have the insns split later (between sched1 and final).
5838 (define_expand "floatsidf2"
5839 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5840 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5843 (clobber (match_dup 4))
5844 (clobber (match_dup 5))
5845 (clobber (match_dup 6))])]
5847 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5850 if (TARGET_E500_DOUBLE)
5852 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5855 if (TARGET_POWERPC64)
5857 rtx x = convert_to_mode (DImode, operands[1], 0);
5858 emit_insn (gen_floatdidf2 (operands[0], x));
5862 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5863 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5864 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5865 operands[5] = gen_reg_rtx (DFmode);
5866 operands[6] = gen_reg_rtx (SImode);
5869 (define_insn_and_split "*floatsidf2_internal"
5870 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5871 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5872 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5873 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5874 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5875 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5876 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5877 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5879 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5883 rtx lowword, highword;
5884 gcc_assert (MEM_P (operands[4]));
5885 highword = adjust_address (operands[4], SImode, 0);
5886 lowword = adjust_address (operands[4], SImode, 4);
5887 if (! WORDS_BIG_ENDIAN)
5890 tmp = highword; highword = lowword; lowword = tmp;
5893 emit_insn (gen_xorsi3 (operands[6], operands[1],
5894 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5895 emit_move_insn (lowword, operands[6]);
5896 emit_move_insn (highword, operands[2]);
5897 emit_move_insn (operands[5], operands[4]);
5898 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5901 [(set_attr "length" "24")])
5903 (define_expand "floatunssisf2"
5904 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5905 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5906 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5909 (define_expand "floatunssidf2"
5910 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5911 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5914 (clobber (match_dup 4))
5915 (clobber (match_dup 5))])]
5916 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5919 if (TARGET_E500_DOUBLE)
5921 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5924 if (TARGET_POWERPC64)
5926 rtx x = convert_to_mode (DImode, operands[1], 1);
5927 emit_insn (gen_floatdidf2 (operands[0], x));
5931 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5932 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5933 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5934 operands[5] = gen_reg_rtx (DFmode);
5937 (define_insn_and_split "*floatunssidf2_internal"
5938 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5939 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5940 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5941 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5942 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5943 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5944 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5946 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5950 rtx lowword, highword;
5951 gcc_assert (MEM_P (operands[4]));
5952 highword = adjust_address (operands[4], SImode, 0);
5953 lowword = adjust_address (operands[4], SImode, 4);
5954 if (! WORDS_BIG_ENDIAN)
5957 tmp = highword; highword = lowword; lowword = tmp;
5960 emit_move_insn (lowword, operands[1]);
5961 emit_move_insn (highword, operands[2]);
5962 emit_move_insn (operands[5], operands[4]);
5963 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5966 [(set_attr "length" "20")])
5968 (define_expand "fix_truncdfsi2"
5969 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5970 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5971 (clobber (match_dup 2))
5972 (clobber (match_dup 3))])]
5973 "(TARGET_POWER2 || TARGET_POWERPC)
5974 && TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5977 if (TARGET_E500_DOUBLE)
5979 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5982 operands[2] = gen_reg_rtx (DImode);
5983 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
5984 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
5986 operands[3] = gen_reg_rtx (DImode);
5987 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
5988 operands[2], operands[3]));
5991 if (TARGET_PPC_GFXOPT)
5993 rtx orig_dest = operands[0];
5994 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5995 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5996 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5998 if (operands[0] != orig_dest)
5999 emit_move_insn (orig_dest, operands[0]);
6002 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
6005 (define_insn_and_split "*fix_truncdfsi2_internal"
6006 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6007 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6008 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
6009 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6010 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6011 && TARGET_DOUBLE_FLOAT"
6013 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[3]))"
6018 gcc_assert (MEM_P (operands[3]));
6019 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6021 emit_insn (gen_fctiwz (operands[2], operands[1]));
6022 emit_move_insn (operands[3], operands[2]);
6023 emit_move_insn (operands[0], lowword);
6026 [(set_attr "length" "16")])
6028 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6029 [(set (match_operand:SI 0 "memory_operand" "=Z")
6030 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6031 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
6032 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6033 && TARGET_DOUBLE_FLOAT
6034 && TARGET_PPC_GFXOPT"
6040 emit_insn (gen_fctiwz (operands[2], operands[1]));
6041 emit_insn (gen_stfiwx (operands[0], operands[2]));
6044 [(set_attr "length" "16")])
6046 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6047 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6048 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6049 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
6050 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6051 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6052 && TARGET_DOUBLE_FLOAT"
6055 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6056 (set (match_dup 3) (match_dup 2))
6057 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6059 [(set_attr "length" "12")])
6061 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6062 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6063 ; because the first makes it clear that operand 0 is not live
6064 ; before the instruction.
6065 (define_insn "fctiwz"
6066 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
6067 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
6069 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6070 && TARGET_DOUBLE_FLOAT"
6071 "{fcirz|fctiwz} %0,%1"
6072 [(set_attr "type" "fp")])
6074 (define_insn "btruncdf2"
6075 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6076 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6077 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6079 [(set_attr "type" "fp")])
6081 (define_insn "btruncsf2"
6082 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6083 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6084 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6086 [(set_attr "type" "fp")])
6088 (define_insn "ceildf2"
6089 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6090 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6091 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6093 [(set_attr "type" "fp")])
6095 (define_insn "ceilsf2"
6096 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6097 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6098 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6100 [(set_attr "type" "fp")])
6102 (define_insn "floordf2"
6103 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6104 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6105 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6107 [(set_attr "type" "fp")])
6109 (define_insn "floorsf2"
6110 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6111 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6112 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6114 [(set_attr "type" "fp")])
6116 (define_insn "rounddf2"
6117 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6118 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6119 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6121 [(set_attr "type" "fp")])
6123 (define_insn "roundsf2"
6124 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6125 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6126 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6128 [(set_attr "type" "fp")])
6130 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6131 (define_insn "stfiwx"
6132 [(set (match_operand:SI 0 "memory_operand" "=Z")
6133 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
6137 [(set_attr "type" "fpstore")])
6139 (define_expand "floatsisf2"
6140 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6141 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6142 "TARGET_HARD_FLOAT && (!TARGET_FPRS || TARGET_SINGLE_FPU)"
6145 (define_insn "floatdidf2"
6146 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6147 (float:DF (match_operand:DI 1 "gpc_reg_operand" "!f#r")))]
6148 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6150 [(set_attr "type" "fp")])
6152 (define_insn "fix_truncdfdi2"
6153 [(set (match_operand:DI 0 "gpc_reg_operand" "=!f#r")
6154 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
6155 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6157 [(set_attr "type" "fp")])
6159 (define_expand "floatdisf2"
6160 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6161 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6162 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6165 rtx val = operands[1];
6166 if (!flag_unsafe_math_optimizations)
6168 rtx label = gen_label_rtx ();
6169 val = gen_reg_rtx (DImode);
6170 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6173 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6177 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6178 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6179 ;; from double rounding.
6180 (define_insn_and_split "floatdisf2_internal1"
6181 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6182 (float:SF (match_operand:DI 1 "gpc_reg_operand" "!f#r")))
6183 (clobber (match_scratch:DF 2 "=f"))]
6184 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6186 "&& reload_completed"
6188 (float:DF (match_dup 1)))
6190 (float_truncate:SF (match_dup 2)))]
6193 ;; Twiddles bits to avoid double rounding.
6194 ;; Bits that might be truncated when converting to DFmode are replaced
6195 ;; by a bit that won't be lost at that stage, but is below the SFmode
6196 ;; rounding position.
6197 (define_expand "floatdisf2_internal2"
6198 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6200 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6202 (clobber (scratch:CC))])
6203 (set (match_dup 3) (plus:DI (match_dup 3)
6205 (set (match_dup 0) (plus:DI (match_dup 0)
6207 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6209 (set (match_dup 0) (ior:DI (match_dup 0)
6211 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6213 (clobber (scratch:CC))])
6214 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6215 (label_ref (match_operand:DI 2 "" ""))
6217 (set (match_dup 0) (match_dup 1))]
6218 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6221 operands[3] = gen_reg_rtx (DImode);
6222 operands[4] = gen_reg_rtx (CCUNSmode);
6225 ;; Define the DImode operations that can be done in a small number
6226 ;; of instructions. The & constraints are to prevent the register
6227 ;; allocator from allocating registers that overlap with the inputs
6228 ;; (for example, having an input in 7,8 and an output in 6,7). We
6229 ;; also allow for the output being the same as one of the inputs.
6231 (define_insn "*adddi3_noppc64"
6232 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6233 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6234 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6235 "! TARGET_POWERPC64"
6238 if (WORDS_BIG_ENDIAN)
6239 return (GET_CODE (operands[2])) != CONST_INT
6240 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6241 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6243 return (GET_CODE (operands[2])) != CONST_INT
6244 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6245 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6247 [(set_attr "type" "two")
6248 (set_attr "length" "8")])
6250 (define_insn "*subdi3_noppc64"
6251 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6252 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6253 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6254 "! TARGET_POWERPC64"
6257 if (WORDS_BIG_ENDIAN)
6258 return (GET_CODE (operands[1]) != CONST_INT)
6259 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6260 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6262 return (GET_CODE (operands[1]) != CONST_INT)
6263 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6264 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6266 [(set_attr "type" "two")
6267 (set_attr "length" "8")])
6269 (define_insn "*negdi2_noppc64"
6270 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6271 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6272 "! TARGET_POWERPC64"
6275 return (WORDS_BIG_ENDIAN)
6276 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6277 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6279 [(set_attr "type" "two")
6280 (set_attr "length" "8")])
6282 (define_expand "mulsidi3"
6283 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6284 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6285 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6286 "! TARGET_POWERPC64"
6289 if (! TARGET_POWER && ! TARGET_POWERPC)
6291 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6292 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6293 emit_insn (gen_mull_call ());
6294 if (WORDS_BIG_ENDIAN)
6295 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6298 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6299 gen_rtx_REG (SImode, 3));
6300 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6301 gen_rtx_REG (SImode, 4));
6305 else if (TARGET_POWER)
6307 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6312 (define_insn "mulsidi3_mq"
6313 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6314 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6315 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6316 (clobber (match_scratch:SI 3 "=q"))]
6318 "mul %0,%1,%2\;mfmq %L0"
6319 [(set_attr "type" "imul")
6320 (set_attr "length" "8")])
6322 (define_insn "*mulsidi3_no_mq"
6323 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6324 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6325 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6326 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6329 return (WORDS_BIG_ENDIAN)
6330 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6331 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6333 [(set_attr "type" "imul")
6334 (set_attr "length" "8")])
6337 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6338 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6339 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6340 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6343 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6344 (sign_extend:DI (match_dup 2)))
6347 (mult:SI (match_dup 1)
6351 int endian = (WORDS_BIG_ENDIAN == 0);
6352 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6353 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6356 (define_expand "umulsidi3"
6357 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6358 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6359 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6360 "TARGET_POWERPC && ! TARGET_POWERPC64"
6365 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6370 (define_insn "umulsidi3_mq"
6371 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6372 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6373 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6374 (clobber (match_scratch:SI 3 "=q"))]
6375 "TARGET_POWERPC && TARGET_POWER"
6378 return (WORDS_BIG_ENDIAN)
6379 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6380 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6382 [(set_attr "type" "imul")
6383 (set_attr "length" "8")])
6385 (define_insn "*umulsidi3_no_mq"
6386 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6387 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6388 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6389 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6392 return (WORDS_BIG_ENDIAN)
6393 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6394 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6396 [(set_attr "type" "imul")
6397 (set_attr "length" "8")])
6400 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6401 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6402 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6403 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6406 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6407 (zero_extend:DI (match_dup 2)))
6410 (mult:SI (match_dup 1)
6414 int endian = (WORDS_BIG_ENDIAN == 0);
6415 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6416 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6419 (define_expand "smulsi3_highpart"
6420 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6422 (lshiftrt:DI (mult:DI (sign_extend:DI
6423 (match_operand:SI 1 "gpc_reg_operand" ""))
6425 (match_operand:SI 2 "gpc_reg_operand" "")))
6430 if (! TARGET_POWER && ! TARGET_POWERPC)
6432 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6433 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6434 emit_insn (gen_mulh_call ());
6435 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6438 else if (TARGET_POWER)
6440 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6445 (define_insn "smulsi3_highpart_mq"
6446 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6448 (lshiftrt:DI (mult:DI (sign_extend:DI
6449 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6451 (match_operand:SI 2 "gpc_reg_operand" "r")))
6453 (clobber (match_scratch:SI 3 "=q"))]
6456 [(set_attr "type" "imul")])
6458 (define_insn "*smulsi3_highpart_no_mq"
6459 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6461 (lshiftrt:DI (mult:DI (sign_extend:DI
6462 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6464 (match_operand:SI 2 "gpc_reg_operand" "r")))
6466 "TARGET_POWERPC && ! TARGET_POWER"
6468 [(set_attr "type" "imul")])
6470 (define_expand "umulsi3_highpart"
6471 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6473 (lshiftrt:DI (mult:DI (zero_extend:DI
6474 (match_operand:SI 1 "gpc_reg_operand" ""))
6476 (match_operand:SI 2 "gpc_reg_operand" "")))
6483 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6488 (define_insn "umulsi3_highpart_mq"
6489 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6491 (lshiftrt:DI (mult:DI (zero_extend:DI
6492 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6494 (match_operand:SI 2 "gpc_reg_operand" "r")))
6496 (clobber (match_scratch:SI 3 "=q"))]
6497 "TARGET_POWERPC && TARGET_POWER"
6499 [(set_attr "type" "imul")])
6501 (define_insn "*umulsi3_highpart_no_mq"
6502 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6504 (lshiftrt:DI (mult:DI (zero_extend:DI
6505 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6507 (match_operand:SI 2 "gpc_reg_operand" "r")))
6509 "TARGET_POWERPC && ! TARGET_POWER"
6511 [(set_attr "type" "imul")])
6513 ;; If operands 0 and 2 are in the same register, we have a problem. But
6514 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6515 ;; why we have the strange constraints below.
6516 (define_insn "ashldi3_power"
6517 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6518 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6519 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6520 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6523 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6524 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6525 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6526 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6527 [(set_attr "length" "8")])
6529 (define_insn "lshrdi3_power"
6530 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6531 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6532 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6533 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6536 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6537 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6538 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6539 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6540 [(set_attr "length" "8")])
6542 ;; Shift by a variable amount is too complex to be worth open-coding. We
6543 ;; just handle shifts by constants.
6544 (define_insn "ashrdi3_power"
6545 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6546 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6547 (match_operand:SI 2 "const_int_operand" "M,i")))
6548 (clobber (match_scratch:SI 3 "=X,q"))]
6551 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6552 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6553 [(set_attr "type" "shift")
6554 (set_attr "length" "8")])
6556 (define_insn "ashrdi3_no_power"
6557 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6558 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6559 (match_operand:SI 2 "const_int_operand" "M,i")))]
6560 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6562 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6563 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6564 [(set_attr "type" "two,three")
6565 (set_attr "length" "8,12")])
6567 (define_insn "*ashrdisi3_noppc64"
6568 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6569 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6570 (const_int 32)) 4))]
6571 "TARGET_32BIT && !TARGET_POWERPC64"
6574 if (REGNO (operands[0]) == REGNO (operands[1]))
6577 return \"mr %0,%1\";
6579 [(set_attr "length" "4")])
6582 ;; PowerPC64 DImode operations.
6584 (define_insn_and_split "absdi2"
6585 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6586 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6587 (clobber (match_scratch:DI 2 "=&r,&r"))]
6590 "&& reload_completed"
6591 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6592 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6593 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6596 (define_insn_and_split "*nabsdi2"
6597 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6598 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6599 (clobber (match_scratch:DI 2 "=&r,&r"))]
6602 "&& reload_completed"
6603 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6604 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6605 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6608 (define_insn "muldi3"
6609 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6610 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6611 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6617 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6618 (const_string "imul3")
6619 (match_operand:SI 2 "short_cint_operand" "")
6620 (const_string "imul2")]
6621 (const_string "lmul")))])
6623 (define_insn "*muldi3_internal1"
6624 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6625 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6626 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6628 (clobber (match_scratch:DI 3 "=r,r"))]
6633 [(set_attr "type" "lmul_compare")
6634 (set_attr "length" "4,8")])
6637 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6638 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6639 (match_operand:DI 2 "gpc_reg_operand" ""))
6641 (clobber (match_scratch:DI 3 ""))]
6642 "TARGET_POWERPC64 && reload_completed"
6644 (mult:DI (match_dup 1) (match_dup 2)))
6646 (compare:CC (match_dup 3)
6650 (define_insn "*muldi3_internal2"
6651 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6652 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6653 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6655 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6656 (mult:DI (match_dup 1) (match_dup 2)))]
6661 [(set_attr "type" "lmul_compare")
6662 (set_attr "length" "4,8")])
6665 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6666 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6667 (match_operand:DI 2 "gpc_reg_operand" ""))
6669 (set (match_operand:DI 0 "gpc_reg_operand" "")
6670 (mult:DI (match_dup 1) (match_dup 2)))]
6671 "TARGET_POWERPC64 && reload_completed"
6673 (mult:DI (match_dup 1) (match_dup 2)))
6675 (compare:CC (match_dup 0)
6679 (define_insn "smuldi3_highpart"
6680 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6682 (lshiftrt:TI (mult:TI (sign_extend:TI
6683 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6685 (match_operand:DI 2 "gpc_reg_operand" "r")))
6689 [(set_attr "type" "lmul")])
6691 (define_insn "umuldi3_highpart"
6692 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6694 (lshiftrt:TI (mult:TI (zero_extend:TI
6695 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6697 (match_operand:DI 2 "gpc_reg_operand" "r")))
6701 [(set_attr "type" "lmul")])
6703 (define_insn "rotldi3"
6704 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6705 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6706 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6711 [(set_attr "type" "var_shift_rotate,integer")])
6713 (define_insn "*rotldi3_internal2"
6714 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6715 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6716 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6718 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6725 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6726 (set_attr "length" "4,4,8,8")])
6729 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6730 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6731 (match_operand:DI 2 "reg_or_cint_operand" ""))
6733 (clobber (match_scratch:DI 3 ""))]
6734 "TARGET_POWERPC64 && reload_completed"
6736 (rotate:DI (match_dup 1) (match_dup 2)))
6738 (compare:CC (match_dup 3)
6742 (define_insn "*rotldi3_internal3"
6743 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6744 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6745 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6747 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6748 (rotate:DI (match_dup 1) (match_dup 2)))]
6755 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6756 (set_attr "length" "4,4,8,8")])
6759 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6760 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6761 (match_operand:DI 2 "reg_or_cint_operand" ""))
6763 (set (match_operand:DI 0 "gpc_reg_operand" "")
6764 (rotate:DI (match_dup 1) (match_dup 2)))]
6765 "TARGET_POWERPC64 && reload_completed"
6767 (rotate:DI (match_dup 1) (match_dup 2)))
6769 (compare:CC (match_dup 0)
6773 (define_insn "*rotldi3_internal4"
6774 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6775 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6776 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6777 (match_operand:DI 3 "mask64_operand" "n,n")))]
6780 rldc%B3 %0,%1,%2,%S3
6781 rldic%B3 %0,%1,%H2,%S3"
6782 [(set_attr "type" "var_shift_rotate,integer")])
6784 (define_insn "*rotldi3_internal5"
6785 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6787 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6788 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6789 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6791 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6794 rldc%B3. %4,%1,%2,%S3
6795 rldic%B3. %4,%1,%H2,%S3
6798 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6799 (set_attr "length" "4,4,8,8")])
6802 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6804 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6805 (match_operand:DI 2 "reg_or_cint_operand" ""))
6806 (match_operand:DI 3 "mask64_operand" ""))
6808 (clobber (match_scratch:DI 4 ""))]
6809 "TARGET_POWERPC64 && reload_completed"
6811 (and:DI (rotate:DI (match_dup 1)
6815 (compare:CC (match_dup 4)
6819 (define_insn "*rotldi3_internal6"
6820 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6822 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6823 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6824 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6826 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6827 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6830 rldc%B3. %0,%1,%2,%S3
6831 rldic%B3. %0,%1,%H2,%S3
6834 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6835 (set_attr "length" "4,4,8,8")])
6838 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6840 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6841 (match_operand:DI 2 "reg_or_cint_operand" ""))
6842 (match_operand:DI 3 "mask64_operand" ""))
6844 (set (match_operand:DI 0 "gpc_reg_operand" "")
6845 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6846 "TARGET_POWERPC64 && reload_completed"
6848 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6850 (compare:CC (match_dup 0)
6854 (define_insn "*rotldi3_internal7"
6855 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6858 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6859 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6863 rldicl %0,%1,%H2,56"
6864 [(set_attr "type" "var_shift_rotate,integer")])
6866 (define_insn "*rotldi3_internal8"
6867 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6868 (compare:CC (zero_extend:DI
6870 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6871 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6873 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6877 rldicl. %3,%1,%H2,56
6880 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6881 (set_attr "length" "4,4,8,8")])
6884 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6885 (compare:CC (zero_extend:DI
6887 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6888 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6890 (clobber (match_scratch:DI 3 ""))]
6891 "TARGET_POWERPC64 && reload_completed"
6893 (zero_extend:DI (subreg:QI
6894 (rotate:DI (match_dup 1)
6897 (compare:CC (match_dup 3)
6901 (define_insn "*rotldi3_internal9"
6902 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6903 (compare:CC (zero_extend:DI
6905 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6906 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6908 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6909 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6913 rldicl. %0,%1,%H2,56
6916 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6917 (set_attr "length" "4,4,8,8")])
6920 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6921 (compare:CC (zero_extend:DI
6923 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6924 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6926 (set (match_operand:DI 0 "gpc_reg_operand" "")
6927 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6928 "TARGET_POWERPC64 && reload_completed"
6930 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6932 (compare:CC (match_dup 0)
6936 (define_insn "*rotldi3_internal10"
6937 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6940 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6941 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6945 rldicl %0,%1,%H2,48"
6946 [(set_attr "type" "var_shift_rotate,integer")])
6948 (define_insn "*rotldi3_internal11"
6949 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6950 (compare:CC (zero_extend:DI
6952 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6953 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6955 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6959 rldicl. %3,%1,%H2,48
6962 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6963 (set_attr "length" "4,4,8,8")])
6966 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6967 (compare:CC (zero_extend:DI
6969 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6970 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6972 (clobber (match_scratch:DI 3 ""))]
6973 "TARGET_POWERPC64 && reload_completed"
6975 (zero_extend:DI (subreg:HI
6976 (rotate:DI (match_dup 1)
6979 (compare:CC (match_dup 3)
6983 (define_insn "*rotldi3_internal12"
6984 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6985 (compare:CC (zero_extend:DI
6987 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6988 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6990 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6991 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6995 rldicl. %0,%1,%H2,48
6998 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6999 (set_attr "length" "4,4,8,8")])
7002 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7003 (compare:CC (zero_extend:DI
7005 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7006 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7008 (set (match_operand:DI 0 "gpc_reg_operand" "")
7009 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7010 "TARGET_POWERPC64 && reload_completed"
7012 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7014 (compare:CC (match_dup 0)
7018 (define_insn "*rotldi3_internal13"
7019 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7022 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7023 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7027 rldicl %0,%1,%H2,32"
7028 [(set_attr "type" "var_shift_rotate,integer")])
7030 (define_insn "*rotldi3_internal14"
7031 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7032 (compare:CC (zero_extend:DI
7034 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7035 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7037 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7041 rldicl. %3,%1,%H2,32
7044 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7045 (set_attr "length" "4,4,8,8")])
7048 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7049 (compare:CC (zero_extend:DI
7051 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7052 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7054 (clobber (match_scratch:DI 3 ""))]
7055 "TARGET_POWERPC64 && reload_completed"
7057 (zero_extend:DI (subreg:SI
7058 (rotate:DI (match_dup 1)
7061 (compare:CC (match_dup 3)
7065 (define_insn "*rotldi3_internal15"
7066 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7067 (compare:CC (zero_extend:DI
7069 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7070 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7072 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7073 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7077 rldicl. %0,%1,%H2,32
7080 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7081 (set_attr "length" "4,4,8,8")])
7084 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7085 (compare:CC (zero_extend:DI
7087 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7088 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7090 (set (match_operand:DI 0 "gpc_reg_operand" "")
7091 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7092 "TARGET_POWERPC64 && reload_completed"
7094 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7096 (compare:CC (match_dup 0)
7100 (define_expand "ashldi3"
7101 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7102 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7103 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7104 "TARGET_POWERPC64 || TARGET_POWER"
7107 if (TARGET_POWERPC64)
7109 else if (TARGET_POWER)
7111 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7118 (define_insn "*ashldi3_internal1"
7119 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7120 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7121 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7126 [(set_attr "type" "var_shift_rotate,shift")])
7128 (define_insn "*ashldi3_internal2"
7129 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7130 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7131 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7133 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7140 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7141 (set_attr "length" "4,4,8,8")])
7144 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7145 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7146 (match_operand:SI 2 "reg_or_cint_operand" ""))
7148 (clobber (match_scratch:DI 3 ""))]
7149 "TARGET_POWERPC64 && reload_completed"
7151 (ashift:DI (match_dup 1) (match_dup 2)))
7153 (compare:CC (match_dup 3)
7157 (define_insn "*ashldi3_internal3"
7158 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7159 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7160 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7162 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7163 (ashift:DI (match_dup 1) (match_dup 2)))]
7170 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7171 (set_attr "length" "4,4,8,8")])
7174 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7175 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7176 (match_operand:SI 2 "reg_or_cint_operand" ""))
7178 (set (match_operand:DI 0 "gpc_reg_operand" "")
7179 (ashift:DI (match_dup 1) (match_dup 2)))]
7180 "TARGET_POWERPC64 && reload_completed"
7182 (ashift:DI (match_dup 1) (match_dup 2)))
7184 (compare:CC (match_dup 0)
7188 (define_insn "*ashldi3_internal4"
7189 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7190 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7191 (match_operand:SI 2 "const_int_operand" "i"))
7192 (match_operand:DI 3 "const_int_operand" "n")))]
7193 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7194 "rldic %0,%1,%H2,%W3")
7196 (define_insn "ashldi3_internal5"
7197 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7199 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7200 (match_operand:SI 2 "const_int_operand" "i,i"))
7201 (match_operand:DI 3 "const_int_operand" "n,n"))
7203 (clobber (match_scratch:DI 4 "=r,r"))]
7204 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7206 rldic. %4,%1,%H2,%W3
7208 [(set_attr "type" "compare")
7209 (set_attr "length" "4,8")])
7212 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7214 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7215 (match_operand:SI 2 "const_int_operand" ""))
7216 (match_operand:DI 3 "const_int_operand" ""))
7218 (clobber (match_scratch:DI 4 ""))]
7219 "TARGET_POWERPC64 && reload_completed
7220 && includes_rldic_lshift_p (operands[2], operands[3])"
7222 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7225 (compare:CC (match_dup 4)
7229 (define_insn "*ashldi3_internal6"
7230 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7232 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7233 (match_operand:SI 2 "const_int_operand" "i,i"))
7234 (match_operand:DI 3 "const_int_operand" "n,n"))
7236 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7237 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7238 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7240 rldic. %0,%1,%H2,%W3
7242 [(set_attr "type" "compare")
7243 (set_attr "length" "4,8")])
7246 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7248 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7249 (match_operand:SI 2 "const_int_operand" ""))
7250 (match_operand:DI 3 "const_int_operand" ""))
7252 (set (match_operand:DI 0 "gpc_reg_operand" "")
7253 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7254 "TARGET_POWERPC64 && reload_completed
7255 && includes_rldic_lshift_p (operands[2], operands[3])"
7257 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7260 (compare:CC (match_dup 0)
7264 (define_insn "*ashldi3_internal7"
7265 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7266 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7267 (match_operand:SI 2 "const_int_operand" "i"))
7268 (match_operand:DI 3 "mask64_operand" "n")))]
7269 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7270 "rldicr %0,%1,%H2,%S3")
7272 (define_insn "ashldi3_internal8"
7273 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7275 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7276 (match_operand:SI 2 "const_int_operand" "i,i"))
7277 (match_operand:DI 3 "mask64_operand" "n,n"))
7279 (clobber (match_scratch:DI 4 "=r,r"))]
7280 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7282 rldicr. %4,%1,%H2,%S3
7284 [(set_attr "type" "compare")
7285 (set_attr "length" "4,8")])
7288 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7290 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7291 (match_operand:SI 2 "const_int_operand" ""))
7292 (match_operand:DI 3 "mask64_operand" ""))
7294 (clobber (match_scratch:DI 4 ""))]
7295 "TARGET_POWERPC64 && reload_completed
7296 && includes_rldicr_lshift_p (operands[2], operands[3])"
7298 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7301 (compare:CC (match_dup 4)
7305 (define_insn "*ashldi3_internal9"
7306 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7308 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7309 (match_operand:SI 2 "const_int_operand" "i,i"))
7310 (match_operand:DI 3 "mask64_operand" "n,n"))
7312 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7313 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7314 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7316 rldicr. %0,%1,%H2,%S3
7318 [(set_attr "type" "compare")
7319 (set_attr "length" "4,8")])
7322 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7324 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7325 (match_operand:SI 2 "const_int_operand" ""))
7326 (match_operand:DI 3 "mask64_operand" ""))
7328 (set (match_operand:DI 0 "gpc_reg_operand" "")
7329 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7330 "TARGET_POWERPC64 && reload_completed
7331 && includes_rldicr_lshift_p (operands[2], operands[3])"
7333 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7336 (compare:CC (match_dup 0)
7340 (define_expand "lshrdi3"
7341 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7342 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7343 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7344 "TARGET_POWERPC64 || TARGET_POWER"
7347 if (TARGET_POWERPC64)
7349 else if (TARGET_POWER)
7351 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7358 (define_insn "*lshrdi3_internal1"
7359 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7360 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7361 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7366 [(set_attr "type" "var_shift_rotate,shift")])
7368 (define_insn "*lshrdi3_internal2"
7369 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7370 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7371 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7373 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7380 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7381 (set_attr "length" "4,4,8,8")])
7384 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7385 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7386 (match_operand:SI 2 "reg_or_cint_operand" ""))
7388 (clobber (match_scratch:DI 3 ""))]
7389 "TARGET_POWERPC64 && reload_completed"
7391 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7393 (compare:CC (match_dup 3)
7397 (define_insn "*lshrdi3_internal3"
7398 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7399 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7400 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7402 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7403 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7410 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7411 (set_attr "length" "4,4,8,8")])
7414 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7415 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7416 (match_operand:SI 2 "reg_or_cint_operand" ""))
7418 (set (match_operand:DI 0 "gpc_reg_operand" "")
7419 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7420 "TARGET_POWERPC64 && reload_completed"
7422 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7424 (compare:CC (match_dup 0)
7428 (define_expand "ashrdi3"
7429 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7430 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7431 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7435 if (TARGET_POWERPC64)
7437 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7439 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7442 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7443 && WORDS_BIG_ENDIAN)
7445 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7452 (define_insn "*ashrdi3_internal1"
7453 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7454 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7455 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7460 [(set_attr "type" "var_shift_rotate,shift")])
7462 (define_insn "*ashrdi3_internal2"
7463 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7464 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7465 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7467 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7474 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7475 (set_attr "length" "4,4,8,8")])
7478 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7479 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7480 (match_operand:SI 2 "reg_or_cint_operand" ""))
7482 (clobber (match_scratch:DI 3 ""))]
7483 "TARGET_POWERPC64 && reload_completed"
7485 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7487 (compare:CC (match_dup 3)
7491 (define_insn "*ashrdi3_internal3"
7492 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7493 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7494 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7496 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7497 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7504 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7505 (set_attr "length" "4,4,8,8")])
7508 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7509 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7510 (match_operand:SI 2 "reg_or_cint_operand" ""))
7512 (set (match_operand:DI 0 "gpc_reg_operand" "")
7513 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7514 "TARGET_POWERPC64 && reload_completed"
7516 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7518 (compare:CC (match_dup 0)
7522 (define_insn "anddi3"
7523 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7524 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7525 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7526 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7530 rldic%B2 %0,%1,0,%S2
7531 rlwinm %0,%1,0,%m2,%M2
7535 [(set_attr "type" "*,*,*,compare,compare,*")
7536 (set_attr "length" "4,4,4,4,4,8")])
7539 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7540 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7541 (match_operand:DI 2 "mask64_2_operand" "")))
7542 (clobber (match_scratch:CC 3 ""))]
7544 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7545 && !mask_operand (operands[2], DImode)
7546 && !mask64_operand (operands[2], DImode)"
7548 (and:DI (rotate:DI (match_dup 1)
7552 (and:DI (rotate:DI (match_dup 0)
7556 build_mask64_2_operands (operands[2], &operands[4]);
7559 (define_insn "*anddi3_internal2"
7560 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7561 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7562 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7564 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7565 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7569 rldic%B2. %3,%1,0,%S2
7570 rlwinm. %3,%1,0,%m2,%M2
7580 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7581 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7584 [(set (match_operand:CC 0 "cc_reg_operand" "")
7585 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7586 (match_operand:DI 2 "mask64_2_operand" ""))
7588 (clobber (match_scratch:DI 3 ""))
7589 (clobber (match_scratch:CC 4 ""))]
7590 "TARGET_64BIT && reload_completed
7591 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7592 && !mask_operand (operands[2], DImode)
7593 && !mask64_operand (operands[2], DImode)"
7595 (and:DI (rotate:DI (match_dup 1)
7598 (parallel [(set (match_dup 0)
7599 (compare:CC (and:DI (rotate:DI (match_dup 3)
7603 (clobber (match_dup 3))])]
7606 build_mask64_2_operands (operands[2], &operands[5]);
7609 (define_insn "*anddi3_internal3"
7610 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7611 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7612 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7614 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7615 (and:DI (match_dup 1) (match_dup 2)))
7616 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7620 rldic%B2. %0,%1,0,%S2
7621 rlwinm. %0,%1,0,%m2,%M2
7631 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7632 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7635 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7636 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7637 (match_operand:DI 2 "and64_2_operand" ""))
7639 (set (match_operand:DI 0 "gpc_reg_operand" "")
7640 (and:DI (match_dup 1) (match_dup 2)))
7641 (clobber (match_scratch:CC 4 ""))]
7642 "TARGET_64BIT && reload_completed"
7643 [(parallel [(set (match_dup 0)
7644 (and:DI (match_dup 1) (match_dup 2)))
7645 (clobber (match_dup 4))])
7647 (compare:CC (match_dup 0)
7652 [(set (match_operand:CC 3 "cc_reg_operand" "")
7653 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7654 (match_operand:DI 2 "mask64_2_operand" ""))
7656 (set (match_operand:DI 0 "gpc_reg_operand" "")
7657 (and:DI (match_dup 1) (match_dup 2)))
7658 (clobber (match_scratch:CC 4 ""))]
7659 "TARGET_64BIT && reload_completed
7660 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7661 && !mask_operand (operands[2], DImode)
7662 && !mask64_operand (operands[2], DImode)"
7664 (and:DI (rotate:DI (match_dup 1)
7667 (parallel [(set (match_dup 3)
7668 (compare:CC (and:DI (rotate:DI (match_dup 0)
7673 (and:DI (rotate:DI (match_dup 0)
7678 build_mask64_2_operands (operands[2], &operands[5]);
7681 (define_expand "iordi3"
7682 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7683 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7684 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7688 if (non_logical_cint_operand (operands[2], DImode))
7690 HOST_WIDE_INT value;
7691 rtx tmp = ((!can_create_pseudo_p ()
7692 || rtx_equal_p (operands[0], operands[1]))
7693 ? operands[0] : gen_reg_rtx (DImode));
7695 if (GET_CODE (operands[2]) == CONST_INT)
7697 value = INTVAL (operands[2]);
7698 emit_insn (gen_iordi3 (tmp, operands[1],
7699 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7703 value = CONST_DOUBLE_LOW (operands[2]);
7704 emit_insn (gen_iordi3 (tmp, operands[1],
7705 immed_double_const (value
7706 & (~ (HOST_WIDE_INT) 0xffff),
7710 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7715 (define_expand "xordi3"
7716 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7717 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7718 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7722 if (non_logical_cint_operand (operands[2], DImode))
7724 HOST_WIDE_INT value;
7725 rtx tmp = ((!can_create_pseudo_p ()
7726 || rtx_equal_p (operands[0], operands[1]))
7727 ? operands[0] : gen_reg_rtx (DImode));
7729 if (GET_CODE (operands[2]) == CONST_INT)
7731 value = INTVAL (operands[2]);
7732 emit_insn (gen_xordi3 (tmp, operands[1],
7733 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7737 value = CONST_DOUBLE_LOW (operands[2]);
7738 emit_insn (gen_xordi3 (tmp, operands[1],
7739 immed_double_const (value
7740 & (~ (HOST_WIDE_INT) 0xffff),
7744 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7749 (define_insn "*booldi3_internal1"
7750 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7751 (match_operator:DI 3 "boolean_or_operator"
7752 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7753 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7760 (define_insn "*booldi3_internal2"
7761 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7762 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7763 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7764 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7766 (clobber (match_scratch:DI 3 "=r,r"))]
7771 [(set_attr "type" "compare")
7772 (set_attr "length" "4,8")])
7775 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7776 (compare:CC (match_operator:DI 4 "boolean_operator"
7777 [(match_operand:DI 1 "gpc_reg_operand" "")
7778 (match_operand:DI 2 "gpc_reg_operand" "")])
7780 (clobber (match_scratch:DI 3 ""))]
7781 "TARGET_POWERPC64 && reload_completed"
7782 [(set (match_dup 3) (match_dup 4))
7784 (compare:CC (match_dup 3)
7788 (define_insn "*booldi3_internal3"
7789 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7790 (compare:CC (match_operator:DI 4 "boolean_operator"
7791 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7792 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7794 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7800 [(set_attr "type" "compare")
7801 (set_attr "length" "4,8")])
7804 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7805 (compare:CC (match_operator:DI 4 "boolean_operator"
7806 [(match_operand:DI 1 "gpc_reg_operand" "")
7807 (match_operand:DI 2 "gpc_reg_operand" "")])
7809 (set (match_operand:DI 0 "gpc_reg_operand" "")
7811 "TARGET_POWERPC64 && reload_completed"
7812 [(set (match_dup 0) (match_dup 4))
7814 (compare:CC (match_dup 0)
7818 ;; Split a logical operation that we can't do in one insn into two insns,
7819 ;; each of which does one 16-bit part. This is used by combine.
7822 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7823 (match_operator:DI 3 "boolean_or_operator"
7824 [(match_operand:DI 1 "gpc_reg_operand" "")
7825 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7827 [(set (match_dup 0) (match_dup 4))
7828 (set (match_dup 0) (match_dup 5))]
7833 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7835 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7836 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7838 i4 = GEN_INT (value & 0xffff);
7842 i3 = GEN_INT (INTVAL (operands[2])
7843 & (~ (HOST_WIDE_INT) 0xffff));
7844 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7846 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7848 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7852 (define_insn "*boolcdi3_internal1"
7853 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7854 (match_operator:DI 3 "boolean_operator"
7855 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7856 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7860 (define_insn "*boolcdi3_internal2"
7861 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7862 (compare:CC (match_operator:DI 4 "boolean_operator"
7863 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7864 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7866 (clobber (match_scratch:DI 3 "=r,r"))]
7871 [(set_attr "type" "compare")
7872 (set_attr "length" "4,8")])
7875 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7876 (compare:CC (match_operator:DI 4 "boolean_operator"
7877 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7878 (match_operand:DI 2 "gpc_reg_operand" "")])
7880 (clobber (match_scratch:DI 3 ""))]
7881 "TARGET_POWERPC64 && reload_completed"
7882 [(set (match_dup 3) (match_dup 4))
7884 (compare:CC (match_dup 3)
7888 (define_insn "*boolcdi3_internal3"
7889 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7890 (compare:CC (match_operator:DI 4 "boolean_operator"
7891 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7892 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7894 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7900 [(set_attr "type" "compare")
7901 (set_attr "length" "4,8")])
7904 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7905 (compare:CC (match_operator:DI 4 "boolean_operator"
7906 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7907 (match_operand:DI 2 "gpc_reg_operand" "")])
7909 (set (match_operand:DI 0 "gpc_reg_operand" "")
7911 "TARGET_POWERPC64 && reload_completed"
7912 [(set (match_dup 0) (match_dup 4))
7914 (compare:CC (match_dup 0)
7918 (define_insn "*boolccdi3_internal1"
7919 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7920 (match_operator:DI 3 "boolean_operator"
7921 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7922 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7926 (define_insn "*boolccdi3_internal2"
7927 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7928 (compare:CC (match_operator:DI 4 "boolean_operator"
7929 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7930 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7932 (clobber (match_scratch:DI 3 "=r,r"))]
7937 [(set_attr "type" "compare")
7938 (set_attr "length" "4,8")])
7941 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7942 (compare:CC (match_operator:DI 4 "boolean_operator"
7943 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7944 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7946 (clobber (match_scratch:DI 3 ""))]
7947 "TARGET_POWERPC64 && reload_completed"
7948 [(set (match_dup 3) (match_dup 4))
7950 (compare:CC (match_dup 3)
7954 (define_insn "*boolccdi3_internal3"
7955 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7956 (compare:CC (match_operator:DI 4 "boolean_operator"
7957 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7958 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7960 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7966 [(set_attr "type" "compare")
7967 (set_attr "length" "4,8")])
7970 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7971 (compare:CC (match_operator:DI 4 "boolean_operator"
7972 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7973 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7975 (set (match_operand:DI 0 "gpc_reg_operand" "")
7977 "TARGET_POWERPC64 && reload_completed"
7978 [(set (match_dup 0) (match_dup 4))
7980 (compare:CC (match_dup 0)
7984 ;; Now define ways of moving data around.
7986 ;; Set up a register with a value from the GOT table
7988 (define_expand "movsi_got"
7989 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7990 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7991 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7992 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7995 if (GET_CODE (operands[1]) == CONST)
7997 rtx offset = const0_rtx;
7998 HOST_WIDE_INT value;
8000 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8001 value = INTVAL (offset);
8004 rtx tmp = (!can_create_pseudo_p ()
8006 : gen_reg_rtx (Pmode));
8007 emit_insn (gen_movsi_got (tmp, operands[1]));
8008 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8013 operands[2] = rs6000_got_register (operands[1]);
8016 (define_insn "*movsi_got_internal"
8017 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8018 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8019 (match_operand:SI 2 "gpc_reg_operand" "b")]
8021 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8022 "{l|lwz} %0,%a1@got(%2)"
8023 [(set_attr "type" "load")])
8025 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8026 ;; didn't get allocated to a hard register.
8028 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8029 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8030 (match_operand:SI 2 "memory_operand" "")]
8032 "DEFAULT_ABI == ABI_V4
8034 && (reload_in_progress || reload_completed)"
8035 [(set (match_dup 0) (match_dup 2))
8036 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8040 ;; For SI, we special-case integers that can't be loaded in one insn. We
8041 ;; do the load 16-bits at a time. We could do this by loading from memory,
8042 ;; and this is even supposed to be faster, but it is simpler not to get
8043 ;; integers in the TOC.
8044 (define_insn "movsi_low"
8045 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8046 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8047 (match_operand 2 "" ""))))]
8048 "TARGET_MACHO && ! TARGET_64BIT"
8049 "{l|lwz} %0,lo16(%2)(%1)"
8050 [(set_attr "type" "load")
8051 (set_attr "length" "4")])
8053 (define_insn "*movsi_internal1"
8054 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8055 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8056 "gpc_reg_operand (operands[0], SImode)
8057 || gpc_reg_operand (operands[1], SImode)"
8061 {l%U1%X1|lwz%U1%X1} %0,%1
8062 {st%U0%X0|stw%U0%X0} %1,%0
8072 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8073 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8075 ;; Split a load of a large constant into the appropriate two-insn
8079 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8080 (match_operand:SI 1 "const_int_operand" ""))]
8081 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8082 && (INTVAL (operands[1]) & 0xffff) != 0"
8086 (ior:SI (match_dup 0)
8089 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8091 if (tem == operands[0])
8097 (define_insn "*mov<mode>_internal2"
8098 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8099 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8101 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8104 {cmpi|cmp<wd>i} %2,%0,0
8107 [(set_attr "type" "cmp,compare,cmp")
8108 (set_attr "length" "4,4,8")])
8111 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8112 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8114 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8116 [(set (match_dup 0) (match_dup 1))
8118 (compare:CC (match_dup 0)
8122 (define_insn "*movhi_internal"
8123 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8124 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8125 "gpc_reg_operand (operands[0], HImode)
8126 || gpc_reg_operand (operands[1], HImode)"
8136 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8138 (define_expand "mov<mode>"
8139 [(set (match_operand:INT 0 "general_operand" "")
8140 (match_operand:INT 1 "any_operand" ""))]
8142 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8144 (define_insn "*movqi_internal"
8145 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8146 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8147 "gpc_reg_operand (operands[0], QImode)
8148 || gpc_reg_operand (operands[1], QImode)"
8158 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8160 ;; Here is how to move condition codes around. When we store CC data in
8161 ;; an integer register or memory, we store just the high-order 4 bits.
8162 ;; This lets us not shift in the most common case of CR0.
8163 (define_expand "movcc"
8164 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8165 (match_operand:CC 1 "nonimmediate_operand" ""))]
8169 (define_insn "*movcc_internal1"
8170 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8171 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8172 "register_operand (operands[0], CCmode)
8173 || register_operand (operands[1], CCmode)"
8177 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8180 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8186 {l%U1%X1|lwz%U1%X1} %0,%1
8187 {st%U0%U1|stw%U0%U1} %1,%0"
8189 (cond [(eq_attr "alternative" "0,3")
8190 (const_string "cr_logical")
8191 (eq_attr "alternative" "1,2")
8192 (const_string "mtcr")
8193 (eq_attr "alternative" "6,7,9")
8194 (const_string "integer")
8195 (eq_attr "alternative" "8")
8196 (const_string "mfjmpr")
8197 (eq_attr "alternative" "10")
8198 (const_string "mtjmpr")
8199 (eq_attr "alternative" "11")
8200 (const_string "load")
8201 (eq_attr "alternative" "12")
8202 (const_string "store")
8203 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8204 (const_string "mfcrf")
8206 (const_string "mfcr")))
8207 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8209 ;; For floating-point, we normally deal with the floating-point registers
8210 ;; unless -msoft-float is used. The sole exception is that parameter passing
8211 ;; can produce floating-point values in fixed-point registers. Unless the
8212 ;; value is a simple constant or already in memory, we deal with this by
8213 ;; allocating memory and copying the value explicitly via that memory location.
8214 (define_expand "movsf"
8215 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8216 (match_operand:SF 1 "any_operand" ""))]
8218 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8221 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8222 (match_operand:SF 1 "const_double_operand" ""))]
8224 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8225 || (GET_CODE (operands[0]) == SUBREG
8226 && GET_CODE (SUBREG_REG (operands[0])) == REG
8227 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8228 [(set (match_dup 2) (match_dup 3))]
8234 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8235 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8237 if (! TARGET_POWERPC64)
8238 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8240 operands[2] = gen_lowpart (SImode, operands[0]);
8242 operands[3] = gen_int_mode (l, SImode);
8245 (define_insn "*movsf_hardfloat"
8246 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8247 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8248 "(gpc_reg_operand (operands[0], SFmode)
8249 || gpc_reg_operand (operands[1], SFmode))
8250 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8253 {l%U1%X1|lwz%U1%X1} %0,%1
8254 {st%U0%X0|stw%U0%X0} %1,%0
8264 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8265 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8267 (define_insn "*movsf_softfloat"
8268 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8269 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8270 "(gpc_reg_operand (operands[0], SFmode)
8271 || gpc_reg_operand (operands[1], SFmode))
8272 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8278 {l%U1%X1|lwz%U1%X1} %0,%1
8279 {st%U0%X0|stw%U0%X0} %1,%0
8286 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8287 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8290 (define_expand "movdf"
8291 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8292 (match_operand:DF 1 "any_operand" ""))]
8294 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8297 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8298 (match_operand:DF 1 "const_int_operand" ""))]
8299 "! TARGET_POWERPC64 && reload_completed
8300 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8301 || (GET_CODE (operands[0]) == SUBREG
8302 && GET_CODE (SUBREG_REG (operands[0])) == REG
8303 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8304 [(set (match_dup 2) (match_dup 4))
8305 (set (match_dup 3) (match_dup 1))]
8308 int endian = (WORDS_BIG_ENDIAN == 0);
8309 HOST_WIDE_INT value = INTVAL (operands[1]);
8311 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8312 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8313 #if HOST_BITS_PER_WIDE_INT == 32
8314 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8316 operands[4] = GEN_INT (value >> 32);
8317 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8322 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8323 (match_operand:DF 1 "const_double_operand" ""))]
8324 "! TARGET_POWERPC64 && reload_completed
8325 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8326 || (GET_CODE (operands[0]) == SUBREG
8327 && GET_CODE (SUBREG_REG (operands[0])) == REG
8328 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8329 [(set (match_dup 2) (match_dup 4))
8330 (set (match_dup 3) (match_dup 5))]
8333 int endian = (WORDS_BIG_ENDIAN == 0);
8337 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8338 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8340 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8341 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8342 operands[4] = gen_int_mode (l[endian], SImode);
8343 operands[5] = gen_int_mode (l[1 - endian], SImode);
8347 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8348 (match_operand:DF 1 "const_double_operand" ""))]
8349 "TARGET_POWERPC64 && reload_completed
8350 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8351 || (GET_CODE (operands[0]) == SUBREG
8352 && GET_CODE (SUBREG_REG (operands[0])) == REG
8353 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8354 [(set (match_dup 2) (match_dup 3))]
8357 int endian = (WORDS_BIG_ENDIAN == 0);
8360 #if HOST_BITS_PER_WIDE_INT >= 64
8364 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8365 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8367 operands[2] = gen_lowpart (DImode, operands[0]);
8368 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8369 #if HOST_BITS_PER_WIDE_INT >= 64
8370 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8371 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8373 operands[3] = gen_int_mode (val, DImode);
8375 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8379 ;; Don't have reload use general registers to load a constant. First,
8380 ;; it might not work if the output operand is the equivalent of
8381 ;; a non-offsettable memref, but also it is less efficient than loading
8382 ;; the constant into an FP register, since it will probably be used there.
8383 ;; The "??" is a kludge until we can figure out a more reasonable way
8384 ;; of handling these non-offsettable values.
8385 (define_insn "*movdf_hardfloat32"
8386 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8387 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8388 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8389 && (gpc_reg_operand (operands[0], DFmode)
8390 || gpc_reg_operand (operands[1], DFmode))"
8393 switch (which_alternative)
8398 /* We normally copy the low-numbered register first. However, if
8399 the first register operand 0 is the same as the second register
8400 of operand 1, we must copy in the opposite order. */
8401 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8402 return \"mr %L0,%L1\;mr %0,%1\";
8404 return \"mr %0,%1\;mr %L0,%L1\";
8406 if (rs6000_offsettable_memref_p (operands[1])
8407 || (GET_CODE (operands[1]) == MEM
8408 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8409 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8410 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC
8411 || GET_CODE (XEXP (operands[1], 0)) == PRE_MODIFY)))
8413 /* If the low-address word is used in the address, we must load
8414 it last. Otherwise, load it first. Note that we cannot have
8415 auto-increment in that case since the address register is
8416 known to be dead. */
8417 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8419 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8421 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8427 addreg = find_addr_reg (XEXP (operands[1], 0));
8428 if (refers_to_regno_p (REGNO (operands[0]),
8429 REGNO (operands[0]) + 1,
8432 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8433 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8434 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8435 return \"{l%X1|lwz%X1} %0,%1\";
8439 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
8440 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8441 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8442 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8447 if (rs6000_offsettable_memref_p (operands[0])
8448 || (GET_CODE (operands[0]) == MEM
8449 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8450 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8451 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
8452 || GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)))
8453 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8458 addreg = find_addr_reg (XEXP (operands[0], 0));
8459 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
8460 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8461 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
8462 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8466 return \"fmr %0,%1\";
8468 return \"lfd%U1%X1 %0,%1\";
8470 return \"stfd%U0%X0 %1,%0\";
8477 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8478 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8480 (define_insn "*movdf_softfloat32"
8481 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8482 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8484 && ((TARGET_FPRS && !TARGET_DOUBLE_FLOAT)
8485 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8486 && (gpc_reg_operand (operands[0], DFmode)
8487 || gpc_reg_operand (operands[1], DFmode))"
8490 switch (which_alternative)
8495 /* We normally copy the low-numbered register first. However, if
8496 the first register operand 0 is the same as the second register of
8497 operand 1, we must copy in the opposite order. */
8498 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8499 return \"mr %L0,%L1\;mr %0,%1\";
8501 return \"mr %0,%1\;mr %L0,%L1\";
8503 /* If the low-address word is used in the address, we must load
8504 it last. Otherwise, load it first. Note that we cannot have
8505 auto-increment in that case since the address register is
8506 known to be dead. */
8507 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8509 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8511 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8513 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8520 [(set_attr "type" "two,load,store,*,*,*")
8521 (set_attr "length" "8,8,8,8,12,16")])
8523 ; ld/std require word-aligned displacements -> 'Y' constraint.
8524 ; List Y->r and r->Y before r->r for reload.
8525 (define_insn "*movdf_hardfloat64_mfpgpr"
8526 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
8527 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
8528 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8529 && TARGET_DOUBLE_FLOAT
8530 && (gpc_reg_operand (operands[0], DFmode)
8531 || gpc_reg_operand (operands[1], DFmode))"
8547 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8548 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8550 ; ld/std require word-aligned displacements -> 'Y' constraint.
8551 ; List Y->r and r->Y before r->r for reload.
8552 (define_insn "*movdf_hardfloat64"
8553 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8554 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8555 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8556 && TARGET_DOUBLE_FLOAT
8557 && (gpc_reg_operand (operands[0], DFmode)
8558 || gpc_reg_operand (operands[1], DFmode))"
8572 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8573 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8575 (define_insn "*movdf_softfloat64"
8576 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8577 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8578 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8579 && (gpc_reg_operand (operands[0], DFmode)
8580 || gpc_reg_operand (operands[1], DFmode))"
8591 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8592 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8594 (define_expand "movtf"
8595 [(set (match_operand:TF 0 "general_operand" "")
8596 (match_operand:TF 1 "any_operand" ""))]
8597 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8598 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8600 ; It's important to list the o->f and f->o moves before f->f because
8601 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8602 ; which doesn't make progress. Likewise r->Y must be before r->r.
8603 (define_insn_and_split "*movtf_internal"
8604 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8605 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8607 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8608 && (gpc_reg_operand (operands[0], TFmode)
8609 || gpc_reg_operand (operands[1], TFmode))"
8611 "&& reload_completed"
8613 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8614 [(set_attr "length" "8,8,8,20,20,16")])
8616 (define_insn_and_split "*movtf_softfloat"
8617 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
8618 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
8620 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8621 && (gpc_reg_operand (operands[0], TFmode)
8622 || gpc_reg_operand (operands[1], TFmode))"
8624 "&& reload_completed"
8626 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8627 [(set_attr "length" "20,20,16")])
8629 (define_expand "extenddftf2"
8630 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8631 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8633 && TARGET_HARD_FLOAT
8634 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8635 && TARGET_LONG_DOUBLE_128"
8637 if (TARGET_E500_DOUBLE)
8638 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8640 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8644 (define_expand "extenddftf2_fprs"
8645 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8646 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8647 (use (match_dup 2))])]
8649 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8650 && TARGET_LONG_DOUBLE_128"
8652 operands[2] = CONST0_RTX (DFmode);
8653 /* Generate GOT reference early for SVR4 PIC. */
8654 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8655 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8658 (define_insn_and_split "*extenddftf2_internal"
8659 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8660 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8661 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8663 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8664 && TARGET_LONG_DOUBLE_128"
8666 "&& reload_completed"
8669 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8670 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8671 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8673 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8678 (define_expand "extendsftf2"
8679 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8680 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8682 && TARGET_HARD_FLOAT
8683 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8684 && TARGET_LONG_DOUBLE_128"
8686 rtx tmp = gen_reg_rtx (DFmode);
8687 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8688 emit_insn (gen_extenddftf2 (operands[0], tmp));
8692 (define_expand "trunctfdf2"
8693 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8694 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8696 && TARGET_HARD_FLOAT
8697 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8698 && TARGET_LONG_DOUBLE_128"
8701 (define_insn_and_split "trunctfdf2_internal1"
8702 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8703 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8704 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8705 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8709 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8712 emit_note (NOTE_INSN_DELETED);
8715 [(set_attr "type" "fp")])
8717 (define_insn "trunctfdf2_internal2"
8718 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8719 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8720 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8721 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8722 && TARGET_LONG_DOUBLE_128"
8724 [(set_attr "type" "fp")])
8726 (define_expand "trunctfsf2"
8727 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8728 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8730 && TARGET_HARD_FLOAT
8731 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8732 && TARGET_LONG_DOUBLE_128"
8734 if (TARGET_E500_DOUBLE)
8735 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8737 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8741 (define_insn_and_split "trunctfsf2_fprs"
8742 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8743 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8744 (clobber (match_scratch:DF 2 "=f"))]
8746 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
8747 && TARGET_LONG_DOUBLE_128"
8749 "&& reload_completed"
8751 (float_truncate:DF (match_dup 1)))
8753 (float_truncate:SF (match_dup 2)))]
8756 (define_expand "floatsitf2"
8757 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8758 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8760 && TARGET_HARD_FLOAT
8761 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8762 && TARGET_LONG_DOUBLE_128"
8764 rtx tmp = gen_reg_rtx (DFmode);
8765 expand_float (tmp, operands[1], false);
8766 emit_insn (gen_extenddftf2 (operands[0], tmp));
8770 ; fadd, but rounding towards zero.
8771 ; This is probably not the optimal code sequence.
8772 (define_insn "fix_trunc_helper"
8773 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8774 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8775 UNSPEC_FIX_TRUNC_TF))
8776 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8777 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
8778 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8779 [(set_attr "type" "fp")
8780 (set_attr "length" "20")])
8782 (define_expand "fix_trunctfsi2"
8783 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8784 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8786 && (TARGET_POWER2 || TARGET_POWERPC)
8787 && TARGET_HARD_FLOAT
8788 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8789 && TARGET_LONG_DOUBLE_128"
8791 if (TARGET_E500_DOUBLE)
8792 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8794 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8798 (define_expand "fix_trunctfsi2_fprs"
8799 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8800 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8801 (clobber (match_dup 2))
8802 (clobber (match_dup 3))
8803 (clobber (match_dup 4))
8804 (clobber (match_dup 5))])]
8806 && (TARGET_POWER2 || TARGET_POWERPC)
8807 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8809 operands[2] = gen_reg_rtx (DFmode);
8810 operands[3] = gen_reg_rtx (DFmode);
8811 operands[4] = gen_reg_rtx (DImode);
8812 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8815 (define_insn_and_split "*fix_trunctfsi2_internal"
8816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8817 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8818 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8819 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8820 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8821 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
8823 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8825 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[5]))"
8829 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8831 gcc_assert (MEM_P (operands[5]));
8832 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8834 emit_insn (gen_fctiwz (operands[4], operands[2]));
8835 emit_move_insn (operands[5], operands[4]);
8836 emit_move_insn (operands[0], lowword);
8840 (define_expand "negtf2"
8841 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8842 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8844 && TARGET_HARD_FLOAT
8845 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8846 && TARGET_LONG_DOUBLE_128"
8849 (define_insn "negtf2_internal"
8850 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8851 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8853 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8856 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8857 return \"fneg %L0,%L1\;fneg %0,%1\";
8859 return \"fneg %0,%1\;fneg %L0,%L1\";
8861 [(set_attr "type" "fp")
8862 (set_attr "length" "8")])
8864 (define_expand "abstf2"
8865 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8866 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8868 && TARGET_HARD_FLOAT
8869 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8870 && TARGET_LONG_DOUBLE_128"
8873 rtx label = gen_label_rtx ();
8874 if (TARGET_E500_DOUBLE)
8876 if (flag_unsafe_math_optimizations)
8877 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8879 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8882 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8887 (define_expand "abstf2_internal"
8888 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8889 (match_operand:TF 1 "gpc_reg_operand" ""))
8890 (set (match_dup 3) (match_dup 5))
8891 (set (match_dup 5) (abs:DF (match_dup 5)))
8892 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8893 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8894 (label_ref (match_operand 2 "" ""))
8896 (set (match_dup 6) (neg:DF (match_dup 6)))]
8898 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8899 && TARGET_LONG_DOUBLE_128"
8902 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8903 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8904 operands[3] = gen_reg_rtx (DFmode);
8905 operands[4] = gen_reg_rtx (CCFPmode);
8906 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8907 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8910 ;; Next come the multi-word integer load and store and the load and store
8913 ; List r->r after r->"o<>", otherwise reload will try to reload a
8914 ; non-offsettable address by using r->r which won't make progress.
8915 (define_insn "*movdi_internal32"
8916 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8917 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8919 && (gpc_reg_operand (operands[0], DImode)
8920 || gpc_reg_operand (operands[1], DImode))"
8929 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8932 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8933 (match_operand:DI 1 "const_int_operand" ""))]
8934 "! TARGET_POWERPC64 && reload_completed"
8935 [(set (match_dup 2) (match_dup 4))
8936 (set (match_dup 3) (match_dup 1))]
8939 HOST_WIDE_INT value = INTVAL (operands[1]);
8940 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8942 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8944 #if HOST_BITS_PER_WIDE_INT == 32
8945 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8947 operands[4] = GEN_INT (value >> 32);
8948 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8953 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
8954 (match_operand:DI 1 "input_operand" ""))]
8955 "reload_completed && !TARGET_POWERPC64
8956 && gpr_or_gpr_p (operands[0], operands[1])"
8958 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8960 (define_insn "*movdi_mfpgpr"
8961 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
8962 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
8963 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8964 && (gpc_reg_operand (operands[0], DImode)
8965 || gpc_reg_operand (operands[1], DImode))"
8982 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8983 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
8985 (define_insn "*movdi_internal64"
8986 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8987 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8988 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
8989 && (gpc_reg_operand (operands[0], DImode)
8990 || gpc_reg_operand (operands[1], DImode))"
9005 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9006 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9008 ;; immediate value valid for a single instruction hiding in a const_double
9010 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9011 (match_operand:DI 1 "const_double_operand" "F"))]
9012 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9013 && GET_CODE (operands[1]) == CONST_DOUBLE
9014 && num_insns_constant (operands[1], DImode) == 1"
9017 return ((unsigned HOST_WIDE_INT)
9018 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9019 ? \"li %0,%1\" : \"lis %0,%v1\";
9022 ;; Generate all one-bits and clear left or right.
9023 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9025 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9026 (match_operand:DI 1 "mask64_operand" ""))]
9027 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9028 [(set (match_dup 0) (const_int -1))
9030 (and:DI (rotate:DI (match_dup 0)
9035 ;; Split a load of a large constant into the appropriate five-instruction
9036 ;; sequence. Handle anything in a constant number of insns.
9037 ;; When non-easy constants can go in the TOC, this should use
9038 ;; easy_fp_constant predicate.
9040 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9041 (match_operand:DI 1 "const_int_operand" ""))]
9042 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9043 [(set (match_dup 0) (match_dup 2))
9044 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9046 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9048 if (tem == operands[0])
9055 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9056 (match_operand:DI 1 "const_double_operand" ""))]
9057 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9058 [(set (match_dup 0) (match_dup 2))
9059 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9061 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9063 if (tem == operands[0])
9069 ;; TImode is similar, except that we usually want to compute the address into
9070 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9071 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9073 ;; We say that MQ is clobbered in the last alternative because the first
9074 ;; alternative would never get used otherwise since it would need a reload
9075 ;; while the 2nd alternative would not. We put memory cases first so they
9076 ;; are preferred. Otherwise, we'd try to reload the output instead of
9077 ;; giving the SCRATCH mq.
9079 (define_insn "*movti_power"
9080 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9081 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9082 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9083 "TARGET_POWER && ! TARGET_POWERPC64
9084 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9087 switch (which_alternative)
9094 return \"{stsi|stswi} %1,%P0,16\";
9099 /* If the address is not used in the output, we can use lsi. Otherwise,
9100 fall through to generating four loads. */
9102 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9103 return \"{lsi|lswi} %0,%P1,16\";
9104 /* ... fall through ... */
9110 [(set_attr "type" "store,store,*,load,load,*")])
9112 (define_insn "*movti_string"
9113 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9114 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9115 "! TARGET_POWER && ! TARGET_POWERPC64
9116 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9119 switch (which_alternative)
9125 return \"{stsi|stswi} %1,%P0,16\";
9130 /* If the address is not used in the output, we can use lsi. Otherwise,
9131 fall through to generating four loads. */
9133 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9134 return \"{lsi|lswi} %0,%P1,16\";
9135 /* ... fall through ... */
9141 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
9143 (define_insn "*movti_ppc64"
9144 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9145 (match_operand:TI 1 "input_operand" "r,r,m"))]
9146 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9147 || gpc_reg_operand (operands[1], TImode))"
9149 [(set_attr "type" "*,load,store")])
9152 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9153 (match_operand:TI 1 "const_double_operand" ""))]
9155 [(set (match_dup 2) (match_dup 4))
9156 (set (match_dup 3) (match_dup 5))]
9159 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9161 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9163 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9165 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9166 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9168 else if (GET_CODE (operands[1]) == CONST_INT)
9170 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9171 operands[5] = operands[1];
9178 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9179 (match_operand:TI 1 "input_operand" ""))]
9181 && gpr_or_gpr_p (operands[0], operands[1])"
9183 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9185 (define_expand "load_multiple"
9186 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9187 (match_operand:SI 1 "" ""))
9188 (use (match_operand:SI 2 "" ""))])]
9189 "TARGET_STRING && !TARGET_POWERPC64"
9197 /* Support only loading a constant number of fixed-point registers from
9198 memory and only bother with this if more than two; the machine
9199 doesn't support more than eight. */
9200 if (GET_CODE (operands[2]) != CONST_INT
9201 || INTVAL (operands[2]) <= 2
9202 || INTVAL (operands[2]) > 8
9203 || GET_CODE (operands[1]) != MEM
9204 || GET_CODE (operands[0]) != REG
9205 || REGNO (operands[0]) >= 32)
9208 count = INTVAL (operands[2]);
9209 regno = REGNO (operands[0]);
9211 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9212 op1 = replace_equiv_address (operands[1],
9213 force_reg (SImode, XEXP (operands[1], 0)));
9215 for (i = 0; i < count; i++)
9216 XVECEXP (operands[3], 0, i)
9217 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9218 adjust_address_nv (op1, SImode, i * 4));
9221 (define_insn "*ldmsi8"
9222 [(match_parallel 0 "load_multiple_operation"
9223 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9224 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9225 (set (match_operand:SI 3 "gpc_reg_operand" "")
9226 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9227 (set (match_operand:SI 4 "gpc_reg_operand" "")
9228 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9229 (set (match_operand:SI 5 "gpc_reg_operand" "")
9230 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9231 (set (match_operand:SI 6 "gpc_reg_operand" "")
9232 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9233 (set (match_operand:SI 7 "gpc_reg_operand" "")
9234 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9235 (set (match_operand:SI 8 "gpc_reg_operand" "")
9236 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9237 (set (match_operand:SI 9 "gpc_reg_operand" "")
9238 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9239 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9241 { return rs6000_output_load_multiple (operands); }"
9242 [(set_attr "type" "load_ux")
9243 (set_attr "length" "32")])
9245 (define_insn "*ldmsi7"
9246 [(match_parallel 0 "load_multiple_operation"
9247 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9248 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9249 (set (match_operand:SI 3 "gpc_reg_operand" "")
9250 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9251 (set (match_operand:SI 4 "gpc_reg_operand" "")
9252 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9253 (set (match_operand:SI 5 "gpc_reg_operand" "")
9254 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9255 (set (match_operand:SI 6 "gpc_reg_operand" "")
9256 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9257 (set (match_operand:SI 7 "gpc_reg_operand" "")
9258 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9259 (set (match_operand:SI 8 "gpc_reg_operand" "")
9260 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9261 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9263 { return rs6000_output_load_multiple (operands); }"
9264 [(set_attr "type" "load_ux")
9265 (set_attr "length" "32")])
9267 (define_insn "*ldmsi6"
9268 [(match_parallel 0 "load_multiple_operation"
9269 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9270 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9271 (set (match_operand:SI 3 "gpc_reg_operand" "")
9272 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9273 (set (match_operand:SI 4 "gpc_reg_operand" "")
9274 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9275 (set (match_operand:SI 5 "gpc_reg_operand" "")
9276 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9277 (set (match_operand:SI 6 "gpc_reg_operand" "")
9278 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9279 (set (match_operand:SI 7 "gpc_reg_operand" "")
9280 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9281 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9283 { return rs6000_output_load_multiple (operands); }"
9284 [(set_attr "type" "load_ux")
9285 (set_attr "length" "32")])
9287 (define_insn "*ldmsi5"
9288 [(match_parallel 0 "load_multiple_operation"
9289 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9290 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9291 (set (match_operand:SI 3 "gpc_reg_operand" "")
9292 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9293 (set (match_operand:SI 4 "gpc_reg_operand" "")
9294 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9295 (set (match_operand:SI 5 "gpc_reg_operand" "")
9296 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9297 (set (match_operand:SI 6 "gpc_reg_operand" "")
9298 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9299 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9301 { return rs6000_output_load_multiple (operands); }"
9302 [(set_attr "type" "load_ux")
9303 (set_attr "length" "32")])
9305 (define_insn "*ldmsi4"
9306 [(match_parallel 0 "load_multiple_operation"
9307 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9308 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9309 (set (match_operand:SI 3 "gpc_reg_operand" "")
9310 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9311 (set (match_operand:SI 4 "gpc_reg_operand" "")
9312 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9313 (set (match_operand:SI 5 "gpc_reg_operand" "")
9314 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9315 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9317 { return rs6000_output_load_multiple (operands); }"
9318 [(set_attr "type" "load_ux")
9319 (set_attr "length" "32")])
9321 (define_insn "*ldmsi3"
9322 [(match_parallel 0 "load_multiple_operation"
9323 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9324 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9325 (set (match_operand:SI 3 "gpc_reg_operand" "")
9326 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9327 (set (match_operand:SI 4 "gpc_reg_operand" "")
9328 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9329 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9331 { return rs6000_output_load_multiple (operands); }"
9332 [(set_attr "type" "load_ux")
9333 (set_attr "length" "32")])
9335 (define_expand "store_multiple"
9336 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9337 (match_operand:SI 1 "" ""))
9338 (clobber (scratch:SI))
9339 (use (match_operand:SI 2 "" ""))])]
9340 "TARGET_STRING && !TARGET_POWERPC64"
9349 /* Support only storing a constant number of fixed-point registers to
9350 memory and only bother with this if more than two; the machine
9351 doesn't support more than eight. */
9352 if (GET_CODE (operands[2]) != CONST_INT
9353 || INTVAL (operands[2]) <= 2
9354 || INTVAL (operands[2]) > 8
9355 || GET_CODE (operands[0]) != MEM
9356 || GET_CODE (operands[1]) != REG
9357 || REGNO (operands[1]) >= 32)
9360 count = INTVAL (operands[2]);
9361 regno = REGNO (operands[1]);
9363 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9364 to = force_reg (SImode, XEXP (operands[0], 0));
9365 op0 = replace_equiv_address (operands[0], to);
9367 XVECEXP (operands[3], 0, 0)
9368 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9369 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9370 gen_rtx_SCRATCH (SImode));
9372 for (i = 1; i < count; i++)
9373 XVECEXP (operands[3], 0, i + 1)
9374 = gen_rtx_SET (VOIDmode,
9375 adjust_address_nv (op0, SImode, i * 4),
9376 gen_rtx_REG (SImode, regno + i));
9379 (define_insn "*stmsi8"
9380 [(match_parallel 0 "store_multiple_operation"
9381 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9382 (match_operand:SI 2 "gpc_reg_operand" "r"))
9383 (clobber (match_scratch:SI 3 "=X"))
9384 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9385 (match_operand:SI 4 "gpc_reg_operand" "r"))
9386 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9387 (match_operand:SI 5 "gpc_reg_operand" "r"))
9388 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9389 (match_operand:SI 6 "gpc_reg_operand" "r"))
9390 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9391 (match_operand:SI 7 "gpc_reg_operand" "r"))
9392 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9393 (match_operand:SI 8 "gpc_reg_operand" "r"))
9394 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9395 (match_operand:SI 9 "gpc_reg_operand" "r"))
9396 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9397 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9398 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9399 "{stsi|stswi} %2,%1,%O0"
9400 [(set_attr "type" "store_ux")])
9402 (define_insn "*stmsi7"
9403 [(match_parallel 0 "store_multiple_operation"
9404 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9405 (match_operand:SI 2 "gpc_reg_operand" "r"))
9406 (clobber (match_scratch:SI 3 "=X"))
9407 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9408 (match_operand:SI 4 "gpc_reg_operand" "r"))
9409 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9410 (match_operand:SI 5 "gpc_reg_operand" "r"))
9411 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9412 (match_operand:SI 6 "gpc_reg_operand" "r"))
9413 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9414 (match_operand:SI 7 "gpc_reg_operand" "r"))
9415 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9416 (match_operand:SI 8 "gpc_reg_operand" "r"))
9417 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9418 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9419 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9420 "{stsi|stswi} %2,%1,%O0"
9421 [(set_attr "type" "store_ux")])
9423 (define_insn "*stmsi6"
9424 [(match_parallel 0 "store_multiple_operation"
9425 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9426 (match_operand:SI 2 "gpc_reg_operand" "r"))
9427 (clobber (match_scratch:SI 3 "=X"))
9428 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9429 (match_operand:SI 4 "gpc_reg_operand" "r"))
9430 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9431 (match_operand:SI 5 "gpc_reg_operand" "r"))
9432 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9433 (match_operand:SI 6 "gpc_reg_operand" "r"))
9434 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9435 (match_operand:SI 7 "gpc_reg_operand" "r"))
9436 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9437 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9438 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9439 "{stsi|stswi} %2,%1,%O0"
9440 [(set_attr "type" "store_ux")])
9442 (define_insn "*stmsi5"
9443 [(match_parallel 0 "store_multiple_operation"
9444 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9445 (match_operand:SI 2 "gpc_reg_operand" "r"))
9446 (clobber (match_scratch:SI 3 "=X"))
9447 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9448 (match_operand:SI 4 "gpc_reg_operand" "r"))
9449 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9450 (match_operand:SI 5 "gpc_reg_operand" "r"))
9451 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9452 (match_operand:SI 6 "gpc_reg_operand" "r"))
9453 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9454 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9455 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9456 "{stsi|stswi} %2,%1,%O0"
9457 [(set_attr "type" "store_ux")])
9459 (define_insn "*stmsi4"
9460 [(match_parallel 0 "store_multiple_operation"
9461 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9462 (match_operand:SI 2 "gpc_reg_operand" "r"))
9463 (clobber (match_scratch:SI 3 "=X"))
9464 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9465 (match_operand:SI 4 "gpc_reg_operand" "r"))
9466 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9467 (match_operand:SI 5 "gpc_reg_operand" "r"))
9468 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9469 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9470 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9471 "{stsi|stswi} %2,%1,%O0"
9472 [(set_attr "type" "store_ux")])
9474 (define_insn "*stmsi3"
9475 [(match_parallel 0 "store_multiple_operation"
9476 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9477 (match_operand:SI 2 "gpc_reg_operand" "r"))
9478 (clobber (match_scratch:SI 3 "=X"))
9479 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9480 (match_operand:SI 4 "gpc_reg_operand" "r"))
9481 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9482 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9483 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9484 "{stsi|stswi} %2,%1,%O0"
9485 [(set_attr "type" "store_ux")])
9487 (define_insn "*stmsi8_power"
9488 [(match_parallel 0 "store_multiple_operation"
9489 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9490 (match_operand:SI 2 "gpc_reg_operand" "r"))
9491 (clobber (match_scratch:SI 3 "=q"))
9492 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9493 (match_operand:SI 4 "gpc_reg_operand" "r"))
9494 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9495 (match_operand:SI 5 "gpc_reg_operand" "r"))
9496 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9497 (match_operand:SI 6 "gpc_reg_operand" "r"))
9498 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9499 (match_operand:SI 7 "gpc_reg_operand" "r"))
9500 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9501 (match_operand:SI 8 "gpc_reg_operand" "r"))
9502 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9503 (match_operand:SI 9 "gpc_reg_operand" "r"))
9504 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9505 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9506 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9507 "{stsi|stswi} %2,%1,%O0"
9508 [(set_attr "type" "store_ux")])
9510 (define_insn "*stmsi7_power"
9511 [(match_parallel 0 "store_multiple_operation"
9512 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9513 (match_operand:SI 2 "gpc_reg_operand" "r"))
9514 (clobber (match_scratch:SI 3 "=q"))
9515 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9516 (match_operand:SI 4 "gpc_reg_operand" "r"))
9517 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9518 (match_operand:SI 5 "gpc_reg_operand" "r"))
9519 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9520 (match_operand:SI 6 "gpc_reg_operand" "r"))
9521 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9522 (match_operand:SI 7 "gpc_reg_operand" "r"))
9523 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9524 (match_operand:SI 8 "gpc_reg_operand" "r"))
9525 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9526 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9527 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9528 "{stsi|stswi} %2,%1,%O0"
9529 [(set_attr "type" "store_ux")])
9531 (define_insn "*stmsi6_power"
9532 [(match_parallel 0 "store_multiple_operation"
9533 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9534 (match_operand:SI 2 "gpc_reg_operand" "r"))
9535 (clobber (match_scratch:SI 3 "=q"))
9536 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9537 (match_operand:SI 4 "gpc_reg_operand" "r"))
9538 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9539 (match_operand:SI 5 "gpc_reg_operand" "r"))
9540 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9541 (match_operand:SI 6 "gpc_reg_operand" "r"))
9542 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9543 (match_operand:SI 7 "gpc_reg_operand" "r"))
9544 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9545 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9546 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9547 "{stsi|stswi} %2,%1,%O0"
9548 [(set_attr "type" "store_ux")])
9550 (define_insn "*stmsi5_power"
9551 [(match_parallel 0 "store_multiple_operation"
9552 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9553 (match_operand:SI 2 "gpc_reg_operand" "r"))
9554 (clobber (match_scratch:SI 3 "=q"))
9555 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9556 (match_operand:SI 4 "gpc_reg_operand" "r"))
9557 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9558 (match_operand:SI 5 "gpc_reg_operand" "r"))
9559 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9560 (match_operand:SI 6 "gpc_reg_operand" "r"))
9561 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9562 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9563 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9564 "{stsi|stswi} %2,%1,%O0"
9565 [(set_attr "type" "store_ux")])
9567 (define_insn "*stmsi4_power"
9568 [(match_parallel 0 "store_multiple_operation"
9569 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9570 (match_operand:SI 2 "gpc_reg_operand" "r"))
9571 (clobber (match_scratch:SI 3 "=q"))
9572 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9573 (match_operand:SI 4 "gpc_reg_operand" "r"))
9574 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9575 (match_operand:SI 5 "gpc_reg_operand" "r"))
9576 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9577 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9578 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9579 "{stsi|stswi} %2,%1,%O0"
9580 [(set_attr "type" "store_ux")])
9582 (define_insn "*stmsi3_power"
9583 [(match_parallel 0 "store_multiple_operation"
9584 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9585 (match_operand:SI 2 "gpc_reg_operand" "r"))
9586 (clobber (match_scratch:SI 3 "=q"))
9587 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9588 (match_operand:SI 4 "gpc_reg_operand" "r"))
9589 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9590 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9591 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9592 "{stsi|stswi} %2,%1,%O0"
9593 [(set_attr "type" "store_ux")])
9595 (define_expand "setmemsi"
9596 [(parallel [(set (match_operand:BLK 0 "" "")
9597 (match_operand 2 "const_int_operand" ""))
9598 (use (match_operand:SI 1 "" ""))
9599 (use (match_operand:SI 3 "" ""))])]
9603 /* If value to set is not zero, use the library routine. */
9604 if (operands[2] != const0_rtx)
9607 if (expand_block_clear (operands))
9613 ;; String/block move insn.
9614 ;; Argument 0 is the destination
9615 ;; Argument 1 is the source
9616 ;; Argument 2 is the length
9617 ;; Argument 3 is the alignment
9619 (define_expand "movmemsi"
9620 [(parallel [(set (match_operand:BLK 0 "" "")
9621 (match_operand:BLK 1 "" ""))
9622 (use (match_operand:SI 2 "" ""))
9623 (use (match_operand:SI 3 "" ""))])]
9627 if (expand_block_move (operands))
9633 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9634 ;; register allocator doesn't have a clue about allocating 8 word registers.
9635 ;; rD/rS = r5 is preferred, efficient form.
9636 (define_expand "movmemsi_8reg"
9637 [(parallel [(set (match_operand 0 "" "")
9638 (match_operand 1 "" ""))
9639 (use (match_operand 2 "" ""))
9640 (use (match_operand 3 "" ""))
9641 (clobber (reg:SI 5))
9642 (clobber (reg:SI 6))
9643 (clobber (reg:SI 7))
9644 (clobber (reg:SI 8))
9645 (clobber (reg:SI 9))
9646 (clobber (reg:SI 10))
9647 (clobber (reg:SI 11))
9648 (clobber (reg:SI 12))
9649 (clobber (match_scratch:SI 4 ""))])]
9654 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9655 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9656 (use (match_operand:SI 2 "immediate_operand" "i"))
9657 (use (match_operand:SI 3 "immediate_operand" "i"))
9658 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9659 (clobber (reg:SI 6))
9660 (clobber (reg:SI 7))
9661 (clobber (reg:SI 8))
9662 (clobber (reg:SI 9))
9663 (clobber (reg:SI 10))
9664 (clobber (reg:SI 11))
9665 (clobber (reg:SI 12))
9666 (clobber (match_scratch:SI 5 "=q"))]
9667 "TARGET_STRING && TARGET_POWER
9668 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9669 || INTVAL (operands[2]) == 0)
9670 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9671 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9672 && REGNO (operands[4]) == 5"
9673 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9674 [(set_attr "type" "store_ux")
9675 (set_attr "length" "8")])
9678 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9679 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9680 (use (match_operand:SI 2 "immediate_operand" "i"))
9681 (use (match_operand:SI 3 "immediate_operand" "i"))
9682 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9683 (clobber (reg:SI 6))
9684 (clobber (reg:SI 7))
9685 (clobber (reg:SI 8))
9686 (clobber (reg:SI 9))
9687 (clobber (reg:SI 10))
9688 (clobber (reg:SI 11))
9689 (clobber (reg:SI 12))
9690 (clobber (match_scratch:SI 5 "=X"))]
9691 "TARGET_STRING && ! TARGET_POWER
9692 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9693 || INTVAL (operands[2]) == 0)
9694 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9695 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9696 && REGNO (operands[4]) == 5"
9697 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9698 [(set_attr "type" "store_ux")
9699 (set_attr "length" "8")])
9701 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9702 ;; register allocator doesn't have a clue about allocating 6 word registers.
9703 ;; rD/rS = r5 is preferred, efficient form.
9704 (define_expand "movmemsi_6reg"
9705 [(parallel [(set (match_operand 0 "" "")
9706 (match_operand 1 "" ""))
9707 (use (match_operand 2 "" ""))
9708 (use (match_operand 3 "" ""))
9709 (clobber (reg:SI 5))
9710 (clobber (reg:SI 6))
9711 (clobber (reg:SI 7))
9712 (clobber (reg:SI 8))
9713 (clobber (reg:SI 9))
9714 (clobber (reg:SI 10))
9715 (clobber (match_scratch:SI 4 ""))])]
9720 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9721 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9722 (use (match_operand:SI 2 "immediate_operand" "i"))
9723 (use (match_operand:SI 3 "immediate_operand" "i"))
9724 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9725 (clobber (reg:SI 6))
9726 (clobber (reg:SI 7))
9727 (clobber (reg:SI 8))
9728 (clobber (reg:SI 9))
9729 (clobber (reg:SI 10))
9730 (clobber (match_scratch:SI 5 "=q"))]
9731 "TARGET_STRING && TARGET_POWER
9732 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9733 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9734 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9735 && REGNO (operands[4]) == 5"
9736 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9737 [(set_attr "type" "store_ux")
9738 (set_attr "length" "8")])
9741 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9742 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9743 (use (match_operand:SI 2 "immediate_operand" "i"))
9744 (use (match_operand:SI 3 "immediate_operand" "i"))
9745 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9746 (clobber (reg:SI 6))
9747 (clobber (reg:SI 7))
9748 (clobber (reg:SI 8))
9749 (clobber (reg:SI 9))
9750 (clobber (reg:SI 10))
9751 (clobber (match_scratch:SI 5 "=X"))]
9752 "TARGET_STRING && ! TARGET_POWER
9753 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9754 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9755 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9756 && REGNO (operands[4]) == 5"
9757 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9758 [(set_attr "type" "store_ux")
9759 (set_attr "length" "8")])
9761 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9762 ;; problems with TImode.
9763 ;; rD/rS = r5 is preferred, efficient form.
9764 (define_expand "movmemsi_4reg"
9765 [(parallel [(set (match_operand 0 "" "")
9766 (match_operand 1 "" ""))
9767 (use (match_operand 2 "" ""))
9768 (use (match_operand 3 "" ""))
9769 (clobber (reg:SI 5))
9770 (clobber (reg:SI 6))
9771 (clobber (reg:SI 7))
9772 (clobber (reg:SI 8))
9773 (clobber (match_scratch:SI 4 ""))])]
9778 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9779 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9780 (use (match_operand:SI 2 "immediate_operand" "i"))
9781 (use (match_operand:SI 3 "immediate_operand" "i"))
9782 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9783 (clobber (reg:SI 6))
9784 (clobber (reg:SI 7))
9785 (clobber (reg:SI 8))
9786 (clobber (match_scratch:SI 5 "=q"))]
9787 "TARGET_STRING && TARGET_POWER
9788 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9789 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9790 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9791 && REGNO (operands[4]) == 5"
9792 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9793 [(set_attr "type" "store_ux")
9794 (set_attr "length" "8")])
9797 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9798 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9799 (use (match_operand:SI 2 "immediate_operand" "i"))
9800 (use (match_operand:SI 3 "immediate_operand" "i"))
9801 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9802 (clobber (reg:SI 6))
9803 (clobber (reg:SI 7))
9804 (clobber (reg:SI 8))
9805 (clobber (match_scratch:SI 5 "=X"))]
9806 "TARGET_STRING && ! TARGET_POWER
9807 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9808 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9809 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9810 && REGNO (operands[4]) == 5"
9811 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9812 [(set_attr "type" "store_ux")
9813 (set_attr "length" "8")])
9815 ;; Move up to 8 bytes at a time.
9816 (define_expand "movmemsi_2reg"
9817 [(parallel [(set (match_operand 0 "" "")
9818 (match_operand 1 "" ""))
9819 (use (match_operand 2 "" ""))
9820 (use (match_operand 3 "" ""))
9821 (clobber (match_scratch:DI 4 ""))
9822 (clobber (match_scratch:SI 5 ""))])]
9823 "TARGET_STRING && ! TARGET_POWERPC64"
9827 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9828 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9829 (use (match_operand:SI 2 "immediate_operand" "i"))
9830 (use (match_operand:SI 3 "immediate_operand" "i"))
9831 (clobber (match_scratch:DI 4 "=&r"))
9832 (clobber (match_scratch:SI 5 "=q"))]
9833 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9834 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9835 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9836 [(set_attr "type" "store_ux")
9837 (set_attr "length" "8")])
9840 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9841 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9842 (use (match_operand:SI 2 "immediate_operand" "i"))
9843 (use (match_operand:SI 3 "immediate_operand" "i"))
9844 (clobber (match_scratch:DI 4 "=&r"))
9845 (clobber (match_scratch:SI 5 "=X"))]
9846 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9847 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9848 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9849 [(set_attr "type" "store_ux")
9850 (set_attr "length" "8")])
9852 ;; Move up to 4 bytes at a time.
9853 (define_expand "movmemsi_1reg"
9854 [(parallel [(set (match_operand 0 "" "")
9855 (match_operand 1 "" ""))
9856 (use (match_operand 2 "" ""))
9857 (use (match_operand 3 "" ""))
9858 (clobber (match_scratch:SI 4 ""))
9859 (clobber (match_scratch:SI 5 ""))])]
9864 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9865 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9866 (use (match_operand:SI 2 "immediate_operand" "i"))
9867 (use (match_operand:SI 3 "immediate_operand" "i"))
9868 (clobber (match_scratch:SI 4 "=&r"))
9869 (clobber (match_scratch:SI 5 "=q"))]
9870 "TARGET_STRING && TARGET_POWER
9871 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9872 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9873 [(set_attr "type" "store_ux")
9874 (set_attr "length" "8")])
9877 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9878 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9879 (use (match_operand:SI 2 "immediate_operand" "i"))
9880 (use (match_operand:SI 3 "immediate_operand" "i"))
9881 (clobber (match_scratch:SI 4 "=&r"))
9882 (clobber (match_scratch:SI 5 "=X"))]
9883 "TARGET_STRING && ! TARGET_POWER
9884 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9885 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9886 [(set_attr "type" "store_ux")
9887 (set_attr "length" "8")])
9889 ;; Define insns that do load or store with update. Some of these we can
9890 ;; get by using pre-decrement or pre-increment, but the hardware can also
9891 ;; do cases where the increment is not the size of the object.
9893 ;; In all these cases, we use operands 0 and 1 for the register being
9894 ;; incremented because those are the operands that local-alloc will
9895 ;; tie and these are the pair most likely to be tieable (and the ones
9896 ;; that will benefit the most).
9898 (define_insn "*movdi_update1"
9899 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9900 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9901 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9902 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9903 (plus:DI (match_dup 1) (match_dup 2)))]
9904 "TARGET_POWERPC64 && TARGET_UPDATE"
9908 [(set_attr "type" "load_ux,load_u")])
9910 (define_insn "movdi_<mode>_update"
9911 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9912 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9913 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9914 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9915 (plus:P (match_dup 1) (match_dup 2)))]
9916 "TARGET_POWERPC64 && TARGET_UPDATE"
9920 [(set_attr "type" "store_ux,store_u")])
9922 (define_insn "*movsi_update1"
9923 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9924 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9925 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9926 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9927 (plus:SI (match_dup 1) (match_dup 2)))]
9930 {lux|lwzux} %3,%0,%2
9931 {lu|lwzu} %3,%2(%0)"
9932 [(set_attr "type" "load_ux,load_u")])
9934 (define_insn "*movsi_update2"
9935 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9937 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9938 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9939 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9940 (plus:DI (match_dup 1) (match_dup 2)))]
9943 [(set_attr "type" "load_ext_ux")])
9945 (define_insn "movsi_update"
9946 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9947 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9948 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9949 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9950 (plus:SI (match_dup 1) (match_dup 2)))]
9953 {stux|stwux} %3,%0,%2
9954 {stu|stwu} %3,%2(%0)"
9955 [(set_attr "type" "store_ux,store_u")])
9957 (define_insn "*movhi_update1"
9958 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9959 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9960 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9961 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9962 (plus:SI (match_dup 1) (match_dup 2)))]
9967 [(set_attr "type" "load_ux,load_u")])
9969 (define_insn "*movhi_update2"
9970 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9972 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9973 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9974 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9975 (plus:SI (match_dup 1) (match_dup 2)))]
9980 [(set_attr "type" "load_ux,load_u")])
9982 (define_insn "*movhi_update3"
9983 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9985 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9986 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9987 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9988 (plus:SI (match_dup 1) (match_dup 2)))]
9993 [(set_attr "type" "load_ext_ux,load_ext_u")])
9995 (define_insn "*movhi_update4"
9996 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9997 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9998 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9999 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10000 (plus:SI (match_dup 1) (match_dup 2)))]
10005 [(set_attr "type" "store_ux,store_u")])
10007 (define_insn "*movqi_update1"
10008 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10009 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10010 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10011 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10012 (plus:SI (match_dup 1) (match_dup 2)))]
10017 [(set_attr "type" "load_ux,load_u")])
10019 (define_insn "*movqi_update2"
10020 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10022 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10023 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10024 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10025 (plus:SI (match_dup 1) (match_dup 2)))]
10030 [(set_attr "type" "load_ux,load_u")])
10032 (define_insn "*movqi_update3"
10033 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10034 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10035 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10036 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10037 (plus:SI (match_dup 1) (match_dup 2)))]
10042 [(set_attr "type" "store_ux,store_u")])
10044 (define_insn "*movsf_update1"
10045 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10046 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10047 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10048 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10049 (plus:SI (match_dup 1) (match_dup 2)))]
10050 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE"
10054 [(set_attr "type" "fpload_ux,fpload_u")])
10056 (define_insn "*movsf_update2"
10057 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10058 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10059 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10060 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10061 (plus:SI (match_dup 1) (match_dup 2)))]
10062 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE"
10066 [(set_attr "type" "fpstore_ux,fpstore_u")])
10068 (define_insn "*movsf_update3"
10069 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10070 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10071 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10072 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10073 (plus:SI (match_dup 1) (match_dup 2)))]
10074 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10076 {lux|lwzux} %3,%0,%2
10077 {lu|lwzu} %3,%2(%0)"
10078 [(set_attr "type" "load_ux,load_u")])
10080 (define_insn "*movsf_update4"
10081 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10082 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10083 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10084 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10085 (plus:SI (match_dup 1) (match_dup 2)))]
10086 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10088 {stux|stwux} %3,%0,%2
10089 {stu|stwu} %3,%2(%0)"
10090 [(set_attr "type" "store_ux,store_u")])
10092 (define_insn "*movdf_update1"
10093 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10094 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10095 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10096 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10097 (plus:SI (match_dup 1) (match_dup 2)))]
10098 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE"
10102 [(set_attr "type" "fpload_ux,fpload_u")])
10104 (define_insn "*movdf_update2"
10105 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10106 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10107 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10108 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10109 (plus:SI (match_dup 1) (match_dup 2)))]
10110 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE"
10114 [(set_attr "type" "fpstore_ux,fpstore_u")])
10116 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10118 (define_insn "*lfq_power2"
10119 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10120 (match_operand:V2DF 1 "memory_operand" ""))]
10122 && TARGET_HARD_FLOAT && TARGET_FPRS"
10126 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10127 (match_operand:DF 1 "memory_operand" ""))
10128 (set (match_operand:DF 2 "gpc_reg_operand" "")
10129 (match_operand:DF 3 "memory_operand" ""))]
10131 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10132 && registers_ok_for_quad_peep (operands[0], operands[2])
10133 && mems_ok_for_quad_peep (operands[1], operands[3])"
10134 [(set (match_dup 0)
10136 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10137 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10139 (define_insn "*stfq_power2"
10140 [(set (match_operand:V2DF 0 "memory_operand" "")
10141 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10143 && TARGET_HARD_FLOAT && TARGET_FPRS"
10144 "stfq%U0%X0 %1,%0")
10148 [(set (match_operand:DF 0 "memory_operand" "")
10149 (match_operand:DF 1 "gpc_reg_operand" ""))
10150 (set (match_operand:DF 2 "memory_operand" "")
10151 (match_operand:DF 3 "gpc_reg_operand" ""))]
10153 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10154 && registers_ok_for_quad_peep (operands[1], operands[3])
10155 && mems_ok_for_quad_peep (operands[0], operands[2])"
10156 [(set (match_dup 0)
10158 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10159 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10161 ;; After inserting conditional returns we can sometimes have
10162 ;; unnecessary register moves. Unfortunately we cannot have a
10163 ;; modeless peephole here, because some single SImode sets have early
10164 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10165 ;; sequences, using get_attr_length here will smash the operands
10166 ;; array. Neither is there an early_cobbler_p predicate.
10167 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10169 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10170 (match_operand:DF 1 "any_operand" ""))
10171 (set (match_operand:DF 2 "gpc_reg_operand" "")
10173 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10174 && peep2_reg_dead_p (2, operands[0])"
10175 [(set (match_dup 2) (match_dup 1))])
10178 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10179 (match_operand:SF 1 "any_operand" ""))
10180 (set (match_operand:SF 2 "gpc_reg_operand" "")
10182 "peep2_reg_dead_p (2, operands[0])"
10183 [(set (match_dup 2) (match_dup 1))])
10188 ;; Mode attributes for different ABIs.
10189 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10190 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10191 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10192 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10194 (define_insn "tls_gd_aix<TLSmode:tls_abi_suffix>"
10195 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10196 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10197 (match_operand 4 "" "g")))
10198 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10199 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10201 (clobber (reg:SI LR_REGNO))]
10202 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10203 "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
10204 [(set_attr "type" "two")
10205 (set_attr "length" "12")])
10207 (define_insn "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10208 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10209 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10210 (match_operand 4 "" "g")))
10211 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10212 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10214 (clobber (reg:SI LR_REGNO))]
10215 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10219 if (TARGET_SECURE_PLT && flag_pic == 2)
10220 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
10222 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
10225 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
10227 [(set_attr "type" "two")
10228 (set_attr "length" "8")])
10230 (define_insn "tls_ld_aix<TLSmode:tls_abi_suffix>"
10231 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10232 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10233 (match_operand 3 "" "g")))
10234 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10236 (clobber (reg:SI LR_REGNO))]
10237 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10238 "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
10239 [(set_attr "length" "12")])
10241 (define_insn "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
10242 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10243 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10244 (match_operand 3 "" "g")))
10245 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10247 (clobber (reg:SI LR_REGNO))]
10248 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10252 if (TARGET_SECURE_PLT && flag_pic == 2)
10253 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
10255 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
10258 return "addi %0,%1,%&@got@tlsld\;bl %z2";
10260 [(set_attr "length" "8")])
10262 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
10263 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10264 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10265 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10266 UNSPEC_TLSDTPREL))]
10268 "addi %0,%1,%2@dtprel")
10270 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
10271 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10272 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10273 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10274 UNSPEC_TLSDTPRELHA))]
10276 "addis %0,%1,%2@dtprel@ha")
10278 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
10279 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10280 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10281 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10282 UNSPEC_TLSDTPRELLO))]
10284 "addi %0,%1,%2@dtprel@l")
10286 (define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
10287 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10288 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10289 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10290 UNSPEC_TLSGOTDTPREL))]
10292 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
10294 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
10295 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10296 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10297 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10300 "addi %0,%1,%2@tprel")
10302 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
10303 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10304 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10305 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10306 UNSPEC_TLSTPRELHA))]
10308 "addis %0,%1,%2@tprel@ha")
10310 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
10311 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10312 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10313 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10314 UNSPEC_TLSTPRELLO))]
10316 "addi %0,%1,%2@tprel@l")
10318 ;; "b" output constraint here and on tls_tls input to support linker tls
10319 ;; optimization. The linker may edit the instructions emitted by a
10320 ;; tls_got_tprel/tls_tls pair to addis,addi.
10321 (define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
10322 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10323 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10324 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10325 UNSPEC_TLSGOTTPREL))]
10327 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
10329 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
10330 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10331 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10332 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10335 "add %0,%1,%2@tls")
10338 ;; Next come insns related to the calling sequence.
10340 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10341 ;; We move the back-chain and decrement the stack pointer.
10343 (define_expand "allocate_stack"
10344 [(set (match_operand 0 "gpc_reg_operand" "")
10345 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10347 (minus (reg 1) (match_dup 1)))]
10350 { rtx chain = gen_reg_rtx (Pmode);
10351 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10354 emit_move_insn (chain, stack_bot);
10356 /* Check stack bounds if necessary. */
10357 if (crtl->limit_stack)
10360 available = expand_binop (Pmode, sub_optab,
10361 stack_pointer_rtx, stack_limit_rtx,
10362 NULL_RTX, 1, OPTAB_WIDEN);
10363 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10366 if (GET_CODE (operands[1]) != CONST_INT
10367 || INTVAL (operands[1]) < -32767
10368 || INTVAL (operands[1]) > 32768)
10370 neg_op0 = gen_reg_rtx (Pmode);
10372 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10374 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10377 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10381 rtx insn, par, set, mem;
10383 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update
10384 : gen_movdi_di_update))
10385 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
10387 /* Since we didn't use gen_frame_mem to generate the MEM, grab
10388 it now and set the alias set/attributes. The above gen_*_update
10389 calls will generate a PARALLEL with the MEM set being the first
10391 par = PATTERN (insn);
10392 gcc_assert (GET_CODE (par) == PARALLEL);
10393 set = XVECEXP (par, 0, 0);
10394 gcc_assert (GET_CODE (set) == SET);
10395 mem = SET_DEST (set);
10396 gcc_assert (MEM_P (mem));
10397 MEM_NOTRAP_P (mem) = 1;
10398 set_mem_alias_set (mem, get_frame_alias_set ());
10403 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10404 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10405 emit_move_insn (gen_frame_mem (Pmode, stack_pointer_rtx), chain);
10408 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10412 ;; These patterns say how to save and restore the stack pointer. We need not
10413 ;; save the stack pointer at function level since we are careful to
10414 ;; preserve the backchain. At block level, we have to restore the backchain
10415 ;; when we restore the stack pointer.
10417 ;; For nonlocal gotos, we must save both the stack pointer and its
10418 ;; backchain and restore both. Note that in the nonlocal case, the
10419 ;; save area is a memory location.
10421 (define_expand "save_stack_function"
10422 [(match_operand 0 "any_operand" "")
10423 (match_operand 1 "any_operand" "")]
10427 (define_expand "restore_stack_function"
10428 [(match_operand 0 "any_operand" "")
10429 (match_operand 1 "any_operand" "")]
10433 ;; Adjust stack pointer (op0) to a new value (op1).
10434 ;; First copy old stack backchain to new location, and ensure that the
10435 ;; scheduler won't reorder the sp assignment before the backchain write.
10436 (define_expand "restore_stack_block"
10437 [(set (match_dup 2) (match_dup 3))
10438 (set (match_dup 4) (match_dup 2))
10439 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10440 (set (match_operand 0 "register_operand" "")
10441 (match_operand 1 "register_operand" ""))]
10445 operands[1] = force_reg (Pmode, operands[1]);
10446 operands[2] = gen_reg_rtx (Pmode);
10447 operands[3] = gen_frame_mem (Pmode, operands[0]);
10448 operands[4] = gen_frame_mem (Pmode, operands[1]);
10449 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10452 (define_expand "save_stack_nonlocal"
10453 [(set (match_dup 3) (match_dup 4))
10454 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10455 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10459 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10461 /* Copy the backchain to the first word, sp to the second. */
10462 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10463 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10464 operands[3] = gen_reg_rtx (Pmode);
10465 operands[4] = gen_frame_mem (Pmode, operands[1]);
10468 (define_expand "restore_stack_nonlocal"
10469 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10470 (set (match_dup 3) (match_dup 4))
10471 (set (match_dup 5) (match_dup 2))
10472 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10473 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10477 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10479 /* Restore the backchain from the first word, sp from the second. */
10480 operands[2] = gen_reg_rtx (Pmode);
10481 operands[3] = gen_reg_rtx (Pmode);
10482 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10483 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10484 operands[5] = gen_frame_mem (Pmode, operands[3]);
10485 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10488 ;; TOC register handling.
10490 ;; Code to initialize the TOC register...
10492 (define_insn "load_toc_aix_si"
10493 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10494 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10495 (use (reg:SI 2))])]
10496 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10500 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10501 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10502 operands[2] = gen_rtx_REG (Pmode, 2);
10503 return \"{l|lwz} %0,%1(%2)\";
10505 [(set_attr "type" "load")])
10507 (define_insn "load_toc_aix_di"
10508 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10509 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10510 (use (reg:DI 2))])]
10511 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10515 #ifdef TARGET_RELOCATABLE
10516 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10517 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10519 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10522 strcat (buf, \"@toc\");
10523 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10524 operands[2] = gen_rtx_REG (Pmode, 2);
10525 return \"ld %0,%1(%2)\";
10527 [(set_attr "type" "load")])
10529 (define_insn "load_toc_v4_pic_si"
10530 [(set (reg:SI LR_REGNO)
10531 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10532 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10533 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10534 [(set_attr "type" "branch")
10535 (set_attr "length" "4")])
10537 (define_insn "load_toc_v4_PIC_1"
10538 [(set (reg:SI LR_REGNO)
10539 (match_operand:SI 0 "immediate_operand" "s"))
10540 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10541 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10542 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10543 "bcl 20,31,%0\\n%0:"
10544 [(set_attr "type" "branch")
10545 (set_attr "length" "4")])
10547 (define_insn "load_toc_v4_PIC_1b"
10548 [(set (reg:SI LR_REGNO)
10549 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
10551 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10552 "bcl 20,31,$+8\\n\\t.long %0-$"
10553 [(set_attr "type" "branch")
10554 (set_attr "length" "8")])
10556 (define_insn "load_toc_v4_PIC_2"
10557 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10558 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10559 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10560 (match_operand:SI 3 "immediate_operand" "s")))))]
10561 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10562 "{l|lwz} %0,%2-%3(%1)"
10563 [(set_attr "type" "load")])
10565 (define_insn "load_toc_v4_PIC_3b"
10566 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10567 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10569 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10570 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10571 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10572 "{cau|addis} %0,%1,%2-%3@ha")
10574 (define_insn "load_toc_v4_PIC_3c"
10575 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10576 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10577 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10578 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10579 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10580 "{cal|addi} %0,%1,%2-%3@l")
10582 ;; If the TOC is shared over a translation unit, as happens with all
10583 ;; the kinds of PIC that we support, we need to restore the TOC
10584 ;; pointer only when jumping over units of translation.
10585 ;; On Darwin, we need to reload the picbase.
10587 (define_expand "builtin_setjmp_receiver"
10588 [(use (label_ref (match_operand 0 "" "")))]
10589 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10590 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10591 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10595 if (DEFAULT_ABI == ABI_DARWIN)
10597 const char *picbase = machopic_function_base_name ();
10598 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10599 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10603 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10604 CODE_LABEL_NUMBER (operands[0]));
10605 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10607 emit_insn (gen_load_macho_picbase (tmplabrtx));
10608 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
10609 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10613 rs6000_emit_load_toc_table (FALSE);
10617 ;; Elf specific ways of loading addresses for non-PIC code.
10618 ;; The output of this could be r0, but we make a very strong
10619 ;; preference for a base register because it will usually
10620 ;; be needed there.
10621 (define_insn "elf_high"
10622 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10623 (high:SI (match_operand 1 "" "")))]
10624 "TARGET_ELF && ! TARGET_64BIT"
10625 "{liu|lis} %0,%1@ha")
10627 (define_insn "elf_low"
10628 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10629 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10630 (match_operand 2 "" "")))]
10631 "TARGET_ELF && ! TARGET_64BIT"
10633 {cal|la} %0,%2@l(%1)
10634 {ai|addic} %0,%1,%K2")
10636 ;; A function pointer under AIX is a pointer to a data area whose first word
10637 ;; contains the actual address of the function, whose second word contains a
10638 ;; pointer to its TOC, and whose third word contains a value to place in the
10639 ;; static chain register (r11). Note that if we load the static chain, our
10640 ;; "trampoline" need not have any executable code.
10642 (define_expand "call_indirect_aix32"
10643 [(set (match_dup 2)
10644 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10645 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10648 (mem:SI (plus:SI (match_dup 0)
10651 (mem:SI (plus:SI (match_dup 0)
10653 (parallel [(call (mem:SI (match_dup 2))
10654 (match_operand 1 "" ""))
10658 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10659 (clobber (reg:SI LR_REGNO))])]
10662 { operands[2] = gen_reg_rtx (SImode); }")
10664 (define_expand "call_indirect_aix64"
10665 [(set (match_dup 2)
10666 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10667 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10670 (mem:DI (plus:DI (match_dup 0)
10673 (mem:DI (plus:DI (match_dup 0)
10675 (parallel [(call (mem:SI (match_dup 2))
10676 (match_operand 1 "" ""))
10680 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10681 (clobber (reg:SI LR_REGNO))])]
10684 { operands[2] = gen_reg_rtx (DImode); }")
10686 (define_expand "call_value_indirect_aix32"
10687 [(set (match_dup 3)
10688 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10689 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10692 (mem:SI (plus:SI (match_dup 1)
10695 (mem:SI (plus:SI (match_dup 1)
10697 (parallel [(set (match_operand 0 "" "")
10698 (call (mem:SI (match_dup 3))
10699 (match_operand 2 "" "")))
10703 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10704 (clobber (reg:SI LR_REGNO))])]
10707 { operands[3] = gen_reg_rtx (SImode); }")
10709 (define_expand "call_value_indirect_aix64"
10710 [(set (match_dup 3)
10711 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10712 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10715 (mem:DI (plus:DI (match_dup 1)
10718 (mem:DI (plus:DI (match_dup 1)
10720 (parallel [(set (match_operand 0 "" "")
10721 (call (mem:SI (match_dup 3))
10722 (match_operand 2 "" "")))
10726 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10727 (clobber (reg:SI LR_REGNO))])]
10730 { operands[3] = gen_reg_rtx (DImode); }")
10732 ;; Now the definitions for the call and call_value insns
10733 (define_expand "call"
10734 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10735 (match_operand 1 "" ""))
10736 (use (match_operand 2 "" ""))
10737 (clobber (reg:SI LR_REGNO))])]
10742 if (MACHOPIC_INDIRECT)
10743 operands[0] = machopic_indirect_call_target (operands[0]);
10746 gcc_assert (GET_CODE (operands[0]) == MEM);
10747 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10749 operands[0] = XEXP (operands[0], 0);
10751 if (GET_CODE (operands[0]) != SYMBOL_REF
10752 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10753 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10755 if (INTVAL (operands[2]) & CALL_LONG)
10756 operands[0] = rs6000_longcall_ref (operands[0]);
10758 switch (DEFAULT_ABI)
10762 operands[0] = force_reg (Pmode, operands[0]);
10766 /* AIX function pointers are really pointers to a three word
10768 emit_call_insn (TARGET_32BIT
10769 ? gen_call_indirect_aix32 (force_reg (SImode,
10772 : gen_call_indirect_aix64 (force_reg (DImode,
10778 gcc_unreachable ();
10783 (define_expand "call_value"
10784 [(parallel [(set (match_operand 0 "" "")
10785 (call (mem:SI (match_operand 1 "address_operand" ""))
10786 (match_operand 2 "" "")))
10787 (use (match_operand 3 "" ""))
10788 (clobber (reg:SI LR_REGNO))])]
10793 if (MACHOPIC_INDIRECT)
10794 operands[1] = machopic_indirect_call_target (operands[1]);
10797 gcc_assert (GET_CODE (operands[1]) == MEM);
10798 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10800 operands[1] = XEXP (operands[1], 0);
10802 if (GET_CODE (operands[1]) != SYMBOL_REF
10803 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10804 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10806 if (INTVAL (operands[3]) & CALL_LONG)
10807 operands[1] = rs6000_longcall_ref (operands[1]);
10809 switch (DEFAULT_ABI)
10813 operands[1] = force_reg (Pmode, operands[1]);
10817 /* AIX function pointers are really pointers to a three word
10819 emit_call_insn (TARGET_32BIT
10820 ? gen_call_value_indirect_aix32 (operands[0],
10824 : gen_call_value_indirect_aix64 (operands[0],
10831 gcc_unreachable ();
10836 ;; Call to function in current module. No TOC pointer reload needed.
10837 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10838 ;; either the function was not prototyped, or it was prototyped as a
10839 ;; variable argument function. It is > 0 if FP registers were passed
10840 ;; and < 0 if they were not.
10842 (define_insn "*call_local32"
10843 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10844 (match_operand 1 "" "g,g"))
10845 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10846 (clobber (reg:SI LR_REGNO))]
10847 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10850 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10851 output_asm_insn (\"crxor 6,6,6\", operands);
10853 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10854 output_asm_insn (\"creqv 6,6,6\", operands);
10856 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10858 [(set_attr "type" "branch")
10859 (set_attr "length" "4,8")])
10861 (define_insn "*call_local64"
10862 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10863 (match_operand 1 "" "g,g"))
10864 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10865 (clobber (reg:SI LR_REGNO))]
10866 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10869 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10870 output_asm_insn (\"crxor 6,6,6\", operands);
10872 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10873 output_asm_insn (\"creqv 6,6,6\", operands);
10875 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10877 [(set_attr "type" "branch")
10878 (set_attr "length" "4,8")])
10880 (define_insn "*call_value_local32"
10881 [(set (match_operand 0 "" "")
10882 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10883 (match_operand 2 "" "g,g")))
10884 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10885 (clobber (reg:SI LR_REGNO))]
10886 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10889 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10890 output_asm_insn (\"crxor 6,6,6\", operands);
10892 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10893 output_asm_insn (\"creqv 6,6,6\", operands);
10895 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10897 [(set_attr "type" "branch")
10898 (set_attr "length" "4,8")])
10901 (define_insn "*call_value_local64"
10902 [(set (match_operand 0 "" "")
10903 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10904 (match_operand 2 "" "g,g")))
10905 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10906 (clobber (reg:SI LR_REGNO))]
10907 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10910 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10911 output_asm_insn (\"crxor 6,6,6\", operands);
10913 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10914 output_asm_insn (\"creqv 6,6,6\", operands);
10916 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10918 [(set_attr "type" "branch")
10919 (set_attr "length" "4,8")])
10921 ;; Call to function which may be in another module. Restore the TOC
10922 ;; pointer (r2) after the call unless this is System V.
10923 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10924 ;; either the function was not prototyped, or it was prototyped as a
10925 ;; variable argument function. It is > 0 if FP registers were passed
10926 ;; and < 0 if they were not.
10928 (define_insn "*call_indirect_nonlocal_aix32"
10929 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10930 (match_operand 1 "" "g,g"))
10934 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10935 (clobber (reg:SI LR_REGNO))]
10936 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10937 "b%T0l\;{l|lwz} 2,20(1)"
10938 [(set_attr "type" "jmpreg")
10939 (set_attr "length" "8")])
10941 (define_insn "*call_nonlocal_aix32"
10942 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10943 (match_operand 1 "" "g"))
10944 (use (match_operand:SI 2 "immediate_operand" "O"))
10945 (clobber (reg:SI LR_REGNO))]
10947 && DEFAULT_ABI == ABI_AIX
10948 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10950 [(set_attr "type" "branch")
10951 (set_attr "length" "8")])
10953 (define_insn "*call_indirect_nonlocal_aix64"
10954 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10955 (match_operand 1 "" "g,g"))
10959 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10960 (clobber (reg:SI LR_REGNO))]
10961 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10962 "b%T0l\;ld 2,40(1)"
10963 [(set_attr "type" "jmpreg")
10964 (set_attr "length" "8")])
10966 (define_insn "*call_nonlocal_aix64"
10967 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10968 (match_operand 1 "" "g"))
10969 (use (match_operand:SI 2 "immediate_operand" "O"))
10970 (clobber (reg:SI LR_REGNO))]
10972 && DEFAULT_ABI == ABI_AIX
10973 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10975 [(set_attr "type" "branch")
10976 (set_attr "length" "8")])
10978 (define_insn "*call_value_indirect_nonlocal_aix32"
10979 [(set (match_operand 0 "" "")
10980 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10981 (match_operand 2 "" "g,g")))
10985 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10986 (clobber (reg:SI LR_REGNO))]
10987 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10988 "b%T1l\;{l|lwz} 2,20(1)"
10989 [(set_attr "type" "jmpreg")
10990 (set_attr "length" "8")])
10992 (define_insn "*call_value_nonlocal_aix32"
10993 [(set (match_operand 0 "" "")
10994 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10995 (match_operand 2 "" "g")))
10996 (use (match_operand:SI 3 "immediate_operand" "O"))
10997 (clobber (reg:SI LR_REGNO))]
10999 && DEFAULT_ABI == ABI_AIX
11000 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11002 [(set_attr "type" "branch")
11003 (set_attr "length" "8")])
11005 (define_insn "*call_value_indirect_nonlocal_aix64"
11006 [(set (match_operand 0 "" "")
11007 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11008 (match_operand 2 "" "g,g")))
11012 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11013 (clobber (reg:SI LR_REGNO))]
11014 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11015 "b%T1l\;ld 2,40(1)"
11016 [(set_attr "type" "jmpreg")
11017 (set_attr "length" "8")])
11019 (define_insn "*call_value_nonlocal_aix64"
11020 [(set (match_operand 0 "" "")
11021 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11022 (match_operand 2 "" "g")))
11023 (use (match_operand:SI 3 "immediate_operand" "O"))
11024 (clobber (reg:SI LR_REGNO))]
11026 && DEFAULT_ABI == ABI_AIX
11027 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11029 [(set_attr "type" "branch")
11030 (set_attr "length" "8")])
11032 ;; A function pointer under System V is just a normal pointer
11033 ;; operands[0] is the function pointer
11034 ;; operands[1] is the stack size to clean up
11035 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11036 ;; which indicates how to set cr1
11038 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11039 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11040 (match_operand 1 "" "g,g,g,g"))
11041 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11042 (clobber (reg:SI LR_REGNO))]
11043 "DEFAULT_ABI == ABI_V4
11044 || DEFAULT_ABI == ABI_DARWIN"
11046 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11047 output_asm_insn ("crxor 6,6,6", operands);
11049 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11050 output_asm_insn ("creqv 6,6,6", operands);
11054 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11055 (set_attr "length" "4,4,8,8")])
11057 (define_insn_and_split "*call_nonlocal_sysv<mode>"
11058 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11059 (match_operand 1 "" "g,g"))
11060 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11061 (clobber (reg:SI LR_REGNO))]
11062 "(DEFAULT_ABI == ABI_DARWIN
11063 || (DEFAULT_ABI == ABI_V4
11064 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11066 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11067 output_asm_insn ("crxor 6,6,6", operands);
11069 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11070 output_asm_insn ("creqv 6,6,6", operands);
11073 return output_call(insn, operands, 0, 2);
11075 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11077 gcc_assert (!TARGET_SECURE_PLT);
11078 return "bl %z0@plt";
11084 "DEFAULT_ABI == ABI_V4
11085 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11086 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11087 [(parallel [(call (mem:SI (match_dup 0))
11089 (use (match_dup 2))
11090 (use (match_dup 3))
11091 (clobber (reg:SI LR_REGNO))])]
11093 operands[3] = pic_offset_table_rtx;
11095 [(set_attr "type" "branch,branch")
11096 (set_attr "length" "4,8")])
11098 (define_insn "*call_nonlocal_sysv_secure<mode>"
11099 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11100 (match_operand 1 "" "g,g"))
11101 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11102 (use (match_operand:SI 3 "register_operand" "r,r"))
11103 (clobber (reg:SI LR_REGNO))]
11104 "(DEFAULT_ABI == ABI_V4
11105 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11106 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
11108 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11109 output_asm_insn ("crxor 6,6,6", operands);
11111 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11112 output_asm_insn ("creqv 6,6,6", operands);
11115 /* The magic 32768 offset here and in the other sysv call insns
11116 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11117 See sysv4.h:toc_section. */
11118 return "bl %z0+32768@plt";
11120 return "bl %z0@plt";
11122 [(set_attr "type" "branch,branch")
11123 (set_attr "length" "4,8")])
11125 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11126 [(set (match_operand 0 "" "")
11127 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11128 (match_operand 2 "" "g,g,g,g")))
11129 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11130 (clobber (reg:SI LR_REGNO))]
11131 "DEFAULT_ABI == ABI_V4
11132 || DEFAULT_ABI == ABI_DARWIN"
11134 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11135 output_asm_insn ("crxor 6,6,6", operands);
11137 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11138 output_asm_insn ("creqv 6,6,6", operands);
11142 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11143 (set_attr "length" "4,4,8,8")])
11145 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
11146 [(set (match_operand 0 "" "")
11147 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11148 (match_operand 2 "" "g,g")))
11149 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11150 (clobber (reg:SI LR_REGNO))]
11151 "(DEFAULT_ABI == ABI_DARWIN
11152 || (DEFAULT_ABI == ABI_V4
11153 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11155 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11156 output_asm_insn ("crxor 6,6,6", operands);
11158 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11159 output_asm_insn ("creqv 6,6,6", operands);
11162 return output_call(insn, operands, 1, 3);
11164 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11166 gcc_assert (!TARGET_SECURE_PLT);
11167 return "bl %z1@plt";
11173 "DEFAULT_ABI == ABI_V4
11174 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11175 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11176 [(parallel [(set (match_dup 0)
11177 (call (mem:SI (match_dup 1))
11179 (use (match_dup 3))
11180 (use (match_dup 4))
11181 (clobber (reg:SI LR_REGNO))])]
11183 operands[4] = pic_offset_table_rtx;
11185 [(set_attr "type" "branch,branch")
11186 (set_attr "length" "4,8")])
11188 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
11189 [(set (match_operand 0 "" "")
11190 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11191 (match_operand 2 "" "g,g")))
11192 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11193 (use (match_operand:SI 4 "register_operand" "r,r"))
11194 (clobber (reg:SI LR_REGNO))]
11195 "(DEFAULT_ABI == ABI_V4
11196 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11197 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
11199 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11200 output_asm_insn ("crxor 6,6,6", operands);
11202 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11203 output_asm_insn ("creqv 6,6,6", operands);
11206 return "bl %z1+32768@plt";
11208 return "bl %z1@plt";
11210 [(set_attr "type" "branch,branch")
11211 (set_attr "length" "4,8")])
11213 ;; Call subroutine returning any type.
11214 (define_expand "untyped_call"
11215 [(parallel [(call (match_operand 0 "" "")
11217 (match_operand 1 "" "")
11218 (match_operand 2 "" "")])]
11224 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11226 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11228 rtx set = XVECEXP (operands[2], 0, i);
11229 emit_move_insn (SET_DEST (set), SET_SRC (set));
11232 /* The optimizer does not know that the call sets the function value
11233 registers we stored in the result block. We avoid problems by
11234 claiming that all hard registers are used and clobbered at this
11236 emit_insn (gen_blockage ());
11241 ;; sibling call patterns
11242 (define_expand "sibcall"
11243 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11244 (match_operand 1 "" ""))
11245 (use (match_operand 2 "" ""))
11246 (use (reg:SI LR_REGNO))
11252 if (MACHOPIC_INDIRECT)
11253 operands[0] = machopic_indirect_call_target (operands[0]);
11256 gcc_assert (GET_CODE (operands[0]) == MEM);
11257 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11259 operands[0] = XEXP (operands[0], 0);
11262 ;; this and similar patterns must be marked as using LR, otherwise
11263 ;; dataflow will try to delete the store into it. This is true
11264 ;; even when the actual reg to jump to is in CTR, when LR was
11265 ;; saved and restored around the PIC-setting BCL.
11266 (define_insn "*sibcall_local32"
11267 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11268 (match_operand 1 "" "g,g"))
11269 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11270 (use (reg:SI LR_REGNO))
11272 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11275 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11276 output_asm_insn (\"crxor 6,6,6\", operands);
11278 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11279 output_asm_insn (\"creqv 6,6,6\", operands);
11281 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11283 [(set_attr "type" "branch")
11284 (set_attr "length" "4,8")])
11286 (define_insn "*sibcall_local64"
11287 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11288 (match_operand 1 "" "g,g"))
11289 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11290 (use (reg:SI LR_REGNO))
11292 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11295 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11296 output_asm_insn (\"crxor 6,6,6\", operands);
11298 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11299 output_asm_insn (\"creqv 6,6,6\", operands);
11301 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11303 [(set_attr "type" "branch")
11304 (set_attr "length" "4,8")])
11306 (define_insn "*sibcall_value_local32"
11307 [(set (match_operand 0 "" "")
11308 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11309 (match_operand 2 "" "g,g")))
11310 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11311 (use (reg:SI LR_REGNO))
11313 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11316 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11317 output_asm_insn (\"crxor 6,6,6\", operands);
11319 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11320 output_asm_insn (\"creqv 6,6,6\", operands);
11322 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11324 [(set_attr "type" "branch")
11325 (set_attr "length" "4,8")])
11328 (define_insn "*sibcall_value_local64"
11329 [(set (match_operand 0 "" "")
11330 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11331 (match_operand 2 "" "g,g")))
11332 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11333 (use (reg:SI LR_REGNO))
11335 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11338 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11339 output_asm_insn (\"crxor 6,6,6\", operands);
11341 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11342 output_asm_insn (\"creqv 6,6,6\", operands);
11344 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11346 [(set_attr "type" "branch")
11347 (set_attr "length" "4,8")])
11349 (define_insn "*sibcall_nonlocal_aix32"
11350 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11351 (match_operand 1 "" "g"))
11352 (use (match_operand:SI 2 "immediate_operand" "O"))
11353 (use (reg:SI LR_REGNO))
11356 && DEFAULT_ABI == ABI_AIX
11357 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11359 [(set_attr "type" "branch")
11360 (set_attr "length" "4")])
11362 (define_insn "*sibcall_nonlocal_aix64"
11363 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11364 (match_operand 1 "" "g"))
11365 (use (match_operand:SI 2 "immediate_operand" "O"))
11366 (use (reg:SI LR_REGNO))
11369 && DEFAULT_ABI == ABI_AIX
11370 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11372 [(set_attr "type" "branch")
11373 (set_attr "length" "4")])
11375 (define_insn "*sibcall_value_nonlocal_aix32"
11376 [(set (match_operand 0 "" "")
11377 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11378 (match_operand 2 "" "g")))
11379 (use (match_operand:SI 3 "immediate_operand" "O"))
11380 (use (reg:SI LR_REGNO))
11383 && DEFAULT_ABI == ABI_AIX
11384 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11386 [(set_attr "type" "branch")
11387 (set_attr "length" "4")])
11389 (define_insn "*sibcall_value_nonlocal_aix64"
11390 [(set (match_operand 0 "" "")
11391 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11392 (match_operand 2 "" "g")))
11393 (use (match_operand:SI 3 "immediate_operand" "O"))
11394 (use (reg:SI LR_REGNO))
11397 && DEFAULT_ABI == ABI_AIX
11398 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11400 [(set_attr "type" "branch")
11401 (set_attr "length" "4")])
11403 (define_insn "*sibcall_nonlocal_sysv<mode>"
11404 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11405 (match_operand 1 "" ""))
11406 (use (match_operand 2 "immediate_operand" "O,n"))
11407 (use (reg:SI LR_REGNO))
11409 "(DEFAULT_ABI == ABI_DARWIN
11410 || DEFAULT_ABI == ABI_V4)
11411 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11414 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11415 output_asm_insn (\"crxor 6,6,6\", operands);
11417 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11418 output_asm_insn (\"creqv 6,6,6\", operands);
11420 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11422 gcc_assert (!TARGET_SECURE_PLT);
11423 return \"b %z0@plt\";
11428 [(set_attr "type" "branch,branch")
11429 (set_attr "length" "4,8")])
11431 (define_expand "sibcall_value"
11432 [(parallel [(set (match_operand 0 "register_operand" "")
11433 (call (mem:SI (match_operand 1 "address_operand" ""))
11434 (match_operand 2 "" "")))
11435 (use (match_operand 3 "" ""))
11436 (use (reg:SI LR_REGNO))
11442 if (MACHOPIC_INDIRECT)
11443 operands[1] = machopic_indirect_call_target (operands[1]);
11446 gcc_assert (GET_CODE (operands[1]) == MEM);
11447 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11449 operands[1] = XEXP (operands[1], 0);
11452 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11453 [(set (match_operand 0 "" "")
11454 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11455 (match_operand 2 "" "")))
11456 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11457 (use (reg:SI LR_REGNO))
11459 "(DEFAULT_ABI == ABI_DARWIN
11460 || DEFAULT_ABI == ABI_V4)
11461 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11464 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11465 output_asm_insn (\"crxor 6,6,6\", operands);
11467 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11468 output_asm_insn (\"creqv 6,6,6\", operands);
11470 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11472 gcc_assert (!TARGET_SECURE_PLT);
11473 return \"b %z1@plt\";
11478 [(set_attr "type" "branch,branch")
11479 (set_attr "length" "4,8")])
11481 (define_expand "sibcall_epilogue"
11482 [(use (const_int 0))]
11483 "TARGET_SCHED_PROLOG"
11486 rs6000_emit_epilogue (TRUE);
11490 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11491 ;; all of memory. This blocks insns from being moved across this point.
11493 (define_insn "blockage"
11494 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11498 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11499 ;; signed & unsigned, and one type of branch.
11501 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11502 ;; insns, and branches. We store the operands of compares until we see
11504 (define_expand "cmp<mode>"
11506 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11507 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11511 /* Take care of the possibility that operands[1] might be negative but
11512 this might be a logical operation. That insn doesn't exist. */
11513 if (GET_CODE (operands[1]) == CONST_INT
11514 && INTVAL (operands[1]) < 0)
11515 operands[1] = force_reg (<MODE>mode, operands[1]);
11517 rs6000_compare_op0 = operands[0];
11518 rs6000_compare_op1 = operands[1];
11519 rs6000_compare_fp_p = 0;
11523 (define_expand "cmp<mode>"
11524 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11525 (match_operand:FP 1 "gpc_reg_operand" "")))]
11529 rs6000_compare_op0 = operands[0];
11530 rs6000_compare_op1 = operands[1];
11531 rs6000_compare_fp_p = 1;
11535 (define_expand "beq"
11536 [(use (match_operand 0 "" ""))]
11538 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11540 (define_expand "bne"
11541 [(use (match_operand 0 "" ""))]
11543 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11545 (define_expand "bge"
11546 [(use (match_operand 0 "" ""))]
11548 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11550 (define_expand "bgt"
11551 [(use (match_operand 0 "" ""))]
11553 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11555 (define_expand "ble"
11556 [(use (match_operand 0 "" ""))]
11558 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11560 (define_expand "blt"
11561 [(use (match_operand 0 "" ""))]
11563 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11565 (define_expand "bgeu"
11566 [(use (match_operand 0 "" ""))]
11568 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11570 (define_expand "bgtu"
11571 [(use (match_operand 0 "" ""))]
11573 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11575 (define_expand "bleu"
11576 [(use (match_operand 0 "" ""))]
11578 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11580 (define_expand "bltu"
11581 [(use (match_operand 0 "" ""))]
11583 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11585 (define_expand "bunordered"
11586 [(use (match_operand 0 "" ""))]
11587 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11588 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11590 (define_expand "bordered"
11591 [(use (match_operand 0 "" ""))]
11592 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11593 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11595 (define_expand "buneq"
11596 [(use (match_operand 0 "" ""))]
11597 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11598 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11600 (define_expand "bunge"
11601 [(use (match_operand 0 "" ""))]
11602 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11603 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11605 (define_expand "bungt"
11606 [(use (match_operand 0 "" ""))]
11607 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11608 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11610 (define_expand "bunle"
11611 [(use (match_operand 0 "" ""))]
11612 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11613 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11615 (define_expand "bunlt"
11616 [(use (match_operand 0 "" ""))]
11617 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11618 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11620 (define_expand "bltgt"
11621 [(use (match_operand 0 "" ""))]
11623 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11625 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11626 ;; For SEQ, likewise, except that comparisons with zero should be done
11627 ;; with an scc insns. However, due to the order that combine see the
11628 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11629 ;; the cases we don't want to handle.
11630 (define_expand "seq"
11631 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11633 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11635 (define_expand "sne"
11636 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11640 if (! rs6000_compare_fp_p)
11643 rs6000_emit_sCOND (NE, operands[0]);
11647 ;; A >= 0 is best done the portable way for A an integer.
11648 (define_expand "sge"
11649 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11653 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11656 rs6000_emit_sCOND (GE, operands[0]);
11660 ;; A > 0 is best done using the portable sequence, so fail in that case.
11661 (define_expand "sgt"
11662 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11666 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11669 rs6000_emit_sCOND (GT, operands[0]);
11673 ;; A <= 0 is best done the portable way for A an integer.
11674 (define_expand "sle"
11675 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11679 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11682 rs6000_emit_sCOND (LE, operands[0]);
11686 ;; A < 0 is best done in the portable way for A an integer.
11687 (define_expand "slt"
11688 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11692 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11695 rs6000_emit_sCOND (LT, operands[0]);
11699 (define_expand "sgeu"
11700 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11702 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11704 (define_expand "sgtu"
11705 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11707 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11709 (define_expand "sleu"
11710 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11712 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11714 (define_expand "sltu"
11715 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11717 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11719 (define_expand "sunordered"
11720 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11721 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11722 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11724 (define_expand "sordered"
11725 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11726 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11727 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11729 (define_expand "suneq"
11730 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11731 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11732 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11734 (define_expand "sunge"
11735 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11736 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11737 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11739 (define_expand "sungt"
11740 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11741 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11742 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11744 (define_expand "sunle"
11745 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11746 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11747 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11749 (define_expand "sunlt"
11750 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11751 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11752 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11754 (define_expand "sltgt"
11755 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11757 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11759 (define_expand "stack_protect_set"
11760 [(match_operand 0 "memory_operand" "")
11761 (match_operand 1 "memory_operand" "")]
11764 #ifdef TARGET_THREAD_SSP_OFFSET
11765 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11766 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11767 operands[1] = gen_rtx_MEM (Pmode, addr);
11770 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11772 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11776 (define_insn "stack_protect_setsi"
11777 [(set (match_operand:SI 0 "memory_operand" "=m")
11778 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11779 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11781 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11782 [(set_attr "type" "three")
11783 (set_attr "length" "12")])
11785 (define_insn "stack_protect_setdi"
11786 [(set (match_operand:DI 0 "memory_operand" "=m")
11787 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11788 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11790 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11791 [(set_attr "type" "three")
11792 (set_attr "length" "12")])
11794 (define_expand "stack_protect_test"
11795 [(match_operand 0 "memory_operand" "")
11796 (match_operand 1 "memory_operand" "")
11797 (match_operand 2 "" "")]
11800 #ifdef TARGET_THREAD_SSP_OFFSET
11801 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11802 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11803 operands[1] = gen_rtx_MEM (Pmode, addr);
11805 rs6000_compare_op0 = operands[0];
11806 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11808 rs6000_compare_fp_p = 0;
11809 emit_jump_insn (gen_beq (operands[2]));
11813 (define_insn "stack_protect_testsi"
11814 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11815 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11816 (match_operand:SI 2 "memory_operand" "m,m")]
11818 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11819 (clobber (match_scratch:SI 3 "=&r,&r"))]
11822 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11823 {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"
11824 [(set_attr "length" "16,20")])
11826 (define_insn "stack_protect_testdi"
11827 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11828 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11829 (match_operand:DI 2 "memory_operand" "m,m")]
11831 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11832 (clobber (match_scratch:DI 3 "=&r,&r"))]
11835 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11836 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11837 [(set_attr "length" "16,20")])
11840 ;; Here are the actual compare insns.
11841 (define_insn "*cmp<mode>_internal1"
11842 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11843 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11844 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11846 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11847 [(set_attr "type" "cmp")])
11849 ;; If we are comparing a register for equality with a large constant,
11850 ;; we can do this with an XOR followed by a compare. But this is profitable
11851 ;; only if the large constant is only used for the comparison (and in this
11852 ;; case we already have a register to reuse as scratch).
11854 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11855 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11858 [(set (match_operand:SI 0 "register_operand")
11859 (match_operand:SI 1 "logical_const_operand" ""))
11860 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11862 (match_operand:SI 2 "logical_const_operand" "")]))
11863 (set (match_operand:CC 4 "cc_reg_operand" "")
11864 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11867 (if_then_else (match_operator 6 "equality_operator"
11868 [(match_dup 4) (const_int 0)])
11869 (match_operand 7 "" "")
11870 (match_operand 8 "" "")))]
11871 "peep2_reg_dead_p (3, operands[0])
11872 && peep2_reg_dead_p (4, operands[4])"
11873 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11874 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11875 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11878 /* Get the constant we are comparing against, and see what it looks like
11879 when sign-extended from 16 to 32 bits. Then see what constant we could
11880 XOR with SEXTC to get the sign-extended value. */
11881 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11883 operands[1], operands[2]);
11884 HOST_WIDE_INT c = INTVAL (cnst);
11885 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11886 HOST_WIDE_INT xorv = c ^ sextc;
11888 operands[9] = GEN_INT (xorv);
11889 operands[10] = GEN_INT (sextc);
11892 (define_insn "*cmpsi_internal2"
11893 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11894 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11895 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11897 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11898 [(set_attr "type" "cmp")])
11900 (define_insn "*cmpdi_internal2"
11901 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11902 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11903 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11905 "cmpld%I2 %0,%1,%b2"
11906 [(set_attr "type" "cmp")])
11908 ;; The following two insns don't exist as single insns, but if we provide
11909 ;; them, we can swap an add and compare, which will enable us to overlap more
11910 ;; of the required delay between a compare and branch. We generate code for
11911 ;; them by splitting.
11914 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11915 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11916 (match_operand:SI 2 "short_cint_operand" "i")))
11917 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11918 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11921 [(set_attr "length" "8")])
11924 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11925 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11926 (match_operand:SI 2 "u_short_cint_operand" "i")))
11927 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11928 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11931 [(set_attr "length" "8")])
11934 [(set (match_operand:CC 3 "cc_reg_operand" "")
11935 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11936 (match_operand:SI 2 "short_cint_operand" "")))
11937 (set (match_operand:SI 0 "gpc_reg_operand" "")
11938 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11940 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11941 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11944 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11945 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11946 (match_operand:SI 2 "u_short_cint_operand" "")))
11947 (set (match_operand:SI 0 "gpc_reg_operand" "")
11948 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11950 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11951 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11953 (define_insn "*cmpsf_internal1"
11954 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11955 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11956 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11957 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
11959 [(set_attr "type" "fpcompare")])
11961 (define_insn "*cmpdf_internal1"
11962 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11963 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11964 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11965 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
11967 [(set_attr "type" "fpcompare")])
11969 ;; Only need to compare second words if first words equal
11970 (define_insn "*cmptf_internal1"
11971 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11972 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11973 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11974 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11975 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11976 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11977 [(set_attr "type" "fpcompare")
11978 (set_attr "length" "12")])
11980 (define_insn_and_split "*cmptf_internal2"
11981 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11982 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11983 (match_operand:TF 2 "gpc_reg_operand" "f")))
11984 (clobber (match_scratch:DF 3 "=f"))
11985 (clobber (match_scratch:DF 4 "=f"))
11986 (clobber (match_scratch:DF 5 "=f"))
11987 (clobber (match_scratch:DF 6 "=f"))
11988 (clobber (match_scratch:DF 7 "=f"))
11989 (clobber (match_scratch:DF 8 "=f"))
11990 (clobber (match_scratch:DF 9 "=f"))
11991 (clobber (match_scratch:DF 10 "=f"))]
11992 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11993 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11995 "&& reload_completed"
11996 [(set (match_dup 3) (match_dup 13))
11997 (set (match_dup 4) (match_dup 14))
11998 (set (match_dup 9) (abs:DF (match_dup 5)))
11999 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12000 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12001 (label_ref (match_dup 11))
12003 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12004 (set (pc) (label_ref (match_dup 12)))
12006 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12007 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12008 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12009 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
12012 REAL_VALUE_TYPE rv;
12013 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12014 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12016 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12017 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12018 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12019 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12020 operands[11] = gen_label_rtx ();
12021 operands[12] = gen_label_rtx ();
12023 operands[13] = force_const_mem (DFmode,
12024 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12025 operands[14] = force_const_mem (DFmode,
12026 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12030 operands[13] = gen_const_mem (DFmode,
12031 create_TOC_reference (XEXP (operands[13], 0)));
12032 operands[14] = gen_const_mem (DFmode,
12033 create_TOC_reference (XEXP (operands[14], 0)));
12034 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12035 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12039 ;; Now we have the scc insns. We can do some combinations because of the
12040 ;; way the machine works.
12042 ;; Note that this is probably faster if we can put an insn between the
12043 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12044 ;; cases the insns below which don't use an intermediate CR field will
12045 ;; be used instead.
12047 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12048 (match_operator:SI 1 "scc_comparison_operator"
12049 [(match_operand 2 "cc_reg_operand" "y")
12052 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12053 [(set (attr "type")
12054 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12055 (const_string "mfcrf")
12057 (const_string "mfcr")))
12058 (set_attr "length" "8")])
12060 ;; Same as above, but get the GT bit.
12061 (define_insn "move_from_CR_gt_bit"
12062 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12063 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12065 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12066 [(set_attr "type" "mfcr")
12067 (set_attr "length" "8")])
12069 ;; Same as above, but get the OV/ORDERED bit.
12070 (define_insn "move_from_CR_ov_bit"
12071 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12072 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12074 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12075 [(set_attr "type" "mfcr")
12076 (set_attr "length" "8")])
12079 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12080 (match_operator:DI 1 "scc_comparison_operator"
12081 [(match_operand 2 "cc_reg_operand" "y")
12084 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12085 [(set (attr "type")
12086 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12087 (const_string "mfcrf")
12089 (const_string "mfcr")))
12090 (set_attr "length" "8")])
12093 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12094 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12095 [(match_operand 2 "cc_reg_operand" "y,y")
12098 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12099 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12102 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12104 [(set_attr "type" "delayed_compare")
12105 (set_attr "length" "8,16")])
12108 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12109 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12110 [(match_operand 2 "cc_reg_operand" "")
12113 (set (match_operand:SI 3 "gpc_reg_operand" "")
12114 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12115 "TARGET_32BIT && reload_completed"
12116 [(set (match_dup 3)
12117 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12119 (compare:CC (match_dup 3)
12124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12125 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12126 [(match_operand 2 "cc_reg_operand" "y")
12128 (match_operand:SI 3 "const_int_operand" "n")))]
12132 int is_bit = ccr_bit (operands[1], 1);
12133 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12136 if (is_bit >= put_bit)
12137 count = is_bit - put_bit;
12139 count = 32 - (put_bit - is_bit);
12141 operands[4] = GEN_INT (count);
12142 operands[5] = GEN_INT (put_bit);
12144 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12146 [(set (attr "type")
12147 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12148 (const_string "mfcrf")
12150 (const_string "mfcr")))
12151 (set_attr "length" "8")])
12154 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12156 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12157 [(match_operand 2 "cc_reg_operand" "y,y")
12159 (match_operand:SI 3 "const_int_operand" "n,n"))
12161 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12162 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12167 int is_bit = ccr_bit (operands[1], 1);
12168 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12171 /* Force split for non-cc0 compare. */
12172 if (which_alternative == 1)
12175 if (is_bit >= put_bit)
12176 count = is_bit - put_bit;
12178 count = 32 - (put_bit - is_bit);
12180 operands[5] = GEN_INT (count);
12181 operands[6] = GEN_INT (put_bit);
12183 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
12185 [(set_attr "type" "delayed_compare")
12186 (set_attr "length" "8,16")])
12189 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12191 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12192 [(match_operand 2 "cc_reg_operand" "")
12194 (match_operand:SI 3 "const_int_operand" ""))
12196 (set (match_operand:SI 4 "gpc_reg_operand" "")
12197 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12200 [(set (match_dup 4)
12201 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12204 (compare:CC (match_dup 4)
12208 ;; There is a 3 cycle delay between consecutive mfcr instructions
12209 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12213 (match_operator:SI 1 "scc_comparison_operator"
12214 [(match_operand 2 "cc_reg_operand" "y")
12216 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12217 (match_operator:SI 4 "scc_comparison_operator"
12218 [(match_operand 5 "cc_reg_operand" "y")
12220 "REGNO (operands[2]) != REGNO (operands[5])"
12221 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12222 [(set_attr "type" "mfcr")
12223 (set_attr "length" "12")])
12226 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12227 (match_operator:DI 1 "scc_comparison_operator"
12228 [(match_operand 2 "cc_reg_operand" "y")
12230 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12231 (match_operator:DI 4 "scc_comparison_operator"
12232 [(match_operand 5 "cc_reg_operand" "y")
12234 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12235 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12236 [(set_attr "type" "mfcr")
12237 (set_attr "length" "12")])
12239 ;; There are some scc insns that can be done directly, without a compare.
12240 ;; These are faster because they don't involve the communications between
12241 ;; the FXU and branch units. In fact, we will be replacing all of the
12242 ;; integer scc insns here or in the portable methods in emit_store_flag.
12244 ;; Also support (neg (scc ..)) since that construct is used to replace
12245 ;; branches, (plus (scc ..) ..) since that construct is common and
12246 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12247 ;; cases where it is no more expensive than (neg (scc ..)).
12249 ;; Have reload force a constant into a register for the simple insns that
12250 ;; otherwise won't accept constants. We do this because it is faster than
12251 ;; the cmp/mfcr sequence we would otherwise generate.
12253 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12256 (define_insn_and_split "*eq<mode>"
12257 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12258 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12259 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12263 [(set (match_dup 0)
12264 (clz:GPR (match_dup 3)))
12266 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12268 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12270 /* Use output operand as intermediate. */
12271 operands[3] = operands[0];
12273 if (logical_operand (operands[2], <MODE>mode))
12274 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12275 gen_rtx_XOR (<MODE>mode,
12276 operands[1], operands[2])));
12278 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12279 gen_rtx_PLUS (<MODE>mode, operands[1],
12280 negate_rtx (<MODE>mode,
12284 operands[3] = operands[1];
12286 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12289 (define_insn_and_split "*eq<mode>_compare"
12290 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12292 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12293 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12295 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12296 (eq:P (match_dup 1) (match_dup 2)))]
12297 "!TARGET_POWER && optimize_size"
12299 "!TARGET_POWER && optimize_size"
12300 [(set (match_dup 0)
12301 (clz:P (match_dup 4)))
12302 (parallel [(set (match_dup 3)
12303 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12306 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12308 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12310 /* Use output operand as intermediate. */
12311 operands[4] = operands[0];
12313 if (logical_operand (operands[2], <MODE>mode))
12314 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12315 gen_rtx_XOR (<MODE>mode,
12316 operands[1], operands[2])));
12318 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12319 gen_rtx_PLUS (<MODE>mode, operands[1],
12320 negate_rtx (<MODE>mode,
12324 operands[4] = operands[1];
12326 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12329 (define_insn "*eqsi_power"
12330 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12331 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12332 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
12333 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
12336 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12337 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
12338 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12339 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12340 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
12341 [(set_attr "type" "three,two,three,three,three")
12342 (set_attr "length" "12,8,12,12,12")])
12344 ;; We have insns of the form shown by the first define_insn below. If
12345 ;; there is something inside the comparison operation, we must split it.
12347 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12348 (plus:SI (match_operator 1 "comparison_operator"
12349 [(match_operand:SI 2 "" "")
12350 (match_operand:SI 3
12351 "reg_or_cint_operand" "")])
12352 (match_operand:SI 4 "gpc_reg_operand" "")))
12353 (clobber (match_operand:SI 5 "register_operand" ""))]
12354 "! gpc_reg_operand (operands[2], SImode)"
12355 [(set (match_dup 5) (match_dup 2))
12356 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
12359 (define_insn "*plus_eqsi"
12360 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12361 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12362 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12363 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12366 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12367 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
12368 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12369 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12370 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12371 [(set_attr "type" "three,two,three,three,three")
12372 (set_attr "length" "12,8,12,12,12")])
12374 (define_insn "*compare_plus_eqsi"
12375 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12378 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12379 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12380 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12382 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12383 "TARGET_32BIT && optimize_size"
12385 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12386 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12387 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12388 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12389 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12395 [(set_attr "type" "compare")
12396 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12399 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12402 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12403 (match_operand:SI 2 "scc_eq_operand" ""))
12404 (match_operand:SI 3 "gpc_reg_operand" ""))
12406 (clobber (match_scratch:SI 4 ""))]
12407 "TARGET_32BIT && optimize_size && reload_completed"
12408 [(set (match_dup 4)
12409 (plus:SI (eq:SI (match_dup 1)
12413 (compare:CC (match_dup 4)
12417 (define_insn "*plus_eqsi_compare"
12418 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12421 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12422 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12423 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12425 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12426 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12427 "TARGET_32BIT && optimize_size"
12429 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12430 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12431 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12432 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12433 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12439 [(set_attr "type" "compare")
12440 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12443 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12446 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12447 (match_operand:SI 2 "scc_eq_operand" ""))
12448 (match_operand:SI 3 "gpc_reg_operand" ""))
12450 (set (match_operand:SI 0 "gpc_reg_operand" "")
12451 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12452 "TARGET_32BIT && optimize_size && reload_completed"
12453 [(set (match_dup 0)
12454 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12456 (compare:CC (match_dup 0)
12460 (define_insn "*neg_eq0<mode>"
12461 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12462 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12465 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12466 [(set_attr "type" "two")
12467 (set_attr "length" "8")])
12469 (define_insn_and_split "*neg_eq<mode>"
12470 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12471 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12472 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12476 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12478 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12480 /* Use output operand as intermediate. */
12481 operands[3] = operands[0];
12483 if (logical_operand (operands[2], <MODE>mode))
12484 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12485 gen_rtx_XOR (<MODE>mode,
12486 operands[1], operands[2])));
12488 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12489 gen_rtx_PLUS (<MODE>mode, operands[1],
12490 negate_rtx (<MODE>mode,
12494 operands[3] = operands[1];
12497 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12498 ;; since it nabs/sr is just as fast.
12499 (define_insn "*ne0si"
12500 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12501 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12503 (clobber (match_scratch:SI 2 "=&r"))]
12504 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12505 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12506 [(set_attr "type" "two")
12507 (set_attr "length" "8")])
12509 (define_insn "*ne0di"
12510 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12511 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12513 (clobber (match_scratch:DI 2 "=&r"))]
12515 "addic %2,%1,-1\;subfe %0,%2,%1"
12516 [(set_attr "type" "two")
12517 (set_attr "length" "8")])
12519 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12520 (define_insn "*plus_ne0si"
12521 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12522 (plus:SI (lshiftrt:SI
12523 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12525 (match_operand:SI 2 "gpc_reg_operand" "r")))
12526 (clobber (match_scratch:SI 3 "=&r"))]
12528 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12529 [(set_attr "type" "two")
12530 (set_attr "length" "8")])
12532 (define_insn "*plus_ne0di"
12533 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12534 (plus:DI (lshiftrt:DI
12535 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12537 (match_operand:DI 2 "gpc_reg_operand" "r")))
12538 (clobber (match_scratch:DI 3 "=&r"))]
12540 "addic %3,%1,-1\;addze %0,%2"
12541 [(set_attr "type" "two")
12542 (set_attr "length" "8")])
12544 (define_insn "*compare_plus_ne0si"
12545 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12547 (plus:SI (lshiftrt:SI
12548 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12550 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12552 (clobber (match_scratch:SI 3 "=&r,&r"))
12553 (clobber (match_scratch:SI 4 "=X,&r"))]
12556 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12558 [(set_attr "type" "compare")
12559 (set_attr "length" "8,12")])
12562 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12564 (plus:SI (lshiftrt:SI
12565 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12567 (match_operand:SI 2 "gpc_reg_operand" ""))
12569 (clobber (match_scratch:SI 3 ""))
12570 (clobber (match_scratch:SI 4 ""))]
12571 "TARGET_32BIT && reload_completed"
12572 [(parallel [(set (match_dup 3)
12573 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12576 (clobber (match_dup 4))])
12578 (compare:CC (match_dup 3)
12582 (define_insn "*compare_plus_ne0di"
12583 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12585 (plus:DI (lshiftrt:DI
12586 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12588 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12590 (clobber (match_scratch:DI 3 "=&r,&r"))]
12593 addic %3,%1,-1\;addze. %3,%2
12595 [(set_attr "type" "compare")
12596 (set_attr "length" "8,12")])
12599 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12601 (plus:DI (lshiftrt:DI
12602 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12604 (match_operand:DI 2 "gpc_reg_operand" ""))
12606 (clobber (match_scratch:DI 3 ""))]
12607 "TARGET_64BIT && reload_completed"
12608 [(set (match_dup 3)
12609 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12613 (compare:CC (match_dup 3)
12617 (define_insn "*plus_ne0si_compare"
12618 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12620 (plus:SI (lshiftrt:SI
12621 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12623 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12625 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12626 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12628 (clobber (match_scratch:SI 3 "=&r,&r"))]
12631 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12633 [(set_attr "type" "compare")
12634 (set_attr "length" "8,12")])
12637 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12639 (plus:SI (lshiftrt:SI
12640 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12642 (match_operand:SI 2 "gpc_reg_operand" ""))
12644 (set (match_operand:SI 0 "gpc_reg_operand" "")
12645 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12647 (clobber (match_scratch:SI 3 ""))]
12648 "TARGET_32BIT && reload_completed"
12649 [(parallel [(set (match_dup 0)
12650 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12652 (clobber (match_dup 3))])
12654 (compare:CC (match_dup 0)
12658 (define_insn "*plus_ne0di_compare"
12659 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12661 (plus:DI (lshiftrt:DI
12662 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12664 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12666 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12667 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12669 (clobber (match_scratch:DI 3 "=&r,&r"))]
12672 addic %3,%1,-1\;addze. %0,%2
12674 [(set_attr "type" "compare")
12675 (set_attr "length" "8,12")])
12678 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12680 (plus:DI (lshiftrt:DI
12681 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12683 (match_operand:DI 2 "gpc_reg_operand" ""))
12685 (set (match_operand:DI 0 "gpc_reg_operand" "")
12686 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12688 (clobber (match_scratch:DI 3 ""))]
12689 "TARGET_64BIT && reload_completed"
12690 [(parallel [(set (match_dup 0)
12691 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12693 (clobber (match_dup 3))])
12695 (compare:CC (match_dup 0)
12700 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12701 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12702 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12703 (clobber (match_scratch:SI 3 "=r,X"))]
12706 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12707 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12708 [(set_attr "length" "12")])
12711 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12713 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12714 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12716 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12717 (le:SI (match_dup 1) (match_dup 2)))
12718 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12721 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12722 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12725 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12726 (set_attr "length" "12,12,16,16")])
12729 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12731 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12732 (match_operand:SI 2 "reg_or_short_operand" ""))
12734 (set (match_operand:SI 0 "gpc_reg_operand" "")
12735 (le:SI (match_dup 1) (match_dup 2)))
12736 (clobber (match_scratch:SI 3 ""))]
12737 "TARGET_POWER && reload_completed"
12738 [(parallel [(set (match_dup 0)
12739 (le:SI (match_dup 1) (match_dup 2)))
12740 (clobber (match_dup 3))])
12742 (compare:CC (match_dup 0)
12747 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12748 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12749 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12750 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12753 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12754 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12755 [(set_attr "length" "12")])
12758 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12760 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12761 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12762 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12764 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12767 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12768 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12771 [(set_attr "type" "compare")
12772 (set_attr "length" "12,12,16,16")])
12775 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12777 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12778 (match_operand:SI 2 "reg_or_short_operand" ""))
12779 (match_operand:SI 3 "gpc_reg_operand" ""))
12781 (clobber (match_scratch:SI 4 ""))]
12782 "TARGET_POWER && reload_completed"
12783 [(set (match_dup 4)
12784 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12787 (compare:CC (match_dup 4)
12792 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12794 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12795 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12796 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12798 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12799 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12802 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12803 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12806 [(set_attr "type" "compare")
12807 (set_attr "length" "12,12,16,16")])
12810 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12812 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12813 (match_operand:SI 2 "reg_or_short_operand" ""))
12814 (match_operand:SI 3 "gpc_reg_operand" ""))
12816 (set (match_operand:SI 0 "gpc_reg_operand" "")
12817 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12818 "TARGET_POWER && reload_completed"
12819 [(set (match_dup 0)
12820 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12822 (compare:CC (match_dup 0)
12827 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12828 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12829 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12832 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12833 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12834 [(set_attr "length" "12")])
12836 (define_insn "*leu<mode>"
12837 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12838 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12839 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12841 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12842 [(set_attr "type" "three")
12843 (set_attr "length" "12")])
12845 (define_insn "*leu<mode>_compare"
12846 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12848 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12849 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12851 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12852 (leu:P (match_dup 1) (match_dup 2)))]
12855 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12857 [(set_attr "type" "compare")
12858 (set_attr "length" "12,16")])
12861 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12863 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12864 (match_operand:P 2 "reg_or_short_operand" ""))
12866 (set (match_operand:P 0 "gpc_reg_operand" "")
12867 (leu:P (match_dup 1) (match_dup 2)))]
12869 [(set (match_dup 0)
12870 (leu:P (match_dup 1) (match_dup 2)))
12872 (compare:CC (match_dup 0)
12876 (define_insn "*plus_leu<mode>"
12877 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12878 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12879 (match_operand:P 2 "reg_or_short_operand" "rI"))
12880 (match_operand:P 3 "gpc_reg_operand" "r")))]
12882 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12883 [(set_attr "type" "two")
12884 (set_attr "length" "8")])
12887 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12889 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12890 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12891 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12893 (clobber (match_scratch:SI 4 "=&r,&r"))]
12896 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12898 [(set_attr "type" "compare")
12899 (set_attr "length" "8,12")])
12902 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12904 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12905 (match_operand:SI 2 "reg_or_short_operand" ""))
12906 (match_operand:SI 3 "gpc_reg_operand" ""))
12908 (clobber (match_scratch:SI 4 ""))]
12909 "TARGET_32BIT && reload_completed"
12910 [(set (match_dup 4)
12911 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12914 (compare:CC (match_dup 4)
12919 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12921 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12922 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12923 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12925 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12926 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12929 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12931 [(set_attr "type" "compare")
12932 (set_attr "length" "8,12")])
12935 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12937 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12938 (match_operand:SI 2 "reg_or_short_operand" ""))
12939 (match_operand:SI 3 "gpc_reg_operand" ""))
12941 (set (match_operand:SI 0 "gpc_reg_operand" "")
12942 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12943 "TARGET_32BIT && reload_completed"
12944 [(set (match_dup 0)
12945 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12947 (compare:CC (match_dup 0)
12951 (define_insn "*neg_leu<mode>"
12952 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12953 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12954 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12956 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12957 [(set_attr "type" "three")
12958 (set_attr "length" "12")])
12960 (define_insn "*and_neg_leu<mode>"
12961 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12963 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12964 (match_operand:P 2 "reg_or_short_operand" "rI")))
12965 (match_operand:P 3 "gpc_reg_operand" "r")))]
12967 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12968 [(set_attr "type" "three")
12969 (set_attr "length" "12")])
12972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12975 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12976 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12977 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12979 (clobber (match_scratch:SI 4 "=&r,&r"))]
12982 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12984 [(set_attr "type" "compare")
12985 (set_attr "length" "12,16")])
12988 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12991 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12992 (match_operand:SI 2 "reg_or_short_operand" "")))
12993 (match_operand:SI 3 "gpc_reg_operand" ""))
12995 (clobber (match_scratch:SI 4 ""))]
12996 "TARGET_32BIT && reload_completed"
12997 [(set (match_dup 4)
12998 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13001 (compare:CC (match_dup 4)
13006 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13009 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13010 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13011 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13013 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13014 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13017 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13019 [(set_attr "type" "compare")
13020 (set_attr "length" "12,16")])
13023 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13026 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13027 (match_operand:SI 2 "reg_or_short_operand" "")))
13028 (match_operand:SI 3 "gpc_reg_operand" ""))
13030 (set (match_operand:SI 0 "gpc_reg_operand" "")
13031 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13032 "TARGET_32BIT && reload_completed"
13033 [(set (match_dup 0)
13034 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13037 (compare:CC (match_dup 0)
13042 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13043 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13044 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13046 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13047 [(set_attr "length" "12")])
13050 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13052 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13053 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13055 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13056 (lt:SI (match_dup 1) (match_dup 2)))]
13059 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13061 [(set_attr "type" "delayed_compare")
13062 (set_attr "length" "12,16")])
13065 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13067 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13068 (match_operand:SI 2 "reg_or_short_operand" ""))
13070 (set (match_operand:SI 0 "gpc_reg_operand" "")
13071 (lt:SI (match_dup 1) (match_dup 2)))]
13072 "TARGET_POWER && reload_completed"
13073 [(set (match_dup 0)
13074 (lt:SI (match_dup 1) (match_dup 2)))
13076 (compare:CC (match_dup 0)
13081 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13082 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13083 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13084 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13086 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13087 [(set_attr "length" "12")])
13090 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13092 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13093 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13094 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13096 (clobber (match_scratch:SI 4 "=&r,&r"))]
13099 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13101 [(set_attr "type" "compare")
13102 (set_attr "length" "12,16")])
13105 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13107 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13108 (match_operand:SI 2 "reg_or_short_operand" ""))
13109 (match_operand:SI 3 "gpc_reg_operand" ""))
13111 (clobber (match_scratch:SI 4 ""))]
13112 "TARGET_POWER && reload_completed"
13113 [(set (match_dup 4)
13114 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13117 (compare:CC (match_dup 4)
13122 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13124 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13125 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13126 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13128 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13129 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13132 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13134 [(set_attr "type" "compare")
13135 (set_attr "length" "12,16")])
13138 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13140 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13141 (match_operand:SI 2 "reg_or_short_operand" ""))
13142 (match_operand:SI 3 "gpc_reg_operand" ""))
13144 (set (match_operand:SI 0 "gpc_reg_operand" "")
13145 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13146 "TARGET_POWER && reload_completed"
13147 [(set (match_dup 0)
13148 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13150 (compare:CC (match_dup 0)
13155 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13156 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13157 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13159 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13160 [(set_attr "length" "12")])
13162 (define_insn_and_split "*ltu<mode>"
13163 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13164 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13165 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13169 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13170 (set (match_dup 0) (neg:P (match_dup 0)))]
13173 (define_insn_and_split "*ltu<mode>_compare"
13174 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13176 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13177 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13179 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13180 (ltu:P (match_dup 1) (match_dup 2)))]
13184 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13185 (parallel [(set (match_dup 3)
13186 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13187 (set (match_dup 0) (neg:P (match_dup 0)))])]
13190 (define_insn_and_split "*plus_ltu<mode>"
13191 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13192 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13193 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13194 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13197 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13198 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13199 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13202 (define_insn_and_split "*plus_ltu<mode>_compare"
13203 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13205 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13206 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13207 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13209 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13210 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13213 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13214 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13215 (parallel [(set (match_dup 4)
13216 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13218 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13221 (define_insn "*neg_ltu<mode>"
13222 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13223 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13224 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13227 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
13228 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
13229 [(set_attr "type" "two")
13230 (set_attr "length" "8")])
13233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13234 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13235 (match_operand:SI 2 "reg_or_short_operand" "rI")))
13236 (clobber (match_scratch:SI 3 "=r"))]
13238 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
13239 [(set_attr "length" "12")])
13242 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13244 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13245 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13247 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13248 (ge:SI (match_dup 1) (match_dup 2)))
13249 (clobber (match_scratch:SI 3 "=r,r"))]
13252 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13254 [(set_attr "type" "compare")
13255 (set_attr "length" "12,16")])
13258 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13260 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13261 (match_operand:SI 2 "reg_or_short_operand" ""))
13263 (set (match_operand:SI 0 "gpc_reg_operand" "")
13264 (ge:SI (match_dup 1) (match_dup 2)))
13265 (clobber (match_scratch:SI 3 ""))]
13266 "TARGET_POWER && reload_completed"
13267 [(parallel [(set (match_dup 0)
13268 (ge:SI (match_dup 1) (match_dup 2)))
13269 (clobber (match_dup 3))])
13271 (compare:CC (match_dup 0)
13276 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13277 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13278 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13279 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13281 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13282 [(set_attr "length" "12")])
13285 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13287 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13288 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13289 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13291 (clobber (match_scratch:SI 4 "=&r,&r"))]
13294 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13296 [(set_attr "type" "compare")
13297 (set_attr "length" "12,16")])
13300 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13302 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13303 (match_operand:SI 2 "reg_or_short_operand" ""))
13304 (match_operand:SI 3 "gpc_reg_operand" ""))
13306 (clobber (match_scratch:SI 4 ""))]
13307 "TARGET_POWER && reload_completed"
13308 [(set (match_dup 4)
13309 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13312 (compare:CC (match_dup 4)
13317 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13319 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13320 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13321 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13323 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13324 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13327 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13329 [(set_attr "type" "compare")
13330 (set_attr "length" "12,16")])
13333 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13335 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13336 (match_operand:SI 2 "reg_or_short_operand" ""))
13337 (match_operand:SI 3 "gpc_reg_operand" ""))
13339 (set (match_operand:SI 0 "gpc_reg_operand" "")
13340 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13341 "TARGET_POWER && reload_completed"
13342 [(set (match_dup 0)
13343 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13345 (compare:CC (match_dup 0)
13350 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13351 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13352 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13354 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13355 [(set_attr "length" "12")])
13357 (define_insn "*geu<mode>"
13358 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13359 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13360 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13363 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13364 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13365 [(set_attr "type" "three")
13366 (set_attr "length" "12")])
13368 (define_insn "*geu<mode>_compare"
13369 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13371 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13372 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13374 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13375 (geu:P (match_dup 1) (match_dup 2)))]
13378 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13379 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13382 [(set_attr "type" "compare")
13383 (set_attr "length" "12,12,16,16")])
13386 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13388 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13389 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13391 (set (match_operand:P 0 "gpc_reg_operand" "")
13392 (geu:P (match_dup 1) (match_dup 2)))]
13394 [(set (match_dup 0)
13395 (geu:P (match_dup 1) (match_dup 2)))
13397 (compare:CC (match_dup 0)
13401 (define_insn "*plus_geu<mode>"
13402 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13403 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13404 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13405 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13408 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13409 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13410 [(set_attr "type" "two")
13411 (set_attr "length" "8")])
13414 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13416 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13417 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13418 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13420 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13423 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13424 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13427 [(set_attr "type" "compare")
13428 (set_attr "length" "8,8,12,12")])
13431 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13433 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13434 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13435 (match_operand:SI 3 "gpc_reg_operand" ""))
13437 (clobber (match_scratch:SI 4 ""))]
13438 "TARGET_32BIT && reload_completed"
13439 [(set (match_dup 4)
13440 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13443 (compare:CC (match_dup 4)
13448 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13450 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13451 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13452 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13454 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13455 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13458 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13459 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13462 [(set_attr "type" "compare")
13463 (set_attr "length" "8,8,12,12")])
13466 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13468 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13469 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13470 (match_operand:SI 3 "gpc_reg_operand" ""))
13472 (set (match_operand:SI 0 "gpc_reg_operand" "")
13473 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13474 "TARGET_32BIT && reload_completed"
13475 [(set (match_dup 0)
13476 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13478 (compare:CC (match_dup 0)
13482 (define_insn "*neg_geu<mode>"
13483 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13484 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13485 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13488 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13489 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13490 [(set_attr "type" "three")
13491 (set_attr "length" "12")])
13493 (define_insn "*and_neg_geu<mode>"
13494 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13496 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13497 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13498 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13501 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13502 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13503 [(set_attr "type" "three")
13504 (set_attr "length" "12")])
13507 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13510 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13511 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13512 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13514 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13517 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13518 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13521 [(set_attr "type" "compare")
13522 (set_attr "length" "12,12,16,16")])
13525 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13528 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13529 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13530 (match_operand:SI 3 "gpc_reg_operand" ""))
13532 (clobber (match_scratch:SI 4 ""))]
13533 "TARGET_32BIT && reload_completed"
13534 [(set (match_dup 4)
13535 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13538 (compare:CC (match_dup 4)
13543 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13546 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13547 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13548 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13550 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13551 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13554 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13555 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13558 [(set_attr "type" "compare")
13559 (set_attr "length" "12,12,16,16")])
13562 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13565 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13566 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13567 (match_operand:SI 3 "gpc_reg_operand" ""))
13569 (set (match_operand:SI 0 "gpc_reg_operand" "")
13570 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13571 "TARGET_32BIT && reload_completed"
13572 [(set (match_dup 0)
13573 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13575 (compare:CC (match_dup 0)
13580 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13581 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13582 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13584 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13585 [(set_attr "length" "12")])
13588 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13590 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13591 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13593 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13594 (gt:SI (match_dup 1) (match_dup 2)))]
13597 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13599 [(set_attr "type" "delayed_compare")
13600 (set_attr "length" "12,16")])
13603 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13605 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13606 (match_operand:SI 2 "reg_or_short_operand" ""))
13608 (set (match_operand:SI 0 "gpc_reg_operand" "")
13609 (gt:SI (match_dup 1) (match_dup 2)))]
13610 "TARGET_POWER && reload_completed"
13611 [(set (match_dup 0)
13612 (gt:SI (match_dup 1) (match_dup 2)))
13614 (compare:CC (match_dup 0)
13618 (define_insn "*plus_gt0<mode>"
13619 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13620 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13622 (match_operand:P 2 "gpc_reg_operand" "r")))]
13624 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13625 [(set_attr "type" "three")
13626 (set_attr "length" "12")])
13629 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13631 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13633 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13635 (clobber (match_scratch:SI 3 "=&r,&r"))]
13638 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13640 [(set_attr "type" "compare")
13641 (set_attr "length" "12,16")])
13644 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13646 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13648 (match_operand:SI 2 "gpc_reg_operand" ""))
13650 (clobber (match_scratch:SI 3 ""))]
13651 "TARGET_32BIT && reload_completed"
13652 [(set (match_dup 3)
13653 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13656 (compare:CC (match_dup 3)
13661 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13663 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13665 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13667 (clobber (match_scratch:DI 3 "=&r,&r"))]
13670 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13672 [(set_attr "type" "compare")
13673 (set_attr "length" "12,16")])
13676 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13678 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13680 (match_operand:DI 2 "gpc_reg_operand" ""))
13682 (clobber (match_scratch:DI 3 ""))]
13683 "TARGET_64BIT && reload_completed"
13684 [(set (match_dup 3)
13685 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13688 (compare:CC (match_dup 3)
13693 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13695 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13697 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13699 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13700 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13703 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13705 [(set_attr "type" "compare")
13706 (set_attr "length" "12,16")])
13709 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13711 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13713 (match_operand:SI 2 "gpc_reg_operand" ""))
13715 (set (match_operand:SI 0 "gpc_reg_operand" "")
13716 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13717 "TARGET_32BIT && reload_completed"
13718 [(set (match_dup 0)
13719 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13721 (compare:CC (match_dup 0)
13726 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13728 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13730 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13732 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13733 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13736 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13738 [(set_attr "type" "compare")
13739 (set_attr "length" "12,16")])
13742 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13744 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13746 (match_operand:DI 2 "gpc_reg_operand" ""))
13748 (set (match_operand:DI 0 "gpc_reg_operand" "")
13749 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13750 "TARGET_64BIT && reload_completed"
13751 [(set (match_dup 0)
13752 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13754 (compare:CC (match_dup 0)
13759 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13760 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13761 (match_operand:SI 2 "reg_or_short_operand" "r"))
13762 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13764 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13765 [(set_attr "length" "12")])
13768 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13770 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13771 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13772 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13774 (clobber (match_scratch:SI 4 "=&r,&r"))]
13777 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13779 [(set_attr "type" "compare")
13780 (set_attr "length" "12,16")])
13783 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13785 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13786 (match_operand:SI 2 "reg_or_short_operand" ""))
13787 (match_operand:SI 3 "gpc_reg_operand" ""))
13789 (clobber (match_scratch:SI 4 ""))]
13790 "TARGET_POWER && reload_completed"
13791 [(set (match_dup 4)
13792 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13794 (compare:CC (match_dup 4)
13799 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13801 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13802 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13803 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13805 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13806 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13809 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13811 [(set_attr "type" "compare")
13812 (set_attr "length" "12,16")])
13815 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13817 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13818 (match_operand:SI 2 "reg_or_short_operand" ""))
13819 (match_operand:SI 3 "gpc_reg_operand" ""))
13821 (set (match_operand:SI 0 "gpc_reg_operand" "")
13822 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13823 "TARGET_POWER && reload_completed"
13824 [(set (match_dup 0)
13825 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13827 (compare:CC (match_dup 0)
13832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13833 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13834 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13836 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13837 [(set_attr "length" "12")])
13839 (define_insn_and_split "*gtu<mode>"
13840 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13841 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13842 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13846 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13847 (set (match_dup 0) (neg:P (match_dup 0)))]
13850 (define_insn_and_split "*gtu<mode>_compare"
13851 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13853 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13854 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13856 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13857 (gtu:P (match_dup 1) (match_dup 2)))]
13861 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13862 (parallel [(set (match_dup 3)
13863 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13864 (set (match_dup 0) (neg:P (match_dup 0)))])]
13867 (define_insn_and_split "*plus_gtu<mode>"
13868 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13869 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13870 (match_operand:P 2 "reg_or_short_operand" "rI"))
13871 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13874 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13875 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13876 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13879 (define_insn_and_split "*plus_gtu<mode>_compare"
13880 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13882 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13883 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13884 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13886 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13887 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13890 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13891 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13892 (parallel [(set (match_dup 4)
13893 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13895 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13898 (define_insn "*neg_gtu<mode>"
13899 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13900 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13901 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13903 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13904 [(set_attr "type" "two")
13905 (set_attr "length" "8")])
13908 ;; Define both directions of branch and return. If we need a reload
13909 ;; register, we'd rather use CR0 since it is much easier to copy a
13910 ;; register CC value to there.
13914 (if_then_else (match_operator 1 "branch_comparison_operator"
13916 "cc_reg_operand" "y")
13918 (label_ref (match_operand 0 "" ""))
13923 return output_cbranch (operands[1], \"%l0\", 0, insn);
13925 [(set_attr "type" "branch")])
13929 (if_then_else (match_operator 0 "branch_comparison_operator"
13931 "cc_reg_operand" "y")
13938 return output_cbranch (operands[0], NULL, 0, insn);
13940 [(set_attr "type" "jmpreg")
13941 (set_attr "length" "4")])
13945 (if_then_else (match_operator 1 "branch_comparison_operator"
13947 "cc_reg_operand" "y")
13950 (label_ref (match_operand 0 "" ""))))]
13954 return output_cbranch (operands[1], \"%l0\", 1, insn);
13956 [(set_attr "type" "branch")])
13960 (if_then_else (match_operator 0 "branch_comparison_operator"
13962 "cc_reg_operand" "y")
13969 return output_cbranch (operands[0], NULL, 1, insn);
13971 [(set_attr "type" "jmpreg")
13972 (set_attr "length" "4")])
13974 ;; Logic on condition register values.
13976 ; This pattern matches things like
13977 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13978 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13980 ; which are generated by the branch logic.
13981 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13983 (define_insn "*cceq_ior_compare"
13984 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13985 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13986 [(match_operator:SI 2
13987 "branch_positive_comparison_operator"
13989 "cc_reg_operand" "y,y")
13991 (match_operator:SI 4
13992 "branch_positive_comparison_operator"
13994 "cc_reg_operand" "0,y")
13998 "cr%q1 %E0,%j2,%j4"
13999 [(set_attr "type" "cr_logical,delayed_cr")])
14001 ; Why is the constant -1 here, but 1 in the previous pattern?
14002 ; Because ~1 has all but the low bit set.
14004 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14005 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14006 [(not:SI (match_operator:SI 2
14007 "branch_positive_comparison_operator"
14009 "cc_reg_operand" "y,y")
14011 (match_operator:SI 4
14012 "branch_positive_comparison_operator"
14014 "cc_reg_operand" "0,y")
14018 "cr%q1 %E0,%j2,%j4"
14019 [(set_attr "type" "cr_logical,delayed_cr")])
14021 (define_insn "*cceq_rev_compare"
14022 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14023 (compare:CCEQ (match_operator:SI 1
14024 "branch_positive_comparison_operator"
14026 "cc_reg_operand" "0,y")
14030 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14031 [(set_attr "type" "cr_logical,delayed_cr")])
14033 ;; If we are comparing the result of two comparisons, this can be done
14034 ;; using creqv or crxor.
14036 (define_insn_and_split ""
14037 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14038 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14039 [(match_operand 2 "cc_reg_operand" "y")
14041 (match_operator 3 "branch_comparison_operator"
14042 [(match_operand 4 "cc_reg_operand" "y")
14047 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14051 int positive_1, positive_2;
14053 positive_1 = branch_positive_comparison_operator (operands[1],
14054 GET_MODE (operands[1]));
14055 positive_2 = branch_positive_comparison_operator (operands[3],
14056 GET_MODE (operands[3]));
14059 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14060 GET_CODE (operands[1])),
14062 operands[2], const0_rtx);
14063 else if (GET_MODE (operands[1]) != SImode)
14064 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14065 operands[2], const0_rtx);
14068 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14069 GET_CODE (operands[3])),
14071 operands[4], const0_rtx);
14072 else if (GET_MODE (operands[3]) != SImode)
14073 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14074 operands[4], const0_rtx);
14076 if (positive_1 == positive_2)
14078 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14079 operands[5] = constm1_rtx;
14083 operands[5] = const1_rtx;
14087 ;; Unconditional branch and return.
14089 (define_insn "jump"
14091 (label_ref (match_operand 0 "" "")))]
14094 [(set_attr "type" "branch")])
14096 (define_insn "return"
14100 [(set_attr "type" "jmpreg")])
14102 (define_expand "indirect_jump"
14103 [(set (pc) (match_operand 0 "register_operand" ""))])
14105 (define_insn "*indirect_jump<mode>"
14106 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14111 [(set_attr "type" "jmpreg")])
14113 ;; Table jump for switch statements:
14114 (define_expand "tablejump"
14115 [(use (match_operand 0 "" ""))
14116 (use (label_ref (match_operand 1 "" "")))]
14121 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14123 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14127 (define_expand "tablejumpsi"
14128 [(set (match_dup 3)
14129 (plus:SI (match_operand:SI 0 "" "")
14131 (parallel [(set (pc) (match_dup 3))
14132 (use (label_ref (match_operand 1 "" "")))])]
14135 { operands[0] = force_reg (SImode, operands[0]);
14136 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14137 operands[3] = gen_reg_rtx (SImode);
14140 (define_expand "tablejumpdi"
14141 [(set (match_dup 4)
14142 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14144 (plus:DI (match_dup 4)
14146 (parallel [(set (pc) (match_dup 3))
14147 (use (label_ref (match_operand 1 "" "")))])]
14150 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14151 operands[3] = gen_reg_rtx (DImode);
14152 operands[4] = gen_reg_rtx (DImode);
14155 (define_insn "*tablejump<mode>_internal1"
14157 (match_operand:P 0 "register_operand" "c,*l"))
14158 (use (label_ref (match_operand 1 "" "")))]
14163 [(set_attr "type" "jmpreg")])
14168 "{cror 0,0,0|nop}")
14170 ;; Define the subtract-one-and-jump insns, starting with the template
14171 ;; so loop.c knows what to generate.
14173 (define_expand "doloop_end"
14174 [(use (match_operand 0 "" "")) ; loop pseudo
14175 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14176 (use (match_operand 2 "" "")) ; max iterations
14177 (use (match_operand 3 "" "")) ; loop level
14178 (use (match_operand 4 "" ""))] ; label
14182 /* Only use this on innermost loops. */
14183 if (INTVAL (operands[3]) > 1)
14187 if (GET_MODE (operands[0]) != DImode)
14189 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14193 if (GET_MODE (operands[0]) != SImode)
14195 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14200 (define_expand "ctr<mode>"
14201 [(parallel [(set (pc)
14202 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14204 (label_ref (match_operand 1 "" ""))
14207 (plus:P (match_dup 0)
14209 (clobber (match_scratch:CC 2 ""))
14210 (clobber (match_scratch:P 3 ""))])]
14214 ;; We need to be able to do this for any operand, including MEM, or we
14215 ;; will cause reload to blow up since we don't allow output reloads on
14217 ;; For the length attribute to be calculated correctly, the
14218 ;; label MUST be operand 0.
14220 (define_insn "*ctr<mode>_internal1"
14222 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14224 (label_ref (match_operand 0 "" ""))
14226 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14227 (plus:P (match_dup 1)
14229 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14230 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14234 if (which_alternative != 0)
14236 else if (get_attr_length (insn) == 4)
14237 return \"{bdn|bdnz} %l0\";
14239 return \"bdz $+8\;b %l0\";
14241 [(set_attr "type" "branch")
14242 (set_attr "length" "*,12,16,16")])
14244 (define_insn "*ctr<mode>_internal2"
14246 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14249 (label_ref (match_operand 0 "" ""))))
14250 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14251 (plus:P (match_dup 1)
14253 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14254 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14258 if (which_alternative != 0)
14260 else if (get_attr_length (insn) == 4)
14261 return \"bdz %l0\";
14263 return \"{bdn|bdnz} $+8\;b %l0\";
14265 [(set_attr "type" "branch")
14266 (set_attr "length" "*,12,16,16")])
14268 ;; Similar but use EQ
14270 (define_insn "*ctr<mode>_internal5"
14272 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14274 (label_ref (match_operand 0 "" ""))
14276 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14277 (plus:P (match_dup 1)
14279 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14280 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14284 if (which_alternative != 0)
14286 else if (get_attr_length (insn) == 4)
14287 return \"bdz %l0\";
14289 return \"{bdn|bdnz} $+8\;b %l0\";
14291 [(set_attr "type" "branch")
14292 (set_attr "length" "*,12,16,16")])
14294 (define_insn "*ctr<mode>_internal6"
14296 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14299 (label_ref (match_operand 0 "" ""))))
14300 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14301 (plus:P (match_dup 1)
14303 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14304 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14308 if (which_alternative != 0)
14310 else if (get_attr_length (insn) == 4)
14311 return \"{bdn|bdnz} %l0\";
14313 return \"bdz $+8\;b %l0\";
14315 [(set_attr "type" "branch")
14316 (set_attr "length" "*,12,16,16")])
14318 ;; Now the splitters if we could not allocate the CTR register
14322 (if_then_else (match_operator 2 "comparison_operator"
14323 [(match_operand:P 1 "gpc_reg_operand" "")
14325 (match_operand 5 "" "")
14326 (match_operand 6 "" "")))
14327 (set (match_operand:P 0 "gpc_reg_operand" "")
14328 (plus:P (match_dup 1) (const_int -1)))
14329 (clobber (match_scratch:CC 3 ""))
14330 (clobber (match_scratch:P 4 ""))]
14332 [(parallel [(set (match_dup 3)
14333 (compare:CC (plus:P (match_dup 1)
14337 (plus:P (match_dup 1)
14339 (set (pc) (if_then_else (match_dup 7)
14343 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14344 operands[3], const0_rtx); }")
14348 (if_then_else (match_operator 2 "comparison_operator"
14349 [(match_operand:P 1 "gpc_reg_operand" "")
14351 (match_operand 5 "" "")
14352 (match_operand 6 "" "")))
14353 (set (match_operand:P 0 "nonimmediate_operand" "")
14354 (plus:P (match_dup 1) (const_int -1)))
14355 (clobber (match_scratch:CC 3 ""))
14356 (clobber (match_scratch:P 4 ""))]
14357 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14358 [(parallel [(set (match_dup 3)
14359 (compare:CC (plus:P (match_dup 1)
14363 (plus:P (match_dup 1)
14367 (set (pc) (if_then_else (match_dup 7)
14371 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14372 operands[3], const0_rtx); }")
14374 (define_insn "trap"
14375 [(trap_if (const_int 1) (const_int 0))]
14378 [(set_attr "type" "trap")])
14380 (define_expand "conditional_trap"
14381 [(trap_if (match_operator 0 "trap_comparison_operator"
14382 [(match_dup 2) (match_dup 3)])
14383 (match_operand 1 "const_int_operand" ""))]
14385 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14386 operands[2] = rs6000_compare_op0;
14387 operands[3] = rs6000_compare_op1;")
14390 [(trap_if (match_operator 0 "trap_comparison_operator"
14391 [(match_operand:GPR 1 "register_operand" "r")
14392 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14395 "{t|t<wd>}%V0%I2 %1,%2"
14396 [(set_attr "type" "trap")])
14398 ;; Insns related to generating the function prologue and epilogue.
14400 (define_expand "prologue"
14401 [(use (const_int 0))]
14402 "TARGET_SCHED_PROLOG"
14405 rs6000_emit_prologue ();
14409 (define_insn "*movesi_from_cr_one"
14410 [(match_parallel 0 "mfcr_operation"
14411 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14412 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14413 (match_operand 3 "immediate_operand" "n")]
14414 UNSPEC_MOVESI_FROM_CR))])]
14420 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14422 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14423 operands[4] = GEN_INT (mask);
14424 output_asm_insn (\"mfcr %1,%4\", operands);
14428 [(set_attr "type" "mfcrf")])
14430 (define_insn "movesi_from_cr"
14431 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14432 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14433 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14434 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14435 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14436 UNSPEC_MOVESI_FROM_CR))]
14439 [(set_attr "type" "mfcr")])
14441 (define_insn "*stmw"
14442 [(match_parallel 0 "stmw_operation"
14443 [(set (match_operand:SI 1 "memory_operand" "=m")
14444 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14447 [(set_attr "type" "store_ux")])
14449 (define_insn "*save_gpregs_<mode>"
14450 [(match_parallel 0 "any_parallel_operand"
14451 [(clobber (reg:P 65))
14452 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14453 (use (match_operand:P 2 "gpc_reg_operand" "r"))
14454 (set (match_operand:P 3 "memory_operand" "=m")
14455 (match_operand:P 4 "gpc_reg_operand" "r"))])]
14458 [(set_attr "type" "branch")
14459 (set_attr "length" "4")])
14461 (define_insn "*save_fpregs_<mode>"
14462 [(match_parallel 0 "any_parallel_operand"
14463 [(clobber (reg:P 65))
14464 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14465 (use (match_operand:P 2 "gpc_reg_operand" "r"))
14466 (set (match_operand:DF 3 "memory_operand" "=m")
14467 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14470 [(set_attr "type" "branch")
14471 (set_attr "length" "4")])
14473 ; These are to explain that changes to the stack pointer should
14474 ; not be moved over stores to stack memory.
14475 (define_insn "stack_tie"
14476 [(set (match_operand:BLK 0 "memory_operand" "+m")
14477 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14480 [(set_attr "length" "0")])
14483 (define_expand "epilogue"
14484 [(use (const_int 0))]
14485 "TARGET_SCHED_PROLOG"
14488 rs6000_emit_epilogue (FALSE);
14492 ; On some processors, doing the mtcrf one CC register at a time is
14493 ; faster (like on the 604e). On others, doing them all at once is
14494 ; faster; for instance, on the 601 and 750.
14496 (define_expand "movsi_to_cr_one"
14497 [(set (match_operand:CC 0 "cc_reg_operand" "")
14498 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14499 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14501 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14503 (define_insn "*movsi_to_cr"
14504 [(match_parallel 0 "mtcrf_operation"
14505 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14506 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14507 (match_operand 3 "immediate_operand" "n")]
14508 UNSPEC_MOVESI_TO_CR))])]
14514 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14515 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14516 operands[4] = GEN_INT (mask);
14517 return \"mtcrf %4,%2\";
14519 [(set_attr "type" "mtcr")])
14521 (define_insn "*mtcrfsi"
14522 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14523 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14524 (match_operand 2 "immediate_operand" "n")]
14525 UNSPEC_MOVESI_TO_CR))]
14526 "GET_CODE (operands[0]) == REG
14527 && CR_REGNO_P (REGNO (operands[0]))
14528 && GET_CODE (operands[2]) == CONST_INT
14529 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14531 [(set_attr "type" "mtcr")])
14533 ; The load-multiple instructions have similar properties.
14534 ; Note that "load_multiple" is a name known to the machine-independent
14535 ; code that actually corresponds to the PowerPC load-string.
14537 (define_insn "*lmw"
14538 [(match_parallel 0 "lmw_operation"
14539 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14540 (match_operand:SI 2 "memory_operand" "m"))])]
14543 [(set_attr "type" "load_ux")])
14545 (define_insn "*return_internal_<mode>"
14547 (use (match_operand:P 0 "register_operand" "lc"))]
14550 [(set_attr "type" "jmpreg")])
14552 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14553 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14555 (define_insn "*restore_gpregs_<mode>"
14556 [(match_parallel 0 "any_parallel_operand"
14557 [(clobber (match_operand:P 1 "register_operand" "=l"))
14558 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14559 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14560 (set (match_operand:P 4 "gpc_reg_operand" "=r")
14561 (match_operand:P 5 "memory_operand" "m"))])]
14564 [(set_attr "type" "branch")
14565 (set_attr "length" "4")])
14567 (define_insn "*return_and_restore_gpregs_<mode>"
14568 [(match_parallel 0 "any_parallel_operand"
14570 (clobber (match_operand:P 1 "register_operand" "=l"))
14571 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14572 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14573 (set (match_operand:P 4 "gpc_reg_operand" "=r")
14574 (match_operand:P 5 "memory_operand" "m"))])]
14577 [(set_attr "type" "branch")
14578 (set_attr "length" "4")])
14580 (define_insn "*return_and_restore_fpregs_<mode>"
14581 [(match_parallel 0 "any_parallel_operand"
14583 (clobber (match_operand:P 1 "register_operand" "=l"))
14584 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14585 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14586 (set (match_operand:DF 4 "gpc_reg_operand" "=f")
14587 (match_operand:DF 5 "memory_operand" "m"))])]
14590 [(set_attr "type" "branch")
14591 (set_attr "length" "4")])
14593 ; This is used in compiling the unwind routines.
14594 (define_expand "eh_return"
14595 [(use (match_operand 0 "general_operand" ""))]
14600 emit_insn (gen_eh_set_lr_si (operands[0]));
14602 emit_insn (gen_eh_set_lr_di (operands[0]));
14606 ; We can't expand this before we know where the link register is stored.
14607 (define_insn "eh_set_lr_<mode>"
14608 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14610 (clobber (match_scratch:P 1 "=&b"))]
14615 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14616 (clobber (match_scratch 1 ""))]
14621 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14625 (define_insn "prefetch"
14626 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14627 (match_operand:SI 1 "const_int_operand" "n")
14628 (match_operand:SI 2 "const_int_operand" "n"))]
14632 if (GET_CODE (operands[0]) == REG)
14633 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14634 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14636 [(set_attr "type" "load")])
14639 (include "sync.md")
14640 (include "altivec.md")
14643 (include "paired.md")