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)
104 ;; UNSPEC_VOLATILE usage
109 (UNSPECV_LL 1) ; load-locked
110 (UNSPECV_SC 2) ; store-conditional
111 (UNSPECV_EH_RR 9) ; eh_reg_restore
114 ;; Define an insn type attribute. This is used in function unit delay
116 (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"
117 (const_string "integer"))
119 ;; Length (in bytes).
120 ; '(pc)' in the following doesn't include the instruction itself; it is
121 ; calculated as if the instruction had zero size.
122 (define_attr "length" ""
123 (if_then_else (eq_attr "type" "branch")
124 (if_then_else (and (ge (minus (match_dup 0) (pc))
126 (lt (minus (match_dup 0) (pc))
132 ;; Processor type -- this attribute must exactly match the processor_type
133 ;; enumeration in rs6000.h.
135 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6,cell"
136 (const (symbol_ref "rs6000_cpu_attr")))
139 ;; If this instruction is microcoded on the CELL processor
140 ; The default for load and stores is conditional
141 ; The default for load extended and the recorded instructions is always microcoded
142 (define_attr "cell_micro" "not,conditional,always"
143 (if_then_else (ior (ior (eq_attr "type" "load")
144 (eq_attr "type" "store"))
145 (ior (eq_attr "type" "fpload")
146 (eq_attr "type" "fpstore")))
147 (const_string "conditional")
148 (if_then_else (ior (eq_attr "type" "load_ext")
149 (ior (eq_attr "type" "compare")
150 (eq_attr "type" "delayed_compare")))
151 (const_string "always")
152 (const_string "not"))))
155 (automata_option "ndfa")
168 (include "power4.md")
169 (include "power5.md")
170 (include "power6.md")
173 (include "predicates.md")
174 (include "constraints.md")
176 (include "darwin.md")
181 ; This mode iterator allows :GPR to be used to indicate the allowable size
182 ; of whole values in GPRs.
183 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
185 ; Any supported integer mode.
186 (define_mode_iterator INT [QI HI SI DI TI])
188 ; Any supported integer mode that fits in one register.
189 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
191 ; extend modes for DImode
192 (define_mode_iterator QHSI [QI HI SI])
194 ; SImode or DImode, even if DImode doesn't fit in GPRs.
195 (define_mode_iterator SDI [SI DI])
197 ; The size of a pointer. Also, the size of the value that a record-condition
198 ; (one with a '.') will compare.
199 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
201 ; Any hardware-supported floating-point mode
202 (define_mode_iterator FP [(SF "TARGET_HARD_FLOAT")
203 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
204 (TF "!TARGET_IEEEQUAD
206 && (TARGET_FPRS || TARGET_E500_DOUBLE)
207 && TARGET_LONG_DOUBLE_128")])
209 ; Various instructions that come in SI and DI forms.
210 ; A generic w/d attribute, for things like cmpw/cmpd.
211 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
214 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
217 ;; Start with fixed-point load and store insns. Here we put only the more
218 ;; complex forms. Basic data transfer is done later.
220 (define_expand "zero_extend<mode>di2"
221 [(set (match_operand:DI 0 "gpc_reg_operand" "")
222 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
226 (define_insn "*zero_extend<mode>di2_internal1"
227 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
228 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
232 rldicl %0,%1,0,<dbits>"
233 [(set_attr "type" "load,*")])
235 (define_insn "*zero_extend<mode>di2_internal2"
236 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
237 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
239 (clobber (match_scratch:DI 2 "=r,r"))]
242 rldicl. %2,%1,0,<dbits>
244 [(set_attr "type" "compare")
245 (set_attr "length" "4,8")])
248 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
249 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
251 (clobber (match_scratch:DI 2 ""))]
252 "TARGET_POWERPC64 && reload_completed"
254 (zero_extend:DI (match_dup 1)))
256 (compare:CC (match_dup 2)
260 (define_insn "*zero_extend<mode>di2_internal3"
261 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
262 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
264 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
265 (zero_extend:DI (match_dup 1)))]
268 rldicl. %0,%1,0,<dbits>
270 [(set_attr "type" "compare")
271 (set_attr "length" "4,8")])
274 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
275 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
277 (set (match_operand:DI 0 "gpc_reg_operand" "")
278 (zero_extend:DI (match_dup 1)))]
279 "TARGET_POWERPC64 && reload_completed"
281 (zero_extend:DI (match_dup 1)))
283 (compare:CC (match_dup 0)
287 (define_insn "extendqidi2"
288 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
289 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
292 [(set_attr "type" "exts")])
295 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
296 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
298 (clobber (match_scratch:DI 2 "=r,r"))]
303 [(set_attr "type" "compare")
304 (set_attr "length" "4,8")])
307 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
308 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
310 (clobber (match_scratch:DI 2 ""))]
311 "TARGET_POWERPC64 && reload_completed"
313 (sign_extend:DI (match_dup 1)))
315 (compare:CC (match_dup 2)
320 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
321 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
323 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
324 (sign_extend:DI (match_dup 1)))]
329 [(set_attr "type" "compare")
330 (set_attr "length" "4,8")])
333 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
334 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
336 (set (match_operand:DI 0 "gpc_reg_operand" "")
337 (sign_extend:DI (match_dup 1)))]
338 "TARGET_POWERPC64 && reload_completed"
340 (sign_extend:DI (match_dup 1)))
342 (compare:CC (match_dup 0)
346 (define_expand "extendhidi2"
347 [(set (match_operand:DI 0 "gpc_reg_operand" "")
348 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
353 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
354 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
359 [(set_attr "type" "load_ext,exts")])
362 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
363 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
365 (clobber (match_scratch:DI 2 "=r,r"))]
370 [(set_attr "type" "compare")
371 (set_attr "length" "4,8")])
374 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
375 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
377 (clobber (match_scratch:DI 2 ""))]
378 "TARGET_POWERPC64 && reload_completed"
380 (sign_extend:DI (match_dup 1)))
382 (compare:CC (match_dup 2)
387 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
388 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
390 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
391 (sign_extend:DI (match_dup 1)))]
396 [(set_attr "type" "compare")
397 (set_attr "length" "4,8")])
400 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
401 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
403 (set (match_operand:DI 0 "gpc_reg_operand" "")
404 (sign_extend:DI (match_dup 1)))]
405 "TARGET_POWERPC64 && reload_completed"
407 (sign_extend:DI (match_dup 1)))
409 (compare:CC (match_dup 0)
413 (define_expand "extendsidi2"
414 [(set (match_operand:DI 0 "gpc_reg_operand" "")
415 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
420 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
421 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
426 [(set_attr "type" "load_ext,exts")])
429 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
430 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
432 (clobber (match_scratch:DI 2 "=r,r"))]
437 [(set_attr "type" "compare")
438 (set_attr "length" "4,8")])
441 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
442 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
444 (clobber (match_scratch:DI 2 ""))]
445 "TARGET_POWERPC64 && reload_completed"
447 (sign_extend:DI (match_dup 1)))
449 (compare:CC (match_dup 2)
454 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
455 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
457 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
458 (sign_extend:DI (match_dup 1)))]
463 [(set_attr "type" "compare")
464 (set_attr "length" "4,8")])
467 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
468 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
470 (set (match_operand:DI 0 "gpc_reg_operand" "")
471 (sign_extend:DI (match_dup 1)))]
472 "TARGET_POWERPC64 && reload_completed"
474 (sign_extend:DI (match_dup 1)))
476 (compare:CC (match_dup 0)
480 (define_expand "zero_extendqisi2"
481 [(set (match_operand:SI 0 "gpc_reg_operand" "")
482 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
487 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
488 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
492 {rlinm|rlwinm} %0,%1,0,0xff"
493 [(set_attr "type" "load,*")])
496 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
497 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
499 (clobber (match_scratch:SI 2 "=r,r"))]
502 {andil.|andi.} %2,%1,0xff
504 [(set_attr "type" "compare")
505 (set_attr "length" "4,8")])
508 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
509 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
511 (clobber (match_scratch:SI 2 ""))]
514 (zero_extend:SI (match_dup 1)))
516 (compare:CC (match_dup 2)
521 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
522 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
524 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
525 (zero_extend:SI (match_dup 1)))]
528 {andil.|andi.} %0,%1,0xff
530 [(set_attr "type" "compare")
531 (set_attr "length" "4,8")])
534 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
535 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
537 (set (match_operand:SI 0 "gpc_reg_operand" "")
538 (zero_extend:SI (match_dup 1)))]
541 (zero_extend:SI (match_dup 1)))
543 (compare:CC (match_dup 0)
547 (define_expand "extendqisi2"
548 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
549 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
554 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
555 else if (TARGET_POWER)
556 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
558 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
562 (define_insn "extendqisi2_ppc"
563 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
564 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
567 [(set_attr "type" "exts")])
570 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
571 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
573 (clobber (match_scratch:SI 2 "=r,r"))]
578 [(set_attr "type" "compare")
579 (set_attr "length" "4,8")])
582 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
583 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
585 (clobber (match_scratch:SI 2 ""))]
586 "TARGET_POWERPC && reload_completed"
588 (sign_extend:SI (match_dup 1)))
590 (compare:CC (match_dup 2)
595 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
596 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
598 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
599 (sign_extend:SI (match_dup 1)))]
604 [(set_attr "type" "compare")
605 (set_attr "length" "4,8")])
608 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
609 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
611 (set (match_operand:SI 0 "gpc_reg_operand" "")
612 (sign_extend:SI (match_dup 1)))]
613 "TARGET_POWERPC && reload_completed"
615 (sign_extend:SI (match_dup 1)))
617 (compare:CC (match_dup 0)
621 (define_expand "extendqisi2_power"
622 [(parallel [(set (match_dup 2)
623 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
625 (clobber (scratch:SI))])
626 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
627 (ashiftrt:SI (match_dup 2)
629 (clobber (scratch:SI))])]
632 { operands[1] = gen_lowpart (SImode, operands[1]);
633 operands[2] = gen_reg_rtx (SImode); }")
635 (define_expand "extendqisi2_no_power"
637 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
639 (set (match_operand:SI 0 "gpc_reg_operand" "")
640 (ashiftrt:SI (match_dup 2)
642 "! TARGET_POWER && ! TARGET_POWERPC"
644 { operands[1] = gen_lowpart (SImode, operands[1]);
645 operands[2] = gen_reg_rtx (SImode); }")
647 (define_expand "zero_extendqihi2"
648 [(set (match_operand:HI 0 "gpc_reg_operand" "")
649 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
654 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
655 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
659 {rlinm|rlwinm} %0,%1,0,0xff"
660 [(set_attr "type" "load,*")])
663 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
664 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
666 (clobber (match_scratch:HI 2 "=r,r"))]
669 {andil.|andi.} %2,%1,0xff
671 [(set_attr "type" "compare")
672 (set_attr "length" "4,8")])
675 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
676 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
678 (clobber (match_scratch:HI 2 ""))]
681 (zero_extend:HI (match_dup 1)))
683 (compare:CC (match_dup 2)
688 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
689 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
691 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
692 (zero_extend:HI (match_dup 1)))]
695 {andil.|andi.} %0,%1,0xff
697 [(set_attr "type" "compare")
698 (set_attr "length" "4,8")])
701 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
702 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
704 (set (match_operand:HI 0 "gpc_reg_operand" "")
705 (zero_extend:HI (match_dup 1)))]
708 (zero_extend:HI (match_dup 1)))
710 (compare:CC (match_dup 0)
714 (define_expand "extendqihi2"
715 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
716 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
721 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
722 else if (TARGET_POWER)
723 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
725 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
729 (define_insn "extendqihi2_ppc"
730 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
731 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
734 [(set_attr "type" "exts")])
737 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
738 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
740 (clobber (match_scratch:HI 2 "=r,r"))]
745 [(set_attr "type" "compare")
746 (set_attr "length" "4,8")])
749 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
750 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
752 (clobber (match_scratch:HI 2 ""))]
753 "TARGET_POWERPC && reload_completed"
755 (sign_extend:HI (match_dup 1)))
757 (compare:CC (match_dup 2)
762 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
763 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
765 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
766 (sign_extend:HI (match_dup 1)))]
771 [(set_attr "type" "compare")
772 (set_attr "length" "4,8")])
775 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
776 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
778 (set (match_operand:HI 0 "gpc_reg_operand" "")
779 (sign_extend:HI (match_dup 1)))]
780 "TARGET_POWERPC && reload_completed"
782 (sign_extend:HI (match_dup 1)))
784 (compare:CC (match_dup 0)
788 (define_expand "extendqihi2_power"
789 [(parallel [(set (match_dup 2)
790 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
792 (clobber (scratch:SI))])
793 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
794 (ashiftrt:SI (match_dup 2)
796 (clobber (scratch:SI))])]
799 { operands[0] = gen_lowpart (SImode, operands[0]);
800 operands[1] = gen_lowpart (SImode, operands[1]);
801 operands[2] = gen_reg_rtx (SImode); }")
803 (define_expand "extendqihi2_no_power"
805 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
807 (set (match_operand:HI 0 "gpc_reg_operand" "")
808 (ashiftrt:SI (match_dup 2)
810 "! TARGET_POWER && ! TARGET_POWERPC"
812 { operands[0] = gen_lowpart (SImode, operands[0]);
813 operands[1] = gen_lowpart (SImode, operands[1]);
814 operands[2] = gen_reg_rtx (SImode); }")
816 (define_expand "zero_extendhisi2"
817 [(set (match_operand:SI 0 "gpc_reg_operand" "")
818 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
823 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
824 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
828 {rlinm|rlwinm} %0,%1,0,0xffff"
829 [(set_attr "type" "load,*")])
832 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
833 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
835 (clobber (match_scratch:SI 2 "=r,r"))]
838 {andil.|andi.} %2,%1,0xffff
840 [(set_attr "type" "compare")
841 (set_attr "length" "4,8")])
844 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
845 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
847 (clobber (match_scratch:SI 2 ""))]
850 (zero_extend:SI (match_dup 1)))
852 (compare:CC (match_dup 2)
857 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
858 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
860 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
861 (zero_extend:SI (match_dup 1)))]
864 {andil.|andi.} %0,%1,0xffff
866 [(set_attr "type" "compare")
867 (set_attr "length" "4,8")])
870 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
871 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
873 (set (match_operand:SI 0 "gpc_reg_operand" "")
874 (zero_extend:SI (match_dup 1)))]
877 (zero_extend:SI (match_dup 1)))
879 (compare:CC (match_dup 0)
883 (define_expand "extendhisi2"
884 [(set (match_operand:SI 0 "gpc_reg_operand" "")
885 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
890 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
891 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
896 [(set_attr "type" "load_ext,exts")])
899 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
900 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
902 (clobber (match_scratch:SI 2 "=r,r"))]
907 [(set_attr "type" "compare")
908 (set_attr "length" "4,8")])
911 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
912 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
914 (clobber (match_scratch:SI 2 ""))]
917 (sign_extend:SI (match_dup 1)))
919 (compare:CC (match_dup 2)
924 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
925 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
927 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
928 (sign_extend:SI (match_dup 1)))]
933 [(set_attr "type" "compare")
934 (set_attr "length" "4,8")])
936 ;; IBM 405 and 440 half-word multiplication operations.
938 (define_insn "*macchwc"
939 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
940 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
941 (match_operand:SI 2 "gpc_reg_operand" "r")
944 (match_operand:HI 1 "gpc_reg_operand" "r")))
945 (match_operand:SI 4 "gpc_reg_operand" "0"))
947 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
948 (plus:SI (mult:SI (ashiftrt:SI
956 [(set_attr "type" "imul3")])
958 (define_insn "*macchw"
959 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
960 (plus:SI (mult:SI (ashiftrt:SI
961 (match_operand:SI 2 "gpc_reg_operand" "r")
964 (match_operand:HI 1 "gpc_reg_operand" "r")))
965 (match_operand:SI 3 "gpc_reg_operand" "0")))]
968 [(set_attr "type" "imul3")])
970 (define_insn "*macchwuc"
971 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
972 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
973 (match_operand:SI 2 "gpc_reg_operand" "r")
976 (match_operand:HI 1 "gpc_reg_operand" "r")))
977 (match_operand:SI 4 "gpc_reg_operand" "0"))
979 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
980 (plus:SI (mult:SI (lshiftrt:SI
987 "macchwu. %0, %1, %2"
988 [(set_attr "type" "imul3")])
990 (define_insn "*macchwu"
991 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
992 (plus:SI (mult:SI (lshiftrt:SI
993 (match_operand:SI 2 "gpc_reg_operand" "r")
996 (match_operand:HI 1 "gpc_reg_operand" "r")))
997 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1000 [(set_attr "type" "imul3")])
1002 (define_insn "*machhwc"
1003 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1004 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1005 (match_operand:SI 1 "gpc_reg_operand" "%r")
1008 (match_operand:SI 2 "gpc_reg_operand" "r")
1010 (match_operand:SI 4 "gpc_reg_operand" "0"))
1012 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1013 (plus:SI (mult:SI (ashiftrt:SI
1021 "machhw. %0, %1, %2"
1022 [(set_attr "type" "imul3")])
1024 (define_insn "*machhw"
1025 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1026 (plus:SI (mult:SI (ashiftrt:SI
1027 (match_operand:SI 1 "gpc_reg_operand" "%r")
1030 (match_operand:SI 2 "gpc_reg_operand" "r")
1032 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1035 [(set_attr "type" "imul3")])
1037 (define_insn "*machhwuc"
1038 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1039 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1040 (match_operand:SI 1 "gpc_reg_operand" "%r")
1043 (match_operand:SI 2 "gpc_reg_operand" "r")
1045 (match_operand:SI 4 "gpc_reg_operand" "0"))
1047 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1048 (plus:SI (mult:SI (lshiftrt:SI
1056 "machhwu. %0, %1, %2"
1057 [(set_attr "type" "imul3")])
1059 (define_insn "*machhwu"
1060 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1061 (plus:SI (mult:SI (lshiftrt:SI
1062 (match_operand:SI 1 "gpc_reg_operand" "%r")
1065 (match_operand:SI 2 "gpc_reg_operand" "r")
1067 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1069 "machhwu %0, %1, %2"
1070 [(set_attr "type" "imul3")])
1072 (define_insn "*maclhwc"
1073 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1074 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1075 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1077 (match_operand:HI 2 "gpc_reg_operand" "r")))
1078 (match_operand:SI 4 "gpc_reg_operand" "0"))
1080 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1081 (plus:SI (mult:SI (sign_extend:SI
1087 "maclhw. %0, %1, %2"
1088 [(set_attr "type" "imul3")])
1090 (define_insn "*maclhw"
1091 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1092 (plus:SI (mult:SI (sign_extend:SI
1093 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1095 (match_operand:HI 2 "gpc_reg_operand" "r")))
1096 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1099 [(set_attr "type" "imul3")])
1101 (define_insn "*maclhwuc"
1102 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1103 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1104 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1106 (match_operand:HI 2 "gpc_reg_operand" "r")))
1107 (match_operand:SI 4 "gpc_reg_operand" "0"))
1109 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1110 (plus:SI (mult:SI (zero_extend:SI
1116 "maclhwu. %0, %1, %2"
1117 [(set_attr "type" "imul3")])
1119 (define_insn "*maclhwu"
1120 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1121 (plus:SI (mult:SI (zero_extend:SI
1122 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1124 (match_operand:HI 2 "gpc_reg_operand" "r")))
1125 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1127 "maclhwu %0, %1, %2"
1128 [(set_attr "type" "imul3")])
1130 (define_insn "*nmacchwc"
1131 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1132 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1133 (mult:SI (ashiftrt:SI
1134 (match_operand:SI 2 "gpc_reg_operand" "r")
1137 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1139 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1140 (minus:SI (match_dup 4)
1141 (mult:SI (ashiftrt:SI
1147 "nmacchw. %0, %1, %2"
1148 [(set_attr "type" "imul3")])
1150 (define_insn "*nmacchw"
1151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1152 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1153 (mult:SI (ashiftrt:SI
1154 (match_operand:SI 2 "gpc_reg_operand" "r")
1157 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1159 "nmacchw %0, %1, %2"
1160 [(set_attr "type" "imul3")])
1162 (define_insn "*nmachhwc"
1163 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1164 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1165 (mult:SI (ashiftrt:SI
1166 (match_operand:SI 1 "gpc_reg_operand" "%r")
1169 (match_operand:SI 2 "gpc_reg_operand" "r")
1172 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1173 (minus:SI (match_dup 4)
1174 (mult:SI (ashiftrt:SI
1181 "nmachhw. %0, %1, %2"
1182 [(set_attr "type" "imul3")])
1184 (define_insn "*nmachhw"
1185 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1186 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1187 (mult:SI (ashiftrt:SI
1188 (match_operand:SI 1 "gpc_reg_operand" "%r")
1191 (match_operand:SI 2 "gpc_reg_operand" "r")
1194 "nmachhw %0, %1, %2"
1195 [(set_attr "type" "imul3")])
1197 (define_insn "*nmaclhwc"
1198 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1199 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1200 (mult:SI (sign_extend:SI
1201 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1203 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1205 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1206 (minus:SI (match_dup 4)
1207 (mult:SI (sign_extend:SI
1212 "nmaclhw. %0, %1, %2"
1213 [(set_attr "type" "imul3")])
1215 (define_insn "*nmaclhw"
1216 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1217 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1218 (mult:SI (sign_extend:SI
1219 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1221 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1223 "nmaclhw %0, %1, %2"
1224 [(set_attr "type" "imul3")])
1226 (define_insn "*mulchwc"
1227 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1228 (compare:CC (mult:SI (ashiftrt:SI
1229 (match_operand:SI 2 "gpc_reg_operand" "r")
1232 (match_operand:HI 1 "gpc_reg_operand" "r")))
1234 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1235 (mult:SI (ashiftrt:SI
1241 "mulchw. %0, %1, %2"
1242 [(set_attr "type" "imul3")])
1244 (define_insn "*mulchw"
1245 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1246 (mult:SI (ashiftrt:SI
1247 (match_operand:SI 2 "gpc_reg_operand" "r")
1250 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1253 [(set_attr "type" "imul3")])
1255 (define_insn "*mulchwuc"
1256 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1257 (compare:CC (mult:SI (lshiftrt:SI
1258 (match_operand:SI 2 "gpc_reg_operand" "r")
1261 (match_operand:HI 1 "gpc_reg_operand" "r")))
1263 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1264 (mult:SI (lshiftrt:SI
1270 "mulchwu. %0, %1, %2"
1271 [(set_attr "type" "imul3")])
1273 (define_insn "*mulchwu"
1274 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1275 (mult:SI (lshiftrt:SI
1276 (match_operand:SI 2 "gpc_reg_operand" "r")
1279 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1281 "mulchwu %0, %1, %2"
1282 [(set_attr "type" "imul3")])
1284 (define_insn "*mulhhwc"
1285 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1286 (compare:CC (mult:SI (ashiftrt:SI
1287 (match_operand:SI 1 "gpc_reg_operand" "%r")
1290 (match_operand:SI 2 "gpc_reg_operand" "r")
1293 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1294 (mult:SI (ashiftrt:SI
1301 "mulhhw. %0, %1, %2"
1302 [(set_attr "type" "imul3")])
1304 (define_insn "*mulhhw"
1305 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1306 (mult:SI (ashiftrt:SI
1307 (match_operand:SI 1 "gpc_reg_operand" "%r")
1310 (match_operand:SI 2 "gpc_reg_operand" "r")
1314 [(set_attr "type" "imul3")])
1316 (define_insn "*mulhhwuc"
1317 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1318 (compare:CC (mult:SI (lshiftrt:SI
1319 (match_operand:SI 1 "gpc_reg_operand" "%r")
1322 (match_operand:SI 2 "gpc_reg_operand" "r")
1325 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1326 (mult:SI (lshiftrt:SI
1333 "mulhhwu. %0, %1, %2"
1334 [(set_attr "type" "imul3")])
1336 (define_insn "*mulhhwu"
1337 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1338 (mult:SI (lshiftrt:SI
1339 (match_operand:SI 1 "gpc_reg_operand" "%r")
1342 (match_operand:SI 2 "gpc_reg_operand" "r")
1345 "mulhhwu %0, %1, %2"
1346 [(set_attr "type" "imul3")])
1348 (define_insn "*mullhwc"
1349 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1350 (compare:CC (mult:SI (sign_extend:SI
1351 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1353 (match_operand:HI 2 "gpc_reg_operand" "r")))
1355 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1356 (mult:SI (sign_extend:SI
1361 "mullhw. %0, %1, %2"
1362 [(set_attr "type" "imul3")])
1364 (define_insn "*mullhw"
1365 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1366 (mult:SI (sign_extend:SI
1367 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1369 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1372 [(set_attr "type" "imul3")])
1374 (define_insn "*mullhwuc"
1375 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1376 (compare:CC (mult:SI (zero_extend:SI
1377 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1379 (match_operand:HI 2 "gpc_reg_operand" "r")))
1381 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1382 (mult:SI (zero_extend:SI
1387 "mullhwu. %0, %1, %2"
1388 [(set_attr "type" "imul3")])
1390 (define_insn "*mullhwu"
1391 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1392 (mult:SI (zero_extend:SI
1393 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1395 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1397 "mullhwu %0, %1, %2"
1398 [(set_attr "type" "imul3")])
1400 ;; IBM 405 and 440 string-search dlmzb instruction support.
1401 (define_insn "dlmzb"
1402 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1403 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1404 (match_operand:SI 2 "gpc_reg_operand" "r")]
1406 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1407 (unspec:SI [(match_dup 1)
1411 "dlmzb. %0, %1, %2")
1413 (define_expand "strlensi"
1414 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1415 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1416 (match_operand:QI 2 "const_int_operand" "")
1417 (match_operand 3 "const_int_operand" "")]
1418 UNSPEC_DLMZB_STRLEN))
1419 (clobber (match_scratch:CC 4 "=x"))]
1420 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1422 rtx result = operands[0];
1423 rtx src = operands[1];
1424 rtx search_char = operands[2];
1425 rtx align = operands[3];
1426 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1427 rtx loop_label, end_label, mem, cr0, cond;
1428 if (search_char != const0_rtx
1429 || GET_CODE (align) != CONST_INT
1430 || INTVAL (align) < 8)
1432 word1 = gen_reg_rtx (SImode);
1433 word2 = gen_reg_rtx (SImode);
1434 scratch_dlmzb = gen_reg_rtx (SImode);
1435 scratch_string = gen_reg_rtx (Pmode);
1436 loop_label = gen_label_rtx ();
1437 end_label = gen_label_rtx ();
1438 addr = force_reg (Pmode, XEXP (src, 0));
1439 emit_move_insn (scratch_string, addr);
1440 emit_label (loop_label);
1441 mem = change_address (src, SImode, scratch_string);
1442 emit_move_insn (word1, mem);
1443 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1444 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1445 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1446 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1447 emit_jump_insn (gen_rtx_SET (VOIDmode,
1449 gen_rtx_IF_THEN_ELSE (VOIDmode,
1455 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1456 emit_jump_insn (gen_rtx_SET (VOIDmode,
1458 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1460 emit_label (end_label);
1461 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1462 emit_insn (gen_subsi3 (result, scratch_string, addr));
1463 emit_insn (gen_subsi3 (result, result, const1_rtx));
1468 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1469 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1471 (set (match_operand:SI 0 "gpc_reg_operand" "")
1472 (sign_extend:SI (match_dup 1)))]
1475 (sign_extend:SI (match_dup 1)))
1477 (compare:CC (match_dup 0)
1481 ;; Fixed-point arithmetic insns.
1483 (define_expand "add<mode>3"
1484 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1485 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1486 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1489 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1491 if (non_short_cint_operand (operands[2], DImode))
1494 else if (GET_CODE (operands[2]) == CONST_INT
1495 && ! add_operand (operands[2], <MODE>mode))
1497 rtx tmp = ((!can_create_pseudo_p ()
1498 || rtx_equal_p (operands[0], operands[1]))
1499 ? operands[0] : gen_reg_rtx (<MODE>mode));
1501 HOST_WIDE_INT val = INTVAL (operands[2]);
1502 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1503 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1505 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1508 /* The ordering here is important for the prolog expander.
1509 When space is allocated from the stack, adding 'low' first may
1510 produce a temporary deallocation (which would be bad). */
1511 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1512 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1517 ;; Discourage ai/addic because of carry but provide it in an alternative
1518 ;; allowing register zero as source.
1519 (define_insn "*add<mode>3_internal1"
1520 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1521 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1522 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1523 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1526 {cal %0,%2(%1)|addi %0,%1,%2}
1528 {cau|addis} %0,%1,%v2"
1529 [(set_attr "length" "4,4,4,4")])
1531 (define_insn "addsi3_high"
1532 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1533 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1534 (high:SI (match_operand 2 "" ""))))]
1535 "TARGET_MACHO && !TARGET_64BIT"
1536 "{cau|addis} %0,%1,ha16(%2)"
1537 [(set_attr "length" "4")])
1539 (define_insn "*add<mode>3_internal2"
1540 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1541 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1542 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1544 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1547 {cax.|add.} %3,%1,%2
1548 {ai.|addic.} %3,%1,%2
1551 [(set_attr "type" "fast_compare,compare,compare,compare")
1552 (set_attr "length" "4,4,8,8")])
1555 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1556 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1557 (match_operand:GPR 2 "reg_or_short_operand" ""))
1559 (clobber (match_scratch:GPR 3 ""))]
1562 (plus:GPR (match_dup 1)
1565 (compare:CC (match_dup 3)
1569 (define_insn "*add<mode>3_internal3"
1570 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1571 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1572 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1574 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1575 (plus:P (match_dup 1)
1579 {cax.|add.} %0,%1,%2
1580 {ai.|addic.} %0,%1,%2
1583 [(set_attr "type" "fast_compare,compare,compare,compare")
1584 (set_attr "length" "4,4,8,8")])
1587 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1588 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1589 (match_operand:P 2 "reg_or_short_operand" ""))
1591 (set (match_operand:P 0 "gpc_reg_operand" "")
1592 (plus:P (match_dup 1) (match_dup 2)))]
1595 (plus:P (match_dup 1)
1598 (compare:CC (match_dup 0)
1602 ;; Split an add that we can't do in one insn into two insns, each of which
1603 ;; does one 16-bit part. This is used by combine. Note that the low-order
1604 ;; add should be last in case the result gets used in an address.
1607 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1608 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1609 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1611 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1612 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1614 HOST_WIDE_INT val = INTVAL (operands[2]);
1615 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1616 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1618 operands[4] = GEN_INT (low);
1619 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1620 operands[3] = GEN_INT (rest);
1621 else if (can_create_pseudo_p ())
1623 operands[3] = gen_reg_rtx (DImode);
1624 emit_move_insn (operands[3], operands[2]);
1625 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1632 (define_insn "one_cmpl<mode>2"
1633 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1634 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1639 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1640 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1642 (clobber (match_scratch:P 2 "=r,r"))]
1647 [(set_attr "type" "compare")
1648 (set_attr "length" "4,8")])
1651 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1652 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1654 (clobber (match_scratch:P 2 ""))]
1657 (not:P (match_dup 1)))
1659 (compare:CC (match_dup 2)
1664 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1665 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1667 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1668 (not:P (match_dup 1)))]
1673 [(set_attr "type" "compare")
1674 (set_attr "length" "4,8")])
1677 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1678 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1680 (set (match_operand:P 0 "gpc_reg_operand" "")
1681 (not:P (match_dup 1)))]
1684 (not:P (match_dup 1)))
1686 (compare:CC (match_dup 0)
1691 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1692 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1693 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1695 "{sf%I1|subf%I1c} %0,%2,%1")
1698 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1699 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1700 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1707 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1708 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1709 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1711 (clobber (match_scratch:SI 3 "=r,r"))]
1714 {sf.|subfc.} %3,%2,%1
1716 [(set_attr "type" "compare")
1717 (set_attr "length" "4,8")])
1720 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1721 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1722 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1724 (clobber (match_scratch:P 3 "=r,r"))]
1729 [(set_attr "type" "fast_compare")
1730 (set_attr "length" "4,8")])
1733 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1734 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1735 (match_operand:P 2 "gpc_reg_operand" ""))
1737 (clobber (match_scratch:P 3 ""))]
1740 (minus:P (match_dup 1)
1743 (compare:CC (match_dup 3)
1748 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1749 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1750 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1752 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1753 (minus:SI (match_dup 1) (match_dup 2)))]
1756 {sf.|subfc.} %0,%2,%1
1758 [(set_attr "type" "compare")
1759 (set_attr "length" "4,8")])
1762 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1763 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1764 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1766 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1767 (minus:P (match_dup 1)
1773 [(set_attr "type" "fast_compare")
1774 (set_attr "length" "4,8")])
1777 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1778 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1779 (match_operand:P 2 "gpc_reg_operand" ""))
1781 (set (match_operand:P 0 "gpc_reg_operand" "")
1782 (minus:P (match_dup 1)
1786 (minus:P (match_dup 1)
1789 (compare:CC (match_dup 0)
1793 (define_expand "sub<mode>3"
1794 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1795 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1796 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1800 if (GET_CODE (operands[2]) == CONST_INT)
1802 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1803 negate_rtx (<MODE>mode, operands[2])));
1808 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1809 ;; instruction and some auxiliary computations. Then we just have a single
1810 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1813 (define_expand "sminsi3"
1815 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1816 (match_operand:SI 2 "reg_or_short_operand" ""))
1818 (minus:SI (match_dup 2) (match_dup 1))))
1819 (set (match_operand:SI 0 "gpc_reg_operand" "")
1820 (minus:SI (match_dup 2) (match_dup 3)))]
1821 "TARGET_POWER || TARGET_ISEL"
1826 operands[2] = force_reg (SImode, operands[2]);
1827 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1831 operands[3] = gen_reg_rtx (SImode);
1835 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1836 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1837 (match_operand:SI 2 "reg_or_short_operand" "")))
1838 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1841 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1843 (minus:SI (match_dup 2) (match_dup 1))))
1844 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1847 (define_expand "smaxsi3"
1849 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1850 (match_operand:SI 2 "reg_or_short_operand" ""))
1852 (minus:SI (match_dup 2) (match_dup 1))))
1853 (set (match_operand:SI 0 "gpc_reg_operand" "")
1854 (plus:SI (match_dup 3) (match_dup 1)))]
1855 "TARGET_POWER || TARGET_ISEL"
1860 operands[2] = force_reg (SImode, operands[2]);
1861 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1864 operands[3] = gen_reg_rtx (SImode);
1868 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1869 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1870 (match_operand:SI 2 "reg_or_short_operand" "")))
1871 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1874 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1876 (minus:SI (match_dup 2) (match_dup 1))))
1877 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1880 (define_expand "uminsi3"
1881 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1883 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1885 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1887 (minus:SI (match_dup 4) (match_dup 3))))
1888 (set (match_operand:SI 0 "gpc_reg_operand" "")
1889 (minus:SI (match_dup 2) (match_dup 3)))]
1890 "TARGET_POWER || TARGET_ISEL"
1895 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1898 operands[3] = gen_reg_rtx (SImode);
1899 operands[4] = gen_reg_rtx (SImode);
1900 operands[5] = GEN_INT (-2147483647 - 1);
1903 (define_expand "umaxsi3"
1904 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1906 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1908 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1910 (minus:SI (match_dup 4) (match_dup 3))))
1911 (set (match_operand:SI 0 "gpc_reg_operand" "")
1912 (plus:SI (match_dup 3) (match_dup 1)))]
1913 "TARGET_POWER || TARGET_ISEL"
1918 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1921 operands[3] = gen_reg_rtx (SImode);
1922 operands[4] = gen_reg_rtx (SImode);
1923 operands[5] = GEN_INT (-2147483647 - 1);
1927 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1928 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1929 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1931 (minus:SI (match_dup 2) (match_dup 1))))]
1936 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1938 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1939 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1941 (minus:SI (match_dup 2) (match_dup 1)))
1943 (clobber (match_scratch:SI 3 "=r,r"))]
1948 [(set_attr "type" "delayed_compare")
1949 (set_attr "length" "4,8")])
1952 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1954 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1955 (match_operand:SI 2 "reg_or_short_operand" ""))
1957 (minus:SI (match_dup 2) (match_dup 1)))
1959 (clobber (match_scratch:SI 3 ""))]
1960 "TARGET_POWER && reload_completed"
1962 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1964 (minus:SI (match_dup 2) (match_dup 1))))
1966 (compare:CC (match_dup 3)
1971 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1973 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1974 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1976 (minus:SI (match_dup 2) (match_dup 1)))
1978 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1979 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1981 (minus:SI (match_dup 2) (match_dup 1))))]
1986 [(set_attr "type" "delayed_compare")
1987 (set_attr "length" "4,8")])
1990 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1992 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1993 (match_operand:SI 2 "reg_or_short_operand" ""))
1995 (minus:SI (match_dup 2) (match_dup 1)))
1997 (set (match_operand:SI 0 "gpc_reg_operand" "")
1998 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2000 (minus:SI (match_dup 2) (match_dup 1))))]
2001 "TARGET_POWER && reload_completed"
2003 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2005 (minus:SI (match_dup 2) (match_dup 1))))
2007 (compare:CC (match_dup 0)
2011 ;; We don't need abs with condition code because such comparisons should
2013 (define_expand "abssi2"
2014 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2015 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2021 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2024 else if (! TARGET_POWER)
2026 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2031 (define_insn "*abssi2_power"
2032 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2033 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2037 (define_insn_and_split "abssi2_isel"
2038 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2039 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2040 (clobber (match_scratch:SI 2 "=&b"))
2041 (clobber (match_scratch:CC 3 "=y"))]
2044 "&& reload_completed"
2045 [(set (match_dup 2) (neg:SI (match_dup 1)))
2047 (compare:CC (match_dup 1)
2050 (if_then_else:SI (ge (match_dup 3)
2056 (define_insn_and_split "abssi2_nopower"
2057 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2058 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2059 (clobber (match_scratch:SI 2 "=&r,&r"))]
2060 "! TARGET_POWER && ! TARGET_ISEL"
2062 "&& reload_completed"
2063 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2064 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2065 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2068 (define_insn "*nabs_power"
2069 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2070 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2074 (define_insn_and_split "*nabs_nopower"
2075 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2076 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2077 (clobber (match_scratch:SI 2 "=&r,&r"))]
2080 "&& reload_completed"
2081 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2082 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2083 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2086 (define_expand "neg<mode>2"
2087 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2088 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2092 (define_insn "*neg<mode>2_internal"
2093 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2094 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2099 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2100 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2102 (clobber (match_scratch:P 2 "=r,r"))]
2107 [(set_attr "type" "fast_compare")
2108 (set_attr "length" "4,8")])
2111 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2112 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2114 (clobber (match_scratch:P 2 ""))]
2117 (neg:P (match_dup 1)))
2119 (compare:CC (match_dup 2)
2124 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2125 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2127 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2128 (neg:P (match_dup 1)))]
2133 [(set_attr "type" "fast_compare")
2134 (set_attr "length" "4,8")])
2137 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2138 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2140 (set (match_operand:P 0 "gpc_reg_operand" "")
2141 (neg:P (match_dup 1)))]
2144 (neg:P (match_dup 1)))
2146 (compare:CC (match_dup 0)
2150 (define_insn "clz<mode>2"
2151 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2152 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2154 "{cntlz|cntlz<wd>} %0,%1"
2155 [(set_attr "type" "cntlz")])
2157 (define_expand "ctz<mode>2"
2159 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2160 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2162 (clobber (scratch:CC))])
2163 (set (match_dup 4) (clz:GPR (match_dup 3)))
2164 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2165 (minus:GPR (match_dup 5) (match_dup 4)))]
2168 operands[2] = gen_reg_rtx (<MODE>mode);
2169 operands[3] = gen_reg_rtx (<MODE>mode);
2170 operands[4] = gen_reg_rtx (<MODE>mode);
2171 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2174 (define_expand "ffs<mode>2"
2176 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2177 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2179 (clobber (scratch:CC))])
2180 (set (match_dup 4) (clz:GPR (match_dup 3)))
2181 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2182 (minus:GPR (match_dup 5) (match_dup 4)))]
2185 operands[2] = gen_reg_rtx (<MODE>mode);
2186 operands[3] = gen_reg_rtx (<MODE>mode);
2187 operands[4] = gen_reg_rtx (<MODE>mode);
2188 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2191 (define_insn "popcntb<mode>2"
2192 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2193 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2198 (define_expand "popcount<mode>2"
2199 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2200 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2203 rs6000_emit_popcount (operands[0], operands[1]);
2207 (define_expand "parity<mode>2"
2208 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2209 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2212 rs6000_emit_parity (operands[0], operands[1]);
2216 (define_insn "bswapsi2"
2217 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2218 (bswap:SI (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2222 {stbrx|stwbrx} %1,%y0
2224 [(set_attr "length" "4,4,12")])
2227 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2228 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2231 (rotate:SI (match_dup 1) (const_int 8)))
2232 (set (zero_extract:SI (match_dup 0)
2236 (set (zero_extract:SI (match_dup 0)
2239 (rotate:SI (match_dup 1)
2243 (define_expand "mulsi3"
2244 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2245 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2246 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2251 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2253 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2257 (define_insn "mulsi3_mq"
2258 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2259 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2260 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2261 (clobber (match_scratch:SI 3 "=q,q"))]
2264 {muls|mullw} %0,%1,%2
2265 {muli|mulli} %0,%1,%2"
2267 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2268 (const_string "imul3")
2269 (match_operand:SI 2 "short_cint_operand" "")
2270 (const_string "imul2")]
2271 (const_string "imul")))])
2273 (define_insn "mulsi3_no_mq"
2274 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2275 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2276 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2279 {muls|mullw} %0,%1,%2
2280 {muli|mulli} %0,%1,%2"
2282 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2283 (const_string "imul3")
2284 (match_operand:SI 2 "short_cint_operand" "")
2285 (const_string "imul2")]
2286 (const_string "imul")))])
2288 (define_insn "*mulsi3_mq_internal1"
2289 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2290 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2291 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2293 (clobber (match_scratch:SI 3 "=r,r"))
2294 (clobber (match_scratch:SI 4 "=q,q"))]
2297 {muls.|mullw.} %3,%1,%2
2299 [(set_attr "type" "imul_compare")
2300 (set_attr "length" "4,8")])
2303 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2304 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2305 (match_operand:SI 2 "gpc_reg_operand" ""))
2307 (clobber (match_scratch:SI 3 ""))
2308 (clobber (match_scratch:SI 4 ""))]
2309 "TARGET_POWER && reload_completed"
2310 [(parallel [(set (match_dup 3)
2311 (mult:SI (match_dup 1) (match_dup 2)))
2312 (clobber (match_dup 4))])
2314 (compare:CC (match_dup 3)
2318 (define_insn "*mulsi3_no_mq_internal1"
2319 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2320 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2321 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2323 (clobber (match_scratch:SI 3 "=r,r"))]
2326 {muls.|mullw.} %3,%1,%2
2328 [(set_attr "type" "imul_compare")
2329 (set_attr "length" "4,8")])
2332 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2333 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2334 (match_operand:SI 2 "gpc_reg_operand" ""))
2336 (clobber (match_scratch:SI 3 ""))]
2337 "! TARGET_POWER && reload_completed"
2339 (mult:SI (match_dup 1) (match_dup 2)))
2341 (compare:CC (match_dup 3)
2345 (define_insn "*mulsi3_mq_internal2"
2346 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2347 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2348 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2350 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2351 (mult:SI (match_dup 1) (match_dup 2)))
2352 (clobber (match_scratch:SI 4 "=q,q"))]
2355 {muls.|mullw.} %0,%1,%2
2357 [(set_attr "type" "imul_compare")
2358 (set_attr "length" "4,8")])
2361 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2362 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2363 (match_operand:SI 2 "gpc_reg_operand" ""))
2365 (set (match_operand:SI 0 "gpc_reg_operand" "")
2366 (mult:SI (match_dup 1) (match_dup 2)))
2367 (clobber (match_scratch:SI 4 ""))]
2368 "TARGET_POWER && reload_completed"
2369 [(parallel [(set (match_dup 0)
2370 (mult:SI (match_dup 1) (match_dup 2)))
2371 (clobber (match_dup 4))])
2373 (compare:CC (match_dup 0)
2377 (define_insn "*mulsi3_no_mq_internal2"
2378 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2379 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2380 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2382 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2383 (mult:SI (match_dup 1) (match_dup 2)))]
2386 {muls.|mullw.} %0,%1,%2
2388 [(set_attr "type" "imul_compare")
2389 (set_attr "length" "4,8")])
2392 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2393 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2394 (match_operand:SI 2 "gpc_reg_operand" ""))
2396 (set (match_operand:SI 0 "gpc_reg_operand" "")
2397 (mult:SI (match_dup 1) (match_dup 2)))]
2398 "! TARGET_POWER && reload_completed"
2400 (mult:SI (match_dup 1) (match_dup 2)))
2402 (compare:CC (match_dup 0)
2406 ;; Operand 1 is divided by operand 2; quotient goes to operand
2407 ;; 0 and remainder to operand 3.
2408 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2410 (define_expand "divmodsi4"
2411 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2412 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2413 (match_operand:SI 2 "gpc_reg_operand" "")))
2414 (set (match_operand:SI 3 "register_operand" "")
2415 (mod:SI (match_dup 1) (match_dup 2)))])]
2416 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2419 if (! TARGET_POWER && ! TARGET_POWERPC)
2421 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2422 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2423 emit_insn (gen_divss_call ());
2424 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2425 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2430 (define_insn "*divmodsi4_internal"
2431 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2432 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2433 (match_operand:SI 2 "gpc_reg_operand" "r")))
2434 (set (match_operand:SI 3 "register_operand" "=q")
2435 (mod:SI (match_dup 1) (match_dup 2)))]
2438 [(set_attr "type" "idiv")])
2440 (define_expand "udiv<mode>3"
2441 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2442 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2443 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2444 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2447 if (! TARGET_POWER && ! TARGET_POWERPC)
2449 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2450 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2451 emit_insn (gen_quous_call ());
2452 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2455 else if (TARGET_POWER)
2457 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2462 (define_insn "udivsi3_mq"
2463 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2464 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2465 (match_operand:SI 2 "gpc_reg_operand" "r")))
2466 (clobber (match_scratch:SI 3 "=q"))]
2467 "TARGET_POWERPC && TARGET_POWER"
2469 [(set_attr "type" "idiv")])
2471 (define_insn "*udivsi3_no_mq"
2472 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2473 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2474 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2475 "TARGET_POWERPC && ! TARGET_POWER"
2478 (cond [(match_operand:SI 0 "" "")
2479 (const_string "idiv")]
2480 (const_string "ldiv")))])
2483 ;; For powers of two we can do srai/aze for divide and then adjust for
2484 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2485 ;; used; for PowerPC, force operands into register and do a normal divide;
2486 ;; for AIX common-mode, use quoss call on register operands.
2487 (define_expand "div<mode>3"
2488 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2489 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2490 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2494 if (GET_CODE (operands[2]) == CONST_INT
2495 && INTVAL (operands[2]) > 0
2496 && exact_log2 (INTVAL (operands[2])) >= 0)
2498 else if (TARGET_POWERPC)
2500 operands[2] = force_reg (<MODE>mode, operands[2]);
2503 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2507 else if (TARGET_POWER)
2511 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2512 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2513 emit_insn (gen_quoss_call ());
2514 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2519 (define_insn "divsi3_mq"
2520 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2521 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2522 (match_operand:SI 2 "gpc_reg_operand" "r")))
2523 (clobber (match_scratch:SI 3 "=q"))]
2524 "TARGET_POWERPC && TARGET_POWER"
2526 [(set_attr "type" "idiv")])
2528 (define_insn "*div<mode>3_no_mq"
2529 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2530 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2531 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2532 "TARGET_POWERPC && ! TARGET_POWER"
2535 (cond [(match_operand:SI 0 "" "")
2536 (const_string "idiv")]
2537 (const_string "ldiv")))])
2539 (define_expand "mod<mode>3"
2540 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2541 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2542 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2550 if (GET_CODE (operands[2]) != CONST_INT
2551 || INTVAL (operands[2]) <= 0
2552 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2555 temp1 = gen_reg_rtx (<MODE>mode);
2556 temp2 = gen_reg_rtx (<MODE>mode);
2558 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2559 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2560 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2565 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2566 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2567 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2569 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2570 [(set_attr "type" "two")
2571 (set_attr "length" "8")])
2574 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2575 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2576 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2578 (clobber (match_scratch:P 3 "=r,r"))]
2581 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2583 [(set_attr "type" "compare")
2584 (set_attr "length" "8,12")])
2587 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2588 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2589 (match_operand:GPR 2 "exact_log2_cint_operand"
2592 (clobber (match_scratch:GPR 3 ""))]
2595 (div:<MODE> (match_dup 1) (match_dup 2)))
2597 (compare:CC (match_dup 3)
2602 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2603 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2604 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2606 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2607 (div:P (match_dup 1) (match_dup 2)))]
2610 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2612 [(set_attr "type" "compare")
2613 (set_attr "length" "8,12")])
2616 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2617 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2618 (match_operand:GPR 2 "exact_log2_cint_operand"
2621 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2622 (div:GPR (match_dup 1) (match_dup 2)))]
2625 (div:<MODE> (match_dup 1) (match_dup 2)))
2627 (compare:CC (match_dup 0)
2632 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2635 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2637 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2638 (match_operand:SI 3 "gpc_reg_operand" "r")))
2639 (set (match_operand:SI 2 "register_operand" "=*q")
2642 (zero_extend:DI (match_dup 1)) (const_int 32))
2643 (zero_extend:DI (match_dup 4)))
2647 [(set_attr "type" "idiv")])
2649 ;; To do unsigned divide we handle the cases of the divisor looking like a
2650 ;; negative number. If it is a constant that is less than 2**31, we don't
2651 ;; have to worry about the branches. So make a few subroutines here.
2653 ;; First comes the normal case.
2654 (define_expand "udivmodsi4_normal"
2655 [(set (match_dup 4) (const_int 0))
2656 (parallel [(set (match_operand:SI 0 "" "")
2657 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2659 (zero_extend:DI (match_operand:SI 1 "" "")))
2660 (match_operand:SI 2 "" "")))
2661 (set (match_operand:SI 3 "" "")
2662 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2664 (zero_extend:DI (match_dup 1)))
2668 { operands[4] = gen_reg_rtx (SImode); }")
2670 ;; This handles the branches.
2671 (define_expand "udivmodsi4_tests"
2672 [(set (match_operand:SI 0 "" "") (const_int 0))
2673 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2674 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2675 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2676 (label_ref (match_operand:SI 4 "" "")) (pc)))
2677 (set (match_dup 0) (const_int 1))
2678 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2679 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2680 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2681 (label_ref (match_dup 4)) (pc)))]
2684 { operands[5] = gen_reg_rtx (CCUNSmode);
2685 operands[6] = gen_reg_rtx (CCmode);
2688 (define_expand "udivmodsi4"
2689 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2690 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2691 (match_operand:SI 2 "reg_or_cint_operand" "")))
2692 (set (match_operand:SI 3 "gpc_reg_operand" "")
2693 (umod:SI (match_dup 1) (match_dup 2)))])]
2701 if (! TARGET_POWERPC)
2703 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2704 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2705 emit_insn (gen_divus_call ());
2706 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2707 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2714 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2716 operands[2] = force_reg (SImode, operands[2]);
2717 label = gen_label_rtx ();
2718 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2719 operands[3], label));
2722 operands[2] = force_reg (SImode, operands[2]);
2724 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2732 ;; AIX architecture-independent common-mode multiply (DImode),
2733 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2734 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2735 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2736 ;; assumed unused if generating common-mode, so ignore.
2737 (define_insn "mulh_call"
2740 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2741 (sign_extend:DI (reg:SI 4)))
2743 (clobber (reg:SI LR_REGNO))]
2744 "! TARGET_POWER && ! TARGET_POWERPC"
2746 [(set_attr "type" "imul")])
2748 (define_insn "mull_call"
2750 (mult:DI (sign_extend:DI (reg:SI 3))
2751 (sign_extend:DI (reg:SI 4))))
2752 (clobber (reg:SI LR_REGNO))
2753 (clobber (reg:SI 0))]
2754 "! TARGET_POWER && ! TARGET_POWERPC"
2756 [(set_attr "type" "imul")])
2758 (define_insn "divss_call"
2760 (div:SI (reg:SI 3) (reg:SI 4)))
2762 (mod:SI (reg:SI 3) (reg:SI 4)))
2763 (clobber (reg:SI LR_REGNO))
2764 (clobber (reg:SI 0))]
2765 "! TARGET_POWER && ! TARGET_POWERPC"
2767 [(set_attr "type" "idiv")])
2769 (define_insn "divus_call"
2771 (udiv:SI (reg:SI 3) (reg:SI 4)))
2773 (umod:SI (reg:SI 3) (reg:SI 4)))
2774 (clobber (reg:SI LR_REGNO))
2775 (clobber (reg:SI 0))
2776 (clobber (match_scratch:CC 0 "=x"))
2777 (clobber (reg:CC CR1_REGNO))]
2778 "! TARGET_POWER && ! TARGET_POWERPC"
2780 [(set_attr "type" "idiv")])
2782 (define_insn "quoss_call"
2784 (div:SI (reg:SI 3) (reg:SI 4)))
2785 (clobber (reg:SI LR_REGNO))]
2786 "! TARGET_POWER && ! TARGET_POWERPC"
2788 [(set_attr "type" "idiv")])
2790 (define_insn "quous_call"
2792 (udiv:SI (reg:SI 3) (reg:SI 4)))
2793 (clobber (reg:SI LR_REGNO))
2794 (clobber (reg:SI 0))
2795 (clobber (match_scratch:CC 0 "=x"))
2796 (clobber (reg:CC CR1_REGNO))]
2797 "! TARGET_POWER && ! TARGET_POWERPC"
2799 [(set_attr "type" "idiv")])
2801 ;; Logical instructions
2802 ;; The logical instructions are mostly combined by using match_operator,
2803 ;; but the plain AND insns are somewhat different because there is no
2804 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2805 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2807 (define_insn "andsi3"
2808 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2809 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2810 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2811 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2815 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2816 {andil.|andi.} %0,%1,%b2
2817 {andiu.|andis.} %0,%1,%u2"
2818 [(set_attr "type" "*,*,compare,compare")])
2820 ;; Note to set cr's other than cr0 we do the and immediate and then
2821 ;; the test again -- this avoids a mfcr which on the higher end
2822 ;; machines causes an execution serialization
2824 (define_insn "*andsi3_internal2"
2825 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2826 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2827 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2829 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2830 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2834 {andil.|andi.} %3,%1,%b2
2835 {andiu.|andis.} %3,%1,%u2
2836 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2841 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2842 (set_attr "length" "4,4,4,4,8,8,8,8")])
2844 (define_insn "*andsi3_internal3"
2845 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2846 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2847 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2849 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2850 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2854 {andil.|andi.} %3,%1,%b2
2855 {andiu.|andis.} %3,%1,%u2
2856 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2861 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2862 (set_attr "length" "8,4,4,4,8,8,8,8")])
2865 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2866 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2867 (match_operand:GPR 2 "and_operand" ""))
2869 (clobber (match_scratch:GPR 3 ""))
2870 (clobber (match_scratch:CC 4 ""))]
2872 [(parallel [(set (match_dup 3)
2873 (and:<MODE> (match_dup 1)
2875 (clobber (match_dup 4))])
2877 (compare:CC (match_dup 3)
2881 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2882 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2885 [(set (match_operand:CC 0 "cc_reg_operand" "")
2886 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2887 (match_operand:SI 2 "gpc_reg_operand" ""))
2889 (clobber (match_scratch:SI 3 ""))
2890 (clobber (match_scratch:CC 4 ""))]
2891 "TARGET_POWERPC64 && reload_completed"
2892 [(parallel [(set (match_dup 3)
2893 (and:SI (match_dup 1)
2895 (clobber (match_dup 4))])
2897 (compare:CC (match_dup 3)
2901 (define_insn "*andsi3_internal4"
2902 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2903 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2904 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2906 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2907 (and:SI (match_dup 1)
2909 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2913 {andil.|andi.} %0,%1,%b2
2914 {andiu.|andis.} %0,%1,%u2
2915 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2920 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2921 (set_attr "length" "4,4,4,4,8,8,8,8")])
2923 (define_insn "*andsi3_internal5"
2924 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2925 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2926 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2928 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2929 (and:SI (match_dup 1)
2931 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2935 {andil.|andi.} %0,%1,%b2
2936 {andiu.|andis.} %0,%1,%u2
2937 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2942 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2943 (set_attr "length" "8,4,4,4,8,8,8,8")])
2946 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2947 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2948 (match_operand:SI 2 "and_operand" ""))
2950 (set (match_operand:SI 0 "gpc_reg_operand" "")
2951 (and:SI (match_dup 1)
2953 (clobber (match_scratch:CC 4 ""))]
2955 [(parallel [(set (match_dup 0)
2956 (and:SI (match_dup 1)
2958 (clobber (match_dup 4))])
2960 (compare:CC (match_dup 0)
2965 [(set (match_operand:CC 3 "cc_reg_operand" "")
2966 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2967 (match_operand:SI 2 "gpc_reg_operand" ""))
2969 (set (match_operand:SI 0 "gpc_reg_operand" "")
2970 (and:SI (match_dup 1)
2972 (clobber (match_scratch:CC 4 ""))]
2973 "TARGET_POWERPC64 && reload_completed"
2974 [(parallel [(set (match_dup 0)
2975 (and:SI (match_dup 1)
2977 (clobber (match_dup 4))])
2979 (compare:CC (match_dup 0)
2983 ;; Handle the PowerPC64 rlwinm corner case
2985 (define_insn_and_split "*andsi3_internal6"
2986 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2987 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2988 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2993 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2996 (rotate:SI (match_dup 0) (match_dup 5)))]
2999 int mb = extract_MB (operands[2]);
3000 int me = extract_ME (operands[2]);
3001 operands[3] = GEN_INT (me + 1);
3002 operands[5] = GEN_INT (32 - (me + 1));
3003 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3005 [(set_attr "length" "8")])
3007 (define_expand "iorsi3"
3008 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3009 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3010 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3014 if (GET_CODE (operands[2]) == CONST_INT
3015 && ! logical_operand (operands[2], SImode))
3017 HOST_WIDE_INT value = INTVAL (operands[2]);
3018 rtx tmp = ((!can_create_pseudo_p ()
3019 || rtx_equal_p (operands[0], operands[1]))
3020 ? operands[0] : gen_reg_rtx (SImode));
3022 emit_insn (gen_iorsi3 (tmp, operands[1],
3023 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3024 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3029 (define_expand "xorsi3"
3030 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3031 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3032 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3036 if (GET_CODE (operands[2]) == CONST_INT
3037 && ! logical_operand (operands[2], SImode))
3039 HOST_WIDE_INT value = INTVAL (operands[2]);
3040 rtx tmp = ((!can_create_pseudo_p ()
3041 || rtx_equal_p (operands[0], operands[1]))
3042 ? operands[0] : gen_reg_rtx (SImode));
3044 emit_insn (gen_xorsi3 (tmp, operands[1],
3045 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3046 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3051 (define_insn "*boolsi3_internal1"
3052 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3053 (match_operator:SI 3 "boolean_or_operator"
3054 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3055 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3059 {%q3il|%q3i} %0,%1,%b2
3060 {%q3iu|%q3is} %0,%1,%u2")
3062 (define_insn "*boolsi3_internal2"
3063 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3064 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3065 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3066 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3068 (clobber (match_scratch:SI 3 "=r,r"))]
3073 [(set_attr "type" "compare")
3074 (set_attr "length" "4,8")])
3077 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3078 (compare:CC (match_operator:SI 4 "boolean_operator"
3079 [(match_operand:SI 1 "gpc_reg_operand" "")
3080 (match_operand:SI 2 "gpc_reg_operand" "")])
3082 (clobber (match_scratch:SI 3 ""))]
3083 "TARGET_32BIT && reload_completed"
3084 [(set (match_dup 3) (match_dup 4))
3086 (compare:CC (match_dup 3)
3090 (define_insn "*boolsi3_internal3"
3091 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3092 (compare:CC (match_operator:SI 4 "boolean_operator"
3093 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3094 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3096 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3102 [(set_attr "type" "compare")
3103 (set_attr "length" "4,8")])
3106 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3107 (compare:CC (match_operator:SI 4 "boolean_operator"
3108 [(match_operand:SI 1 "gpc_reg_operand" "")
3109 (match_operand:SI 2 "gpc_reg_operand" "")])
3111 (set (match_operand:SI 0 "gpc_reg_operand" "")
3113 "TARGET_32BIT && reload_completed"
3114 [(set (match_dup 0) (match_dup 4))
3116 (compare:CC (match_dup 0)
3120 ;; Split a logical operation that we can't do in one insn into two insns,
3121 ;; each of which does one 16-bit part. This is used by combine.
3124 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3125 (match_operator:SI 3 "boolean_or_operator"
3126 [(match_operand:SI 1 "gpc_reg_operand" "")
3127 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3129 [(set (match_dup 0) (match_dup 4))
3130 (set (match_dup 0) (match_dup 5))]
3134 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3135 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3137 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3138 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3142 (define_insn "*boolcsi3_internal1"
3143 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3144 (match_operator:SI 3 "boolean_operator"
3145 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3146 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3150 (define_insn "*boolcsi3_internal2"
3151 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3152 (compare:CC (match_operator:SI 4 "boolean_operator"
3153 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3154 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3156 (clobber (match_scratch:SI 3 "=r,r"))]
3161 [(set_attr "type" "compare")
3162 (set_attr "length" "4,8")])
3165 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3166 (compare:CC (match_operator:SI 4 "boolean_operator"
3167 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3168 (match_operand:SI 2 "gpc_reg_operand" "")])
3170 (clobber (match_scratch:SI 3 ""))]
3171 "TARGET_32BIT && reload_completed"
3172 [(set (match_dup 3) (match_dup 4))
3174 (compare:CC (match_dup 3)
3178 (define_insn "*boolcsi3_internal3"
3179 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3180 (compare:CC (match_operator:SI 4 "boolean_operator"
3181 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3182 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3184 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3190 [(set_attr "type" "compare")
3191 (set_attr "length" "4,8")])
3194 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3195 (compare:CC (match_operator:SI 4 "boolean_operator"
3196 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3197 (match_operand:SI 2 "gpc_reg_operand" "")])
3199 (set (match_operand:SI 0 "gpc_reg_operand" "")
3201 "TARGET_32BIT && reload_completed"
3202 [(set (match_dup 0) (match_dup 4))
3204 (compare:CC (match_dup 0)
3208 (define_insn "*boolccsi3_internal1"
3209 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3210 (match_operator:SI 3 "boolean_operator"
3211 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3212 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3216 (define_insn "*boolccsi3_internal2"
3217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3218 (compare:CC (match_operator:SI 4 "boolean_operator"
3219 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3220 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3222 (clobber (match_scratch:SI 3 "=r,r"))]
3227 [(set_attr "type" "compare")
3228 (set_attr "length" "4,8")])
3231 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3232 (compare:CC (match_operator:SI 4 "boolean_operator"
3233 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3234 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3236 (clobber (match_scratch:SI 3 ""))]
3237 "TARGET_32BIT && reload_completed"
3238 [(set (match_dup 3) (match_dup 4))
3240 (compare:CC (match_dup 3)
3244 (define_insn "*boolccsi3_internal3"
3245 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3246 (compare:CC (match_operator:SI 4 "boolean_operator"
3247 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3248 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3250 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3256 [(set_attr "type" "compare")
3257 (set_attr "length" "4,8")])
3260 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3261 (compare:CC (match_operator:SI 4 "boolean_operator"
3262 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3263 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3265 (set (match_operand:SI 0 "gpc_reg_operand" "")
3267 "TARGET_32BIT && reload_completed"
3268 [(set (match_dup 0) (match_dup 4))
3270 (compare:CC (match_dup 0)
3274 ;; maskir insn. We need four forms because things might be in arbitrary
3275 ;; orders. Don't define forms that only set CR fields because these
3276 ;; would modify an input register.
3278 (define_insn "*maskir_internal1"
3279 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3280 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3281 (match_operand:SI 1 "gpc_reg_operand" "0"))
3282 (and:SI (match_dup 2)
3283 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3287 (define_insn "*maskir_internal2"
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_operand:SI 3 "gpc_reg_operand" "r")
3296 (define_insn "*maskir_internal3"
3297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3298 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3299 (match_operand:SI 3 "gpc_reg_operand" "r"))
3300 (and:SI (not:SI (match_dup 2))
3301 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3305 (define_insn "*maskir_internal4"
3306 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3307 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3308 (match_operand:SI 2 "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_internal5"
3315 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3317 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3318 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3319 (and:SI (match_dup 2)
3320 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3322 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3323 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3324 (and:SI (match_dup 2) (match_dup 3))))]
3329 [(set_attr "type" "compare")
3330 (set_attr "length" "4,8")])
3333 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3335 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3336 (match_operand:SI 1 "gpc_reg_operand" ""))
3337 (and:SI (match_dup 2)
3338 (match_operand:SI 3 "gpc_reg_operand" "")))
3340 (set (match_operand:SI 0 "gpc_reg_operand" "")
3341 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3342 (and:SI (match_dup 2) (match_dup 3))))]
3343 "TARGET_POWER && reload_completed"
3345 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3346 (and:SI (match_dup 2) (match_dup 3))))
3348 (compare:CC (match_dup 0)
3352 (define_insn "*maskir_internal6"
3353 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3355 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3356 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3357 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3360 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3361 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3362 (and:SI (match_dup 3) (match_dup 2))))]
3367 [(set_attr "type" "compare")
3368 (set_attr "length" "4,8")])
3371 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3373 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3374 (match_operand:SI 1 "gpc_reg_operand" ""))
3375 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3378 (set (match_operand:SI 0 "gpc_reg_operand" "")
3379 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3380 (and:SI (match_dup 3) (match_dup 2))))]
3381 "TARGET_POWER && reload_completed"
3383 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3384 (and:SI (match_dup 3) (match_dup 2))))
3386 (compare:CC (match_dup 0)
3390 (define_insn "*maskir_internal7"
3391 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3393 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3394 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3395 (and:SI (not:SI (match_dup 2))
3396 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3398 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3399 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3400 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3405 [(set_attr "type" "compare")
3406 (set_attr "length" "4,8")])
3409 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3411 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3412 (match_operand:SI 3 "gpc_reg_operand" ""))
3413 (and:SI (not:SI (match_dup 2))
3414 (match_operand:SI 1 "gpc_reg_operand" "")))
3416 (set (match_operand:SI 0 "gpc_reg_operand" "")
3417 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3418 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3419 "TARGET_POWER && reload_completed"
3421 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3422 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3424 (compare:CC (match_dup 0)
3428 (define_insn "*maskir_internal8"
3429 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3431 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3432 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3433 (and:SI (not:SI (match_dup 2))
3434 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3436 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3437 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3438 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3443 [(set_attr "type" "compare")
3444 (set_attr "length" "4,8")])
3447 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3449 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3450 (match_operand:SI 2 "gpc_reg_operand" ""))
3451 (and:SI (not:SI (match_dup 2))
3452 (match_operand:SI 1 "gpc_reg_operand" "")))
3454 (set (match_operand:SI 0 "gpc_reg_operand" "")
3455 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3456 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3457 "TARGET_POWER && reload_completed"
3459 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3460 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3462 (compare:CC (match_dup 0)
3466 ;; Rotate and shift insns, in all their variants. These support shifts,
3467 ;; field inserts and extracts, and various combinations thereof.
3468 (define_expand "insv"
3469 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3470 (match_operand:SI 1 "const_int_operand" "")
3471 (match_operand:SI 2 "const_int_operand" ""))
3472 (match_operand 3 "gpc_reg_operand" ""))]
3476 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3477 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3478 compiler if the address of the structure is taken later. Likewise, do
3479 not handle invalid E500 subregs. */
3480 if (GET_CODE (operands[0]) == SUBREG
3481 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3482 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3483 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3486 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3487 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3489 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3493 (define_insn "insvsi"
3494 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3495 (match_operand:SI 1 "const_int_operand" "i")
3496 (match_operand:SI 2 "const_int_operand" "i"))
3497 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3501 int start = INTVAL (operands[2]) & 31;
3502 int size = INTVAL (operands[1]) & 31;
3504 operands[4] = GEN_INT (32 - start - size);
3505 operands[1] = GEN_INT (start + size - 1);
3506 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3508 [(set_attr "type" "insert_word")])
3510 (define_insn "*insvsi_internal1"
3511 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3512 (match_operand:SI 1 "const_int_operand" "i")
3513 (match_operand:SI 2 "const_int_operand" "i"))
3514 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3515 (match_operand:SI 4 "const_int_operand" "i")))]
3516 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3519 int shift = INTVAL (operands[4]) & 31;
3520 int start = INTVAL (operands[2]) & 31;
3521 int size = INTVAL (operands[1]) & 31;
3523 operands[4] = GEN_INT (shift - start - size);
3524 operands[1] = GEN_INT (start + size - 1);
3525 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3527 [(set_attr "type" "insert_word")])
3529 (define_insn "*insvsi_internal2"
3530 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3531 (match_operand:SI 1 "const_int_operand" "i")
3532 (match_operand:SI 2 "const_int_operand" "i"))
3533 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3534 (match_operand:SI 4 "const_int_operand" "i")))]
3535 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3538 int shift = INTVAL (operands[4]) & 31;
3539 int start = INTVAL (operands[2]) & 31;
3540 int size = INTVAL (operands[1]) & 31;
3542 operands[4] = GEN_INT (32 - shift - start - size);
3543 operands[1] = GEN_INT (start + size - 1);
3544 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3546 [(set_attr "type" "insert_word")])
3548 (define_insn "*insvsi_internal3"
3549 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3550 (match_operand:SI 1 "const_int_operand" "i")
3551 (match_operand:SI 2 "const_int_operand" "i"))
3552 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3553 (match_operand:SI 4 "const_int_operand" "i")))]
3554 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3557 int shift = INTVAL (operands[4]) & 31;
3558 int start = INTVAL (operands[2]) & 31;
3559 int size = INTVAL (operands[1]) & 31;
3561 operands[4] = GEN_INT (32 - shift - start - size);
3562 operands[1] = GEN_INT (start + size - 1);
3563 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3565 [(set_attr "type" "insert_word")])
3567 (define_insn "*insvsi_internal4"
3568 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3569 (match_operand:SI 1 "const_int_operand" "i")
3570 (match_operand:SI 2 "const_int_operand" "i"))
3571 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3572 (match_operand:SI 4 "const_int_operand" "i")
3573 (match_operand:SI 5 "const_int_operand" "i")))]
3574 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3577 int extract_start = INTVAL (operands[5]) & 31;
3578 int extract_size = INTVAL (operands[4]) & 31;
3579 int insert_start = INTVAL (operands[2]) & 31;
3580 int insert_size = INTVAL (operands[1]) & 31;
3582 /* Align extract field with insert field */
3583 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3584 operands[1] = GEN_INT (insert_start + insert_size - 1);
3585 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3587 [(set_attr "type" "insert_word")])
3589 ;; combine patterns for rlwimi
3590 (define_insn "*insvsi_internal5"
3591 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3592 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3593 (match_operand:SI 1 "mask_operand" "i"))
3594 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3595 (match_operand:SI 2 "const_int_operand" "i"))
3596 (match_operand:SI 5 "mask_operand" "i"))))]
3597 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3600 int me = extract_ME(operands[5]);
3601 int mb = extract_MB(operands[5]);
3602 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3603 operands[2] = GEN_INT(mb);
3604 operands[1] = GEN_INT(me);
3605 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3607 [(set_attr "type" "insert_word")])
3609 (define_insn "*insvsi_internal6"
3610 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3611 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3612 (match_operand:SI 2 "const_int_operand" "i"))
3613 (match_operand:SI 5 "mask_operand" "i"))
3614 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3615 (match_operand:SI 1 "mask_operand" "i"))))]
3616 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3619 int me = extract_ME(operands[5]);
3620 int mb = extract_MB(operands[5]);
3621 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3622 operands[2] = GEN_INT(mb);
3623 operands[1] = GEN_INT(me);
3624 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3626 [(set_attr "type" "insert_word")])
3628 (define_insn "insvdi"
3629 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3630 (match_operand:SI 1 "const_int_operand" "i")
3631 (match_operand:SI 2 "const_int_operand" "i"))
3632 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3636 int start = INTVAL (operands[2]) & 63;
3637 int size = INTVAL (operands[1]) & 63;
3639 operands[1] = GEN_INT (64 - start - size);
3640 return \"rldimi %0,%3,%H1,%H2\";
3642 [(set_attr "type" "insert_dword")])
3644 (define_insn "*insvdi_internal2"
3645 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3646 (match_operand:SI 1 "const_int_operand" "i")
3647 (match_operand:SI 2 "const_int_operand" "i"))
3648 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3649 (match_operand:SI 4 "const_int_operand" "i")))]
3651 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3654 int shift = INTVAL (operands[4]) & 63;
3655 int start = (INTVAL (operands[2]) & 63) - 32;
3656 int size = INTVAL (operands[1]) & 63;
3658 operands[4] = GEN_INT (64 - shift - start - size);
3659 operands[2] = GEN_INT (start);
3660 operands[1] = GEN_INT (start + size - 1);
3661 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3664 (define_insn "*insvdi_internal3"
3665 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3666 (match_operand:SI 1 "const_int_operand" "i")
3667 (match_operand:SI 2 "const_int_operand" "i"))
3668 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3669 (match_operand:SI 4 "const_int_operand" "i")))]
3671 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3674 int shift = INTVAL (operands[4]) & 63;
3675 int start = (INTVAL (operands[2]) & 63) - 32;
3676 int size = INTVAL (operands[1]) & 63;
3678 operands[4] = GEN_INT (64 - shift - start - size);
3679 operands[2] = GEN_INT (start);
3680 operands[1] = GEN_INT (start + size - 1);
3681 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3684 (define_expand "extzv"
3685 [(set (match_operand 0 "gpc_reg_operand" "")
3686 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3687 (match_operand:SI 2 "const_int_operand" "")
3688 (match_operand:SI 3 "const_int_operand" "")))]
3692 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3693 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3694 compiler if the address of the structure is taken later. */
3695 if (GET_CODE (operands[0]) == SUBREG
3696 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3699 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3700 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3702 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3706 (define_insn "extzvsi"
3707 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3708 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3709 (match_operand:SI 2 "const_int_operand" "i")
3710 (match_operand:SI 3 "const_int_operand" "i")))]
3714 int start = INTVAL (operands[3]) & 31;
3715 int size = INTVAL (operands[2]) & 31;
3717 if (start + size >= 32)
3718 operands[3] = const0_rtx;
3720 operands[3] = GEN_INT (start + size);
3721 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3724 (define_insn "*extzvsi_internal1"
3725 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3726 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3727 (match_operand:SI 2 "const_int_operand" "i,i")
3728 (match_operand:SI 3 "const_int_operand" "i,i"))
3730 (clobber (match_scratch:SI 4 "=r,r"))]
3734 int start = INTVAL (operands[3]) & 31;
3735 int size = INTVAL (operands[2]) & 31;
3737 /* Force split for non-cc0 compare. */
3738 if (which_alternative == 1)
3741 /* If the bit-field being tested fits in the upper or lower half of a
3742 word, it is possible to use andiu. or andil. to test it. This is
3743 useful because the condition register set-use delay is smaller for
3744 andi[ul]. than for rlinm. This doesn't work when the starting bit
3745 position is 0 because the LT and GT bits may be set wrong. */
3747 if ((start > 0 && start + size <= 16) || start >= 16)
3749 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3750 - (1 << (16 - (start & 15) - size))));
3752 return \"{andiu.|andis.} %4,%1,%3\";
3754 return \"{andil.|andi.} %4,%1,%3\";
3757 if (start + size >= 32)
3758 operands[3] = const0_rtx;
3760 operands[3] = GEN_INT (start + size);
3761 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3763 [(set_attr "type" "delayed_compare")
3764 (set_attr "length" "4,8")])
3767 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3768 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3769 (match_operand:SI 2 "const_int_operand" "")
3770 (match_operand:SI 3 "const_int_operand" ""))
3772 (clobber (match_scratch:SI 4 ""))]
3775 (zero_extract:SI (match_dup 1) (match_dup 2)
3778 (compare:CC (match_dup 4)
3782 (define_insn "*extzvsi_internal2"
3783 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3784 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3785 (match_operand:SI 2 "const_int_operand" "i,i")
3786 (match_operand:SI 3 "const_int_operand" "i,i"))
3788 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3789 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3793 int start = INTVAL (operands[3]) & 31;
3794 int size = INTVAL (operands[2]) & 31;
3796 /* Force split for non-cc0 compare. */
3797 if (which_alternative == 1)
3800 /* Since we are using the output value, we can't ignore any need for
3801 a shift. The bit-field must end at the LSB. */
3802 if (start >= 16 && start + size == 32)
3804 operands[3] = GEN_INT ((1 << size) - 1);
3805 return \"{andil.|andi.} %0,%1,%3\";
3808 if (start + size >= 32)
3809 operands[3] = const0_rtx;
3811 operands[3] = GEN_INT (start + size);
3812 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3814 [(set_attr "type" "delayed_compare")
3815 (set_attr "length" "4,8")])
3818 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3819 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3820 (match_operand:SI 2 "const_int_operand" "")
3821 (match_operand:SI 3 "const_int_operand" ""))
3823 (set (match_operand:SI 0 "gpc_reg_operand" "")
3824 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3827 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3829 (compare:CC (match_dup 0)
3833 (define_insn "extzvdi"
3834 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3835 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3836 (match_operand:SI 2 "const_int_operand" "i")
3837 (match_operand:SI 3 "const_int_operand" "i")))]
3841 int start = INTVAL (operands[3]) & 63;
3842 int size = INTVAL (operands[2]) & 63;
3844 if (start + size >= 64)
3845 operands[3] = const0_rtx;
3847 operands[3] = GEN_INT (start + size);
3848 operands[2] = GEN_INT (64 - size);
3849 return \"rldicl %0,%1,%3,%2\";
3852 (define_insn "*extzvdi_internal1"
3853 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3854 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3855 (match_operand:SI 2 "const_int_operand" "i")
3856 (match_operand:SI 3 "const_int_operand" "i"))
3858 (clobber (match_scratch:DI 4 "=r"))]
3862 int start = INTVAL (operands[3]) & 63;
3863 int size = INTVAL (operands[2]) & 63;
3865 if (start + size >= 64)
3866 operands[3] = const0_rtx;
3868 operands[3] = GEN_INT (start + size);
3869 operands[2] = GEN_INT (64 - size);
3870 return \"rldicl. %4,%1,%3,%2\";
3872 [(set_attr "type" "compare")])
3874 (define_insn "*extzvdi_internal2"
3875 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3876 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3877 (match_operand:SI 2 "const_int_operand" "i")
3878 (match_operand:SI 3 "const_int_operand" "i"))
3880 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3881 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3885 int start = INTVAL (operands[3]) & 63;
3886 int size = INTVAL (operands[2]) & 63;
3888 if (start + size >= 64)
3889 operands[3] = const0_rtx;
3891 operands[3] = GEN_INT (start + size);
3892 operands[2] = GEN_INT (64 - size);
3893 return \"rldicl. %0,%1,%3,%2\";
3895 [(set_attr "type" "compare")])
3897 (define_insn "rotlsi3"
3898 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3899 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3900 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3903 {rlnm|rlwnm} %0,%1,%2,0xffffffff
3904 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
3905 [(set_attr "type" "var_shift_rotate,integer")])
3907 (define_insn "*rotlsi3_internal2"
3908 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3909 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3910 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3912 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3915 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
3916 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
3919 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3920 (set_attr "length" "4,4,8,8")])
3923 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3924 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3925 (match_operand:SI 2 "reg_or_cint_operand" ""))
3927 (clobber (match_scratch:SI 3 ""))]
3930 (rotate:SI (match_dup 1) (match_dup 2)))
3932 (compare:CC (match_dup 3)
3936 (define_insn "*rotlsi3_internal3"
3937 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3938 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3939 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3941 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3942 (rotate:SI (match_dup 1) (match_dup 2)))]
3945 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
3946 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
3949 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3950 (set_attr "length" "4,4,8,8")])
3953 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3954 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3955 (match_operand:SI 2 "reg_or_cint_operand" ""))
3957 (set (match_operand:SI 0 "gpc_reg_operand" "")
3958 (rotate:SI (match_dup 1) (match_dup 2)))]
3961 (rotate:SI (match_dup 1) (match_dup 2)))
3963 (compare:CC (match_dup 0)
3967 (define_insn "*rotlsi3_internal4"
3968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3969 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3970 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3971 (match_operand:SI 3 "mask_operand" "n,n")))]
3974 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
3975 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
3976 [(set_attr "type" "var_shift_rotate,integer")])
3978 (define_insn "*rotlsi3_internal5"
3979 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3981 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3982 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3983 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3985 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3988 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
3989 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3992 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3993 (set_attr "length" "4,4,8,8")])
3996 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3998 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3999 (match_operand:SI 2 "reg_or_cint_operand" ""))
4000 (match_operand:SI 3 "mask_operand" ""))
4002 (clobber (match_scratch:SI 4 ""))]
4005 (and:SI (rotate:SI (match_dup 1)
4009 (compare:CC (match_dup 4)
4013 (define_insn "*rotlsi3_internal6"
4014 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4016 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4017 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4018 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4020 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4021 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4024 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4025 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4028 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4029 (set_attr "length" "4,4,8,8")])
4032 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4034 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4035 (match_operand:SI 2 "reg_or_cint_operand" ""))
4036 (match_operand:SI 3 "mask_operand" ""))
4038 (set (match_operand:SI 0 "gpc_reg_operand" "")
4039 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4042 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4044 (compare:CC (match_dup 0)
4048 (define_insn "*rotlsi3_internal7"
4049 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4052 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4053 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4055 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
4057 (define_insn "*rotlsi3_internal8"
4058 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4059 (compare:CC (zero_extend:SI
4061 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4062 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4064 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4067 {rlnm.|rlwnm.} %3,%1,%2,0xff
4068 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4071 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4072 (set_attr "length" "4,4,8,8")])
4075 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4076 (compare:CC (zero_extend:SI
4078 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4079 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4081 (clobber (match_scratch:SI 3 ""))]
4084 (zero_extend:SI (subreg:QI
4085 (rotate:SI (match_dup 1)
4088 (compare:CC (match_dup 3)
4092 (define_insn "*rotlsi3_internal9"
4093 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4094 (compare:CC (zero_extend:SI
4096 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4097 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4099 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4100 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4103 {rlnm.|rlwnm.} %0,%1,%2,0xff
4104 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4107 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4108 (set_attr "length" "4,4,8,8")])
4111 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4112 (compare:CC (zero_extend:SI
4114 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4115 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4117 (set (match_operand:SI 0 "gpc_reg_operand" "")
4118 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4121 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4123 (compare:CC (match_dup 0)
4127 (define_insn "*rotlsi3_internal10"
4128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4131 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4132 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4135 {rlnm|rlwnm} %0,%1,%2,0xffff
4136 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4137 [(set_attr "type" "var_shift_rotate,integer")])
4140 (define_insn "*rotlsi3_internal11"
4141 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4142 (compare:CC (zero_extend:SI
4144 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4145 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4147 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4150 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4151 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4154 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4155 (set_attr "length" "4,4,8,8")])
4158 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4159 (compare:CC (zero_extend:SI
4161 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4162 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4164 (clobber (match_scratch:SI 3 ""))]
4167 (zero_extend:SI (subreg:HI
4168 (rotate:SI (match_dup 1)
4171 (compare:CC (match_dup 3)
4175 (define_insn "*rotlsi3_internal12"
4176 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4177 (compare:CC (zero_extend:SI
4179 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4180 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4182 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4183 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4186 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4187 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4190 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4191 (set_attr "length" "4,4,8,8")])
4194 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4195 (compare:CC (zero_extend:SI
4197 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4198 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4200 (set (match_operand:SI 0 "gpc_reg_operand" "")
4201 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4204 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4206 (compare:CC (match_dup 0)
4210 ;; Note that we use "sle." instead of "sl." so that we can set
4211 ;; SHIFT_COUNT_TRUNCATED.
4213 (define_expand "ashlsi3"
4214 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4215 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4216 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4221 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4223 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4227 (define_insn "ashlsi3_power"
4228 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4229 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4230 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4231 (clobber (match_scratch:SI 3 "=q,X"))]
4235 {sli|slwi} %0,%1,%h2")
4237 (define_insn "ashlsi3_no_power"
4238 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4239 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4240 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4244 {sli|slwi} %0,%1,%h2"
4245 [(set_attr "type" "var_shift_rotate,shift")])
4248 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4249 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4250 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4252 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4253 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4257 {sli.|slwi.} %3,%1,%h2
4260 [(set_attr "type" "delayed_compare")
4261 (set_attr "length" "4,4,8,8")])
4264 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4265 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4266 (match_operand:SI 2 "reg_or_cint_operand" ""))
4268 (clobber (match_scratch:SI 3 ""))
4269 (clobber (match_scratch:SI 4 ""))]
4270 "TARGET_POWER && reload_completed"
4271 [(parallel [(set (match_dup 3)
4272 (ashift:SI (match_dup 1) (match_dup 2)))
4273 (clobber (match_dup 4))])
4275 (compare:CC (match_dup 3)
4280 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4281 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4282 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4284 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4285 "! TARGET_POWER && TARGET_32BIT"
4288 {sli.|slwi.} %3,%1,%h2
4291 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4292 (set_attr "length" "4,4,8,8")])
4295 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4296 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4297 (match_operand:SI 2 "reg_or_cint_operand" ""))
4299 (clobber (match_scratch:SI 3 ""))]
4300 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4302 (ashift:SI (match_dup 1) (match_dup 2)))
4304 (compare:CC (match_dup 3)
4309 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4310 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4311 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4313 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4314 (ashift:SI (match_dup 1) (match_dup 2)))
4315 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4319 {sli.|slwi.} %0,%1,%h2
4322 [(set_attr "type" "delayed_compare")
4323 (set_attr "length" "4,4,8,8")])
4326 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4327 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4328 (match_operand:SI 2 "reg_or_cint_operand" ""))
4330 (set (match_operand:SI 0 "gpc_reg_operand" "")
4331 (ashift:SI (match_dup 1) (match_dup 2)))
4332 (clobber (match_scratch:SI 4 ""))]
4333 "TARGET_POWER && reload_completed"
4334 [(parallel [(set (match_dup 0)
4335 (ashift:SI (match_dup 1) (match_dup 2)))
4336 (clobber (match_dup 4))])
4338 (compare:CC (match_dup 0)
4343 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4344 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4345 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4347 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4348 (ashift:SI (match_dup 1) (match_dup 2)))]
4349 "! TARGET_POWER && TARGET_32BIT"
4352 {sli.|slwi.} %0,%1,%h2
4355 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4356 (set_attr "length" "4,4,8,8")])
4359 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4360 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4361 (match_operand:SI 2 "reg_or_cint_operand" ""))
4363 (set (match_operand:SI 0 "gpc_reg_operand" "")
4364 (ashift:SI (match_dup 1) (match_dup 2)))]
4365 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4367 (ashift:SI (match_dup 1) (match_dup 2)))
4369 (compare:CC (match_dup 0)
4373 (define_insn "rlwinm"
4374 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4375 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4376 (match_operand:SI 2 "const_int_operand" "i"))
4377 (match_operand:SI 3 "mask_operand" "n")))]
4378 "includes_lshift_p (operands[2], operands[3])"
4379 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4382 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4384 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4385 (match_operand:SI 2 "const_int_operand" "i,i"))
4386 (match_operand:SI 3 "mask_operand" "n,n"))
4388 (clobber (match_scratch:SI 4 "=r,r"))]
4389 "includes_lshift_p (operands[2], operands[3])"
4391 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4393 [(set_attr "type" "delayed_compare")
4394 (set_attr "length" "4,8")])
4397 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4399 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4400 (match_operand:SI 2 "const_int_operand" ""))
4401 (match_operand:SI 3 "mask_operand" ""))
4403 (clobber (match_scratch:SI 4 ""))]
4404 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4406 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4409 (compare:CC (match_dup 4)
4414 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4416 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4417 (match_operand:SI 2 "const_int_operand" "i,i"))
4418 (match_operand:SI 3 "mask_operand" "n,n"))
4420 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4421 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4422 "includes_lshift_p (operands[2], operands[3])"
4424 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4426 [(set_attr "type" "delayed_compare")
4427 (set_attr "length" "4,8")])
4430 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4432 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4433 (match_operand:SI 2 "const_int_operand" ""))
4434 (match_operand:SI 3 "mask_operand" ""))
4436 (set (match_operand:SI 0 "gpc_reg_operand" "")
4437 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4438 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4440 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4442 (compare:CC (match_dup 0)
4446 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4448 (define_expand "lshrsi3"
4449 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4450 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4451 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4456 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4458 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4462 (define_insn "lshrsi3_power"
4463 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4464 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4465 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4466 (clobber (match_scratch:SI 3 "=q,X,X"))]
4471 {s%A2i|s%A2wi} %0,%1,%h2")
4473 (define_insn "lshrsi3_no_power"
4474 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4475 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4476 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4481 {sri|srwi} %0,%1,%h2"
4482 [(set_attr "type" "integer,var_shift_rotate,shift")])
4485 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4486 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4487 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4489 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4490 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4495 {s%A2i.|s%A2wi.} %3,%1,%h2
4499 [(set_attr "type" "delayed_compare")
4500 (set_attr "length" "4,4,4,8,8,8")])
4503 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4504 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4505 (match_operand:SI 2 "reg_or_cint_operand" ""))
4507 (clobber (match_scratch:SI 3 ""))
4508 (clobber (match_scratch:SI 4 ""))]
4509 "TARGET_POWER && reload_completed"
4510 [(parallel [(set (match_dup 3)
4511 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4512 (clobber (match_dup 4))])
4514 (compare:CC (match_dup 3)
4519 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4520 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4521 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4523 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4524 "! TARGET_POWER && TARGET_32BIT"
4528 {sri.|srwi.} %3,%1,%h2
4532 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4533 (set_attr "length" "4,4,4,8,8,8")])
4536 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4537 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4538 (match_operand:SI 2 "reg_or_cint_operand" ""))
4540 (clobber (match_scratch:SI 3 ""))]
4541 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4543 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4545 (compare:CC (match_dup 3)
4550 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4551 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4552 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4554 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4555 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4556 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4561 {s%A2i.|s%A2wi.} %0,%1,%h2
4565 [(set_attr "type" "delayed_compare")
4566 (set_attr "length" "4,4,4,8,8,8")])
4569 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4570 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4571 (match_operand:SI 2 "reg_or_cint_operand" ""))
4573 (set (match_operand:SI 0 "gpc_reg_operand" "")
4574 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4575 (clobber (match_scratch:SI 4 ""))]
4576 "TARGET_POWER && reload_completed"
4577 [(parallel [(set (match_dup 0)
4578 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4579 (clobber (match_dup 4))])
4581 (compare:CC (match_dup 0)
4586 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4587 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4588 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4590 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4591 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4592 "! TARGET_POWER && TARGET_32BIT"
4596 {sri.|srwi.} %0,%1,%h2
4600 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4601 (set_attr "length" "4,4,4,8,8,8")])
4604 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4605 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4606 (match_operand:SI 2 "reg_or_cint_operand" ""))
4608 (set (match_operand:SI 0 "gpc_reg_operand" "")
4609 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4610 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4612 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4614 (compare:CC (match_dup 0)
4619 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4620 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4621 (match_operand:SI 2 "const_int_operand" "i"))
4622 (match_operand:SI 3 "mask_operand" "n")))]
4623 "includes_rshift_p (operands[2], operands[3])"
4624 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4627 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4629 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4630 (match_operand:SI 2 "const_int_operand" "i,i"))
4631 (match_operand:SI 3 "mask_operand" "n,n"))
4633 (clobber (match_scratch:SI 4 "=r,r"))]
4634 "includes_rshift_p (operands[2], operands[3])"
4636 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4638 [(set_attr "type" "delayed_compare")
4639 (set_attr "length" "4,8")])
4642 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4644 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4645 (match_operand:SI 2 "const_int_operand" ""))
4646 (match_operand:SI 3 "mask_operand" ""))
4648 (clobber (match_scratch:SI 4 ""))]
4649 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4651 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4654 (compare:CC (match_dup 4)
4659 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4661 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4662 (match_operand:SI 2 "const_int_operand" "i,i"))
4663 (match_operand:SI 3 "mask_operand" "n,n"))
4665 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4666 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4667 "includes_rshift_p (operands[2], operands[3])"
4669 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4671 [(set_attr "type" "delayed_compare")
4672 (set_attr "length" "4,8")])
4675 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4677 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4678 (match_operand:SI 2 "const_int_operand" ""))
4679 (match_operand:SI 3 "mask_operand" ""))
4681 (set (match_operand:SI 0 "gpc_reg_operand" "")
4682 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4683 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4685 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4687 (compare:CC (match_dup 0)
4692 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4695 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4696 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4697 "includes_rshift_p (operands[2], GEN_INT (255))"
4698 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4701 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4705 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4706 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4708 (clobber (match_scratch:SI 3 "=r,r"))]
4709 "includes_rshift_p (operands[2], GEN_INT (255))"
4711 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4713 [(set_attr "type" "delayed_compare")
4714 (set_attr "length" "4,8")])
4717 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4721 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4722 (match_operand:SI 2 "const_int_operand" "")) 0))
4724 (clobber (match_scratch:SI 3 ""))]
4725 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4727 (zero_extend:SI (subreg:QI
4728 (lshiftrt:SI (match_dup 1)
4731 (compare:CC (match_dup 3)
4736 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4740 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4741 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4743 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4744 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4745 "includes_rshift_p (operands[2], GEN_INT (255))"
4747 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4749 [(set_attr "type" "delayed_compare")
4750 (set_attr "length" "4,8")])
4753 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4757 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4758 (match_operand:SI 2 "const_int_operand" "")) 0))
4760 (set (match_operand:SI 0 "gpc_reg_operand" "")
4761 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4762 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4764 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4766 (compare:CC (match_dup 0)
4771 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4774 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4775 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4776 "includes_rshift_p (operands[2], GEN_INT (65535))"
4777 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4780 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4784 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4785 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4787 (clobber (match_scratch:SI 3 "=r,r"))]
4788 "includes_rshift_p (operands[2], GEN_INT (65535))"
4790 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4792 [(set_attr "type" "delayed_compare")
4793 (set_attr "length" "4,8")])
4796 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4800 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4801 (match_operand:SI 2 "const_int_operand" "")) 0))
4803 (clobber (match_scratch:SI 3 ""))]
4804 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4806 (zero_extend:SI (subreg:HI
4807 (lshiftrt:SI (match_dup 1)
4810 (compare:CC (match_dup 3)
4815 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4819 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4820 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4822 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4823 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4824 "includes_rshift_p (operands[2], GEN_INT (65535))"
4826 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4828 [(set_attr "type" "delayed_compare")
4829 (set_attr "length" "4,8")])
4832 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4836 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4837 (match_operand:SI 2 "const_int_operand" "")) 0))
4839 (set (match_operand:SI 0 "gpc_reg_operand" "")
4840 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4841 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4843 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4845 (compare:CC (match_dup 0)
4850 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4852 (match_operand:SI 1 "gpc_reg_operand" "r"))
4853 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4859 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4861 (match_operand:SI 1 "gpc_reg_operand" "r"))
4862 (lshiftrt: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 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4877 (define_expand "ashrsi3"
4878 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4879 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4880 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4885 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4887 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4891 (define_insn "ashrsi3_power"
4892 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4893 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4894 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4895 (clobber (match_scratch:SI 3 "=q,X"))]
4899 {srai|srawi} %0,%1,%h2"
4900 [(set_attr "type" "shift")])
4902 (define_insn "ashrsi3_no_power"
4903 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4904 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4905 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4909 {srai|srawi} %0,%1,%h2"
4910 [(set_attr "type" "var_shift_rotate,shift")])
4913 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4914 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4915 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4917 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4918 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4922 {srai.|srawi.} %3,%1,%h2
4925 [(set_attr "type" "delayed_compare")
4926 (set_attr "length" "4,4,8,8")])
4929 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4930 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4931 (match_operand:SI 2 "reg_or_cint_operand" ""))
4933 (clobber (match_scratch:SI 3 ""))
4934 (clobber (match_scratch:SI 4 ""))]
4935 "TARGET_POWER && reload_completed"
4936 [(parallel [(set (match_dup 3)
4937 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4938 (clobber (match_dup 4))])
4940 (compare:CC (match_dup 3)
4945 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4946 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4947 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4949 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4952 {sra.|sraw.} %3,%1,%2
4953 {srai.|srawi.} %3,%1,%h2
4956 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4957 (set_attr "length" "4,4,8,8")])
4960 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4961 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4962 (match_operand:SI 2 "reg_or_cint_operand" ""))
4964 (clobber (match_scratch:SI 3 ""))]
4965 "! TARGET_POWER && reload_completed"
4967 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4969 (compare:CC (match_dup 3)
4974 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4975 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4976 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4978 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4979 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4980 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4984 {srai.|srawi.} %0,%1,%h2
4987 [(set_attr "type" "delayed_compare")
4988 (set_attr "length" "4,4,8,8")])
4991 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4992 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4993 (match_operand:SI 2 "reg_or_cint_operand" ""))
4995 (set (match_operand:SI 0 "gpc_reg_operand" "")
4996 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4997 (clobber (match_scratch:SI 4 ""))]
4998 "TARGET_POWER && reload_completed"
4999 [(parallel [(set (match_dup 0)
5000 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5001 (clobber (match_dup 4))])
5003 (compare:CC (match_dup 0)
5008 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5009 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5010 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5012 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5013 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5016 {sra.|sraw.} %0,%1,%2
5017 {srai.|srawi.} %0,%1,%h2
5020 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5021 (set_attr "length" "4,4,8,8")])
5024 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5025 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5026 (match_operand:SI 2 "reg_or_cint_operand" ""))
5028 (set (match_operand:SI 0 "gpc_reg_operand" "")
5029 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5030 "! TARGET_POWER && reload_completed"
5032 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5034 (compare:CC (match_dup 0)
5038 ;; Floating-point insns, excluding normal data motion.
5040 ;; PowerPC has a full set of single-precision floating point instructions.
5042 ;; For the POWER architecture, we pretend that we have both SFmode and
5043 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5044 ;; The only conversions we will do will be when storing to memory. In that
5045 ;; case, we will use the "frsp" instruction before storing.
5047 ;; Note that when we store into a single-precision memory location, we need to
5048 ;; use the frsp insn first. If the register being stored isn't dead, we
5049 ;; need a scratch register for the frsp. But this is difficult when the store
5050 ;; is done by reload. It is not incorrect to do the frsp on the register in
5051 ;; this case, we just lose precision that we would have otherwise gotten but
5052 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5054 (define_expand "extendsfdf2"
5055 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5056 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5057 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5060 (define_insn_and_split "*extendsfdf2_fpr"
5061 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
5062 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5063 "TARGET_HARD_FLOAT && TARGET_FPRS"
5068 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5071 emit_note (NOTE_INSN_DELETED);
5074 [(set_attr "type" "fp,fp,fpload")])
5076 (define_expand "truncdfsf2"
5077 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5078 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5079 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5082 (define_insn "*truncdfsf2_fpr"
5083 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5084 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5085 "TARGET_HARD_FLOAT && TARGET_FPRS"
5087 [(set_attr "type" "fp")])
5089 (define_insn "aux_truncdfsf2"
5090 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5091 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5092 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5094 [(set_attr "type" "fp")])
5096 (define_expand "negsf2"
5097 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5098 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5102 (define_insn "*negsf2"
5103 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5104 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5105 "TARGET_HARD_FLOAT && TARGET_FPRS"
5107 [(set_attr "type" "fp")])
5109 (define_expand "abssf2"
5110 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5111 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5115 (define_insn "*abssf2"
5116 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5117 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5118 "TARGET_HARD_FLOAT && TARGET_FPRS"
5120 [(set_attr "type" "fp")])
5123 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5124 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5125 "TARGET_HARD_FLOAT && TARGET_FPRS"
5127 [(set_attr "type" "fp")])
5129 (define_expand "addsf3"
5130 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5131 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5132 (match_operand:SF 2 "gpc_reg_operand" "")))]
5137 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5138 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5139 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5140 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5142 [(set_attr "type" "fp")])
5145 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5146 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5147 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5148 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5149 "{fa|fadd} %0,%1,%2"
5150 [(set_attr "type" "fp")])
5152 (define_expand "subsf3"
5153 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5154 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5155 (match_operand:SF 2 "gpc_reg_operand" "")))]
5160 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5161 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5162 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5163 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5165 [(set_attr "type" "fp")])
5168 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5169 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5170 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5171 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5172 "{fs|fsub} %0,%1,%2"
5173 [(set_attr "type" "fp")])
5175 (define_expand "mulsf3"
5176 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5177 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5178 (match_operand:SF 2 "gpc_reg_operand" "")))]
5183 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5184 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5185 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5186 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5188 [(set_attr "type" "fp")])
5191 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5192 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5193 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5194 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5195 "{fm|fmul} %0,%1,%2"
5196 [(set_attr "type" "dmul")])
5199 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5200 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5201 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5203 [(set_attr "type" "fp")])
5205 (define_expand "divsf3"
5206 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5207 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5208 (match_operand:SF 2 "gpc_reg_operand" "")))]
5211 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
5212 && flag_finite_math_only && !flag_trapping_math)
5214 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5220 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5221 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5222 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5223 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5225 [(set_attr "type" "sdiv")])
5228 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5229 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5230 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5231 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5232 "{fd|fdiv} %0,%1,%2"
5233 [(set_attr "type" "ddiv")])
5236 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5237 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5238 (match_operand:SF 2 "gpc_reg_operand" "f"))
5239 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5240 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5241 "fmadds %0,%1,%2,%3"
5242 [(set_attr "type" "fp")])
5245 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5246 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5247 (match_operand:SF 2 "gpc_reg_operand" "f"))
5248 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5249 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5250 "{fma|fmadd} %0,%1,%2,%3"
5251 [(set_attr "type" "dmul")])
5254 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5255 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5256 (match_operand:SF 2 "gpc_reg_operand" "f"))
5257 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5258 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5259 "fmsubs %0,%1,%2,%3"
5260 [(set_attr "type" "fp")])
5263 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5264 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5265 (match_operand:SF 2 "gpc_reg_operand" "f"))
5266 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5267 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5268 "{fms|fmsub} %0,%1,%2,%3"
5269 [(set_attr "type" "dmul")])
5272 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5273 (neg:SF (plus: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 && TARGET_FUSED_MADD
5277 && HONOR_SIGNED_ZEROS (SFmode)"
5278 "fnmadds %0,%1,%2,%3"
5279 [(set_attr "type" "fp")])
5282 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5283 (minus:SF (mult:SF (neg: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 && TARGET_FUSED_MADD
5287 && ! HONOR_SIGNED_ZEROS (SFmode)"
5288 "fnmadds %0,%1,%2,%3"
5289 [(set_attr "type" "fp")])
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 "{fnma|fnmadd} %0,%1,%2,%3"
5298 [(set_attr "type" "dmul")])
5301 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5302 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5303 (match_operand:SF 2 "gpc_reg_operand" "f"))
5304 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5305 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5306 && ! HONOR_SIGNED_ZEROS (SFmode)"
5307 "{fnma|fnmadd} %0,%1,%2,%3"
5308 [(set_attr "type" "dmul")])
5311 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5312 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5313 (match_operand:SF 2 "gpc_reg_operand" "f"))
5314 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5315 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5316 && HONOR_SIGNED_ZEROS (SFmode)"
5317 "fnmsubs %0,%1,%2,%3"
5318 [(set_attr "type" "fp")])
5321 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5322 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5323 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5324 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5325 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5326 && ! HONOR_SIGNED_ZEROS (SFmode)"
5327 "fnmsubs %0,%1,%2,%3"
5328 [(set_attr "type" "fp")])
5331 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5332 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5333 (match_operand:SF 2 "gpc_reg_operand" "f"))
5334 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5335 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5336 "{fnms|fnmsub} %0,%1,%2,%3"
5337 [(set_attr "type" "dmul")])
5340 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5341 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5342 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5343 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5344 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5345 && ! HONOR_SIGNED_ZEROS (SFmode)"
5346 "{fnms|fnmsub} %0,%1,%2,%3"
5347 [(set_attr "type" "dmul")])
5349 (define_expand "sqrtsf2"
5350 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5351 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5352 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5356 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5357 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5358 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5360 [(set_attr "type" "ssqrt")])
5363 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5364 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5365 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5367 [(set_attr "type" "dsqrt")])
5369 (define_expand "copysignsf3"
5371 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5373 (neg:SF (abs:SF (match_dup 1))))
5374 (set (match_operand:SF 0 "gpc_reg_operand" "")
5375 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5379 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5380 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5382 operands[3] = gen_reg_rtx (SFmode);
5383 operands[4] = gen_reg_rtx (SFmode);
5384 operands[5] = CONST0_RTX (SFmode);
5387 (define_expand "copysigndf3"
5389 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5391 (neg:DF (abs:DF (match_dup 1))))
5392 (set (match_operand:DF 0 "gpc_reg_operand" "")
5393 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5397 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5398 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5400 operands[3] = gen_reg_rtx (DFmode);
5401 operands[4] = gen_reg_rtx (DFmode);
5402 operands[5] = CONST0_RTX (DFmode);
5405 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5406 ;; fsel instruction and some auxiliary computations. Then we just have a
5407 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5409 (define_expand "smaxsf3"
5410 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5411 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5412 (match_operand:SF 2 "gpc_reg_operand" ""))
5415 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5416 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5418 (define_expand "sminsf3"
5419 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5420 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5421 (match_operand:SF 2 "gpc_reg_operand" ""))
5424 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5425 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5428 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5429 (match_operator:SF 3 "min_max_operator"
5430 [(match_operand:SF 1 "gpc_reg_operand" "")
5431 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5432 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5435 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5436 operands[1], operands[2]);
5440 (define_expand "movsicc"
5441 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5442 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5443 (match_operand:SI 2 "gpc_reg_operand" "")
5444 (match_operand:SI 3 "gpc_reg_operand" "")))]
5448 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5454 ;; We use the BASE_REGS for the isel input operands because, if rA is
5455 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5456 ;; because we may switch the operands and rB may end up being rA.
5458 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5459 ;; leave out the mode in operand 4 and use one pattern, but reload can
5460 ;; change the mode underneath our feet and then gets confused trying
5461 ;; to reload the value.
5462 (define_insn "isel_signed"
5463 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5465 (match_operator 1 "comparison_operator"
5466 [(match_operand:CC 4 "cc_reg_operand" "y")
5468 (match_operand:SI 2 "gpc_reg_operand" "b")
5469 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5472 { return output_isel (operands); }"
5473 [(set_attr "length" "4")])
5475 (define_insn "isel_unsigned"
5476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5478 (match_operator 1 "comparison_operator"
5479 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5481 (match_operand:SI 2 "gpc_reg_operand" "b")
5482 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5485 { return output_isel (operands); }"
5486 [(set_attr "length" "4")])
5488 (define_expand "movsfcc"
5489 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5490 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5491 (match_operand:SF 2 "gpc_reg_operand" "")
5492 (match_operand:SF 3 "gpc_reg_operand" "")))]
5493 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5496 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5502 (define_insn "*fselsfsf4"
5503 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5504 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5505 (match_operand:SF 4 "zero_fp_constant" "F"))
5506 (match_operand:SF 2 "gpc_reg_operand" "f")
5507 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5508 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5510 [(set_attr "type" "fp")])
5512 (define_insn "*fseldfsf4"
5513 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5514 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5515 (match_operand:DF 4 "zero_fp_constant" "F"))
5516 (match_operand:SF 2 "gpc_reg_operand" "f")
5517 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5518 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5520 [(set_attr "type" "fp")])
5522 (define_expand "negdf2"
5523 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5524 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5525 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5528 (define_insn "*negdf2_fpr"
5529 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5530 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5531 "TARGET_HARD_FLOAT && TARGET_FPRS"
5533 [(set_attr "type" "fp")])
5535 (define_expand "absdf2"
5536 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5537 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5538 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5541 (define_insn "*absdf2_fpr"
5542 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5543 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5544 "TARGET_HARD_FLOAT && TARGET_FPRS"
5546 [(set_attr "type" "fp")])
5548 (define_insn "*nabsdf2_fpr"
5549 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5550 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5551 "TARGET_HARD_FLOAT && TARGET_FPRS"
5553 [(set_attr "type" "fp")])
5555 (define_expand "adddf3"
5556 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5557 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5558 (match_operand:DF 2 "gpc_reg_operand" "")))]
5559 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5562 (define_insn "*adddf3_fpr"
5563 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5564 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5565 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5566 "TARGET_HARD_FLOAT && TARGET_FPRS"
5567 "{fa|fadd} %0,%1,%2"
5568 [(set_attr "type" "fp")])
5570 (define_expand "subdf3"
5571 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5572 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5573 (match_operand:DF 2 "gpc_reg_operand" "")))]
5574 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5577 (define_insn "*subdf3_fpr"
5578 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5579 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5580 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5581 "TARGET_HARD_FLOAT && TARGET_FPRS"
5582 "{fs|fsub} %0,%1,%2"
5583 [(set_attr "type" "fp")])
5585 (define_expand "muldf3"
5586 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5587 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5588 (match_operand:DF 2 "gpc_reg_operand" "")))]
5589 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5592 (define_insn "*muldf3_fpr"
5593 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5594 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5595 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5596 "TARGET_HARD_FLOAT && TARGET_FPRS"
5597 "{fm|fmul} %0,%1,%2"
5598 [(set_attr "type" "dmul")])
5601 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5602 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5603 "TARGET_POPCNTB && flag_finite_math_only"
5605 [(set_attr "type" "fp")])
5607 (define_expand "divdf3"
5608 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5609 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5610 (match_operand:DF 2 "gpc_reg_operand" "")))]
5611 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5613 if (swdiv && !optimize_size && TARGET_POPCNTB
5614 && flag_finite_math_only && !flag_trapping_math)
5616 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5621 (define_insn "*divdf3_fpr"
5622 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5623 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5624 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5625 "TARGET_HARD_FLOAT && TARGET_FPRS"
5626 "{fd|fdiv} %0,%1,%2"
5627 [(set_attr "type" "ddiv")])
5630 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5631 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5632 (match_operand:DF 2 "gpc_reg_operand" "f"))
5633 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5634 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5635 "{fma|fmadd} %0,%1,%2,%3"
5636 [(set_attr "type" "dmul")])
5639 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5640 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5641 (match_operand:DF 2 "gpc_reg_operand" "f"))
5642 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5643 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5644 "{fms|fmsub} %0,%1,%2,%3"
5645 [(set_attr "type" "dmul")])
5648 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5649 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5650 (match_operand:DF 2 "gpc_reg_operand" "f"))
5651 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5652 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5653 && HONOR_SIGNED_ZEROS (DFmode)"
5654 "{fnma|fnmadd} %0,%1,%2,%3"
5655 [(set_attr "type" "dmul")])
5658 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5659 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5660 (match_operand:DF 2 "gpc_reg_operand" "f"))
5661 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5662 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5663 && ! HONOR_SIGNED_ZEROS (DFmode)"
5664 "{fnma|fnmadd} %0,%1,%2,%3"
5665 [(set_attr "type" "dmul")])
5668 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5669 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5670 (match_operand:DF 2 "gpc_reg_operand" "f"))
5671 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5672 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5673 && HONOR_SIGNED_ZEROS (DFmode)"
5674 "{fnms|fnmsub} %0,%1,%2,%3"
5675 [(set_attr "type" "dmul")])
5678 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5679 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5680 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5681 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5682 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5683 && ! HONOR_SIGNED_ZEROS (DFmode)"
5684 "{fnms|fnmsub} %0,%1,%2,%3"
5685 [(set_attr "type" "dmul")])
5687 (define_insn "sqrtdf2"
5688 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5689 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5690 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5692 [(set_attr "type" "dsqrt")])
5694 ;; The conditional move instructions allow us to perform max and min
5695 ;; operations even when
5697 (define_expand "smaxdf3"
5698 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5699 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5700 (match_operand:DF 2 "gpc_reg_operand" ""))
5703 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5704 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5706 (define_expand "smindf3"
5707 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5708 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5709 (match_operand:DF 2 "gpc_reg_operand" ""))
5712 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5713 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5716 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5717 (match_operator:DF 3 "min_max_operator"
5718 [(match_operand:DF 1 "gpc_reg_operand" "")
5719 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5720 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5723 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5724 operands[1], operands[2]);
5728 (define_expand "movdfcc"
5729 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5730 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5731 (match_operand:DF 2 "gpc_reg_operand" "")
5732 (match_operand:DF 3 "gpc_reg_operand" "")))]
5733 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5736 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5742 (define_insn "*fseldfdf4"
5743 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5744 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5745 (match_operand:DF 4 "zero_fp_constant" "F"))
5746 (match_operand:DF 2 "gpc_reg_operand" "f")
5747 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5748 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5750 [(set_attr "type" "fp")])
5752 (define_insn "*fselsfdf4"
5753 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5754 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5755 (match_operand:SF 4 "zero_fp_constant" "F"))
5756 (match_operand:DF 2 "gpc_reg_operand" "f")
5757 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5760 [(set_attr "type" "fp")])
5762 ;; Conversions to and from floating-point.
5764 (define_expand "fixuns_truncsfsi2"
5765 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5766 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5767 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5770 (define_expand "fix_truncsfsi2"
5771 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5772 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5773 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5776 ; For each of these conversions, there is a define_expand, a define_insn
5777 ; with a '#' template, and a define_split (with C code). The idea is
5778 ; to allow constant folding with the template of the define_insn,
5779 ; then to have the insns split later (between sched1 and final).
5781 (define_expand "floatsidf2"
5782 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5783 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5786 (clobber (match_dup 4))
5787 (clobber (match_dup 5))
5788 (clobber (match_dup 6))])]
5789 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5792 if (TARGET_E500_DOUBLE)
5794 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5797 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS)
5799 rtx t1 = gen_reg_rtx (DImode);
5800 emit_insn (gen_floatsidf_ppc64_mfpgpr (operands[0], operands[1], t1));
5803 if (TARGET_POWERPC64)
5805 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5806 rtx t1 = gen_reg_rtx (DImode);
5807 rtx t2 = gen_reg_rtx (DImode);
5808 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5812 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5813 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5814 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5815 operands[5] = gen_reg_rtx (DFmode);
5816 operands[6] = gen_reg_rtx (SImode);
5819 (define_insn_and_split "*floatsidf2_internal"
5820 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5821 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5822 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5823 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5824 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5825 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5826 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5827 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5829 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5833 rtx lowword, highword;
5834 gcc_assert (MEM_P (operands[4]));
5835 highword = adjust_address (operands[4], SImode, 0);
5836 lowword = adjust_address (operands[4], SImode, 4);
5837 if (! WORDS_BIG_ENDIAN)
5840 tmp = highword; highword = lowword; lowword = tmp;
5843 emit_insn (gen_xorsi3 (operands[6], operands[1],
5844 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5845 emit_move_insn (lowword, operands[6]);
5846 emit_move_insn (highword, operands[2]);
5847 emit_move_insn (operands[5], operands[4]);
5848 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5851 [(set_attr "length" "24")])
5853 (define_expand "floatunssisf2"
5854 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5855 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5856 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5859 (define_expand "floatunssidf2"
5860 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5861 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5864 (clobber (match_dup 4))
5865 (clobber (match_dup 5))])]
5866 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5869 if (TARGET_E500_DOUBLE)
5871 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5874 if (TARGET_POWERPC64)
5876 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5877 rtx t1 = gen_reg_rtx (DImode);
5878 rtx t2 = gen_reg_rtx (DImode);
5879 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5884 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5885 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5886 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5887 operands[5] = gen_reg_rtx (DFmode);
5890 (define_insn_and_split "*floatunssidf2_internal"
5891 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5892 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5893 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5894 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5895 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5896 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5897 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5899 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5903 rtx lowword, highword;
5904 gcc_assert (MEM_P (operands[4]));
5905 highword = adjust_address (operands[4], SImode, 0);
5906 lowword = adjust_address (operands[4], SImode, 4);
5907 if (! WORDS_BIG_ENDIAN)
5910 tmp = highword; highword = lowword; lowword = tmp;
5913 emit_move_insn (lowword, operands[1]);
5914 emit_move_insn (highword, operands[2]);
5915 emit_move_insn (operands[5], operands[4]);
5916 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5919 [(set_attr "length" "20")])
5921 (define_expand "fix_truncdfsi2"
5922 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5923 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5924 (clobber (match_dup 2))
5925 (clobber (match_dup 3))])]
5926 "(TARGET_POWER2 || TARGET_POWERPC)
5927 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5930 if (TARGET_E500_DOUBLE)
5932 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5935 operands[2] = gen_reg_rtx (DImode);
5936 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
5937 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
5939 operands[3] = gen_reg_rtx (DImode);
5940 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
5941 operands[2], operands[3]));
5944 if (TARGET_PPC_GFXOPT)
5946 rtx orig_dest = operands[0];
5947 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5948 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5949 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5951 if (operands[0] != orig_dest)
5952 emit_move_insn (orig_dest, operands[0]);
5955 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5958 (define_insn_and_split "*fix_truncdfsi2_internal"
5959 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5960 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5961 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5962 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5963 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5965 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[3]))"
5970 gcc_assert (MEM_P (operands[3]));
5971 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5973 emit_insn (gen_fctiwz (operands[2], operands[1]));
5974 emit_move_insn (operands[3], operands[2]);
5975 emit_move_insn (operands[0], lowword);
5978 [(set_attr "length" "16")])
5980 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5981 [(set (match_operand:SI 0 "memory_operand" "=Z")
5982 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5983 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5984 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5985 && TARGET_PPC_GFXOPT"
5991 emit_insn (gen_fctiwz (operands[2], operands[1]));
5992 emit_insn (gen_stfiwx (operands[0], operands[2]));
5995 [(set_attr "length" "16")])
5997 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
5998 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5999 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6000 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
6001 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6002 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6005 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6006 (set (match_dup 3) (match_dup 2))
6007 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6009 [(set_attr "length" "12")])
6011 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6012 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6013 ; because the first makes it clear that operand 0 is not live
6014 ; before the instruction.
6015 (define_insn "fctiwz"
6016 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
6017 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
6019 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
6020 "{fcirz|fctiwz} %0,%1"
6021 [(set_attr "type" "fp")])
6023 (define_insn "btruncdf2"
6024 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6025 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6026 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6028 [(set_attr "type" "fp")])
6030 (define_insn "btruncsf2"
6031 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6032 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6033 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6035 [(set_attr "type" "fp")])
6037 (define_insn "ceildf2"
6038 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6039 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6040 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6042 [(set_attr "type" "fp")])
6044 (define_insn "ceilsf2"
6045 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6046 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6047 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6049 [(set_attr "type" "fp")])
6051 (define_insn "floordf2"
6052 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6053 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6054 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6056 [(set_attr "type" "fp")])
6058 (define_insn "floorsf2"
6059 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6060 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6061 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6063 [(set_attr "type" "fp")])
6065 (define_insn "rounddf2"
6066 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6067 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6068 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6070 [(set_attr "type" "fp")])
6072 (define_insn "roundsf2"
6073 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6074 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6075 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6077 [(set_attr "type" "fp")])
6079 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6080 (define_insn "stfiwx"
6081 [(set (match_operand:SI 0 "memory_operand" "=Z")
6082 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
6086 [(set_attr "type" "fpstore")])
6088 (define_expand "floatsisf2"
6089 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6090 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6091 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6094 (define_insn "floatdidf2"
6095 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6096 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
6097 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6099 [(set_attr "type" "fp")])
6101 (define_insn_and_split "floatsidf_ppc64_mfpgpr"
6102 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6103 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6104 (clobber (match_operand:DI 2 "gpc_reg_operand" "=r"))]
6105 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6108 [(set (match_dup 2) (sign_extend:DI (match_dup 1)))
6109 (set (match_dup 0) (float:DF (match_dup 2)))]
6112 (define_insn_and_split "floatsidf_ppc64"
6113 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6114 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6115 (clobber (match_operand:DI 2 "memory_operand" "=o"))
6116 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6117 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6118 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6121 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
6122 (set (match_dup 2) (match_dup 3))
6123 (set (match_dup 4) (match_dup 2))
6124 (set (match_dup 0) (float:DF (match_dup 4)))]
6127 (define_insn_and_split "floatunssidf_ppc64"
6128 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6129 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6130 (clobber (match_operand:DI 2 "memory_operand" "=o"))
6131 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6132 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6133 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6136 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
6137 (set (match_dup 2) (match_dup 3))
6138 (set (match_dup 4) (match_dup 2))
6139 (set (match_dup 0) (float:DF (match_dup 4)))]
6142 (define_insn "fix_truncdfdi2"
6143 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
6144 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
6145 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6147 [(set_attr "type" "fp")])
6149 (define_expand "floatdisf2"
6150 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6151 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6152 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6155 rtx val = operands[1];
6156 if (!flag_unsafe_math_optimizations)
6158 rtx label = gen_label_rtx ();
6159 val = gen_reg_rtx (DImode);
6160 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6163 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6167 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6168 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6169 ;; from double rounding.
6170 (define_insn_and_split "floatdisf2_internal1"
6171 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6172 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
6173 (clobber (match_scratch:DF 2 "=f"))]
6174 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6176 "&& reload_completed"
6178 (float:DF (match_dup 1)))
6180 (float_truncate:SF (match_dup 2)))]
6183 ;; Twiddles bits to avoid double rounding.
6184 ;; Bits that might be truncated when converting to DFmode are replaced
6185 ;; by a bit that won't be lost at that stage, but is below the SFmode
6186 ;; rounding position.
6187 (define_expand "floatdisf2_internal2"
6188 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6190 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6192 (clobber (scratch:CC))])
6193 (set (match_dup 3) (plus:DI (match_dup 3)
6195 (set (match_dup 0) (plus:DI (match_dup 0)
6197 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6199 (set (match_dup 0) (ior:DI (match_dup 0)
6201 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6203 (clobber (scratch:CC))])
6204 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6205 (label_ref (match_operand:DI 2 "" ""))
6207 (set (match_dup 0) (match_dup 1))]
6208 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6211 operands[3] = gen_reg_rtx (DImode);
6212 operands[4] = gen_reg_rtx (CCUNSmode);
6215 ;; Define the DImode operations that can be done in a small number
6216 ;; of instructions. The & constraints are to prevent the register
6217 ;; allocator from allocating registers that overlap with the inputs
6218 ;; (for example, having an input in 7,8 and an output in 6,7). We
6219 ;; also allow for the output being the same as one of the inputs.
6221 (define_insn "*adddi3_noppc64"
6222 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6223 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6224 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6225 "! TARGET_POWERPC64"
6228 if (WORDS_BIG_ENDIAN)
6229 return (GET_CODE (operands[2])) != CONST_INT
6230 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6231 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6233 return (GET_CODE (operands[2])) != CONST_INT
6234 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6235 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6237 [(set_attr "type" "two")
6238 (set_attr "length" "8")])
6240 (define_insn "*subdi3_noppc64"
6241 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6242 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6243 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6244 "! TARGET_POWERPC64"
6247 if (WORDS_BIG_ENDIAN)
6248 return (GET_CODE (operands[1]) != CONST_INT)
6249 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6250 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6252 return (GET_CODE (operands[1]) != CONST_INT)
6253 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6254 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6256 [(set_attr "type" "two")
6257 (set_attr "length" "8")])
6259 (define_insn "*negdi2_noppc64"
6260 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6261 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6262 "! TARGET_POWERPC64"
6265 return (WORDS_BIG_ENDIAN)
6266 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6267 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6269 [(set_attr "type" "two")
6270 (set_attr "length" "8")])
6272 (define_expand "mulsidi3"
6273 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6274 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6275 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6276 "! TARGET_POWERPC64"
6279 if (! TARGET_POWER && ! TARGET_POWERPC)
6281 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6282 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6283 emit_insn (gen_mull_call ());
6284 if (WORDS_BIG_ENDIAN)
6285 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6288 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6289 gen_rtx_REG (SImode, 3));
6290 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6291 gen_rtx_REG (SImode, 4));
6295 else if (TARGET_POWER)
6297 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6302 (define_insn "mulsidi3_mq"
6303 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6304 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6305 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6306 (clobber (match_scratch:SI 3 "=q"))]
6308 "mul %0,%1,%2\;mfmq %L0"
6309 [(set_attr "type" "imul")
6310 (set_attr "length" "8")])
6312 (define_insn "*mulsidi3_no_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 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6319 return (WORDS_BIG_ENDIAN)
6320 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6321 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6323 [(set_attr "type" "imul")
6324 (set_attr "length" "8")])
6327 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6328 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6329 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6330 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6333 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6334 (sign_extend:DI (match_dup 2)))
6337 (mult:SI (match_dup 1)
6341 int endian = (WORDS_BIG_ENDIAN == 0);
6342 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6343 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6346 (define_expand "umulsidi3"
6347 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6348 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6349 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6350 "TARGET_POWERPC && ! TARGET_POWERPC64"
6355 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6360 (define_insn "umulsidi3_mq"
6361 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6362 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6363 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6364 (clobber (match_scratch:SI 3 "=q"))]
6365 "TARGET_POWERPC && TARGET_POWER"
6368 return (WORDS_BIG_ENDIAN)
6369 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6370 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6372 [(set_attr "type" "imul")
6373 (set_attr "length" "8")])
6375 (define_insn "*umulsidi3_no_mq"
6376 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6377 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6378 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6379 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6382 return (WORDS_BIG_ENDIAN)
6383 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6384 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6386 [(set_attr "type" "imul")
6387 (set_attr "length" "8")])
6390 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6391 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6392 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6393 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6396 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6397 (zero_extend:DI (match_dup 2)))
6400 (mult:SI (match_dup 1)
6404 int endian = (WORDS_BIG_ENDIAN == 0);
6405 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6406 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6409 (define_expand "smulsi3_highpart"
6410 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6412 (lshiftrt:DI (mult:DI (sign_extend:DI
6413 (match_operand:SI 1 "gpc_reg_operand" ""))
6415 (match_operand:SI 2 "gpc_reg_operand" "")))
6420 if (! TARGET_POWER && ! TARGET_POWERPC)
6422 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6423 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6424 emit_insn (gen_mulh_call ());
6425 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6428 else if (TARGET_POWER)
6430 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6435 (define_insn "smulsi3_highpart_mq"
6436 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6438 (lshiftrt:DI (mult:DI (sign_extend:DI
6439 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6441 (match_operand:SI 2 "gpc_reg_operand" "r")))
6443 (clobber (match_scratch:SI 3 "=q"))]
6446 [(set_attr "type" "imul")])
6448 (define_insn "*smulsi3_highpart_no_mq"
6449 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6451 (lshiftrt:DI (mult:DI (sign_extend:DI
6452 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6454 (match_operand:SI 2 "gpc_reg_operand" "r")))
6456 "TARGET_POWERPC && ! TARGET_POWER"
6458 [(set_attr "type" "imul")])
6460 (define_expand "umulsi3_highpart"
6461 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6463 (lshiftrt:DI (mult:DI (zero_extend:DI
6464 (match_operand:SI 1 "gpc_reg_operand" ""))
6466 (match_operand:SI 2 "gpc_reg_operand" "")))
6473 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6478 (define_insn "umulsi3_highpart_mq"
6479 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6481 (lshiftrt:DI (mult:DI (zero_extend:DI
6482 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6484 (match_operand:SI 2 "gpc_reg_operand" "r")))
6486 (clobber (match_scratch:SI 3 "=q"))]
6487 "TARGET_POWERPC && TARGET_POWER"
6489 [(set_attr "type" "imul")])
6491 (define_insn "*umulsi3_highpart_no_mq"
6492 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6494 (lshiftrt:DI (mult:DI (zero_extend:DI
6495 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6497 (match_operand:SI 2 "gpc_reg_operand" "r")))
6499 "TARGET_POWERPC && ! TARGET_POWER"
6501 [(set_attr "type" "imul")])
6503 ;; If operands 0 and 2 are in the same register, we have a problem. But
6504 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6505 ;; why we have the strange constraints below.
6506 (define_insn "ashldi3_power"
6507 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6508 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6509 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6510 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6513 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6514 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6515 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6516 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6517 [(set_attr "length" "8")])
6519 (define_insn "lshrdi3_power"
6520 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6521 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6522 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6523 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6526 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6527 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6528 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6529 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6530 [(set_attr "length" "8")])
6532 ;; Shift by a variable amount is too complex to be worth open-coding. We
6533 ;; just handle shifts by constants.
6534 (define_insn "ashrdi3_power"
6535 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6536 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6537 (match_operand:SI 2 "const_int_operand" "M,i")))
6538 (clobber (match_scratch:SI 3 "=X,q"))]
6541 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6542 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6543 [(set_attr "type" "shift")
6544 (set_attr "length" "8")])
6546 (define_insn "ashrdi3_no_power"
6547 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6548 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6549 (match_operand:SI 2 "const_int_operand" "M,i")))]
6550 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6552 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6553 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6554 [(set_attr "type" "two,three")
6555 (set_attr "length" "8,12")])
6557 (define_insn "*ashrdisi3_noppc64"
6558 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6559 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6560 (const_int 32)) 4))]
6561 "TARGET_32BIT && !TARGET_POWERPC64"
6564 if (REGNO (operands[0]) == REGNO (operands[1]))
6567 return \"mr %0,%1\";
6569 [(set_attr "length" "4")])
6572 ;; PowerPC64 DImode operations.
6574 (define_insn_and_split "absdi2"
6575 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6576 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6577 (clobber (match_scratch:DI 2 "=&r,&r"))]
6580 "&& reload_completed"
6581 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6582 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6583 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6586 (define_insn_and_split "*nabsdi2"
6587 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6588 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6589 (clobber (match_scratch:DI 2 "=&r,&r"))]
6592 "&& reload_completed"
6593 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6594 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6595 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6598 (define_insn "muldi3"
6599 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6600 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6601 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6607 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6608 (const_string "imul3")
6609 (match_operand:SI 2 "short_cint_operand" "")
6610 (const_string "imul2")]
6611 (const_string "lmul")))])
6613 (define_insn "*muldi3_internal1"
6614 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6615 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6616 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6618 (clobber (match_scratch:DI 3 "=r,r"))]
6623 [(set_attr "type" "lmul_compare")
6624 (set_attr "length" "4,8")])
6627 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6628 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6629 (match_operand:DI 2 "gpc_reg_operand" ""))
6631 (clobber (match_scratch:DI 3 ""))]
6632 "TARGET_POWERPC64 && reload_completed"
6634 (mult:DI (match_dup 1) (match_dup 2)))
6636 (compare:CC (match_dup 3)
6640 (define_insn "*muldi3_internal2"
6641 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6642 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6643 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6645 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6646 (mult:DI (match_dup 1) (match_dup 2)))]
6651 [(set_attr "type" "lmul_compare")
6652 (set_attr "length" "4,8")])
6655 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6656 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6657 (match_operand:DI 2 "gpc_reg_operand" ""))
6659 (set (match_operand:DI 0 "gpc_reg_operand" "")
6660 (mult:DI (match_dup 1) (match_dup 2)))]
6661 "TARGET_POWERPC64 && reload_completed"
6663 (mult:DI (match_dup 1) (match_dup 2)))
6665 (compare:CC (match_dup 0)
6669 (define_insn "smuldi3_highpart"
6670 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6672 (lshiftrt:TI (mult:TI (sign_extend:TI
6673 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6675 (match_operand:DI 2 "gpc_reg_operand" "r")))
6679 [(set_attr "type" "lmul")])
6681 (define_insn "umuldi3_highpart"
6682 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6684 (lshiftrt:TI (mult:TI (zero_extend:TI
6685 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6687 (match_operand:DI 2 "gpc_reg_operand" "r")))
6691 [(set_attr "type" "lmul")])
6693 (define_insn "rotldi3"
6694 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6695 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6696 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6701 [(set_attr "type" "var_shift_rotate,integer")])
6703 (define_insn "*rotldi3_internal2"
6704 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6705 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6706 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6708 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6715 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6716 (set_attr "length" "4,4,8,8")])
6719 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6720 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6721 (match_operand:DI 2 "reg_or_cint_operand" ""))
6723 (clobber (match_scratch:DI 3 ""))]
6724 "TARGET_POWERPC64 && reload_completed"
6726 (rotate:DI (match_dup 1) (match_dup 2)))
6728 (compare:CC (match_dup 3)
6732 (define_insn "*rotldi3_internal3"
6733 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6734 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6735 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6737 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6738 (rotate:DI (match_dup 1) (match_dup 2)))]
6745 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6746 (set_attr "length" "4,4,8,8")])
6749 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6750 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6751 (match_operand:DI 2 "reg_or_cint_operand" ""))
6753 (set (match_operand:DI 0 "gpc_reg_operand" "")
6754 (rotate:DI (match_dup 1) (match_dup 2)))]
6755 "TARGET_POWERPC64 && reload_completed"
6757 (rotate:DI (match_dup 1) (match_dup 2)))
6759 (compare:CC (match_dup 0)
6763 (define_insn "*rotldi3_internal4"
6764 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6765 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6766 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6767 (match_operand:DI 3 "mask64_operand" "n,n")))]
6770 rldc%B3 %0,%1,%2,%S3
6771 rldic%B3 %0,%1,%H2,%S3"
6772 [(set_attr "type" "var_shift_rotate,integer")])
6774 (define_insn "*rotldi3_internal5"
6775 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6777 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6778 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6779 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6781 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6784 rldc%B3. %4,%1,%2,%S3
6785 rldic%B3. %4,%1,%H2,%S3
6788 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6789 (set_attr "length" "4,4,8,8")])
6792 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6794 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6795 (match_operand:DI 2 "reg_or_cint_operand" ""))
6796 (match_operand:DI 3 "mask64_operand" ""))
6798 (clobber (match_scratch:DI 4 ""))]
6799 "TARGET_POWERPC64 && reload_completed"
6801 (and:DI (rotate:DI (match_dup 1)
6805 (compare:CC (match_dup 4)
6809 (define_insn "*rotldi3_internal6"
6810 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6812 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6813 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6814 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6816 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6817 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6820 rldc%B3. %0,%1,%2,%S3
6821 rldic%B3. %0,%1,%H2,%S3
6824 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6825 (set_attr "length" "4,4,8,8")])
6828 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6830 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6831 (match_operand:DI 2 "reg_or_cint_operand" ""))
6832 (match_operand:DI 3 "mask64_operand" ""))
6834 (set (match_operand:DI 0 "gpc_reg_operand" "")
6835 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6836 "TARGET_POWERPC64 && reload_completed"
6838 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6840 (compare:CC (match_dup 0)
6844 (define_insn "*rotldi3_internal7"
6845 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6848 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6849 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6853 rldicl %0,%1,%H2,56"
6854 [(set_attr "type" "var_shift_rotate,integer")])
6856 (define_insn "*rotldi3_internal8"
6857 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6858 (compare:CC (zero_extend:DI
6860 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6861 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6863 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6867 rldicl. %3,%1,%H2,56
6870 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6871 (set_attr "length" "4,4,8,8")])
6874 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6875 (compare:CC (zero_extend:DI
6877 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6878 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6880 (clobber (match_scratch:DI 3 ""))]
6881 "TARGET_POWERPC64 && reload_completed"
6883 (zero_extend:DI (subreg:QI
6884 (rotate:DI (match_dup 1)
6887 (compare:CC (match_dup 3)
6891 (define_insn "*rotldi3_internal9"
6892 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6893 (compare:CC (zero_extend:DI
6895 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6896 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6898 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6899 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6903 rldicl. %0,%1,%H2,56
6906 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6907 (set_attr "length" "4,4,8,8")])
6910 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6911 (compare:CC (zero_extend:DI
6913 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6914 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6916 (set (match_operand:DI 0 "gpc_reg_operand" "")
6917 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6918 "TARGET_POWERPC64 && reload_completed"
6920 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6922 (compare:CC (match_dup 0)
6926 (define_insn "*rotldi3_internal10"
6927 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6930 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6931 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6935 rldicl %0,%1,%H2,48"
6936 [(set_attr "type" "var_shift_rotate,integer")])
6938 (define_insn "*rotldi3_internal11"
6939 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6940 (compare:CC (zero_extend:DI
6942 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6943 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6945 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6949 rldicl. %3,%1,%H2,48
6952 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6953 (set_attr "length" "4,4,8,8")])
6956 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6957 (compare:CC (zero_extend:DI
6959 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6960 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6962 (clobber (match_scratch:DI 3 ""))]
6963 "TARGET_POWERPC64 && reload_completed"
6965 (zero_extend:DI (subreg:HI
6966 (rotate:DI (match_dup 1)
6969 (compare:CC (match_dup 3)
6973 (define_insn "*rotldi3_internal12"
6974 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6975 (compare:CC (zero_extend:DI
6977 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6978 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6980 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6981 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6985 rldicl. %0,%1,%H2,48
6988 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6989 (set_attr "length" "4,4,8,8")])
6992 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6993 (compare:CC (zero_extend:DI
6995 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6996 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6998 (set (match_operand:DI 0 "gpc_reg_operand" "")
6999 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7000 "TARGET_POWERPC64 && reload_completed"
7002 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7004 (compare:CC (match_dup 0)
7008 (define_insn "*rotldi3_internal13"
7009 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7012 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7013 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7017 rldicl %0,%1,%H2,32"
7018 [(set_attr "type" "var_shift_rotate,integer")])
7020 (define_insn "*rotldi3_internal14"
7021 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7022 (compare:CC (zero_extend:DI
7024 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7025 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7027 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7031 rldicl. %3,%1,%H2,32
7034 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7035 (set_attr "length" "4,4,8,8")])
7038 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7039 (compare:CC (zero_extend:DI
7041 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7042 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7044 (clobber (match_scratch:DI 3 ""))]
7045 "TARGET_POWERPC64 && reload_completed"
7047 (zero_extend:DI (subreg:SI
7048 (rotate:DI (match_dup 1)
7051 (compare:CC (match_dup 3)
7055 (define_insn "*rotldi3_internal15"
7056 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7057 (compare:CC (zero_extend:DI
7059 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7060 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7062 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7063 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7067 rldicl. %0,%1,%H2,32
7070 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7071 (set_attr "length" "4,4,8,8")])
7074 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7075 (compare:CC (zero_extend:DI
7077 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7078 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7080 (set (match_operand:DI 0 "gpc_reg_operand" "")
7081 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7082 "TARGET_POWERPC64 && reload_completed"
7084 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7086 (compare:CC (match_dup 0)
7090 (define_expand "ashldi3"
7091 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7092 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7093 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7094 "TARGET_POWERPC64 || TARGET_POWER"
7097 if (TARGET_POWERPC64)
7099 else if (TARGET_POWER)
7101 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7108 (define_insn "*ashldi3_internal1"
7109 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7110 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7111 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7116 [(set_attr "type" "var_shift_rotate,shift")])
7118 (define_insn "*ashldi3_internal2"
7119 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7120 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7121 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7123 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7130 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7131 (set_attr "length" "4,4,8,8")])
7134 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7135 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7136 (match_operand:SI 2 "reg_or_cint_operand" ""))
7138 (clobber (match_scratch:DI 3 ""))]
7139 "TARGET_POWERPC64 && reload_completed"
7141 (ashift:DI (match_dup 1) (match_dup 2)))
7143 (compare:CC (match_dup 3)
7147 (define_insn "*ashldi3_internal3"
7148 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7149 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7150 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7152 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7153 (ashift:DI (match_dup 1) (match_dup 2)))]
7160 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7161 (set_attr "length" "4,4,8,8")])
7164 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7165 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7166 (match_operand:SI 2 "reg_or_cint_operand" ""))
7168 (set (match_operand:DI 0 "gpc_reg_operand" "")
7169 (ashift:DI (match_dup 1) (match_dup 2)))]
7170 "TARGET_POWERPC64 && reload_completed"
7172 (ashift:DI (match_dup 1) (match_dup 2)))
7174 (compare:CC (match_dup 0)
7178 (define_insn "*ashldi3_internal4"
7179 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7180 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7181 (match_operand:SI 2 "const_int_operand" "i"))
7182 (match_operand:DI 3 "const_int_operand" "n")))]
7183 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7184 "rldic %0,%1,%H2,%W3")
7186 (define_insn "ashldi3_internal5"
7187 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7189 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7190 (match_operand:SI 2 "const_int_operand" "i,i"))
7191 (match_operand:DI 3 "const_int_operand" "n,n"))
7193 (clobber (match_scratch:DI 4 "=r,r"))]
7194 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7196 rldic. %4,%1,%H2,%W3
7198 [(set_attr "type" "compare")
7199 (set_attr "length" "4,8")])
7202 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7204 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7205 (match_operand:SI 2 "const_int_operand" ""))
7206 (match_operand:DI 3 "const_int_operand" ""))
7208 (clobber (match_scratch:DI 4 ""))]
7209 "TARGET_POWERPC64 && reload_completed
7210 && includes_rldic_lshift_p (operands[2], operands[3])"
7212 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7215 (compare:CC (match_dup 4)
7219 (define_insn "*ashldi3_internal6"
7220 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7222 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7223 (match_operand:SI 2 "const_int_operand" "i,i"))
7224 (match_operand:DI 3 "const_int_operand" "n,n"))
7226 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7227 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7228 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7230 rldic. %0,%1,%H2,%W3
7232 [(set_attr "type" "compare")
7233 (set_attr "length" "4,8")])
7236 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7238 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7239 (match_operand:SI 2 "const_int_operand" ""))
7240 (match_operand:DI 3 "const_int_operand" ""))
7242 (set (match_operand:DI 0 "gpc_reg_operand" "")
7243 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7244 "TARGET_POWERPC64 && reload_completed
7245 && includes_rldic_lshift_p (operands[2], operands[3])"
7247 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7250 (compare:CC (match_dup 0)
7254 (define_insn "*ashldi3_internal7"
7255 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7256 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7257 (match_operand:SI 2 "const_int_operand" "i"))
7258 (match_operand:DI 3 "mask64_operand" "n")))]
7259 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7260 "rldicr %0,%1,%H2,%S3")
7262 (define_insn "ashldi3_internal8"
7263 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7265 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7266 (match_operand:SI 2 "const_int_operand" "i,i"))
7267 (match_operand:DI 3 "mask64_operand" "n,n"))
7269 (clobber (match_scratch:DI 4 "=r,r"))]
7270 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7272 rldicr. %4,%1,%H2,%S3
7274 [(set_attr "type" "compare")
7275 (set_attr "length" "4,8")])
7278 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7280 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7281 (match_operand:SI 2 "const_int_operand" ""))
7282 (match_operand:DI 3 "mask64_operand" ""))
7284 (clobber (match_scratch:DI 4 ""))]
7285 "TARGET_POWERPC64 && reload_completed
7286 && includes_rldicr_lshift_p (operands[2], operands[3])"
7288 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7291 (compare:CC (match_dup 4)
7295 (define_insn "*ashldi3_internal9"
7296 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7298 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7299 (match_operand:SI 2 "const_int_operand" "i,i"))
7300 (match_operand:DI 3 "mask64_operand" "n,n"))
7302 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7303 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7304 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7306 rldicr. %0,%1,%H2,%S3
7308 [(set_attr "type" "compare")
7309 (set_attr "length" "4,8")])
7312 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7314 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7315 (match_operand:SI 2 "const_int_operand" ""))
7316 (match_operand:DI 3 "mask64_operand" ""))
7318 (set (match_operand:DI 0 "gpc_reg_operand" "")
7319 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7320 "TARGET_POWERPC64 && reload_completed
7321 && includes_rldicr_lshift_p (operands[2], operands[3])"
7323 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7326 (compare:CC (match_dup 0)
7330 (define_expand "lshrdi3"
7331 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7332 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7333 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7334 "TARGET_POWERPC64 || TARGET_POWER"
7337 if (TARGET_POWERPC64)
7339 else if (TARGET_POWER)
7341 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7348 (define_insn "*lshrdi3_internal1"
7349 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7350 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7351 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7356 [(set_attr "type" "var_shift_rotate,shift")])
7358 (define_insn "*lshrdi3_internal2"
7359 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7360 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7361 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7363 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7370 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7371 (set_attr "length" "4,4,8,8")])
7374 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7375 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7376 (match_operand:SI 2 "reg_or_cint_operand" ""))
7378 (clobber (match_scratch:DI 3 ""))]
7379 "TARGET_POWERPC64 && reload_completed"
7381 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7383 (compare:CC (match_dup 3)
7387 (define_insn "*lshrdi3_internal3"
7388 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7389 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7390 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7392 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7393 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7400 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7401 (set_attr "length" "4,4,8,8")])
7404 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7405 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7406 (match_operand:SI 2 "reg_or_cint_operand" ""))
7408 (set (match_operand:DI 0 "gpc_reg_operand" "")
7409 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7410 "TARGET_POWERPC64 && reload_completed"
7412 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7414 (compare:CC (match_dup 0)
7418 (define_expand "ashrdi3"
7419 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7420 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7421 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7425 if (TARGET_POWERPC64)
7427 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7429 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7432 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7433 && WORDS_BIG_ENDIAN)
7435 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7442 (define_insn "*ashrdi3_internal1"
7443 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7444 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7445 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7450 [(set_attr "type" "var_shift_rotate,shift")])
7452 (define_insn "*ashrdi3_internal2"
7453 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7454 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7455 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7457 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7464 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7465 (set_attr "length" "4,4,8,8")])
7468 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7469 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7470 (match_operand:SI 2 "reg_or_cint_operand" ""))
7472 (clobber (match_scratch:DI 3 ""))]
7473 "TARGET_POWERPC64 && reload_completed"
7475 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7477 (compare:CC (match_dup 3)
7481 (define_insn "*ashrdi3_internal3"
7482 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7483 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7484 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7486 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7487 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7494 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7495 (set_attr "length" "4,4,8,8")])
7498 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7499 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7500 (match_operand:SI 2 "reg_or_cint_operand" ""))
7502 (set (match_operand:DI 0 "gpc_reg_operand" "")
7503 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7504 "TARGET_POWERPC64 && reload_completed"
7506 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7508 (compare:CC (match_dup 0)
7512 (define_insn "anddi3"
7513 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7514 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7515 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7516 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7520 rldic%B2 %0,%1,0,%S2
7521 rlwinm %0,%1,0,%m2,%M2
7525 [(set_attr "type" "*,*,*,compare,compare,*")
7526 (set_attr "length" "4,4,4,4,4,8")])
7529 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7530 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7531 (match_operand:DI 2 "mask64_2_operand" "")))
7532 (clobber (match_scratch:CC 3 ""))]
7534 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7535 && !mask_operand (operands[2], DImode)
7536 && !mask64_operand (operands[2], DImode)"
7538 (and:DI (rotate:DI (match_dup 1)
7542 (and:DI (rotate:DI (match_dup 0)
7546 build_mask64_2_operands (operands[2], &operands[4]);
7549 (define_insn "*anddi3_internal2"
7550 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7551 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7552 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7554 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7555 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7559 rldic%B2. %3,%1,0,%S2
7560 rlwinm. %3,%1,0,%m2,%M2
7570 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7571 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7574 [(set (match_operand:CC 0 "cc_reg_operand" "")
7575 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7576 (match_operand:DI 2 "mask64_2_operand" ""))
7578 (clobber (match_scratch:DI 3 ""))
7579 (clobber (match_scratch:CC 4 ""))]
7580 "TARGET_64BIT && reload_completed
7581 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7582 && !mask_operand (operands[2], DImode)
7583 && !mask64_operand (operands[2], DImode)"
7585 (and:DI (rotate:DI (match_dup 1)
7588 (parallel [(set (match_dup 0)
7589 (compare:CC (and:DI (rotate:DI (match_dup 3)
7593 (clobber (match_dup 3))])]
7596 build_mask64_2_operands (operands[2], &operands[5]);
7599 (define_insn "*anddi3_internal3"
7600 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7601 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7602 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7604 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7605 (and:DI (match_dup 1) (match_dup 2)))
7606 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7610 rldic%B2. %0,%1,0,%S2
7611 rlwinm. %0,%1,0,%m2,%M2
7621 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7622 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7625 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7626 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7627 (match_operand:DI 2 "and64_2_operand" ""))
7629 (set (match_operand:DI 0 "gpc_reg_operand" "")
7630 (and:DI (match_dup 1) (match_dup 2)))
7631 (clobber (match_scratch:CC 4 ""))]
7632 "TARGET_64BIT && reload_completed"
7633 [(parallel [(set (match_dup 0)
7634 (and:DI (match_dup 1) (match_dup 2)))
7635 (clobber (match_dup 4))])
7637 (compare:CC (match_dup 0)
7642 [(set (match_operand:CC 3 "cc_reg_operand" "")
7643 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7644 (match_operand:DI 2 "mask64_2_operand" ""))
7646 (set (match_operand:DI 0 "gpc_reg_operand" "")
7647 (and:DI (match_dup 1) (match_dup 2)))
7648 (clobber (match_scratch:CC 4 ""))]
7649 "TARGET_64BIT && reload_completed
7650 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7651 && !mask_operand (operands[2], DImode)
7652 && !mask64_operand (operands[2], DImode)"
7654 (and:DI (rotate:DI (match_dup 1)
7657 (parallel [(set (match_dup 3)
7658 (compare:CC (and:DI (rotate:DI (match_dup 0)
7663 (and:DI (rotate:DI (match_dup 0)
7668 build_mask64_2_operands (operands[2], &operands[5]);
7671 (define_expand "iordi3"
7672 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7673 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7674 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7678 if (non_logical_cint_operand (operands[2], DImode))
7680 HOST_WIDE_INT value;
7681 rtx tmp = ((!can_create_pseudo_p ()
7682 || rtx_equal_p (operands[0], operands[1]))
7683 ? operands[0] : gen_reg_rtx (DImode));
7685 if (GET_CODE (operands[2]) == CONST_INT)
7687 value = INTVAL (operands[2]);
7688 emit_insn (gen_iordi3 (tmp, operands[1],
7689 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7693 value = CONST_DOUBLE_LOW (operands[2]);
7694 emit_insn (gen_iordi3 (tmp, operands[1],
7695 immed_double_const (value
7696 & (~ (HOST_WIDE_INT) 0xffff),
7700 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7705 (define_expand "xordi3"
7706 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7707 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7708 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7712 if (non_logical_cint_operand (operands[2], DImode))
7714 HOST_WIDE_INT value;
7715 rtx tmp = ((!can_create_pseudo_p ()
7716 || rtx_equal_p (operands[0], operands[1]))
7717 ? operands[0] : gen_reg_rtx (DImode));
7719 if (GET_CODE (operands[2]) == CONST_INT)
7721 value = INTVAL (operands[2]);
7722 emit_insn (gen_xordi3 (tmp, operands[1],
7723 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7727 value = CONST_DOUBLE_LOW (operands[2]);
7728 emit_insn (gen_xordi3 (tmp, operands[1],
7729 immed_double_const (value
7730 & (~ (HOST_WIDE_INT) 0xffff),
7734 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7739 (define_insn "*booldi3_internal1"
7740 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7741 (match_operator:DI 3 "boolean_or_operator"
7742 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7743 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7750 (define_insn "*booldi3_internal2"
7751 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7752 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7753 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7754 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7756 (clobber (match_scratch:DI 3 "=r,r"))]
7761 [(set_attr "type" "compare")
7762 (set_attr "length" "4,8")])
7765 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7766 (compare:CC (match_operator:DI 4 "boolean_operator"
7767 [(match_operand:DI 1 "gpc_reg_operand" "")
7768 (match_operand:DI 2 "gpc_reg_operand" "")])
7770 (clobber (match_scratch:DI 3 ""))]
7771 "TARGET_POWERPC64 && reload_completed"
7772 [(set (match_dup 3) (match_dup 4))
7774 (compare:CC (match_dup 3)
7778 (define_insn "*booldi3_internal3"
7779 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7780 (compare:CC (match_operator:DI 4 "boolean_operator"
7781 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7782 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7784 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7790 [(set_attr "type" "compare")
7791 (set_attr "length" "4,8")])
7794 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7795 (compare:CC (match_operator:DI 4 "boolean_operator"
7796 [(match_operand:DI 1 "gpc_reg_operand" "")
7797 (match_operand:DI 2 "gpc_reg_operand" "")])
7799 (set (match_operand:DI 0 "gpc_reg_operand" "")
7801 "TARGET_POWERPC64 && reload_completed"
7802 [(set (match_dup 0) (match_dup 4))
7804 (compare:CC (match_dup 0)
7808 ;; Split a logical operation that we can't do in one insn into two insns,
7809 ;; each of which does one 16-bit part. This is used by combine.
7812 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7813 (match_operator:DI 3 "boolean_or_operator"
7814 [(match_operand:DI 1 "gpc_reg_operand" "")
7815 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7817 [(set (match_dup 0) (match_dup 4))
7818 (set (match_dup 0) (match_dup 5))]
7823 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7825 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7826 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7828 i4 = GEN_INT (value & 0xffff);
7832 i3 = GEN_INT (INTVAL (operands[2])
7833 & (~ (HOST_WIDE_INT) 0xffff));
7834 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7836 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7838 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7842 (define_insn "*boolcdi3_internal1"
7843 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7844 (match_operator:DI 3 "boolean_operator"
7845 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7846 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7850 (define_insn "*boolcdi3_internal2"
7851 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7852 (compare:CC (match_operator:DI 4 "boolean_operator"
7853 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7854 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7856 (clobber (match_scratch:DI 3 "=r,r"))]
7861 [(set_attr "type" "compare")
7862 (set_attr "length" "4,8")])
7865 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7866 (compare:CC (match_operator:DI 4 "boolean_operator"
7867 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7868 (match_operand:DI 2 "gpc_reg_operand" "")])
7870 (clobber (match_scratch:DI 3 ""))]
7871 "TARGET_POWERPC64 && reload_completed"
7872 [(set (match_dup 3) (match_dup 4))
7874 (compare:CC (match_dup 3)
7878 (define_insn "*boolcdi3_internal3"
7879 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7880 (compare:CC (match_operator:DI 4 "boolean_operator"
7881 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7882 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7884 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7890 [(set_attr "type" "compare")
7891 (set_attr "length" "4,8")])
7894 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7895 (compare:CC (match_operator:DI 4 "boolean_operator"
7896 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7897 (match_operand:DI 2 "gpc_reg_operand" "")])
7899 (set (match_operand:DI 0 "gpc_reg_operand" "")
7901 "TARGET_POWERPC64 && reload_completed"
7902 [(set (match_dup 0) (match_dup 4))
7904 (compare:CC (match_dup 0)
7908 (define_insn "*boolccdi3_internal1"
7909 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7910 (match_operator:DI 3 "boolean_operator"
7911 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7912 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7916 (define_insn "*boolccdi3_internal2"
7917 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7918 (compare:CC (match_operator:DI 4 "boolean_operator"
7919 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7920 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7922 (clobber (match_scratch:DI 3 "=r,r"))]
7927 [(set_attr "type" "compare")
7928 (set_attr "length" "4,8")])
7931 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7932 (compare:CC (match_operator:DI 4 "boolean_operator"
7933 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7934 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7936 (clobber (match_scratch:DI 3 ""))]
7937 "TARGET_POWERPC64 && reload_completed"
7938 [(set (match_dup 3) (match_dup 4))
7940 (compare:CC (match_dup 3)
7944 (define_insn "*boolccdi3_internal3"
7945 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7946 (compare:CC (match_operator:DI 4 "boolean_operator"
7947 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7948 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7950 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7956 [(set_attr "type" "compare")
7957 (set_attr "length" "4,8")])
7960 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7961 (compare:CC (match_operator:DI 4 "boolean_operator"
7962 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7963 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7965 (set (match_operand:DI 0 "gpc_reg_operand" "")
7967 "TARGET_POWERPC64 && reload_completed"
7968 [(set (match_dup 0) (match_dup 4))
7970 (compare:CC (match_dup 0)
7974 ;; Now define ways of moving data around.
7976 ;; Set up a register with a value from the GOT table
7978 (define_expand "movsi_got"
7979 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7980 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7981 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7982 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7985 if (GET_CODE (operands[1]) == CONST)
7987 rtx offset = const0_rtx;
7988 HOST_WIDE_INT value;
7990 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7991 value = INTVAL (offset);
7994 rtx tmp = (!can_create_pseudo_p ()
7996 : gen_reg_rtx (Pmode));
7997 emit_insn (gen_movsi_got (tmp, operands[1]));
7998 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8003 operands[2] = rs6000_got_register (operands[1]);
8006 (define_insn "*movsi_got_internal"
8007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8008 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8009 (match_operand:SI 2 "gpc_reg_operand" "b")]
8011 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8012 "{l|lwz} %0,%a1@got(%2)"
8013 [(set_attr "type" "load")])
8015 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8016 ;; didn't get allocated to a hard register.
8018 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8019 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8020 (match_operand:SI 2 "memory_operand" "")]
8022 "DEFAULT_ABI == ABI_V4
8024 && (reload_in_progress || reload_completed)"
8025 [(set (match_dup 0) (match_dup 2))
8026 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8030 ;; For SI, we special-case integers that can't be loaded in one insn. We
8031 ;; do the load 16-bits at a time. We could do this by loading from memory,
8032 ;; and this is even supposed to be faster, but it is simpler not to get
8033 ;; integers in the TOC.
8034 (define_insn "movsi_low"
8035 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8036 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8037 (match_operand 2 "" ""))))]
8038 "TARGET_MACHO && ! TARGET_64BIT"
8039 "{l|lwz} %0,lo16(%2)(%1)"
8040 [(set_attr "type" "load")
8041 (set_attr "length" "4")])
8043 (define_insn "*movsi_internal1"
8044 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8045 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8046 "gpc_reg_operand (operands[0], SImode)
8047 || gpc_reg_operand (operands[1], SImode)"
8051 {l%U1%X1|lwz%U1%X1} %0,%1
8052 {st%U0%X0|stw%U0%X0} %1,%0
8062 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8063 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8065 ;; Split a load of a large constant into the appropriate two-insn
8069 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8070 (match_operand:SI 1 "const_int_operand" ""))]
8071 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8072 && (INTVAL (operands[1]) & 0xffff) != 0"
8076 (ior:SI (match_dup 0)
8079 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8081 if (tem == operands[0])
8087 (define_insn "*mov<mode>_internal2"
8088 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8089 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8091 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8094 {cmpi|cmp<wd>i} %2,%0,0
8097 [(set_attr "type" "cmp,compare,cmp")
8098 (set_attr "length" "4,4,8")])
8101 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8102 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8104 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8106 [(set (match_dup 0) (match_dup 1))
8108 (compare:CC (match_dup 0)
8112 (define_insn "*movhi_internal"
8113 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8114 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8115 "gpc_reg_operand (operands[0], HImode)
8116 || gpc_reg_operand (operands[1], HImode)"
8126 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8128 (define_expand "mov<mode>"
8129 [(set (match_operand:INT 0 "general_operand" "")
8130 (match_operand:INT 1 "any_operand" ""))]
8132 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8134 (define_insn "*movqi_internal"
8135 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8136 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8137 "gpc_reg_operand (operands[0], QImode)
8138 || gpc_reg_operand (operands[1], QImode)"
8148 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8150 ;; Here is how to move condition codes around. When we store CC data in
8151 ;; an integer register or memory, we store just the high-order 4 bits.
8152 ;; This lets us not shift in the most common case of CR0.
8153 (define_expand "movcc"
8154 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8155 (match_operand:CC 1 "nonimmediate_operand" ""))]
8159 (define_insn "*movcc_internal1"
8160 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8161 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8162 "register_operand (operands[0], CCmode)
8163 || register_operand (operands[1], CCmode)"
8167 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8170 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8176 {l%U1%X1|lwz%U1%X1} %0,%1
8177 {st%U0%U1|stw%U0%U1} %1,%0"
8179 (cond [(eq_attr "alternative" "0,3")
8180 (const_string "cr_logical")
8181 (eq_attr "alternative" "1,2")
8182 (const_string "mtcr")
8183 (eq_attr "alternative" "6,7,9")
8184 (const_string "integer")
8185 (eq_attr "alternative" "8")
8186 (const_string "mfjmpr")
8187 (eq_attr "alternative" "10")
8188 (const_string "mtjmpr")
8189 (eq_attr "alternative" "11")
8190 (const_string "load")
8191 (eq_attr "alternative" "12")
8192 (const_string "store")
8193 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8194 (const_string "mfcrf")
8196 (const_string "mfcr")))
8197 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8199 ;; For floating-point, we normally deal with the floating-point registers
8200 ;; unless -msoft-float is used. The sole exception is that parameter passing
8201 ;; can produce floating-point values in fixed-point registers. Unless the
8202 ;; value is a simple constant or already in memory, we deal with this by
8203 ;; allocating memory and copying the value explicitly via that memory location.
8204 (define_expand "movsf"
8205 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8206 (match_operand:SF 1 "any_operand" ""))]
8208 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8211 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8212 (match_operand:SF 1 "const_double_operand" ""))]
8214 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8215 || (GET_CODE (operands[0]) == SUBREG
8216 && GET_CODE (SUBREG_REG (operands[0])) == REG
8217 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8218 [(set (match_dup 2) (match_dup 3))]
8224 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8225 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8227 if (! TARGET_POWERPC64)
8228 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8230 operands[2] = gen_lowpart (SImode, operands[0]);
8232 operands[3] = gen_int_mode (l, SImode);
8235 (define_insn "*movsf_hardfloat"
8236 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8237 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8238 "(gpc_reg_operand (operands[0], SFmode)
8239 || gpc_reg_operand (operands[1], SFmode))
8240 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
8243 {l%U1%X1|lwz%U1%X1} %0,%1
8244 {st%U0%X0|stw%U0%X0} %1,%0
8254 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8255 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8257 (define_insn "*movsf_softfloat"
8258 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8259 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8260 "(gpc_reg_operand (operands[0], SFmode)
8261 || gpc_reg_operand (operands[1], SFmode))
8262 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8268 {l%U1%X1|lwz%U1%X1} %0,%1
8269 {st%U0%X0|stw%U0%X0} %1,%0
8276 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8277 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8280 (define_expand "movdf"
8281 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8282 (match_operand:DF 1 "any_operand" ""))]
8284 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8287 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8288 (match_operand:DF 1 "const_int_operand" ""))]
8289 "! TARGET_POWERPC64 && reload_completed
8290 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8291 || (GET_CODE (operands[0]) == SUBREG
8292 && GET_CODE (SUBREG_REG (operands[0])) == REG
8293 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8294 [(set (match_dup 2) (match_dup 4))
8295 (set (match_dup 3) (match_dup 1))]
8298 int endian = (WORDS_BIG_ENDIAN == 0);
8299 HOST_WIDE_INT value = INTVAL (operands[1]);
8301 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8302 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8303 #if HOST_BITS_PER_WIDE_INT == 32
8304 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8306 operands[4] = GEN_INT (value >> 32);
8307 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8312 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8313 (match_operand:DF 1 "const_double_operand" ""))]
8314 "! TARGET_POWERPC64 && reload_completed
8315 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8316 || (GET_CODE (operands[0]) == SUBREG
8317 && GET_CODE (SUBREG_REG (operands[0])) == REG
8318 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8319 [(set (match_dup 2) (match_dup 4))
8320 (set (match_dup 3) (match_dup 5))]
8323 int endian = (WORDS_BIG_ENDIAN == 0);
8327 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8328 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8330 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8331 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8332 operands[4] = gen_int_mode (l[endian], SImode);
8333 operands[5] = gen_int_mode (l[1 - endian], SImode);
8337 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8338 (match_operand:DF 1 "const_double_operand" ""))]
8339 "TARGET_POWERPC64 && reload_completed
8340 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8341 || (GET_CODE (operands[0]) == SUBREG
8342 && GET_CODE (SUBREG_REG (operands[0])) == REG
8343 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8344 [(set (match_dup 2) (match_dup 3))]
8347 int endian = (WORDS_BIG_ENDIAN == 0);
8350 #if HOST_BITS_PER_WIDE_INT >= 64
8354 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8355 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8357 operands[2] = gen_lowpart (DImode, operands[0]);
8358 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8359 #if HOST_BITS_PER_WIDE_INT >= 64
8360 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8361 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8363 operands[3] = gen_int_mode (val, DImode);
8365 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8369 ;; Don't have reload use general registers to load a constant. First,
8370 ;; it might not work if the output operand is the equivalent of
8371 ;; a non-offsettable memref, but also it is less efficient than loading
8372 ;; the constant into an FP register, since it will probably be used there.
8373 ;; The "??" is a kludge until we can figure out a more reasonable way
8374 ;; of handling these non-offsettable values.
8375 (define_insn "*movdf_hardfloat32"
8376 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8377 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8378 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8379 && (gpc_reg_operand (operands[0], DFmode)
8380 || gpc_reg_operand (operands[1], DFmode))"
8383 switch (which_alternative)
8388 /* We normally copy the low-numbered register first. However, if
8389 the first register operand 0 is the same as the second register
8390 of operand 1, we must copy in the opposite order. */
8391 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8392 return \"mr %L0,%L1\;mr %0,%1\";
8394 return \"mr %0,%1\;mr %L0,%L1\";
8396 if (rs6000_offsettable_memref_p (operands[1])
8397 || (GET_CODE (operands[1]) == MEM
8398 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8399 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8400 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC
8401 || GET_CODE (XEXP (operands[1], 0)) == PRE_MODIFY)))
8403 /* If the low-address word is used in the address, we must load
8404 it last. Otherwise, load it first. Note that we cannot have
8405 auto-increment in that case since the address register is
8406 known to be dead. */
8407 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8409 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8411 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8417 addreg = find_addr_reg (XEXP (operands[1], 0));
8418 if (refers_to_regno_p (REGNO (operands[0]),
8419 REGNO (operands[0]) + 1,
8422 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8423 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8424 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8425 return \"{l%X1|lwz%X1} %0,%1\";
8429 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
8430 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8431 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8432 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8437 if (rs6000_offsettable_memref_p (operands[0])
8438 || (GET_CODE (operands[0]) == MEM
8439 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8440 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8441 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
8442 || GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)))
8443 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8448 addreg = find_addr_reg (XEXP (operands[0], 0));
8449 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
8450 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8451 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
8452 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8456 return \"fmr %0,%1\";
8458 return \"lfd%U1%X1 %0,%1\";
8460 return \"stfd%U0%X0 %1,%0\";
8467 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8468 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8470 (define_insn "*movdf_softfloat32"
8471 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8472 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8473 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8474 && (gpc_reg_operand (operands[0], DFmode)
8475 || gpc_reg_operand (operands[1], DFmode))"
8478 switch (which_alternative)
8483 /* We normally copy the low-numbered register first. However, if
8484 the first register operand 0 is the same as the second register of
8485 operand 1, we must copy in the opposite order. */
8486 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8487 return \"mr %L0,%L1\;mr %0,%1\";
8489 return \"mr %0,%1\;mr %L0,%L1\";
8491 /* If the low-address word is used in the address, we must load
8492 it last. Otherwise, load it first. Note that we cannot have
8493 auto-increment in that case since the address register is
8494 known to be dead. */
8495 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8497 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8499 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8501 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8508 [(set_attr "type" "two,load,store,*,*,*")
8509 (set_attr "length" "8,8,8,8,12,16")])
8511 ; ld/std require word-aligned displacements -> 'Y' constraint.
8512 ; List Y->r and r->Y before r->r for reload.
8513 (define_insn "*movdf_hardfloat64_mfpgpr"
8514 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
8515 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
8516 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8517 && (gpc_reg_operand (operands[0], DFmode)
8518 || gpc_reg_operand (operands[1], DFmode))"
8534 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8535 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8537 ; ld/std require word-aligned displacements -> 'Y' constraint.
8538 ; List Y->r and r->Y before r->r for reload.
8539 (define_insn "*movdf_hardfloat64"
8540 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8541 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8542 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8543 && (gpc_reg_operand (operands[0], DFmode)
8544 || gpc_reg_operand (operands[1], DFmode))"
8558 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8559 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8561 (define_insn "*movdf_softfloat64"
8562 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8563 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8564 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8565 && (gpc_reg_operand (operands[0], DFmode)
8566 || gpc_reg_operand (operands[1], DFmode))"
8577 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8578 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8580 (define_expand "movtf"
8581 [(set (match_operand:TF 0 "general_operand" "")
8582 (match_operand:TF 1 "any_operand" ""))]
8583 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8584 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8586 ; It's important to list the o->f and f->o moves before f->f because
8587 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8588 ; which doesn't make progress. Likewise r->Y must be before r->r.
8589 (define_insn_and_split "*movtf_internal"
8590 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8591 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8593 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8594 && (gpc_reg_operand (operands[0], TFmode)
8595 || gpc_reg_operand (operands[1], TFmode))"
8597 "&& reload_completed"
8599 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8600 [(set_attr "length" "8,8,8,20,20,16")])
8602 (define_insn_and_split "*movtf_softfloat"
8603 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
8604 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
8606 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8607 && (gpc_reg_operand (operands[0], TFmode)
8608 || gpc_reg_operand (operands[1], TFmode))"
8610 "&& reload_completed"
8612 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8613 [(set_attr "length" "20,20,16")])
8615 (define_expand "extenddftf2"
8616 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8617 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8619 && TARGET_HARD_FLOAT
8620 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8621 && TARGET_LONG_DOUBLE_128"
8623 if (TARGET_E500_DOUBLE)
8624 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8626 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8630 (define_expand "extenddftf2_fprs"
8631 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8632 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8633 (use (match_dup 2))])]
8635 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8637 operands[2] = CONST0_RTX (DFmode);
8638 /* Generate GOT reference early for SVR4 PIC. */
8639 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8640 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8643 (define_insn_and_split "*extenddftf2_internal"
8644 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8645 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8646 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8648 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8650 "&& reload_completed"
8653 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8654 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8655 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8657 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8662 (define_expand "extendsftf2"
8663 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8664 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8666 && TARGET_HARD_FLOAT
8667 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8668 && TARGET_LONG_DOUBLE_128"
8670 rtx tmp = gen_reg_rtx (DFmode);
8671 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8672 emit_insn (gen_extenddftf2 (operands[0], tmp));
8676 (define_expand "trunctfdf2"
8677 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8678 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8680 && TARGET_HARD_FLOAT
8681 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8682 && TARGET_LONG_DOUBLE_128"
8685 (define_insn_and_split "trunctfdf2_internal1"
8686 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8687 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8688 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8689 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8693 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8696 emit_note (NOTE_INSN_DELETED);
8699 [(set_attr "type" "fp")])
8701 (define_insn "trunctfdf2_internal2"
8702 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8703 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8704 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8705 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8707 [(set_attr "type" "fp")])
8709 (define_expand "trunctfsf2"
8710 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8711 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8713 && TARGET_HARD_FLOAT
8714 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8715 && TARGET_LONG_DOUBLE_128"
8717 if (TARGET_E500_DOUBLE)
8718 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8720 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8724 (define_insn_and_split "trunctfsf2_fprs"
8725 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8726 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8727 (clobber (match_scratch:DF 2 "=f"))]
8729 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8731 "&& reload_completed"
8733 (float_truncate:DF (match_dup 1)))
8735 (float_truncate:SF (match_dup 2)))]
8738 (define_expand "floatsitf2"
8739 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8740 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8742 && TARGET_HARD_FLOAT
8743 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8744 && TARGET_LONG_DOUBLE_128"
8746 rtx tmp = gen_reg_rtx (DFmode);
8747 expand_float (tmp, operands[1], false);
8748 emit_insn (gen_extenddftf2 (operands[0], tmp));
8752 ; fadd, but rounding towards zero.
8753 ; This is probably not the optimal code sequence.
8754 (define_insn "fix_trunc_helper"
8755 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8756 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8757 UNSPEC_FIX_TRUNC_TF))
8758 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8759 "TARGET_HARD_FLOAT && TARGET_FPRS"
8760 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8761 [(set_attr "type" "fp")
8762 (set_attr "length" "20")])
8764 (define_expand "fix_trunctfsi2"
8765 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8766 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8768 && (TARGET_POWER2 || TARGET_POWERPC)
8769 && TARGET_HARD_FLOAT
8770 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8771 && TARGET_LONG_DOUBLE_128"
8773 if (TARGET_E500_DOUBLE)
8774 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8776 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8780 (define_expand "fix_trunctfsi2_fprs"
8781 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8782 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8783 (clobber (match_dup 2))
8784 (clobber (match_dup 3))
8785 (clobber (match_dup 4))
8786 (clobber (match_dup 5))])]
8788 && (TARGET_POWER2 || TARGET_POWERPC)
8789 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8791 operands[2] = gen_reg_rtx (DFmode);
8792 operands[3] = gen_reg_rtx (DFmode);
8793 operands[4] = gen_reg_rtx (DImode);
8794 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8797 (define_insn_and_split "*fix_trunctfsi2_internal"
8798 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8799 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8800 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8801 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8802 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8803 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8805 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8807 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[5]))"
8811 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8813 gcc_assert (MEM_P (operands[5]));
8814 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8816 emit_insn (gen_fctiwz (operands[4], operands[2]));
8817 emit_move_insn (operands[5], operands[4]);
8818 emit_move_insn (operands[0], lowword);
8822 (define_expand "negtf2"
8823 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8824 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8826 && TARGET_HARD_FLOAT
8827 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8828 && TARGET_LONG_DOUBLE_128"
8831 (define_insn "negtf2_internal"
8832 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8833 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8835 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8838 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8839 return \"fneg %L0,%L1\;fneg %0,%1\";
8841 return \"fneg %0,%1\;fneg %L0,%L1\";
8843 [(set_attr "type" "fp")
8844 (set_attr "length" "8")])
8846 (define_expand "abstf2"
8847 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8848 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8850 && TARGET_HARD_FLOAT
8851 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8852 && TARGET_LONG_DOUBLE_128"
8855 rtx label = gen_label_rtx ();
8856 if (TARGET_E500_DOUBLE)
8858 if (flag_unsafe_math_optimizations)
8859 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8861 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8864 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8869 (define_expand "abstf2_internal"
8870 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8871 (match_operand:TF 1 "gpc_reg_operand" ""))
8872 (set (match_dup 3) (match_dup 5))
8873 (set (match_dup 5) (abs:DF (match_dup 5)))
8874 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8875 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8876 (label_ref (match_operand 2 "" ""))
8878 (set (match_dup 6) (neg:DF (match_dup 6)))]
8880 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8883 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8884 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8885 operands[3] = gen_reg_rtx (DFmode);
8886 operands[4] = gen_reg_rtx (CCFPmode);
8887 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8888 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8891 ;; Next come the multi-word integer load and store and the load and store
8894 ; List r->r after r->"o<>", otherwise reload will try to reload a
8895 ; non-offsettable address by using r->r which won't make progress.
8896 (define_insn "*movdi_internal32"
8897 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8898 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8900 && (gpc_reg_operand (operands[0], DImode)
8901 || gpc_reg_operand (operands[1], DImode))"
8910 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8913 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8914 (match_operand:DI 1 "const_int_operand" ""))]
8915 "! TARGET_POWERPC64 && reload_completed"
8916 [(set (match_dup 2) (match_dup 4))
8917 (set (match_dup 3) (match_dup 1))]
8920 HOST_WIDE_INT value = INTVAL (operands[1]);
8921 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8923 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8925 #if HOST_BITS_PER_WIDE_INT == 32
8926 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8928 operands[4] = GEN_INT (value >> 32);
8929 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8934 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
8935 (match_operand:DI 1 "input_operand" ""))]
8936 "reload_completed && !TARGET_POWERPC64
8937 && gpr_or_gpr_p (operands[0], operands[1])"
8939 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8941 (define_insn "*movdi_mfpgpr"
8942 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
8943 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
8944 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8945 && (gpc_reg_operand (operands[0], DImode)
8946 || gpc_reg_operand (operands[1], DImode))"
8963 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8964 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
8966 (define_insn "*movdi_internal64"
8967 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8968 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8969 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
8970 && (gpc_reg_operand (operands[0], DImode)
8971 || gpc_reg_operand (operands[1], DImode))"
8986 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8987 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8989 ;; immediate value valid for a single instruction hiding in a const_double
8991 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8992 (match_operand:DI 1 "const_double_operand" "F"))]
8993 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8994 && GET_CODE (operands[1]) == CONST_DOUBLE
8995 && num_insns_constant (operands[1], DImode) == 1"
8998 return ((unsigned HOST_WIDE_INT)
8999 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9000 ? \"li %0,%1\" : \"lis %0,%v1\";
9003 ;; Generate all one-bits and clear left or right.
9004 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9006 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9007 (match_operand:DI 1 "mask64_operand" ""))]
9008 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9009 [(set (match_dup 0) (const_int -1))
9011 (and:DI (rotate:DI (match_dup 0)
9016 ;; Split a load of a large constant into the appropriate five-instruction
9017 ;; sequence. Handle anything in a constant number of insns.
9018 ;; When non-easy constants can go in the TOC, this should use
9019 ;; easy_fp_constant predicate.
9021 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9022 (match_operand:DI 1 "const_int_operand" ""))]
9023 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9024 [(set (match_dup 0) (match_dup 2))
9025 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9027 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9029 if (tem == operands[0])
9036 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9037 (match_operand:DI 1 "const_double_operand" ""))]
9038 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9039 [(set (match_dup 0) (match_dup 2))
9040 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9042 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9044 if (tem == operands[0])
9050 ;; TImode is similar, except that we usually want to compute the address into
9051 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9052 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9054 ;; We say that MQ is clobbered in the last alternative because the first
9055 ;; alternative would never get used otherwise since it would need a reload
9056 ;; while the 2nd alternative would not. We put memory cases first so they
9057 ;; are preferred. Otherwise, we'd try to reload the output instead of
9058 ;; giving the SCRATCH mq.
9060 (define_insn "*movti_power"
9061 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9062 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9063 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9064 "TARGET_POWER && ! TARGET_POWERPC64
9065 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9068 switch (which_alternative)
9075 return \"{stsi|stswi} %1,%P0,16\";
9080 /* If the address is not used in the output, we can use lsi. Otherwise,
9081 fall through to generating four loads. */
9083 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9084 return \"{lsi|lswi} %0,%P1,16\";
9085 /* ... fall through ... */
9091 [(set_attr "type" "store,store,*,load,load,*")])
9093 (define_insn "*movti_string"
9094 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9095 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9096 "! TARGET_POWER && ! TARGET_POWERPC64
9097 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9100 switch (which_alternative)
9106 return \"{stsi|stswi} %1,%P0,16\";
9111 /* If the address is not used in the output, we can use lsi. Otherwise,
9112 fall through to generating four loads. */
9114 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9115 return \"{lsi|lswi} %0,%P1,16\";
9116 /* ... fall through ... */
9122 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
9124 (define_insn "*movti_ppc64"
9125 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9126 (match_operand:TI 1 "input_operand" "r,r,m"))]
9127 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9128 || gpc_reg_operand (operands[1], TImode))"
9130 [(set_attr "type" "*,load,store")])
9133 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9134 (match_operand:TI 1 "const_double_operand" ""))]
9136 [(set (match_dup 2) (match_dup 4))
9137 (set (match_dup 3) (match_dup 5))]
9140 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9142 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9144 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9146 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9147 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9149 else if (GET_CODE (operands[1]) == CONST_INT)
9151 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9152 operands[5] = operands[1];
9159 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9160 (match_operand:TI 1 "input_operand" ""))]
9162 && gpr_or_gpr_p (operands[0], operands[1])"
9164 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9166 (define_expand "load_multiple"
9167 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9168 (match_operand:SI 1 "" ""))
9169 (use (match_operand:SI 2 "" ""))])]
9170 "TARGET_STRING && !TARGET_POWERPC64"
9178 /* Support only loading a constant number of fixed-point registers from
9179 memory and only bother with this if more than two; the machine
9180 doesn't support more than eight. */
9181 if (GET_CODE (operands[2]) != CONST_INT
9182 || INTVAL (operands[2]) <= 2
9183 || INTVAL (operands[2]) > 8
9184 || GET_CODE (operands[1]) != MEM
9185 || GET_CODE (operands[0]) != REG
9186 || REGNO (operands[0]) >= 32)
9189 count = INTVAL (operands[2]);
9190 regno = REGNO (operands[0]);
9192 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9193 op1 = replace_equiv_address (operands[1],
9194 force_reg (SImode, XEXP (operands[1], 0)));
9196 for (i = 0; i < count; i++)
9197 XVECEXP (operands[3], 0, i)
9198 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9199 adjust_address_nv (op1, SImode, i * 4));
9202 (define_insn "*ldmsi8"
9203 [(match_parallel 0 "load_multiple_operation"
9204 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9205 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9206 (set (match_operand:SI 3 "gpc_reg_operand" "")
9207 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9208 (set (match_operand:SI 4 "gpc_reg_operand" "")
9209 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9210 (set (match_operand:SI 5 "gpc_reg_operand" "")
9211 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9212 (set (match_operand:SI 6 "gpc_reg_operand" "")
9213 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9214 (set (match_operand:SI 7 "gpc_reg_operand" "")
9215 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9216 (set (match_operand:SI 8 "gpc_reg_operand" "")
9217 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9218 (set (match_operand:SI 9 "gpc_reg_operand" "")
9219 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9220 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9222 { return rs6000_output_load_multiple (operands); }"
9223 [(set_attr "type" "load_ux")
9224 (set_attr "length" "32")])
9226 (define_insn "*ldmsi7"
9227 [(match_parallel 0 "load_multiple_operation"
9228 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9229 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9230 (set (match_operand:SI 3 "gpc_reg_operand" "")
9231 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9232 (set (match_operand:SI 4 "gpc_reg_operand" "")
9233 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9234 (set (match_operand:SI 5 "gpc_reg_operand" "")
9235 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9236 (set (match_operand:SI 6 "gpc_reg_operand" "")
9237 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9238 (set (match_operand:SI 7 "gpc_reg_operand" "")
9239 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9240 (set (match_operand:SI 8 "gpc_reg_operand" "")
9241 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9242 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9244 { return rs6000_output_load_multiple (operands); }"
9245 [(set_attr "type" "load_ux")
9246 (set_attr "length" "32")])
9248 (define_insn "*ldmsi6"
9249 [(match_parallel 0 "load_multiple_operation"
9250 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9251 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9252 (set (match_operand:SI 3 "gpc_reg_operand" "")
9253 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9254 (set (match_operand:SI 4 "gpc_reg_operand" "")
9255 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9256 (set (match_operand:SI 5 "gpc_reg_operand" "")
9257 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9258 (set (match_operand:SI 6 "gpc_reg_operand" "")
9259 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9260 (set (match_operand:SI 7 "gpc_reg_operand" "")
9261 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9262 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9264 { return rs6000_output_load_multiple (operands); }"
9265 [(set_attr "type" "load_ux")
9266 (set_attr "length" "32")])
9268 (define_insn "*ldmsi5"
9269 [(match_parallel 0 "load_multiple_operation"
9270 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9271 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9272 (set (match_operand:SI 3 "gpc_reg_operand" "")
9273 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9274 (set (match_operand:SI 4 "gpc_reg_operand" "")
9275 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9276 (set (match_operand:SI 5 "gpc_reg_operand" "")
9277 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9278 (set (match_operand:SI 6 "gpc_reg_operand" "")
9279 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9280 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9282 { return rs6000_output_load_multiple (operands); }"
9283 [(set_attr "type" "load_ux")
9284 (set_attr "length" "32")])
9286 (define_insn "*ldmsi4"
9287 [(match_parallel 0 "load_multiple_operation"
9288 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9289 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9290 (set (match_operand:SI 3 "gpc_reg_operand" "")
9291 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9292 (set (match_operand:SI 4 "gpc_reg_operand" "")
9293 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9294 (set (match_operand:SI 5 "gpc_reg_operand" "")
9295 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9296 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9298 { return rs6000_output_load_multiple (operands); }"
9299 [(set_attr "type" "load_ux")
9300 (set_attr "length" "32")])
9302 (define_insn "*ldmsi3"
9303 [(match_parallel 0 "load_multiple_operation"
9304 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9305 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9306 (set (match_operand:SI 3 "gpc_reg_operand" "")
9307 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9308 (set (match_operand:SI 4 "gpc_reg_operand" "")
9309 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9310 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9312 { return rs6000_output_load_multiple (operands); }"
9313 [(set_attr "type" "load_ux")
9314 (set_attr "length" "32")])
9316 (define_expand "store_multiple"
9317 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9318 (match_operand:SI 1 "" ""))
9319 (clobber (scratch:SI))
9320 (use (match_operand:SI 2 "" ""))])]
9321 "TARGET_STRING && !TARGET_POWERPC64"
9330 /* Support only storing a constant number of fixed-point registers to
9331 memory and only bother with this if more than two; the machine
9332 doesn't support more than eight. */
9333 if (GET_CODE (operands[2]) != CONST_INT
9334 || INTVAL (operands[2]) <= 2
9335 || INTVAL (operands[2]) > 8
9336 || GET_CODE (operands[0]) != MEM
9337 || GET_CODE (operands[1]) != REG
9338 || REGNO (operands[1]) >= 32)
9341 count = INTVAL (operands[2]);
9342 regno = REGNO (operands[1]);
9344 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9345 to = force_reg (SImode, XEXP (operands[0], 0));
9346 op0 = replace_equiv_address (operands[0], to);
9348 XVECEXP (operands[3], 0, 0)
9349 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9350 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9351 gen_rtx_SCRATCH (SImode));
9353 for (i = 1; i < count; i++)
9354 XVECEXP (operands[3], 0, i + 1)
9355 = gen_rtx_SET (VOIDmode,
9356 adjust_address_nv (op0, SImode, i * 4),
9357 gen_rtx_REG (SImode, regno + i));
9360 (define_insn "*stmsi8"
9361 [(match_parallel 0 "store_multiple_operation"
9362 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9363 (match_operand:SI 2 "gpc_reg_operand" "r"))
9364 (clobber (match_scratch:SI 3 "=X"))
9365 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9366 (match_operand:SI 4 "gpc_reg_operand" "r"))
9367 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9368 (match_operand:SI 5 "gpc_reg_operand" "r"))
9369 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9370 (match_operand:SI 6 "gpc_reg_operand" "r"))
9371 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9372 (match_operand:SI 7 "gpc_reg_operand" "r"))
9373 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9374 (match_operand:SI 8 "gpc_reg_operand" "r"))
9375 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9376 (match_operand:SI 9 "gpc_reg_operand" "r"))
9377 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9378 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9379 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9380 "{stsi|stswi} %2,%1,%O0"
9381 [(set_attr "type" "store_ux")])
9383 (define_insn "*stmsi7"
9384 [(match_parallel 0 "store_multiple_operation"
9385 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9386 (match_operand:SI 2 "gpc_reg_operand" "r"))
9387 (clobber (match_scratch:SI 3 "=X"))
9388 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9389 (match_operand:SI 4 "gpc_reg_operand" "r"))
9390 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9391 (match_operand:SI 5 "gpc_reg_operand" "r"))
9392 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9393 (match_operand:SI 6 "gpc_reg_operand" "r"))
9394 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9395 (match_operand:SI 7 "gpc_reg_operand" "r"))
9396 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9397 (match_operand:SI 8 "gpc_reg_operand" "r"))
9398 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9399 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9400 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9401 "{stsi|stswi} %2,%1,%O0"
9402 [(set_attr "type" "store_ux")])
9404 (define_insn "*stmsi6"
9405 [(match_parallel 0 "store_multiple_operation"
9406 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9407 (match_operand:SI 2 "gpc_reg_operand" "r"))
9408 (clobber (match_scratch:SI 3 "=X"))
9409 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9410 (match_operand:SI 4 "gpc_reg_operand" "r"))
9411 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9412 (match_operand:SI 5 "gpc_reg_operand" "r"))
9413 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9414 (match_operand:SI 6 "gpc_reg_operand" "r"))
9415 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9416 (match_operand:SI 7 "gpc_reg_operand" "r"))
9417 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9418 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9419 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9420 "{stsi|stswi} %2,%1,%O0"
9421 [(set_attr "type" "store_ux")])
9423 (define_insn "*stmsi5"
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 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9437 "{stsi|stswi} %2,%1,%O0"
9438 [(set_attr "type" "store_ux")])
9440 (define_insn "*stmsi4"
9441 [(match_parallel 0 "store_multiple_operation"
9442 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9443 (match_operand:SI 2 "gpc_reg_operand" "r"))
9444 (clobber (match_scratch:SI 3 "=X"))
9445 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9446 (match_operand:SI 4 "gpc_reg_operand" "r"))
9447 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9448 (match_operand:SI 5 "gpc_reg_operand" "r"))
9449 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9450 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9451 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9452 "{stsi|stswi} %2,%1,%O0"
9453 [(set_attr "type" "store_ux")])
9455 (define_insn "*stmsi3"
9456 [(match_parallel 0 "store_multiple_operation"
9457 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9458 (match_operand:SI 2 "gpc_reg_operand" "r"))
9459 (clobber (match_scratch:SI 3 "=X"))
9460 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9461 (match_operand:SI 4 "gpc_reg_operand" "r"))
9462 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9463 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9464 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9465 "{stsi|stswi} %2,%1,%O0"
9466 [(set_attr "type" "store_ux")])
9468 (define_insn "*stmsi8_power"
9469 [(match_parallel 0 "store_multiple_operation"
9470 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9471 (match_operand:SI 2 "gpc_reg_operand" "r"))
9472 (clobber (match_scratch:SI 3 "=q"))
9473 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9474 (match_operand:SI 4 "gpc_reg_operand" "r"))
9475 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9476 (match_operand:SI 5 "gpc_reg_operand" "r"))
9477 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9478 (match_operand:SI 6 "gpc_reg_operand" "r"))
9479 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9480 (match_operand:SI 7 "gpc_reg_operand" "r"))
9481 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9482 (match_operand:SI 8 "gpc_reg_operand" "r"))
9483 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9484 (match_operand:SI 9 "gpc_reg_operand" "r"))
9485 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9486 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9487 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9488 "{stsi|stswi} %2,%1,%O0"
9489 [(set_attr "type" "store_ux")])
9491 (define_insn "*stmsi7_power"
9492 [(match_parallel 0 "store_multiple_operation"
9493 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9494 (match_operand:SI 2 "gpc_reg_operand" "r"))
9495 (clobber (match_scratch:SI 3 "=q"))
9496 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9497 (match_operand:SI 4 "gpc_reg_operand" "r"))
9498 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9499 (match_operand:SI 5 "gpc_reg_operand" "r"))
9500 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9501 (match_operand:SI 6 "gpc_reg_operand" "r"))
9502 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9503 (match_operand:SI 7 "gpc_reg_operand" "r"))
9504 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9505 (match_operand:SI 8 "gpc_reg_operand" "r"))
9506 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9507 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9508 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9509 "{stsi|stswi} %2,%1,%O0"
9510 [(set_attr "type" "store_ux")])
9512 (define_insn "*stmsi6_power"
9513 [(match_parallel 0 "store_multiple_operation"
9514 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9515 (match_operand:SI 2 "gpc_reg_operand" "r"))
9516 (clobber (match_scratch:SI 3 "=q"))
9517 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9518 (match_operand:SI 4 "gpc_reg_operand" "r"))
9519 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9520 (match_operand:SI 5 "gpc_reg_operand" "r"))
9521 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9522 (match_operand:SI 6 "gpc_reg_operand" "r"))
9523 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9524 (match_operand:SI 7 "gpc_reg_operand" "r"))
9525 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9526 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9527 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9528 "{stsi|stswi} %2,%1,%O0"
9529 [(set_attr "type" "store_ux")])
9531 (define_insn "*stmsi5_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 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9545 "{stsi|stswi} %2,%1,%O0"
9546 [(set_attr "type" "store_ux")])
9548 (define_insn "*stmsi4_power"
9549 [(match_parallel 0 "store_multiple_operation"
9550 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9551 (match_operand:SI 2 "gpc_reg_operand" "r"))
9552 (clobber (match_scratch:SI 3 "=q"))
9553 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9554 (match_operand:SI 4 "gpc_reg_operand" "r"))
9555 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9556 (match_operand:SI 5 "gpc_reg_operand" "r"))
9557 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9558 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9559 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9560 "{stsi|stswi} %2,%1,%O0"
9561 [(set_attr "type" "store_ux")])
9563 (define_insn "*stmsi3_power"
9564 [(match_parallel 0 "store_multiple_operation"
9565 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9566 (match_operand:SI 2 "gpc_reg_operand" "r"))
9567 (clobber (match_scratch:SI 3 "=q"))
9568 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9569 (match_operand:SI 4 "gpc_reg_operand" "r"))
9570 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9571 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9572 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9573 "{stsi|stswi} %2,%1,%O0"
9574 [(set_attr "type" "store_ux")])
9576 (define_expand "setmemsi"
9577 [(parallel [(set (match_operand:BLK 0 "" "")
9578 (match_operand 2 "const_int_operand" ""))
9579 (use (match_operand:SI 1 "" ""))
9580 (use (match_operand:SI 3 "" ""))])]
9584 /* If value to set is not zero, use the library routine. */
9585 if (operands[2] != const0_rtx)
9588 if (expand_block_clear (operands))
9594 ;; String/block move insn.
9595 ;; Argument 0 is the destination
9596 ;; Argument 1 is the source
9597 ;; Argument 2 is the length
9598 ;; Argument 3 is the alignment
9600 (define_expand "movmemsi"
9601 [(parallel [(set (match_operand:BLK 0 "" "")
9602 (match_operand:BLK 1 "" ""))
9603 (use (match_operand:SI 2 "" ""))
9604 (use (match_operand:SI 3 "" ""))])]
9608 if (expand_block_move (operands))
9614 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9615 ;; register allocator doesn't have a clue about allocating 8 word registers.
9616 ;; rD/rS = r5 is preferred, efficient form.
9617 (define_expand "movmemsi_8reg"
9618 [(parallel [(set (match_operand 0 "" "")
9619 (match_operand 1 "" ""))
9620 (use (match_operand 2 "" ""))
9621 (use (match_operand 3 "" ""))
9622 (clobber (reg:SI 5))
9623 (clobber (reg:SI 6))
9624 (clobber (reg:SI 7))
9625 (clobber (reg:SI 8))
9626 (clobber (reg:SI 9))
9627 (clobber (reg:SI 10))
9628 (clobber (reg:SI 11))
9629 (clobber (reg:SI 12))
9630 (clobber (match_scratch:SI 4 ""))])]
9635 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9636 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9637 (use (match_operand:SI 2 "immediate_operand" "i"))
9638 (use (match_operand:SI 3 "immediate_operand" "i"))
9639 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9640 (clobber (reg:SI 6))
9641 (clobber (reg:SI 7))
9642 (clobber (reg:SI 8))
9643 (clobber (reg:SI 9))
9644 (clobber (reg:SI 10))
9645 (clobber (reg:SI 11))
9646 (clobber (reg:SI 12))
9647 (clobber (match_scratch:SI 5 "=q"))]
9648 "TARGET_STRING && TARGET_POWER
9649 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9650 || INTVAL (operands[2]) == 0)
9651 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9652 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9653 && REGNO (operands[4]) == 5"
9654 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9655 [(set_attr "type" "store_ux")
9656 (set_attr "length" "8")])
9659 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9660 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9661 (use (match_operand:SI 2 "immediate_operand" "i"))
9662 (use (match_operand:SI 3 "immediate_operand" "i"))
9663 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9664 (clobber (reg:SI 6))
9665 (clobber (reg:SI 7))
9666 (clobber (reg:SI 8))
9667 (clobber (reg:SI 9))
9668 (clobber (reg:SI 10))
9669 (clobber (reg:SI 11))
9670 (clobber (reg:SI 12))
9671 (clobber (match_scratch:SI 5 "=X"))]
9672 "TARGET_STRING && ! TARGET_POWER
9673 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9674 || INTVAL (operands[2]) == 0)
9675 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9676 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9677 && REGNO (operands[4]) == 5"
9678 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9679 [(set_attr "type" "store_ux")
9680 (set_attr "length" "8")])
9682 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9683 ;; register allocator doesn't have a clue about allocating 6 word registers.
9684 ;; rD/rS = r5 is preferred, efficient form.
9685 (define_expand "movmemsi_6reg"
9686 [(parallel [(set (match_operand 0 "" "")
9687 (match_operand 1 "" ""))
9688 (use (match_operand 2 "" ""))
9689 (use (match_operand 3 "" ""))
9690 (clobber (reg:SI 5))
9691 (clobber (reg:SI 6))
9692 (clobber (reg:SI 7))
9693 (clobber (reg:SI 8))
9694 (clobber (reg:SI 9))
9695 (clobber (reg:SI 10))
9696 (clobber (match_scratch:SI 4 ""))])]
9701 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9702 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9703 (use (match_operand:SI 2 "immediate_operand" "i"))
9704 (use (match_operand:SI 3 "immediate_operand" "i"))
9705 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9706 (clobber (reg:SI 6))
9707 (clobber (reg:SI 7))
9708 (clobber (reg:SI 8))
9709 (clobber (reg:SI 9))
9710 (clobber (reg:SI 10))
9711 (clobber (match_scratch:SI 5 "=q"))]
9712 "TARGET_STRING && TARGET_POWER
9713 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9714 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9715 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9716 && REGNO (operands[4]) == 5"
9717 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9718 [(set_attr "type" "store_ux")
9719 (set_attr "length" "8")])
9722 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9723 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9724 (use (match_operand:SI 2 "immediate_operand" "i"))
9725 (use (match_operand:SI 3 "immediate_operand" "i"))
9726 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9727 (clobber (reg:SI 6))
9728 (clobber (reg:SI 7))
9729 (clobber (reg:SI 8))
9730 (clobber (reg:SI 9))
9731 (clobber (reg:SI 10))
9732 (clobber (match_scratch:SI 5 "=X"))]
9733 "TARGET_STRING && ! TARGET_POWER
9734 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9735 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9736 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9737 && REGNO (operands[4]) == 5"
9738 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9739 [(set_attr "type" "store_ux")
9740 (set_attr "length" "8")])
9742 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9743 ;; problems with TImode.
9744 ;; rD/rS = r5 is preferred, efficient form.
9745 (define_expand "movmemsi_4reg"
9746 [(parallel [(set (match_operand 0 "" "")
9747 (match_operand 1 "" ""))
9748 (use (match_operand 2 "" ""))
9749 (use (match_operand 3 "" ""))
9750 (clobber (reg:SI 5))
9751 (clobber (reg:SI 6))
9752 (clobber (reg:SI 7))
9753 (clobber (reg:SI 8))
9754 (clobber (match_scratch:SI 4 ""))])]
9759 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9760 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9761 (use (match_operand:SI 2 "immediate_operand" "i"))
9762 (use (match_operand:SI 3 "immediate_operand" "i"))
9763 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9764 (clobber (reg:SI 6))
9765 (clobber (reg:SI 7))
9766 (clobber (reg:SI 8))
9767 (clobber (match_scratch:SI 5 "=q"))]
9768 "TARGET_STRING && TARGET_POWER
9769 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9770 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9771 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9772 && REGNO (operands[4]) == 5"
9773 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9774 [(set_attr "type" "store_ux")
9775 (set_attr "length" "8")])
9778 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9779 (mem:BLK (match_operand:P 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 "=X"))]
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")])
9796 ;; Move up to 8 bytes at a time.
9797 (define_expand "movmemsi_2reg"
9798 [(parallel [(set (match_operand 0 "" "")
9799 (match_operand 1 "" ""))
9800 (use (match_operand 2 "" ""))
9801 (use (match_operand 3 "" ""))
9802 (clobber (match_scratch:DI 4 ""))
9803 (clobber (match_scratch:SI 5 ""))])]
9804 "TARGET_STRING && ! TARGET_POWERPC64"
9808 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9809 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9810 (use (match_operand:SI 2 "immediate_operand" "i"))
9811 (use (match_operand:SI 3 "immediate_operand" "i"))
9812 (clobber (match_scratch:DI 4 "=&r"))
9813 (clobber (match_scratch:SI 5 "=q"))]
9814 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9815 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9816 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9817 [(set_attr "type" "store_ux")
9818 (set_attr "length" "8")])
9821 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9822 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9823 (use (match_operand:SI 2 "immediate_operand" "i"))
9824 (use (match_operand:SI 3 "immediate_operand" "i"))
9825 (clobber (match_scratch:DI 4 "=&r"))
9826 (clobber (match_scratch:SI 5 "=X"))]
9827 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9828 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9829 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9830 [(set_attr "type" "store_ux")
9831 (set_attr "length" "8")])
9833 ;; Move up to 4 bytes at a time.
9834 (define_expand "movmemsi_1reg"
9835 [(parallel [(set (match_operand 0 "" "")
9836 (match_operand 1 "" ""))
9837 (use (match_operand 2 "" ""))
9838 (use (match_operand 3 "" ""))
9839 (clobber (match_scratch:SI 4 ""))
9840 (clobber (match_scratch:SI 5 ""))])]
9845 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9846 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9847 (use (match_operand:SI 2 "immediate_operand" "i"))
9848 (use (match_operand:SI 3 "immediate_operand" "i"))
9849 (clobber (match_scratch:SI 4 "=&r"))
9850 (clobber (match_scratch:SI 5 "=q"))]
9851 "TARGET_STRING && TARGET_POWER
9852 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9853 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9854 [(set_attr "type" "store_ux")
9855 (set_attr "length" "8")])
9858 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9859 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9860 (use (match_operand:SI 2 "immediate_operand" "i"))
9861 (use (match_operand:SI 3 "immediate_operand" "i"))
9862 (clobber (match_scratch:SI 4 "=&r"))
9863 (clobber (match_scratch:SI 5 "=X"))]
9864 "TARGET_STRING && ! TARGET_POWER
9865 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9866 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9867 [(set_attr "type" "store_ux")
9868 (set_attr "length" "8")])
9870 ;; Define insns that do load or store with update. Some of these we can
9871 ;; get by using pre-decrement or pre-increment, but the hardware can also
9872 ;; do cases where the increment is not the size of the object.
9874 ;; In all these cases, we use operands 0 and 1 for the register being
9875 ;; incremented because those are the operands that local-alloc will
9876 ;; tie and these are the pair most likely to be tieable (and the ones
9877 ;; that will benefit the most).
9879 (define_insn "*movdi_update1"
9880 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9881 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9882 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9883 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9884 (plus:DI (match_dup 1) (match_dup 2)))]
9885 "TARGET_POWERPC64 && TARGET_UPDATE"
9889 [(set_attr "type" "load_ux,load_u")])
9891 (define_insn "movdi_<mode>_update"
9892 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9893 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9894 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9895 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9896 (plus:P (match_dup 1) (match_dup 2)))]
9897 "TARGET_POWERPC64 && TARGET_UPDATE"
9901 [(set_attr "type" "store_ux,store_u")])
9903 (define_insn "*movsi_update1"
9904 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9905 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9906 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9907 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9908 (plus:SI (match_dup 1) (match_dup 2)))]
9911 {lux|lwzux} %3,%0,%2
9912 {lu|lwzu} %3,%2(%0)"
9913 [(set_attr "type" "load_ux,load_u")])
9915 (define_insn "*movsi_update2"
9916 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9918 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9919 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9920 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9921 (plus:DI (match_dup 1) (match_dup 2)))]
9924 [(set_attr "type" "load_ext_ux")])
9926 (define_insn "movsi_update"
9927 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9928 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9929 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9930 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9931 (plus:SI (match_dup 1) (match_dup 2)))]
9934 {stux|stwux} %3,%0,%2
9935 {stu|stwu} %3,%2(%0)"
9936 [(set_attr "type" "store_ux,store_u")])
9938 (define_insn "*movhi_update1"
9939 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9940 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9941 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9942 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9943 (plus:SI (match_dup 1) (match_dup 2)))]
9948 [(set_attr "type" "load_ux,load_u")])
9950 (define_insn "*movhi_update2"
9951 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9953 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9954 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9955 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9956 (plus:SI (match_dup 1) (match_dup 2)))]
9961 [(set_attr "type" "load_ux,load_u")])
9963 (define_insn "*movhi_update3"
9964 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9966 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9967 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9968 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9969 (plus:SI (match_dup 1) (match_dup 2)))]
9974 [(set_attr "type" "load_ext_ux,load_ext_u")])
9976 (define_insn "*movhi_update4"
9977 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9978 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9979 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9980 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9981 (plus:SI (match_dup 1) (match_dup 2)))]
9986 [(set_attr "type" "store_ux,store_u")])
9988 (define_insn "*movqi_update1"
9989 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9990 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9991 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9992 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9993 (plus:SI (match_dup 1) (match_dup 2)))]
9998 [(set_attr "type" "load_ux,load_u")])
10000 (define_insn "*movqi_update2"
10001 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10003 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10004 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10005 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10006 (plus:SI (match_dup 1) (match_dup 2)))]
10011 [(set_attr "type" "load_ux,load_u")])
10013 (define_insn "*movqi_update3"
10014 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10015 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10016 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10017 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10018 (plus:SI (match_dup 1) (match_dup 2)))]
10023 [(set_attr "type" "store_ux,store_u")])
10025 (define_insn "*movsf_update1"
10026 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10027 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10028 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10029 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10030 (plus:SI (match_dup 1) (match_dup 2)))]
10031 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10035 [(set_attr "type" "fpload_ux,fpload_u")])
10037 (define_insn "*movsf_update2"
10038 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10039 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10040 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10041 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10042 (plus:SI (match_dup 1) (match_dup 2)))]
10043 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10047 [(set_attr "type" "fpstore_ux,fpstore_u")])
10049 (define_insn "*movsf_update3"
10050 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10051 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10052 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10053 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10054 (plus:SI (match_dup 1) (match_dup 2)))]
10055 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10057 {lux|lwzux} %3,%0,%2
10058 {lu|lwzu} %3,%2(%0)"
10059 [(set_attr "type" "load_ux,load_u")])
10061 (define_insn "*movsf_update4"
10062 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10063 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10064 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10065 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10066 (plus:SI (match_dup 1) (match_dup 2)))]
10067 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10069 {stux|stwux} %3,%0,%2
10070 {stu|stwu} %3,%2(%0)"
10071 [(set_attr "type" "store_ux,store_u")])
10073 (define_insn "*movdf_update1"
10074 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10075 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10076 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10077 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10078 (plus:SI (match_dup 1) (match_dup 2)))]
10079 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10083 [(set_attr "type" "fpload_ux,fpload_u")])
10085 (define_insn "*movdf_update2"
10086 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10087 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10088 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10089 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10090 (plus:SI (match_dup 1) (match_dup 2)))]
10091 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10095 [(set_attr "type" "fpstore_ux,fpstore_u")])
10097 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10099 (define_insn "*lfq_power2"
10100 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10101 (match_operand:V2DF 1 "memory_operand" ""))]
10103 && TARGET_HARD_FLOAT && TARGET_FPRS"
10107 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10108 (match_operand:DF 1 "memory_operand" ""))
10109 (set (match_operand:DF 2 "gpc_reg_operand" "")
10110 (match_operand:DF 3 "memory_operand" ""))]
10112 && TARGET_HARD_FLOAT && TARGET_FPRS
10113 && registers_ok_for_quad_peep (operands[0], operands[2])
10114 && mems_ok_for_quad_peep (operands[1], operands[3])"
10115 [(set (match_dup 0)
10117 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10118 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10120 (define_insn "*stfq_power2"
10121 [(set (match_operand:V2DF 0 "memory_operand" "")
10122 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10124 && TARGET_HARD_FLOAT && TARGET_FPRS"
10125 "stfq%U0%X0 %1,%0")
10129 [(set (match_operand:DF 0 "memory_operand" "")
10130 (match_operand:DF 1 "gpc_reg_operand" ""))
10131 (set (match_operand:DF 2 "memory_operand" "")
10132 (match_operand:DF 3 "gpc_reg_operand" ""))]
10134 && TARGET_HARD_FLOAT && TARGET_FPRS
10135 && registers_ok_for_quad_peep (operands[1], operands[3])
10136 && mems_ok_for_quad_peep (operands[0], operands[2])"
10137 [(set (match_dup 0)
10139 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10140 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10142 ;; After inserting conditional returns we can sometimes have
10143 ;; unnecessary register moves. Unfortunately we cannot have a
10144 ;; modeless peephole here, because some single SImode sets have early
10145 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10146 ;; sequences, using get_attr_length here will smash the operands
10147 ;; array. Neither is there an early_cobbler_p predicate.
10148 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10150 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10151 (match_operand:DF 1 "any_operand" ""))
10152 (set (match_operand:DF 2 "gpc_reg_operand" "")
10154 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10155 && peep2_reg_dead_p (2, operands[0])"
10156 [(set (match_dup 2) (match_dup 1))])
10159 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10160 (match_operand:SF 1 "any_operand" ""))
10161 (set (match_operand:SF 2 "gpc_reg_operand" "")
10163 "peep2_reg_dead_p (2, operands[0])"
10164 [(set (match_dup 2) (match_dup 1))])
10169 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
10170 (define_insn "tls_gd_32"
10171 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10172 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10173 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10175 "HAVE_AS_TLS && !TARGET_64BIT"
10176 "addi %0,%1,%2@got@tlsgd")
10178 (define_insn "tls_gd_64"
10179 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10180 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10181 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10183 "HAVE_AS_TLS && TARGET_64BIT"
10184 "addi %0,%1,%2@got@tlsgd")
10186 (define_insn "tls_ld_32"
10187 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10188 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
10190 "HAVE_AS_TLS && !TARGET_64BIT"
10191 "addi %0,%1,%&@got@tlsld")
10193 (define_insn "tls_ld_64"
10194 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10195 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
10197 "HAVE_AS_TLS && TARGET_64BIT"
10198 "addi %0,%1,%&@got@tlsld")
10200 (define_insn "tls_dtprel_32"
10201 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10202 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10203 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10204 UNSPEC_TLSDTPREL))]
10205 "HAVE_AS_TLS && !TARGET_64BIT"
10206 "addi %0,%1,%2@dtprel")
10208 (define_insn "tls_dtprel_64"
10209 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10210 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10211 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10212 UNSPEC_TLSDTPREL))]
10213 "HAVE_AS_TLS && TARGET_64BIT"
10214 "addi %0,%1,%2@dtprel")
10216 (define_insn "tls_dtprel_ha_32"
10217 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10218 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10219 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10220 UNSPEC_TLSDTPRELHA))]
10221 "HAVE_AS_TLS && !TARGET_64BIT"
10222 "addis %0,%1,%2@dtprel@ha")
10224 (define_insn "tls_dtprel_ha_64"
10225 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10226 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10227 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10228 UNSPEC_TLSDTPRELHA))]
10229 "HAVE_AS_TLS && TARGET_64BIT"
10230 "addis %0,%1,%2@dtprel@ha")
10232 (define_insn "tls_dtprel_lo_32"
10233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10234 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10235 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10236 UNSPEC_TLSDTPRELLO))]
10237 "HAVE_AS_TLS && !TARGET_64BIT"
10238 "addi %0,%1,%2@dtprel@l")
10240 (define_insn "tls_dtprel_lo_64"
10241 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10242 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10243 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10244 UNSPEC_TLSDTPRELLO))]
10245 "HAVE_AS_TLS && TARGET_64BIT"
10246 "addi %0,%1,%2@dtprel@l")
10248 (define_insn "tls_got_dtprel_32"
10249 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10250 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10251 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10252 UNSPEC_TLSGOTDTPREL))]
10253 "HAVE_AS_TLS && !TARGET_64BIT"
10254 "lwz %0,%2@got@dtprel(%1)")
10256 (define_insn "tls_got_dtprel_64"
10257 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10258 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10259 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10260 UNSPEC_TLSGOTDTPREL))]
10261 "HAVE_AS_TLS && TARGET_64BIT"
10262 "ld %0,%2@got@dtprel(%1)")
10264 (define_insn "tls_tprel_32"
10265 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10266 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10267 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10269 "HAVE_AS_TLS && !TARGET_64BIT"
10270 "addi %0,%1,%2@tprel")
10272 (define_insn "tls_tprel_64"
10273 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10274 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10275 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10277 "HAVE_AS_TLS && TARGET_64BIT"
10278 "addi %0,%1,%2@tprel")
10280 (define_insn "tls_tprel_ha_32"
10281 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10282 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10283 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10284 UNSPEC_TLSTPRELHA))]
10285 "HAVE_AS_TLS && !TARGET_64BIT"
10286 "addis %0,%1,%2@tprel@ha")
10288 (define_insn "tls_tprel_ha_64"
10289 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10290 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10291 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10292 UNSPEC_TLSTPRELHA))]
10293 "HAVE_AS_TLS && TARGET_64BIT"
10294 "addis %0,%1,%2@tprel@ha")
10296 (define_insn "tls_tprel_lo_32"
10297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10298 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10299 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10300 UNSPEC_TLSTPRELLO))]
10301 "HAVE_AS_TLS && !TARGET_64BIT"
10302 "addi %0,%1,%2@tprel@l")
10304 (define_insn "tls_tprel_lo_64"
10305 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10306 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10307 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10308 UNSPEC_TLSTPRELLO))]
10309 "HAVE_AS_TLS && TARGET_64BIT"
10310 "addi %0,%1,%2@tprel@l")
10312 ;; "b" output constraint here and on tls_tls input to support linker tls
10313 ;; optimization. The linker may edit the instructions emitted by a
10314 ;; tls_got_tprel/tls_tls pair to addis,addi.
10315 (define_insn "tls_got_tprel_32"
10316 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10317 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10318 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10319 UNSPEC_TLSGOTTPREL))]
10320 "HAVE_AS_TLS && !TARGET_64BIT"
10321 "lwz %0,%2@got@tprel(%1)")
10323 (define_insn "tls_got_tprel_64"
10324 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10325 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10326 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10327 UNSPEC_TLSGOTTPREL))]
10328 "HAVE_AS_TLS && TARGET_64BIT"
10329 "ld %0,%2@got@tprel(%1)")
10331 (define_insn "tls_tls_32"
10332 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10333 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10334 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10336 "HAVE_AS_TLS && !TARGET_64BIT"
10337 "add %0,%1,%2@tls")
10339 (define_insn "tls_tls_64"
10340 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10341 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10342 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10344 "HAVE_AS_TLS && TARGET_64BIT"
10345 "add %0,%1,%2@tls")
10347 ;; Next come insns related to the calling sequence.
10349 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10350 ;; We move the back-chain and decrement the stack pointer.
10352 (define_expand "allocate_stack"
10353 [(set (match_operand 0 "gpc_reg_operand" "")
10354 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10356 (minus (reg 1) (match_dup 1)))]
10359 { rtx chain = gen_reg_rtx (Pmode);
10360 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10363 emit_move_insn (chain, stack_bot);
10365 /* Check stack bounds if necessary. */
10366 if (current_function_limit_stack)
10369 available = expand_binop (Pmode, sub_optab,
10370 stack_pointer_rtx, stack_limit_rtx,
10371 NULL_RTX, 1, OPTAB_WIDEN);
10372 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10375 if (GET_CODE (operands[1]) != CONST_INT
10376 || INTVAL (operands[1]) < -32767
10377 || INTVAL (operands[1]) > 32768)
10379 neg_op0 = gen_reg_rtx (Pmode);
10381 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10383 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10386 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10389 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
10390 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10394 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10395 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10396 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10399 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10403 ;; These patterns say how to save and restore the stack pointer. We need not
10404 ;; save the stack pointer at function level since we are careful to
10405 ;; preserve the backchain. At block level, we have to restore the backchain
10406 ;; when we restore the stack pointer.
10408 ;; For nonlocal gotos, we must save both the stack pointer and its
10409 ;; backchain and restore both. Note that in the nonlocal case, the
10410 ;; save area is a memory location.
10412 (define_expand "save_stack_function"
10413 [(match_operand 0 "any_operand" "")
10414 (match_operand 1 "any_operand" "")]
10418 (define_expand "restore_stack_function"
10419 [(match_operand 0 "any_operand" "")
10420 (match_operand 1 "any_operand" "")]
10424 ;; Adjust stack pointer (op0) to a new value (op1).
10425 ;; First copy old stack backchain to new location, and ensure that the
10426 ;; scheduler won't reorder the sp assignment before the backchain write.
10427 (define_expand "restore_stack_block"
10428 [(set (match_dup 2) (match_dup 3))
10429 (set (match_dup 4) (match_dup 2))
10430 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10431 (set (match_operand 0 "register_operand" "")
10432 (match_operand 1 "register_operand" ""))]
10436 operands[2] = gen_reg_rtx (Pmode);
10437 operands[3] = gen_frame_mem (Pmode, operands[0]);
10438 operands[4] = gen_frame_mem (Pmode, operands[1]);
10439 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10442 (define_expand "save_stack_nonlocal"
10443 [(set (match_dup 3) (match_dup 4))
10444 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10445 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10449 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10451 /* Copy the backchain to the first word, sp to the second. */
10452 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10453 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10454 operands[3] = gen_reg_rtx (Pmode);
10455 operands[4] = gen_frame_mem (Pmode, operands[1]);
10458 (define_expand "restore_stack_nonlocal"
10459 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10460 (set (match_dup 3) (match_dup 4))
10461 (set (match_dup 5) (match_dup 2))
10462 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10463 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10467 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10469 /* Restore the backchain from the first word, sp from the second. */
10470 operands[2] = gen_reg_rtx (Pmode);
10471 operands[3] = gen_reg_rtx (Pmode);
10472 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10473 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10474 operands[5] = gen_frame_mem (Pmode, operands[3]);
10475 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10478 ;; TOC register handling.
10480 ;; Code to initialize the TOC register...
10482 (define_insn "load_toc_aix_si"
10483 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10484 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10485 (use (reg:SI 2))])]
10486 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10490 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10491 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10492 operands[2] = gen_rtx_REG (Pmode, 2);
10493 return \"{l|lwz} %0,%1(%2)\";
10495 [(set_attr "type" "load")])
10497 (define_insn "load_toc_aix_di"
10498 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10499 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10500 (use (reg:DI 2))])]
10501 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10505 #ifdef TARGET_RELOCATABLE
10506 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10507 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10509 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10512 strcat (buf, \"@toc\");
10513 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10514 operands[2] = gen_rtx_REG (Pmode, 2);
10515 return \"ld %0,%1(%2)\";
10517 [(set_attr "type" "load")])
10519 (define_insn "load_toc_v4_pic_si"
10520 [(set (reg:SI LR_REGNO)
10521 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10522 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10523 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10524 [(set_attr "type" "branch")
10525 (set_attr "length" "4")])
10527 (define_insn "load_toc_v4_PIC_1"
10528 [(set (reg:SI LR_REGNO)
10529 (match_operand:SI 0 "immediate_operand" "s"))
10530 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10531 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10532 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10533 "bcl 20,31,%0\\n%0:"
10534 [(set_attr "type" "branch")
10535 (set_attr "length" "4")])
10537 (define_insn "load_toc_v4_PIC_1b"
10538 [(set (reg:SI LR_REGNO)
10539 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
10541 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10542 "bcl 20,31,$+8\\n\\t.long %0-$"
10543 [(set_attr "type" "branch")
10544 (set_attr "length" "8")])
10546 (define_insn "load_toc_v4_PIC_2"
10547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10548 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10549 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10550 (match_operand:SI 3 "immediate_operand" "s")))))]
10551 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10552 "{l|lwz} %0,%2-%3(%1)"
10553 [(set_attr "type" "load")])
10555 (define_insn "load_toc_v4_PIC_3b"
10556 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10557 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10559 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10560 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10561 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10562 "{cau|addis} %0,%1,%2-%3@ha")
10564 (define_insn "load_toc_v4_PIC_3c"
10565 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10566 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10567 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10568 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10569 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10570 "{cal|addi} %0,%1,%2-%3@l")
10572 ;; If the TOC is shared over a translation unit, as happens with all
10573 ;; the kinds of PIC that we support, we need to restore the TOC
10574 ;; pointer only when jumping over units of translation.
10575 ;; On Darwin, we need to reload the picbase.
10577 (define_expand "builtin_setjmp_receiver"
10578 [(use (label_ref (match_operand 0 "" "")))]
10579 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10580 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10581 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10585 if (DEFAULT_ABI == ABI_DARWIN)
10587 const char *picbase = machopic_function_base_name ();
10588 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10589 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10593 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10594 CODE_LABEL_NUMBER (operands[0]));
10595 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10597 emit_insn (gen_load_macho_picbase (tmplabrtx));
10598 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
10599 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10603 rs6000_emit_load_toc_table (FALSE);
10607 ;; Elf specific ways of loading addresses for non-PIC code.
10608 ;; The output of this could be r0, but we make a very strong
10609 ;; preference for a base register because it will usually
10610 ;; be needed there.
10611 (define_insn "elf_high"
10612 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10613 (high:SI (match_operand 1 "" "")))]
10614 "TARGET_ELF && ! TARGET_64BIT"
10615 "{liu|lis} %0,%1@ha")
10617 (define_insn "elf_low"
10618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10619 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10620 (match_operand 2 "" "")))]
10621 "TARGET_ELF && ! TARGET_64BIT"
10623 {cal|la} %0,%2@l(%1)
10624 {ai|addic} %0,%1,%K2")
10626 ;; A function pointer under AIX is a pointer to a data area whose first word
10627 ;; contains the actual address of the function, whose second word contains a
10628 ;; pointer to its TOC, and whose third word contains a value to place in the
10629 ;; static chain register (r11). Note that if we load the static chain, our
10630 ;; "trampoline" need not have any executable code.
10632 (define_expand "call_indirect_aix32"
10633 [(set (match_dup 2)
10634 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10635 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10638 (mem:SI (plus:SI (match_dup 0)
10641 (mem:SI (plus:SI (match_dup 0)
10643 (parallel [(call (mem:SI (match_dup 2))
10644 (match_operand 1 "" ""))
10648 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10649 (clobber (reg:SI LR_REGNO))])]
10652 { operands[2] = gen_reg_rtx (SImode); }")
10654 (define_expand "call_indirect_aix64"
10655 [(set (match_dup 2)
10656 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10657 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10660 (mem:DI (plus:DI (match_dup 0)
10663 (mem:DI (plus:DI (match_dup 0)
10665 (parallel [(call (mem:SI (match_dup 2))
10666 (match_operand 1 "" ""))
10670 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10671 (clobber (reg:SI LR_REGNO))])]
10674 { operands[2] = gen_reg_rtx (DImode); }")
10676 (define_expand "call_value_indirect_aix32"
10677 [(set (match_dup 3)
10678 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10679 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10682 (mem:SI (plus:SI (match_dup 1)
10685 (mem:SI (plus:SI (match_dup 1)
10687 (parallel [(set (match_operand 0 "" "")
10688 (call (mem:SI (match_dup 3))
10689 (match_operand 2 "" "")))
10693 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10694 (clobber (reg:SI LR_REGNO))])]
10697 { operands[3] = gen_reg_rtx (SImode); }")
10699 (define_expand "call_value_indirect_aix64"
10700 [(set (match_dup 3)
10701 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10702 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10705 (mem:DI (plus:DI (match_dup 1)
10708 (mem:DI (plus:DI (match_dup 1)
10710 (parallel [(set (match_operand 0 "" "")
10711 (call (mem:SI (match_dup 3))
10712 (match_operand 2 "" "")))
10716 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10717 (clobber (reg:SI LR_REGNO))])]
10720 { operands[3] = gen_reg_rtx (DImode); }")
10722 ;; Now the definitions for the call and call_value insns
10723 (define_expand "call"
10724 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10725 (match_operand 1 "" ""))
10726 (use (match_operand 2 "" ""))
10727 (clobber (reg:SI LR_REGNO))])]
10732 if (MACHOPIC_INDIRECT)
10733 operands[0] = machopic_indirect_call_target (operands[0]);
10736 gcc_assert (GET_CODE (operands[0]) == MEM);
10737 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10739 operands[0] = XEXP (operands[0], 0);
10741 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10743 && GET_CODE (operands[0]) == SYMBOL_REF
10744 && !SYMBOL_REF_LOCAL_P (operands[0]))
10749 tmp = gen_rtvec (3,
10750 gen_rtx_CALL (VOIDmode,
10751 gen_rtx_MEM (SImode, operands[0]),
10753 gen_rtx_USE (VOIDmode, operands[2]),
10754 gen_rtx_CLOBBER (VOIDmode,
10755 gen_rtx_REG (Pmode, LR_REGNO)));
10756 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10757 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10761 if (GET_CODE (operands[0]) != SYMBOL_REF
10762 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10763 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10765 if (INTVAL (operands[2]) & CALL_LONG)
10766 operands[0] = rs6000_longcall_ref (operands[0]);
10768 switch (DEFAULT_ABI)
10772 operands[0] = force_reg (Pmode, operands[0]);
10776 /* AIX function pointers are really pointers to a three word
10778 emit_call_insn (TARGET_32BIT
10779 ? gen_call_indirect_aix32 (force_reg (SImode,
10782 : gen_call_indirect_aix64 (force_reg (DImode,
10788 gcc_unreachable ();
10793 (define_expand "call_value"
10794 [(parallel [(set (match_operand 0 "" "")
10795 (call (mem:SI (match_operand 1 "address_operand" ""))
10796 (match_operand 2 "" "")))
10797 (use (match_operand 3 "" ""))
10798 (clobber (reg:SI LR_REGNO))])]
10803 if (MACHOPIC_INDIRECT)
10804 operands[1] = machopic_indirect_call_target (operands[1]);
10807 gcc_assert (GET_CODE (operands[1]) == MEM);
10808 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10810 operands[1] = XEXP (operands[1], 0);
10812 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10814 && GET_CODE (operands[1]) == SYMBOL_REF
10815 && !SYMBOL_REF_LOCAL_P (operands[1]))
10820 tmp = gen_rtvec (3,
10821 gen_rtx_SET (VOIDmode,
10823 gen_rtx_CALL (VOIDmode,
10824 gen_rtx_MEM (SImode,
10827 gen_rtx_USE (VOIDmode, operands[3]),
10828 gen_rtx_CLOBBER (VOIDmode,
10829 gen_rtx_REG (Pmode, LR_REGNO)));
10830 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10831 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10835 if (GET_CODE (operands[1]) != SYMBOL_REF
10836 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10837 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10839 if (INTVAL (operands[3]) & CALL_LONG)
10840 operands[1] = rs6000_longcall_ref (operands[1]);
10842 switch (DEFAULT_ABI)
10846 operands[1] = force_reg (Pmode, operands[1]);
10850 /* AIX function pointers are really pointers to a three word
10852 emit_call_insn (TARGET_32BIT
10853 ? gen_call_value_indirect_aix32 (operands[0],
10857 : gen_call_value_indirect_aix64 (operands[0],
10864 gcc_unreachable ();
10869 ;; Call to function in current module. No TOC pointer reload needed.
10870 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10871 ;; either the function was not prototyped, or it was prototyped as a
10872 ;; variable argument function. It is > 0 if FP registers were passed
10873 ;; and < 0 if they were not.
10875 (define_insn "*call_local32"
10876 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10877 (match_operand 1 "" "g,g"))
10878 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10879 (clobber (reg:SI LR_REGNO))]
10880 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10883 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10884 output_asm_insn (\"crxor 6,6,6\", operands);
10886 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10887 output_asm_insn (\"creqv 6,6,6\", operands);
10889 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10891 [(set_attr "type" "branch")
10892 (set_attr "length" "4,8")])
10894 (define_insn "*call_local64"
10895 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10896 (match_operand 1 "" "g,g"))
10897 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10898 (clobber (reg:SI LR_REGNO))]
10899 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10902 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10903 output_asm_insn (\"crxor 6,6,6\", operands);
10905 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10906 output_asm_insn (\"creqv 6,6,6\", operands);
10908 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10910 [(set_attr "type" "branch")
10911 (set_attr "length" "4,8")])
10913 (define_insn "*call_value_local32"
10914 [(set (match_operand 0 "" "")
10915 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10916 (match_operand 2 "" "g,g")))
10917 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10918 (clobber (reg:SI LR_REGNO))]
10919 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10922 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10923 output_asm_insn (\"crxor 6,6,6\", operands);
10925 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10926 output_asm_insn (\"creqv 6,6,6\", operands);
10928 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10930 [(set_attr "type" "branch")
10931 (set_attr "length" "4,8")])
10934 (define_insn "*call_value_local64"
10935 [(set (match_operand 0 "" "")
10936 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10937 (match_operand 2 "" "g,g")))
10938 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10939 (clobber (reg:SI LR_REGNO))]
10940 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10943 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10944 output_asm_insn (\"crxor 6,6,6\", operands);
10946 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10947 output_asm_insn (\"creqv 6,6,6\", operands);
10949 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10951 [(set_attr "type" "branch")
10952 (set_attr "length" "4,8")])
10954 ;; Call to function which may be in another module. Restore the TOC
10955 ;; pointer (r2) after the call unless this is System V.
10956 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10957 ;; either the function was not prototyped, or it was prototyped as a
10958 ;; variable argument function. It is > 0 if FP registers were passed
10959 ;; and < 0 if they were not.
10961 (define_insn "*call_indirect_nonlocal_aix32"
10962 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10963 (match_operand 1 "" "g,g"))
10967 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10968 (clobber (reg:SI LR_REGNO))]
10969 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10970 "b%T0l\;{l|lwz} 2,20(1)"
10971 [(set_attr "type" "jmpreg")
10972 (set_attr "length" "8")])
10974 (define_insn "*call_nonlocal_aix32"
10975 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10976 (match_operand 1 "" "g"))
10977 (use (match_operand:SI 2 "immediate_operand" "O"))
10978 (clobber (reg:SI LR_REGNO))]
10980 && DEFAULT_ABI == ABI_AIX
10981 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10983 [(set_attr "type" "branch")
10984 (set_attr "length" "8")])
10986 (define_insn "*call_indirect_nonlocal_aix64"
10987 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10988 (match_operand 1 "" "g,g"))
10992 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10993 (clobber (reg:SI LR_REGNO))]
10994 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10995 "b%T0l\;ld 2,40(1)"
10996 [(set_attr "type" "jmpreg")
10997 (set_attr "length" "8")])
10999 (define_insn "*call_nonlocal_aix64"
11000 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11001 (match_operand 1 "" "g"))
11002 (use (match_operand:SI 2 "immediate_operand" "O"))
11003 (clobber (reg:SI LR_REGNO))]
11005 && DEFAULT_ABI == ABI_AIX
11006 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11008 [(set_attr "type" "branch")
11009 (set_attr "length" "8")])
11011 (define_insn "*call_value_indirect_nonlocal_aix32"
11012 [(set (match_operand 0 "" "")
11013 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11014 (match_operand 2 "" "g,g")))
11018 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11019 (clobber (reg:SI LR_REGNO))]
11020 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11021 "b%T1l\;{l|lwz} 2,20(1)"
11022 [(set_attr "type" "jmpreg")
11023 (set_attr "length" "8")])
11025 (define_insn "*call_value_nonlocal_aix32"
11026 [(set (match_operand 0 "" "")
11027 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11028 (match_operand 2 "" "g")))
11029 (use (match_operand:SI 3 "immediate_operand" "O"))
11030 (clobber (reg:SI LR_REGNO))]
11032 && DEFAULT_ABI == ABI_AIX
11033 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11035 [(set_attr "type" "branch")
11036 (set_attr "length" "8")])
11038 (define_insn "*call_value_indirect_nonlocal_aix64"
11039 [(set (match_operand 0 "" "")
11040 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11041 (match_operand 2 "" "g,g")))
11045 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11046 (clobber (reg:SI LR_REGNO))]
11047 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11048 "b%T1l\;ld 2,40(1)"
11049 [(set_attr "type" "jmpreg")
11050 (set_attr "length" "8")])
11052 (define_insn "*call_value_nonlocal_aix64"
11053 [(set (match_operand 0 "" "")
11054 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11055 (match_operand 2 "" "g")))
11056 (use (match_operand:SI 3 "immediate_operand" "O"))
11057 (clobber (reg:SI LR_REGNO))]
11059 && DEFAULT_ABI == ABI_AIX
11060 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11062 [(set_attr "type" "branch")
11063 (set_attr "length" "8")])
11065 ;; A function pointer under System V is just a normal pointer
11066 ;; operands[0] is the function pointer
11067 ;; operands[1] is the stack size to clean up
11068 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11069 ;; which indicates how to set cr1
11071 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11072 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11073 (match_operand 1 "" "g,g,g,g"))
11074 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11075 (clobber (reg:SI LR_REGNO))]
11076 "DEFAULT_ABI == ABI_V4
11077 || DEFAULT_ABI == ABI_DARWIN"
11079 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11080 output_asm_insn ("crxor 6,6,6", operands);
11082 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11083 output_asm_insn ("creqv 6,6,6", operands);
11087 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11088 (set_attr "length" "4,4,8,8")])
11090 (define_insn "*call_nonlocal_sysv<mode>"
11091 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11092 (match_operand 1 "" "g,g"))
11093 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11094 (clobber (reg:SI LR_REGNO))]
11095 "(DEFAULT_ABI == ABI_DARWIN
11096 || (DEFAULT_ABI == ABI_V4
11097 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11099 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11100 output_asm_insn ("crxor 6,6,6", operands);
11102 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11103 output_asm_insn ("creqv 6,6,6", operands);
11106 return output_call(insn, operands, 0, 2);
11108 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11110 if (TARGET_SECURE_PLT && flag_pic == 2)
11111 /* The magic 32768 offset here and in the other sysv call insns
11112 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11113 See sysv4.h:toc_section. */
11114 return "bl %z0+32768@plt";
11116 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 "*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 if (TARGET_SECURE_PLT && flag_pic == 2)
11167 return "bl %z1+32768@plt";
11169 return "bl %z1@plt";
11175 [(set_attr "type" "branch,branch")
11176 (set_attr "length" "4,8")])
11178 ;; Call subroutine returning any type.
11179 (define_expand "untyped_call"
11180 [(parallel [(call (match_operand 0 "" "")
11182 (match_operand 1 "" "")
11183 (match_operand 2 "" "")])]
11189 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11191 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11193 rtx set = XVECEXP (operands[2], 0, i);
11194 emit_move_insn (SET_DEST (set), SET_SRC (set));
11197 /* The optimizer does not know that the call sets the function value
11198 registers we stored in the result block. We avoid problems by
11199 claiming that all hard registers are used and clobbered at this
11201 emit_insn (gen_blockage ());
11206 ;; sibling call patterns
11207 (define_expand "sibcall"
11208 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11209 (match_operand 1 "" ""))
11210 (use (match_operand 2 "" ""))
11211 (use (reg:SI LR_REGNO))
11217 if (MACHOPIC_INDIRECT)
11218 operands[0] = machopic_indirect_call_target (operands[0]);
11221 gcc_assert (GET_CODE (operands[0]) == MEM);
11222 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11224 operands[0] = XEXP (operands[0], 0);
11227 ;; this and similar patterns must be marked as using LR, otherwise
11228 ;; dataflow will try to delete the store into it. This is true
11229 ;; even when the actual reg to jump to is in CTR, when LR was
11230 ;; saved and restored around the PIC-setting BCL.
11231 (define_insn "*sibcall_local32"
11232 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11233 (match_operand 1 "" "g,g"))
11234 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11235 (use (reg:SI LR_REGNO))
11237 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11240 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11241 output_asm_insn (\"crxor 6,6,6\", operands);
11243 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11244 output_asm_insn (\"creqv 6,6,6\", operands);
11246 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11248 [(set_attr "type" "branch")
11249 (set_attr "length" "4,8")])
11251 (define_insn "*sibcall_local64"
11252 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11253 (match_operand 1 "" "g,g"))
11254 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11255 (use (reg:SI LR_REGNO))
11257 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11260 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11261 output_asm_insn (\"crxor 6,6,6\", operands);
11263 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11264 output_asm_insn (\"creqv 6,6,6\", operands);
11266 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11268 [(set_attr "type" "branch")
11269 (set_attr "length" "4,8")])
11271 (define_insn "*sibcall_value_local32"
11272 [(set (match_operand 0 "" "")
11273 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11274 (match_operand 2 "" "g,g")))
11275 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11276 (use (reg:SI LR_REGNO))
11278 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11281 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11282 output_asm_insn (\"crxor 6,6,6\", operands);
11284 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11285 output_asm_insn (\"creqv 6,6,6\", operands);
11287 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11289 [(set_attr "type" "branch")
11290 (set_attr "length" "4,8")])
11293 (define_insn "*sibcall_value_local64"
11294 [(set (match_operand 0 "" "")
11295 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11296 (match_operand 2 "" "g,g")))
11297 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11298 (use (reg:SI LR_REGNO))
11300 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11303 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11304 output_asm_insn (\"crxor 6,6,6\", operands);
11306 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11307 output_asm_insn (\"creqv 6,6,6\", operands);
11309 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11311 [(set_attr "type" "branch")
11312 (set_attr "length" "4,8")])
11314 (define_insn "*sibcall_nonlocal_aix32"
11315 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11316 (match_operand 1 "" "g"))
11317 (use (match_operand:SI 2 "immediate_operand" "O"))
11318 (use (reg:SI LR_REGNO))
11321 && DEFAULT_ABI == ABI_AIX
11322 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11324 [(set_attr "type" "branch")
11325 (set_attr "length" "4")])
11327 (define_insn "*sibcall_nonlocal_aix64"
11328 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11329 (match_operand 1 "" "g"))
11330 (use (match_operand:SI 2 "immediate_operand" "O"))
11331 (use (reg:SI LR_REGNO))
11334 && DEFAULT_ABI == ABI_AIX
11335 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11337 [(set_attr "type" "branch")
11338 (set_attr "length" "4")])
11340 (define_insn "*sibcall_value_nonlocal_aix32"
11341 [(set (match_operand 0 "" "")
11342 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11343 (match_operand 2 "" "g")))
11344 (use (match_operand:SI 3 "immediate_operand" "O"))
11345 (use (reg:SI LR_REGNO))
11348 && DEFAULT_ABI == ABI_AIX
11349 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11351 [(set_attr "type" "branch")
11352 (set_attr "length" "4")])
11354 (define_insn "*sibcall_value_nonlocal_aix64"
11355 [(set (match_operand 0 "" "")
11356 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11357 (match_operand 2 "" "g")))
11358 (use (match_operand:SI 3 "immediate_operand" "O"))
11359 (use (reg:SI LR_REGNO))
11362 && DEFAULT_ABI == ABI_AIX
11363 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11365 [(set_attr "type" "branch")
11366 (set_attr "length" "4")])
11368 (define_insn "*sibcall_nonlocal_sysv<mode>"
11369 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11370 (match_operand 1 "" ""))
11371 (use (match_operand 2 "immediate_operand" "O,n"))
11372 (use (reg:SI LR_REGNO))
11374 "(DEFAULT_ABI == ABI_DARWIN
11375 || DEFAULT_ABI == ABI_V4)
11376 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11379 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11380 output_asm_insn (\"crxor 6,6,6\", operands);
11382 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11383 output_asm_insn (\"creqv 6,6,6\", operands);
11385 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11387 if (TARGET_SECURE_PLT && flag_pic == 2)
11388 return \"b %z0+32768@plt\";
11390 return \"b %z0@plt\";
11395 [(set_attr "type" "branch,branch")
11396 (set_attr "length" "4,8")])
11398 (define_expand "sibcall_value"
11399 [(parallel [(set (match_operand 0 "register_operand" "")
11400 (call (mem:SI (match_operand 1 "address_operand" ""))
11401 (match_operand 2 "" "")))
11402 (use (match_operand 3 "" ""))
11403 (use (reg:SI LR_REGNO))
11409 if (MACHOPIC_INDIRECT)
11410 operands[1] = machopic_indirect_call_target (operands[1]);
11413 gcc_assert (GET_CODE (operands[1]) == MEM);
11414 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11416 operands[1] = XEXP (operands[1], 0);
11419 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11420 [(set (match_operand 0 "" "")
11421 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11422 (match_operand 2 "" "")))
11423 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11424 (use (reg:SI LR_REGNO))
11426 "(DEFAULT_ABI == ABI_DARWIN
11427 || DEFAULT_ABI == ABI_V4)
11428 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11431 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11432 output_asm_insn (\"crxor 6,6,6\", operands);
11434 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11435 output_asm_insn (\"creqv 6,6,6\", operands);
11437 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11439 if (TARGET_SECURE_PLT && flag_pic == 2)
11440 return \"b %z1+32768@plt\";
11442 return \"b %z1@plt\";
11447 [(set_attr "type" "branch,branch")
11448 (set_attr "length" "4,8")])
11450 (define_expand "sibcall_epilogue"
11451 [(use (const_int 0))]
11452 "TARGET_SCHED_PROLOG"
11455 rs6000_emit_epilogue (TRUE);
11459 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11460 ;; all of memory. This blocks insns from being moved across this point.
11462 (define_insn "blockage"
11463 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11467 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11468 ;; signed & unsigned, and one type of branch.
11470 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11471 ;; insns, and branches. We store the operands of compares until we see
11473 (define_expand "cmp<mode>"
11475 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11476 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11480 /* Take care of the possibility that operands[1] might be negative but
11481 this might be a logical operation. That insn doesn't exist. */
11482 if (GET_CODE (operands[1]) == CONST_INT
11483 && INTVAL (operands[1]) < 0)
11484 operands[1] = force_reg (<MODE>mode, operands[1]);
11486 rs6000_compare_op0 = operands[0];
11487 rs6000_compare_op1 = operands[1];
11488 rs6000_compare_fp_p = 0;
11492 (define_expand "cmp<mode>"
11493 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11494 (match_operand:FP 1 "gpc_reg_operand" "")))]
11498 rs6000_compare_op0 = operands[0];
11499 rs6000_compare_op1 = operands[1];
11500 rs6000_compare_fp_p = 1;
11504 (define_expand "beq"
11505 [(use (match_operand 0 "" ""))]
11507 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11509 (define_expand "bne"
11510 [(use (match_operand 0 "" ""))]
11512 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11514 (define_expand "bge"
11515 [(use (match_operand 0 "" ""))]
11517 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11519 (define_expand "bgt"
11520 [(use (match_operand 0 "" ""))]
11522 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11524 (define_expand "ble"
11525 [(use (match_operand 0 "" ""))]
11527 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11529 (define_expand "blt"
11530 [(use (match_operand 0 "" ""))]
11532 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11534 (define_expand "bgeu"
11535 [(use (match_operand 0 "" ""))]
11537 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11539 (define_expand "bgtu"
11540 [(use (match_operand 0 "" ""))]
11542 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11544 (define_expand "bleu"
11545 [(use (match_operand 0 "" ""))]
11547 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11549 (define_expand "bltu"
11550 [(use (match_operand 0 "" ""))]
11552 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11554 (define_expand "bunordered"
11555 [(use (match_operand 0 "" ""))]
11556 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11557 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11559 (define_expand "bordered"
11560 [(use (match_operand 0 "" ""))]
11561 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11562 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11564 (define_expand "buneq"
11565 [(use (match_operand 0 "" ""))]
11566 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11567 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11569 (define_expand "bunge"
11570 [(use (match_operand 0 "" ""))]
11571 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11572 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11574 (define_expand "bungt"
11575 [(use (match_operand 0 "" ""))]
11576 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11577 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11579 (define_expand "bunle"
11580 [(use (match_operand 0 "" ""))]
11581 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11582 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11584 (define_expand "bunlt"
11585 [(use (match_operand 0 "" ""))]
11586 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11587 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11589 (define_expand "bltgt"
11590 [(use (match_operand 0 "" ""))]
11592 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11594 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11595 ;; For SEQ, likewise, except that comparisons with zero should be done
11596 ;; with an scc insns. However, due to the order that combine see the
11597 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11598 ;; the cases we don't want to handle.
11599 (define_expand "seq"
11600 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11602 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11604 (define_expand "sne"
11605 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11609 if (! rs6000_compare_fp_p)
11612 rs6000_emit_sCOND (NE, operands[0]);
11616 ;; A >= 0 is best done the portable way for A an integer.
11617 (define_expand "sge"
11618 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11622 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11625 rs6000_emit_sCOND (GE, operands[0]);
11629 ;; A > 0 is best done using the portable sequence, so fail in that case.
11630 (define_expand "sgt"
11631 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11635 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11638 rs6000_emit_sCOND (GT, operands[0]);
11642 ;; A <= 0 is best done the portable way for A an integer.
11643 (define_expand "sle"
11644 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11648 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11651 rs6000_emit_sCOND (LE, operands[0]);
11655 ;; A < 0 is best done in the portable way for A an integer.
11656 (define_expand "slt"
11657 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11661 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11664 rs6000_emit_sCOND (LT, operands[0]);
11668 (define_expand "sgeu"
11669 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11671 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11673 (define_expand "sgtu"
11674 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11676 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11678 (define_expand "sleu"
11679 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11681 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11683 (define_expand "sltu"
11684 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11686 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11688 (define_expand "sunordered"
11689 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11690 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11691 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11693 (define_expand "sordered"
11694 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11695 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11696 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11698 (define_expand "suneq"
11699 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11700 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11701 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11703 (define_expand "sunge"
11704 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11705 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11706 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11708 (define_expand "sungt"
11709 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11710 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11711 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11713 (define_expand "sunle"
11714 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11715 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11716 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11718 (define_expand "sunlt"
11719 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11720 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11721 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11723 (define_expand "sltgt"
11724 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11726 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11728 (define_expand "stack_protect_set"
11729 [(match_operand 0 "memory_operand" "")
11730 (match_operand 1 "memory_operand" "")]
11733 #ifdef TARGET_THREAD_SSP_OFFSET
11734 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11735 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11736 operands[1] = gen_rtx_MEM (Pmode, addr);
11739 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11741 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11745 (define_insn "stack_protect_setsi"
11746 [(set (match_operand:SI 0 "memory_operand" "=m")
11747 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11748 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11750 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11751 [(set_attr "type" "three")
11752 (set_attr "length" "12")])
11754 (define_insn "stack_protect_setdi"
11755 [(set (match_operand:DI 0 "memory_operand" "=m")
11756 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11757 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11759 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11760 [(set_attr "type" "three")
11761 (set_attr "length" "12")])
11763 (define_expand "stack_protect_test"
11764 [(match_operand 0 "memory_operand" "")
11765 (match_operand 1 "memory_operand" "")
11766 (match_operand 2 "" "")]
11769 #ifdef TARGET_THREAD_SSP_OFFSET
11770 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11771 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11772 operands[1] = gen_rtx_MEM (Pmode, addr);
11774 rs6000_compare_op0 = operands[0];
11775 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11777 rs6000_compare_fp_p = 0;
11778 emit_jump_insn (gen_beq (operands[2]));
11782 (define_insn "stack_protect_testsi"
11783 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11784 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11785 (match_operand:SI 2 "memory_operand" "m,m")]
11787 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11788 (clobber (match_scratch:SI 3 "=&r,&r"))]
11791 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11792 {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"
11793 [(set_attr "length" "16,20")])
11795 (define_insn "stack_protect_testdi"
11796 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11797 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11798 (match_operand:DI 2 "memory_operand" "m,m")]
11800 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11801 (clobber (match_scratch:DI 3 "=&r,&r"))]
11804 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11805 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11806 [(set_attr "length" "16,20")])
11809 ;; Here are the actual compare insns.
11810 (define_insn "*cmp<mode>_internal1"
11811 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11812 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11813 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11815 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11816 [(set_attr "type" "cmp")])
11818 ;; If we are comparing a register for equality with a large constant,
11819 ;; we can do this with an XOR followed by a compare. But this is profitable
11820 ;; only if the large constant is only used for the comparison (and in this
11821 ;; case we already have a register to reuse as scratch).
11823 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11824 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11827 [(set (match_operand:SI 0 "register_operand")
11828 (match_operand:SI 1 "logical_const_operand" ""))
11829 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11831 (match_operand:SI 2 "logical_const_operand" "")]))
11832 (set (match_operand:CC 4 "cc_reg_operand" "")
11833 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11836 (if_then_else (match_operator 6 "equality_operator"
11837 [(match_dup 4) (const_int 0)])
11838 (match_operand 7 "" "")
11839 (match_operand 8 "" "")))]
11840 "peep2_reg_dead_p (3, operands[0])
11841 && peep2_reg_dead_p (4, operands[4])"
11842 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11843 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11844 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11847 /* Get the constant we are comparing against, and see what it looks like
11848 when sign-extended from 16 to 32 bits. Then see what constant we could
11849 XOR with SEXTC to get the sign-extended value. */
11850 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11852 operands[1], operands[2]);
11853 HOST_WIDE_INT c = INTVAL (cnst);
11854 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11855 HOST_WIDE_INT xorv = c ^ sextc;
11857 operands[9] = GEN_INT (xorv);
11858 operands[10] = GEN_INT (sextc);
11861 (define_insn "*cmpsi_internal2"
11862 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11863 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11864 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11866 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11867 [(set_attr "type" "cmp")])
11869 (define_insn "*cmpdi_internal2"
11870 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11871 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11872 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11874 "cmpld%I2 %0,%1,%b2"
11875 [(set_attr "type" "cmp")])
11877 ;; The following two insns don't exist as single insns, but if we provide
11878 ;; them, we can swap an add and compare, which will enable us to overlap more
11879 ;; of the required delay between a compare and branch. We generate code for
11880 ;; them by splitting.
11883 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11884 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11885 (match_operand:SI 2 "short_cint_operand" "i")))
11886 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11887 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11890 [(set_attr "length" "8")])
11893 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11894 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11895 (match_operand:SI 2 "u_short_cint_operand" "i")))
11896 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11897 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11900 [(set_attr "length" "8")])
11903 [(set (match_operand:CC 3 "cc_reg_operand" "")
11904 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11905 (match_operand:SI 2 "short_cint_operand" "")))
11906 (set (match_operand:SI 0 "gpc_reg_operand" "")
11907 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11909 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11910 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11913 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11914 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11915 (match_operand:SI 2 "u_short_cint_operand" "")))
11916 (set (match_operand:SI 0 "gpc_reg_operand" "")
11917 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11919 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11920 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11922 (define_insn "*cmpsf_internal1"
11923 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11924 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11925 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11926 "TARGET_HARD_FLOAT && TARGET_FPRS"
11928 [(set_attr "type" "fpcompare")])
11930 (define_insn "*cmpdf_internal1"
11931 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11932 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11933 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11934 "TARGET_HARD_FLOAT && TARGET_FPRS"
11936 [(set_attr "type" "fpcompare")])
11938 ;; Only need to compare second words if first words equal
11939 (define_insn "*cmptf_internal1"
11940 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11941 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11942 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11943 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11944 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11945 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11946 [(set_attr "type" "fpcompare")
11947 (set_attr "length" "12")])
11949 (define_insn_and_split "*cmptf_internal2"
11950 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11951 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11952 (match_operand:TF 2 "gpc_reg_operand" "f")))
11953 (clobber (match_scratch:DF 3 "=f"))
11954 (clobber (match_scratch:DF 4 "=f"))
11955 (clobber (match_scratch:DF 5 "=f"))
11956 (clobber (match_scratch:DF 6 "=f"))
11957 (clobber (match_scratch:DF 7 "=f"))
11958 (clobber (match_scratch:DF 8 "=f"))
11959 (clobber (match_scratch:DF 9 "=f"))
11960 (clobber (match_scratch:DF 10 "=f"))]
11961 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11962 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11964 "&& reload_completed"
11965 [(set (match_dup 3) (match_dup 13))
11966 (set (match_dup 4) (match_dup 14))
11967 (set (match_dup 9) (abs:DF (match_dup 5)))
11968 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11969 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11970 (label_ref (match_dup 11))
11972 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11973 (set (pc) (label_ref (match_dup 12)))
11975 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11976 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11977 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11978 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11981 REAL_VALUE_TYPE rv;
11982 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11983 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11985 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11986 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11987 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11988 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11989 operands[11] = gen_label_rtx ();
11990 operands[12] = gen_label_rtx ();
11992 operands[13] = force_const_mem (DFmode,
11993 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11994 operands[14] = force_const_mem (DFmode,
11995 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11999 operands[13] = gen_const_mem (DFmode,
12000 create_TOC_reference (XEXP (operands[13], 0)));
12001 operands[14] = gen_const_mem (DFmode,
12002 create_TOC_reference (XEXP (operands[14], 0)));
12003 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12004 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12008 ;; Now we have the scc insns. We can do some combinations because of the
12009 ;; way the machine works.
12011 ;; Note that this is probably faster if we can put an insn between the
12012 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12013 ;; cases the insns below which don't use an intermediate CR field will
12014 ;; be used instead.
12016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12017 (match_operator:SI 1 "scc_comparison_operator"
12018 [(match_operand 2 "cc_reg_operand" "y")
12021 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12022 [(set (attr "type")
12023 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12024 (const_string "mfcrf")
12026 (const_string "mfcr")))
12027 (set_attr "length" "8")])
12029 ;; Same as above, but get the GT bit.
12030 (define_insn "move_from_CR_gt_bit"
12031 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12032 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12034 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12035 [(set_attr "type" "mfcr")
12036 (set_attr "length" "8")])
12038 ;; Same as above, but get the OV/ORDERED bit.
12039 (define_insn "move_from_CR_ov_bit"
12040 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12041 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12043 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12044 [(set_attr "type" "mfcr")
12045 (set_attr "length" "8")])
12048 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12049 (match_operator:DI 1 "scc_comparison_operator"
12050 [(match_operand 2 "cc_reg_operand" "y")
12053 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12054 [(set (attr "type")
12055 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12056 (const_string "mfcrf")
12058 (const_string "mfcr")))
12059 (set_attr "length" "8")])
12062 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12063 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12064 [(match_operand 2 "cc_reg_operand" "y,y")
12067 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12068 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12071 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12073 [(set_attr "type" "delayed_compare")
12074 (set_attr "length" "8,16")])
12077 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12078 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12079 [(match_operand 2 "cc_reg_operand" "")
12082 (set (match_operand:SI 3 "gpc_reg_operand" "")
12083 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12084 "TARGET_32BIT && reload_completed"
12085 [(set (match_dup 3)
12086 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12088 (compare:CC (match_dup 3)
12093 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12094 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12095 [(match_operand 2 "cc_reg_operand" "y")
12097 (match_operand:SI 3 "const_int_operand" "n")))]
12101 int is_bit = ccr_bit (operands[1], 1);
12102 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12105 if (is_bit >= put_bit)
12106 count = is_bit - put_bit;
12108 count = 32 - (put_bit - is_bit);
12110 operands[4] = GEN_INT (count);
12111 operands[5] = GEN_INT (put_bit);
12113 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12115 [(set (attr "type")
12116 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12117 (const_string "mfcrf")
12119 (const_string "mfcr")))
12120 (set_attr "length" "8")])
12123 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12125 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12126 [(match_operand 2 "cc_reg_operand" "y,y")
12128 (match_operand:SI 3 "const_int_operand" "n,n"))
12130 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12131 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12136 int is_bit = ccr_bit (operands[1], 1);
12137 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12140 /* Force split for non-cc0 compare. */
12141 if (which_alternative == 1)
12144 if (is_bit >= put_bit)
12145 count = is_bit - put_bit;
12147 count = 32 - (put_bit - is_bit);
12149 operands[5] = GEN_INT (count);
12150 operands[6] = GEN_INT (put_bit);
12152 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
12154 [(set_attr "type" "delayed_compare")
12155 (set_attr "length" "8,16")])
12158 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12160 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12161 [(match_operand 2 "cc_reg_operand" "")
12163 (match_operand:SI 3 "const_int_operand" ""))
12165 (set (match_operand:SI 4 "gpc_reg_operand" "")
12166 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12169 [(set (match_dup 4)
12170 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12173 (compare:CC (match_dup 4)
12177 ;; There is a 3 cycle delay between consecutive mfcr instructions
12178 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12181 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12182 (match_operator:SI 1 "scc_comparison_operator"
12183 [(match_operand 2 "cc_reg_operand" "y")
12185 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12186 (match_operator:SI 4 "scc_comparison_operator"
12187 [(match_operand 5 "cc_reg_operand" "y")
12189 "REGNO (operands[2]) != REGNO (operands[5])"
12190 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12191 [(set_attr "type" "mfcr")
12192 (set_attr "length" "12")])
12195 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12196 (match_operator:DI 1 "scc_comparison_operator"
12197 [(match_operand 2 "cc_reg_operand" "y")
12199 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12200 (match_operator:DI 4 "scc_comparison_operator"
12201 [(match_operand 5 "cc_reg_operand" "y")
12203 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12204 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12205 [(set_attr "type" "mfcr")
12206 (set_attr "length" "12")])
12208 ;; There are some scc insns that can be done directly, without a compare.
12209 ;; These are faster because they don't involve the communications between
12210 ;; the FXU and branch units. In fact, we will be replacing all of the
12211 ;; integer scc insns here or in the portable methods in emit_store_flag.
12213 ;; Also support (neg (scc ..)) since that construct is used to replace
12214 ;; branches, (plus (scc ..) ..) since that construct is common and
12215 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12216 ;; cases where it is no more expensive than (neg (scc ..)).
12218 ;; Have reload force a constant into a register for the simple insns that
12219 ;; otherwise won't accept constants. We do this because it is faster than
12220 ;; the cmp/mfcr sequence we would otherwise generate.
12222 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12225 (define_insn_and_split "*eq<mode>"
12226 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12227 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12228 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12232 [(set (match_dup 0)
12233 (clz:GPR (match_dup 3)))
12235 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12237 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12239 /* Use output operand as intermediate. */
12240 operands[3] = operands[0];
12242 if (logical_operand (operands[2], <MODE>mode))
12243 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12244 gen_rtx_XOR (<MODE>mode,
12245 operands[1], operands[2])));
12247 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12248 gen_rtx_PLUS (<MODE>mode, operands[1],
12249 negate_rtx (<MODE>mode,
12253 operands[3] = operands[1];
12255 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12258 (define_insn_and_split "*eq<mode>_compare"
12259 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12261 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12262 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12264 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12265 (eq:P (match_dup 1) (match_dup 2)))]
12266 "!TARGET_POWER && optimize_size"
12268 "!TARGET_POWER && optimize_size"
12269 [(set (match_dup 0)
12270 (clz:P (match_dup 4)))
12271 (parallel [(set (match_dup 3)
12272 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12275 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12277 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12279 /* Use output operand as intermediate. */
12280 operands[4] = operands[0];
12282 if (logical_operand (operands[2], <MODE>mode))
12283 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12284 gen_rtx_XOR (<MODE>mode,
12285 operands[1], operands[2])));
12287 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12288 gen_rtx_PLUS (<MODE>mode, operands[1],
12289 negate_rtx (<MODE>mode,
12293 operands[4] = operands[1];
12295 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12298 (define_insn "*eqsi_power"
12299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12300 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12301 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
12302 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
12305 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12306 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
12307 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12308 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12309 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
12310 [(set_attr "type" "three,two,three,three,three")
12311 (set_attr "length" "12,8,12,12,12")])
12313 ;; We have insns of the form shown by the first define_insn below. If
12314 ;; there is something inside the comparison operation, we must split it.
12316 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12317 (plus:SI (match_operator 1 "comparison_operator"
12318 [(match_operand:SI 2 "" "")
12319 (match_operand:SI 3
12320 "reg_or_cint_operand" "")])
12321 (match_operand:SI 4 "gpc_reg_operand" "")))
12322 (clobber (match_operand:SI 5 "register_operand" ""))]
12323 "! gpc_reg_operand (operands[2], SImode)"
12324 [(set (match_dup 5) (match_dup 2))
12325 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
12328 (define_insn "*plus_eqsi"
12329 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12330 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12331 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12332 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12335 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12336 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
12337 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12338 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12339 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12340 [(set_attr "type" "three,two,three,three,three")
12341 (set_attr "length" "12,8,12,12,12")])
12343 (define_insn "*compare_plus_eqsi"
12344 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12347 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12348 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12349 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12351 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12352 "TARGET_32BIT && optimize_size"
12354 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12355 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12356 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12357 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12358 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12364 [(set_attr "type" "compare")
12365 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12368 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12371 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12372 (match_operand:SI 2 "scc_eq_operand" ""))
12373 (match_operand:SI 3 "gpc_reg_operand" ""))
12375 (clobber (match_scratch:SI 4 ""))]
12376 "TARGET_32BIT && optimize_size && reload_completed"
12377 [(set (match_dup 4)
12378 (plus:SI (eq:SI (match_dup 1)
12382 (compare:CC (match_dup 4)
12386 (define_insn "*plus_eqsi_compare"
12387 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12390 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12391 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12392 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12394 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12395 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12396 "TARGET_32BIT && optimize_size"
12398 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12399 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12400 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12401 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12402 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12408 [(set_attr "type" "compare")
12409 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12412 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12415 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12416 (match_operand:SI 2 "scc_eq_operand" ""))
12417 (match_operand:SI 3 "gpc_reg_operand" ""))
12419 (set (match_operand:SI 0 "gpc_reg_operand" "")
12420 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12421 "TARGET_32BIT && optimize_size && reload_completed"
12422 [(set (match_dup 0)
12423 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12425 (compare:CC (match_dup 0)
12429 (define_insn "*neg_eq0<mode>"
12430 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12431 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12434 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12435 [(set_attr "type" "two")
12436 (set_attr "length" "8")])
12438 (define_insn_and_split "*neg_eq<mode>"
12439 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12440 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12441 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12445 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12447 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12449 /* Use output operand as intermediate. */
12450 operands[3] = operands[0];
12452 if (logical_operand (operands[2], <MODE>mode))
12453 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12454 gen_rtx_XOR (<MODE>mode,
12455 operands[1], operands[2])));
12457 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12458 gen_rtx_PLUS (<MODE>mode, operands[1],
12459 negate_rtx (<MODE>mode,
12463 operands[3] = operands[1];
12466 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12467 ;; since it nabs/sr is just as fast.
12468 (define_insn "*ne0si"
12469 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12470 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12472 (clobber (match_scratch:SI 2 "=&r"))]
12473 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12474 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12475 [(set_attr "type" "two")
12476 (set_attr "length" "8")])
12478 (define_insn "*ne0di"
12479 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12480 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12482 (clobber (match_scratch:DI 2 "=&r"))]
12484 "addic %2,%1,-1\;subfe %0,%2,%1"
12485 [(set_attr "type" "two")
12486 (set_attr "length" "8")])
12488 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12489 (define_insn "*plus_ne0si"
12490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12491 (plus:SI (lshiftrt:SI
12492 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12494 (match_operand:SI 2 "gpc_reg_operand" "r")))
12495 (clobber (match_scratch:SI 3 "=&r"))]
12497 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12498 [(set_attr "type" "two")
12499 (set_attr "length" "8")])
12501 (define_insn "*plus_ne0di"
12502 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12503 (plus:DI (lshiftrt:DI
12504 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12506 (match_operand:DI 2 "gpc_reg_operand" "r")))
12507 (clobber (match_scratch:DI 3 "=&r"))]
12509 "addic %3,%1,-1\;addze %0,%2"
12510 [(set_attr "type" "two")
12511 (set_attr "length" "8")])
12513 (define_insn "*compare_plus_ne0si"
12514 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12516 (plus:SI (lshiftrt:SI
12517 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12519 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12521 (clobber (match_scratch:SI 3 "=&r,&r"))
12522 (clobber (match_scratch:SI 4 "=X,&r"))]
12525 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12527 [(set_attr "type" "compare")
12528 (set_attr "length" "8,12")])
12531 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12533 (plus:SI (lshiftrt:SI
12534 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12536 (match_operand:SI 2 "gpc_reg_operand" ""))
12538 (clobber (match_scratch:SI 3 ""))
12539 (clobber (match_scratch:SI 4 ""))]
12540 "TARGET_32BIT && reload_completed"
12541 [(parallel [(set (match_dup 3)
12542 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12545 (clobber (match_dup 4))])
12547 (compare:CC (match_dup 3)
12551 (define_insn "*compare_plus_ne0di"
12552 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12554 (plus:DI (lshiftrt:DI
12555 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12557 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12559 (clobber (match_scratch:DI 3 "=&r,&r"))]
12562 addic %3,%1,-1\;addze. %3,%2
12564 [(set_attr "type" "compare")
12565 (set_attr "length" "8,12")])
12568 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12570 (plus:DI (lshiftrt:DI
12571 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12573 (match_operand:DI 2 "gpc_reg_operand" ""))
12575 (clobber (match_scratch:DI 3 ""))]
12576 "TARGET_64BIT && reload_completed"
12577 [(set (match_dup 3)
12578 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12582 (compare:CC (match_dup 3)
12586 (define_insn "*plus_ne0si_compare"
12587 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12589 (plus:SI (lshiftrt:SI
12590 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12592 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12594 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12595 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12597 (clobber (match_scratch:SI 3 "=&r,&r"))]
12600 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12602 [(set_attr "type" "compare")
12603 (set_attr "length" "8,12")])
12606 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12608 (plus:SI (lshiftrt:SI
12609 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12611 (match_operand:SI 2 "gpc_reg_operand" ""))
12613 (set (match_operand:SI 0 "gpc_reg_operand" "")
12614 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12616 (clobber (match_scratch:SI 3 ""))]
12617 "TARGET_32BIT && reload_completed"
12618 [(parallel [(set (match_dup 0)
12619 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12621 (clobber (match_dup 3))])
12623 (compare:CC (match_dup 0)
12627 (define_insn "*plus_ne0di_compare"
12628 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12630 (plus:DI (lshiftrt:DI
12631 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12633 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12635 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12636 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12638 (clobber (match_scratch:DI 3 "=&r,&r"))]
12641 addic %3,%1,-1\;addze. %0,%2
12643 [(set_attr "type" "compare")
12644 (set_attr "length" "8,12")])
12647 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12649 (plus:DI (lshiftrt:DI
12650 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12652 (match_operand:DI 2 "gpc_reg_operand" ""))
12654 (set (match_operand:DI 0 "gpc_reg_operand" "")
12655 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12657 (clobber (match_scratch:DI 3 ""))]
12658 "TARGET_64BIT && reload_completed"
12659 [(parallel [(set (match_dup 0)
12660 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12662 (clobber (match_dup 3))])
12664 (compare:CC (match_dup 0)
12669 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12670 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12671 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12672 (clobber (match_scratch:SI 3 "=r,X"))]
12675 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12676 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12677 [(set_attr "length" "12")])
12680 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12682 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12683 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12685 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12686 (le:SI (match_dup 1) (match_dup 2)))
12687 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12690 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12691 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12694 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12695 (set_attr "length" "12,12,16,16")])
12698 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12700 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12701 (match_operand:SI 2 "reg_or_short_operand" ""))
12703 (set (match_operand:SI 0 "gpc_reg_operand" "")
12704 (le:SI (match_dup 1) (match_dup 2)))
12705 (clobber (match_scratch:SI 3 ""))]
12706 "TARGET_POWER && reload_completed"
12707 [(parallel [(set (match_dup 0)
12708 (le:SI (match_dup 1) (match_dup 2)))
12709 (clobber (match_dup 3))])
12711 (compare:CC (match_dup 0)
12716 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12717 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12718 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12719 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12722 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12723 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12724 [(set_attr "length" "12")])
12727 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12729 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12730 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12731 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12733 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12736 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12737 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12740 [(set_attr "type" "compare")
12741 (set_attr "length" "12,12,16,16")])
12744 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12746 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12747 (match_operand:SI 2 "reg_or_short_operand" ""))
12748 (match_operand:SI 3 "gpc_reg_operand" ""))
12750 (clobber (match_scratch:SI 4 ""))]
12751 "TARGET_POWER && reload_completed"
12752 [(set (match_dup 4)
12753 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12756 (compare:CC (match_dup 4)
12761 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12763 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12764 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12765 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12767 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12768 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12771 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12772 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12775 [(set_attr "type" "compare")
12776 (set_attr "length" "12,12,16,16")])
12779 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12781 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12782 (match_operand:SI 2 "reg_or_short_operand" ""))
12783 (match_operand:SI 3 "gpc_reg_operand" ""))
12785 (set (match_operand:SI 0 "gpc_reg_operand" "")
12786 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12787 "TARGET_POWER && reload_completed"
12788 [(set (match_dup 0)
12789 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12791 (compare:CC (match_dup 0)
12796 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12797 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12798 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12801 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12802 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12803 [(set_attr "length" "12")])
12805 (define_insn "*leu<mode>"
12806 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12807 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12808 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12810 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12811 [(set_attr "type" "three")
12812 (set_attr "length" "12")])
12814 (define_insn "*leu<mode>_compare"
12815 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12817 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12818 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12820 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12821 (leu:P (match_dup 1) (match_dup 2)))]
12824 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12826 [(set_attr "type" "compare")
12827 (set_attr "length" "12,16")])
12830 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12832 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12833 (match_operand:P 2 "reg_or_short_operand" ""))
12835 (set (match_operand:P 0 "gpc_reg_operand" "")
12836 (leu:P (match_dup 1) (match_dup 2)))]
12838 [(set (match_dup 0)
12839 (leu:P (match_dup 1) (match_dup 2)))
12841 (compare:CC (match_dup 0)
12845 (define_insn "*plus_leu<mode>"
12846 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12847 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12848 (match_operand:P 2 "reg_or_short_operand" "rI"))
12849 (match_operand:P 3 "gpc_reg_operand" "r")))]
12851 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12852 [(set_attr "type" "two")
12853 (set_attr "length" "8")])
12856 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12858 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12859 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12860 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12862 (clobber (match_scratch:SI 4 "=&r,&r"))]
12865 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12867 [(set_attr "type" "compare")
12868 (set_attr "length" "8,12")])
12871 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12873 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12874 (match_operand:SI 2 "reg_or_short_operand" ""))
12875 (match_operand:SI 3 "gpc_reg_operand" ""))
12877 (clobber (match_scratch:SI 4 ""))]
12878 "TARGET_32BIT && reload_completed"
12879 [(set (match_dup 4)
12880 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12883 (compare:CC (match_dup 4)
12888 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12890 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12891 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12892 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12894 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12895 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12898 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12900 [(set_attr "type" "compare")
12901 (set_attr "length" "8,12")])
12904 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12906 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12907 (match_operand:SI 2 "reg_or_short_operand" ""))
12908 (match_operand:SI 3 "gpc_reg_operand" ""))
12910 (set (match_operand:SI 0 "gpc_reg_operand" "")
12911 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12912 "TARGET_32BIT && reload_completed"
12913 [(set (match_dup 0)
12914 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12916 (compare:CC (match_dup 0)
12920 (define_insn "*neg_leu<mode>"
12921 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12922 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12923 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12925 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12926 [(set_attr "type" "three")
12927 (set_attr "length" "12")])
12929 (define_insn "*and_neg_leu<mode>"
12930 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12932 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12933 (match_operand:P 2 "reg_or_short_operand" "rI")))
12934 (match_operand:P 3 "gpc_reg_operand" "r")))]
12936 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12937 [(set_attr "type" "three")
12938 (set_attr "length" "12")])
12941 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12944 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12945 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12946 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12948 (clobber (match_scratch:SI 4 "=&r,&r"))]
12951 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12953 [(set_attr "type" "compare")
12954 (set_attr "length" "12,16")])
12957 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12960 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12961 (match_operand:SI 2 "reg_or_short_operand" "")))
12962 (match_operand:SI 3 "gpc_reg_operand" ""))
12964 (clobber (match_scratch:SI 4 ""))]
12965 "TARGET_32BIT && reload_completed"
12966 [(set (match_dup 4)
12967 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12970 (compare:CC (match_dup 4)
12975 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12978 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12979 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12980 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12982 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12983 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12986 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12988 [(set_attr "type" "compare")
12989 (set_attr "length" "12,16")])
12992 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12995 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12996 (match_operand:SI 2 "reg_or_short_operand" "")))
12997 (match_operand:SI 3 "gpc_reg_operand" ""))
12999 (set (match_operand:SI 0 "gpc_reg_operand" "")
13000 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13001 "TARGET_32BIT && reload_completed"
13002 [(set (match_dup 0)
13003 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13006 (compare:CC (match_dup 0)
13011 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13012 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13013 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13015 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13016 [(set_attr "length" "12")])
13019 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13021 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13022 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13024 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13025 (lt:SI (match_dup 1) (match_dup 2)))]
13028 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13030 [(set_attr "type" "delayed_compare")
13031 (set_attr "length" "12,16")])
13034 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13036 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13037 (match_operand:SI 2 "reg_or_short_operand" ""))
13039 (set (match_operand:SI 0 "gpc_reg_operand" "")
13040 (lt:SI (match_dup 1) (match_dup 2)))]
13041 "TARGET_POWER && reload_completed"
13042 [(set (match_dup 0)
13043 (lt:SI (match_dup 1) (match_dup 2)))
13045 (compare:CC (match_dup 0)
13050 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13051 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13052 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13053 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13055 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13056 [(set_attr "length" "12")])
13059 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13061 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13062 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13063 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13065 (clobber (match_scratch:SI 4 "=&r,&r"))]
13068 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13070 [(set_attr "type" "compare")
13071 (set_attr "length" "12,16")])
13074 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13076 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13077 (match_operand:SI 2 "reg_or_short_operand" ""))
13078 (match_operand:SI 3 "gpc_reg_operand" ""))
13080 (clobber (match_scratch:SI 4 ""))]
13081 "TARGET_POWER && reload_completed"
13082 [(set (match_dup 4)
13083 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13086 (compare:CC (match_dup 4)
13091 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13093 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13094 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13095 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13097 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13098 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13101 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13103 [(set_attr "type" "compare")
13104 (set_attr "length" "12,16")])
13107 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13109 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13110 (match_operand:SI 2 "reg_or_short_operand" ""))
13111 (match_operand:SI 3 "gpc_reg_operand" ""))
13113 (set (match_operand:SI 0 "gpc_reg_operand" "")
13114 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13115 "TARGET_POWER && reload_completed"
13116 [(set (match_dup 0)
13117 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13119 (compare:CC (match_dup 0)
13124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13125 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13126 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13128 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13129 [(set_attr "length" "12")])
13131 (define_insn_and_split "*ltu<mode>"
13132 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13133 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13134 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13138 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13139 (set (match_dup 0) (neg:P (match_dup 0)))]
13142 (define_insn_and_split "*ltu<mode>_compare"
13143 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13145 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13146 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13148 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13149 (ltu:P (match_dup 1) (match_dup 2)))]
13153 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13154 (parallel [(set (match_dup 3)
13155 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13156 (set (match_dup 0) (neg:P (match_dup 0)))])]
13159 (define_insn_and_split "*plus_ltu<mode>"
13160 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13161 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13162 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13163 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13166 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13167 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13168 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13171 (define_insn_and_split "*plus_ltu<mode>_compare"
13172 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13174 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13175 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13176 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13178 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13179 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13182 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13183 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13184 (parallel [(set (match_dup 4)
13185 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13187 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13190 (define_insn "*neg_ltu<mode>"
13191 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13192 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13193 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13196 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
13197 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
13198 [(set_attr "type" "two")
13199 (set_attr "length" "8")])
13202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13203 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13204 (match_operand:SI 2 "reg_or_short_operand" "rI")))
13205 (clobber (match_scratch:SI 3 "=r"))]
13207 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
13208 [(set_attr "length" "12")])
13211 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13213 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13214 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13216 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13217 (ge:SI (match_dup 1) (match_dup 2)))
13218 (clobber (match_scratch:SI 3 "=r,r"))]
13221 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13223 [(set_attr "type" "compare")
13224 (set_attr "length" "12,16")])
13227 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13229 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13230 (match_operand:SI 2 "reg_or_short_operand" ""))
13232 (set (match_operand:SI 0 "gpc_reg_operand" "")
13233 (ge:SI (match_dup 1) (match_dup 2)))
13234 (clobber (match_scratch:SI 3 ""))]
13235 "TARGET_POWER && reload_completed"
13236 [(parallel [(set (match_dup 0)
13237 (ge:SI (match_dup 1) (match_dup 2)))
13238 (clobber (match_dup 3))])
13240 (compare:CC (match_dup 0)
13245 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13246 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13247 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13248 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13250 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13251 [(set_attr "length" "12")])
13254 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13256 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13257 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13258 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13260 (clobber (match_scratch:SI 4 "=&r,&r"))]
13263 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13265 [(set_attr "type" "compare")
13266 (set_attr "length" "12,16")])
13269 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13271 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13272 (match_operand:SI 2 "reg_or_short_operand" ""))
13273 (match_operand:SI 3 "gpc_reg_operand" ""))
13275 (clobber (match_scratch:SI 4 ""))]
13276 "TARGET_POWER && reload_completed"
13277 [(set (match_dup 4)
13278 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13281 (compare:CC (match_dup 4)
13286 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13288 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13289 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13290 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13292 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13293 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13296 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13298 [(set_attr "type" "compare")
13299 (set_attr "length" "12,16")])
13302 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13304 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13305 (match_operand:SI 2 "reg_or_short_operand" ""))
13306 (match_operand:SI 3 "gpc_reg_operand" ""))
13308 (set (match_operand:SI 0 "gpc_reg_operand" "")
13309 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13310 "TARGET_POWER && reload_completed"
13311 [(set (match_dup 0)
13312 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13314 (compare:CC (match_dup 0)
13319 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13320 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13321 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13323 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13324 [(set_attr "length" "12")])
13326 (define_insn "*geu<mode>"
13327 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13328 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13329 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13332 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13333 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13334 [(set_attr "type" "three")
13335 (set_attr "length" "12")])
13337 (define_insn "*geu<mode>_compare"
13338 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13340 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13341 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13343 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13344 (geu:P (match_dup 1) (match_dup 2)))]
13347 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13348 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13351 [(set_attr "type" "compare")
13352 (set_attr "length" "12,12,16,16")])
13355 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13357 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13358 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13360 (set (match_operand:P 0 "gpc_reg_operand" "")
13361 (geu:P (match_dup 1) (match_dup 2)))]
13363 [(set (match_dup 0)
13364 (geu:P (match_dup 1) (match_dup 2)))
13366 (compare:CC (match_dup 0)
13370 (define_insn "*plus_geu<mode>"
13371 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13372 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13373 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13374 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13377 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13378 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13379 [(set_attr "type" "two")
13380 (set_attr "length" "8")])
13383 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13385 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13386 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13387 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13389 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13392 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13393 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13396 [(set_attr "type" "compare")
13397 (set_attr "length" "8,8,12,12")])
13400 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13402 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13403 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13404 (match_operand:SI 3 "gpc_reg_operand" ""))
13406 (clobber (match_scratch:SI 4 ""))]
13407 "TARGET_32BIT && reload_completed"
13408 [(set (match_dup 4)
13409 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13412 (compare:CC (match_dup 4)
13417 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13419 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13420 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13421 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13423 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13424 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13427 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13428 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13431 [(set_attr "type" "compare")
13432 (set_attr "length" "8,8,12,12")])
13435 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13437 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13438 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13439 (match_operand:SI 3 "gpc_reg_operand" ""))
13441 (set (match_operand:SI 0 "gpc_reg_operand" "")
13442 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13443 "TARGET_32BIT && reload_completed"
13444 [(set (match_dup 0)
13445 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13447 (compare:CC (match_dup 0)
13451 (define_insn "*neg_geu<mode>"
13452 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13453 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13454 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13457 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13458 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13459 [(set_attr "type" "three")
13460 (set_attr "length" "12")])
13462 (define_insn "*and_neg_geu<mode>"
13463 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13465 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13466 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13467 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13470 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13471 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13472 [(set_attr "type" "three")
13473 (set_attr "length" "12")])
13476 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13479 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13480 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13481 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13483 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13486 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13487 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13490 [(set_attr "type" "compare")
13491 (set_attr "length" "12,12,16,16")])
13494 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13497 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13498 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13499 (match_operand:SI 3 "gpc_reg_operand" ""))
13501 (clobber (match_scratch:SI 4 ""))]
13502 "TARGET_32BIT && reload_completed"
13503 [(set (match_dup 4)
13504 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13507 (compare:CC (match_dup 4)
13512 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13515 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13516 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13517 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13519 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13520 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13523 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13524 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13527 [(set_attr "type" "compare")
13528 (set_attr "length" "12,12,16,16")])
13531 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13534 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13535 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13536 (match_operand:SI 3 "gpc_reg_operand" ""))
13538 (set (match_operand:SI 0 "gpc_reg_operand" "")
13539 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13540 "TARGET_32BIT && reload_completed"
13541 [(set (match_dup 0)
13542 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13544 (compare:CC (match_dup 0)
13549 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13550 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13551 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13553 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13554 [(set_attr "length" "12")])
13557 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13559 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13560 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13562 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13563 (gt:SI (match_dup 1) (match_dup 2)))]
13566 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13568 [(set_attr "type" "delayed_compare")
13569 (set_attr "length" "12,16")])
13572 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13574 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13575 (match_operand:SI 2 "reg_or_short_operand" ""))
13577 (set (match_operand:SI 0 "gpc_reg_operand" "")
13578 (gt:SI (match_dup 1) (match_dup 2)))]
13579 "TARGET_POWER && reload_completed"
13580 [(set (match_dup 0)
13581 (gt:SI (match_dup 1) (match_dup 2)))
13583 (compare:CC (match_dup 0)
13587 (define_insn "*plus_gt0<mode>"
13588 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13589 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13591 (match_operand:P 2 "gpc_reg_operand" "r")))]
13593 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13594 [(set_attr "type" "three")
13595 (set_attr "length" "12")])
13598 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13600 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13602 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13604 (clobber (match_scratch:SI 3 "=&r,&r"))]
13607 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13609 [(set_attr "type" "compare")
13610 (set_attr "length" "12,16")])
13613 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13615 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13617 (match_operand:SI 2 "gpc_reg_operand" ""))
13619 (clobber (match_scratch:SI 3 ""))]
13620 "TARGET_32BIT && reload_completed"
13621 [(set (match_dup 3)
13622 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13625 (compare:CC (match_dup 3)
13630 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13632 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13634 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13636 (clobber (match_scratch:DI 3 "=&r,&r"))]
13639 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13641 [(set_attr "type" "compare")
13642 (set_attr "length" "12,16")])
13645 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13647 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13649 (match_operand:DI 2 "gpc_reg_operand" ""))
13651 (clobber (match_scratch:DI 3 ""))]
13652 "TARGET_64BIT && reload_completed"
13653 [(set (match_dup 3)
13654 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13657 (compare:CC (match_dup 3)
13662 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13664 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13666 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13668 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13669 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13672 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13674 [(set_attr "type" "compare")
13675 (set_attr "length" "12,16")])
13678 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13680 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13682 (match_operand:SI 2 "gpc_reg_operand" ""))
13684 (set (match_operand:SI 0 "gpc_reg_operand" "")
13685 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13686 "TARGET_32BIT && reload_completed"
13687 [(set (match_dup 0)
13688 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13690 (compare:CC (match_dup 0)
13695 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13697 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13699 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13701 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13702 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13705 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13707 [(set_attr "type" "compare")
13708 (set_attr "length" "12,16")])
13711 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13713 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13715 (match_operand:DI 2 "gpc_reg_operand" ""))
13717 (set (match_operand:DI 0 "gpc_reg_operand" "")
13718 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13719 "TARGET_64BIT && reload_completed"
13720 [(set (match_dup 0)
13721 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13723 (compare:CC (match_dup 0)
13728 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13729 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13730 (match_operand:SI 2 "reg_or_short_operand" "r"))
13731 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13733 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13734 [(set_attr "length" "12")])
13737 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13739 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13740 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13741 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13743 (clobber (match_scratch:SI 4 "=&r,&r"))]
13746 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13748 [(set_attr "type" "compare")
13749 (set_attr "length" "12,16")])
13752 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13754 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13755 (match_operand:SI 2 "reg_or_short_operand" ""))
13756 (match_operand:SI 3 "gpc_reg_operand" ""))
13758 (clobber (match_scratch:SI 4 ""))]
13759 "TARGET_POWER && reload_completed"
13760 [(set (match_dup 4)
13761 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13763 (compare:CC (match_dup 4)
13768 [(set (match_operand:CC 4 "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 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13775 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13778 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13780 [(set_attr "type" "compare")
13781 (set_attr "length" "12,16")])
13784 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13786 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13787 (match_operand:SI 2 "reg_or_short_operand" ""))
13788 (match_operand:SI 3 "gpc_reg_operand" ""))
13790 (set (match_operand:SI 0 "gpc_reg_operand" "")
13791 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13792 "TARGET_POWER && reload_completed"
13793 [(set (match_dup 0)
13794 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13796 (compare:CC (match_dup 0)
13801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13802 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13803 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13805 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13806 [(set_attr "length" "12")])
13808 (define_insn_and_split "*gtu<mode>"
13809 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13810 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13811 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13815 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13816 (set (match_dup 0) (neg:P (match_dup 0)))]
13819 (define_insn_and_split "*gtu<mode>_compare"
13820 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13822 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13823 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13825 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13826 (gtu:P (match_dup 1) (match_dup 2)))]
13830 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13831 (parallel [(set (match_dup 3)
13832 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13833 (set (match_dup 0) (neg:P (match_dup 0)))])]
13836 (define_insn_and_split "*plus_gtu<mode>"
13837 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13838 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13839 (match_operand:P 2 "reg_or_short_operand" "rI"))
13840 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13843 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13844 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13845 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13848 (define_insn_and_split "*plus_gtu<mode>_compare"
13849 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13851 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13852 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13853 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13855 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13856 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13859 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13860 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13861 (parallel [(set (match_dup 4)
13862 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13864 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13867 (define_insn "*neg_gtu<mode>"
13868 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13869 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13870 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13872 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13873 [(set_attr "type" "two")
13874 (set_attr "length" "8")])
13877 ;; Define both directions of branch and return. If we need a reload
13878 ;; register, we'd rather use CR0 since it is much easier to copy a
13879 ;; register CC value to there.
13883 (if_then_else (match_operator 1 "branch_comparison_operator"
13885 "cc_reg_operand" "y")
13887 (label_ref (match_operand 0 "" ""))
13892 return output_cbranch (operands[1], \"%l0\", 0, insn);
13894 [(set_attr "type" "branch")])
13898 (if_then_else (match_operator 0 "branch_comparison_operator"
13900 "cc_reg_operand" "y")
13907 return output_cbranch (operands[0], NULL, 0, insn);
13909 [(set_attr "type" "jmpreg")
13910 (set_attr "length" "4")])
13914 (if_then_else (match_operator 1 "branch_comparison_operator"
13916 "cc_reg_operand" "y")
13919 (label_ref (match_operand 0 "" ""))))]
13923 return output_cbranch (operands[1], \"%l0\", 1, 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, 1, insn);
13940 [(set_attr "type" "jmpreg")
13941 (set_attr "length" "4")])
13943 ;; Logic on condition register values.
13945 ; This pattern matches things like
13946 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13947 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13949 ; which are generated by the branch logic.
13950 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13952 (define_insn "*cceq_ior_compare"
13953 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13954 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13955 [(match_operator:SI 2
13956 "branch_positive_comparison_operator"
13958 "cc_reg_operand" "y,y")
13960 (match_operator:SI 4
13961 "branch_positive_comparison_operator"
13963 "cc_reg_operand" "0,y")
13967 "cr%q1 %E0,%j2,%j4"
13968 [(set_attr "type" "cr_logical,delayed_cr")])
13970 ; Why is the constant -1 here, but 1 in the previous pattern?
13971 ; Because ~1 has all but the low bit set.
13973 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13974 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13975 [(not:SI (match_operator:SI 2
13976 "branch_positive_comparison_operator"
13978 "cc_reg_operand" "y,y")
13980 (match_operator:SI 4
13981 "branch_positive_comparison_operator"
13983 "cc_reg_operand" "0,y")
13987 "cr%q1 %E0,%j2,%j4"
13988 [(set_attr "type" "cr_logical,delayed_cr")])
13990 (define_insn "*cceq_rev_compare"
13991 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13992 (compare:CCEQ (match_operator:SI 1
13993 "branch_positive_comparison_operator"
13995 "cc_reg_operand" "0,y")
13999 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14000 [(set_attr "type" "cr_logical,delayed_cr")])
14002 ;; If we are comparing the result of two comparisons, this can be done
14003 ;; using creqv or crxor.
14005 (define_insn_and_split ""
14006 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14007 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14008 [(match_operand 2 "cc_reg_operand" "y")
14010 (match_operator 3 "branch_comparison_operator"
14011 [(match_operand 4 "cc_reg_operand" "y")
14016 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14020 int positive_1, positive_2;
14022 positive_1 = branch_positive_comparison_operator (operands[1],
14023 GET_MODE (operands[1]));
14024 positive_2 = branch_positive_comparison_operator (operands[3],
14025 GET_MODE (operands[3]));
14028 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14029 GET_CODE (operands[1])),
14031 operands[2], const0_rtx);
14032 else if (GET_MODE (operands[1]) != SImode)
14033 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14034 operands[2], const0_rtx);
14037 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14038 GET_CODE (operands[3])),
14040 operands[4], const0_rtx);
14041 else if (GET_MODE (operands[3]) != SImode)
14042 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14043 operands[4], const0_rtx);
14045 if (positive_1 == positive_2)
14047 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14048 operands[5] = constm1_rtx;
14052 operands[5] = const1_rtx;
14056 ;; Unconditional branch and return.
14058 (define_insn "jump"
14060 (label_ref (match_operand 0 "" "")))]
14063 [(set_attr "type" "branch")])
14065 (define_insn "return"
14069 [(set_attr "type" "jmpreg")])
14071 (define_expand "indirect_jump"
14072 [(set (pc) (match_operand 0 "register_operand" ""))])
14074 (define_insn "*indirect_jump<mode>"
14075 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14080 [(set_attr "type" "jmpreg")])
14082 ;; Table jump for switch statements:
14083 (define_expand "tablejump"
14084 [(use (match_operand 0 "" ""))
14085 (use (label_ref (match_operand 1 "" "")))]
14090 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14092 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14096 (define_expand "tablejumpsi"
14097 [(set (match_dup 3)
14098 (plus:SI (match_operand:SI 0 "" "")
14100 (parallel [(set (pc) (match_dup 3))
14101 (use (label_ref (match_operand 1 "" "")))])]
14104 { operands[0] = force_reg (SImode, operands[0]);
14105 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14106 operands[3] = gen_reg_rtx (SImode);
14109 (define_expand "tablejumpdi"
14110 [(set (match_dup 4)
14111 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14113 (plus:DI (match_dup 4)
14115 (parallel [(set (pc) (match_dup 3))
14116 (use (label_ref (match_operand 1 "" "")))])]
14119 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14120 operands[3] = gen_reg_rtx (DImode);
14121 operands[4] = gen_reg_rtx (DImode);
14124 (define_insn "*tablejump<mode>_internal1"
14126 (match_operand:P 0 "register_operand" "c,*l"))
14127 (use (label_ref (match_operand 1 "" "")))]
14132 [(set_attr "type" "jmpreg")])
14137 "{cror 0,0,0|nop}")
14139 ;; Define the subtract-one-and-jump insns, starting with the template
14140 ;; so loop.c knows what to generate.
14142 (define_expand "doloop_end"
14143 [(use (match_operand 0 "" "")) ; loop pseudo
14144 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14145 (use (match_operand 2 "" "")) ; max iterations
14146 (use (match_operand 3 "" "")) ; loop level
14147 (use (match_operand 4 "" ""))] ; label
14151 /* Only use this on innermost loops. */
14152 if (INTVAL (operands[3]) > 1)
14156 if (GET_MODE (operands[0]) != DImode)
14158 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14162 if (GET_MODE (operands[0]) != SImode)
14164 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14169 (define_expand "ctr<mode>"
14170 [(parallel [(set (pc)
14171 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14173 (label_ref (match_operand 1 "" ""))
14176 (plus:P (match_dup 0)
14178 (clobber (match_scratch:CC 2 ""))
14179 (clobber (match_scratch:P 3 ""))])]
14183 ;; We need to be able to do this for any operand, including MEM, or we
14184 ;; will cause reload to blow up since we don't allow output reloads on
14186 ;; For the length attribute to be calculated correctly, the
14187 ;; label MUST be operand 0.
14189 (define_insn "*ctr<mode>_internal1"
14191 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14193 (label_ref (match_operand 0 "" ""))
14195 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14196 (plus:P (match_dup 1)
14198 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14199 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14203 if (which_alternative != 0)
14205 else if (get_attr_length (insn) == 4)
14206 return \"{bdn|bdnz} %l0\";
14208 return \"bdz $+8\;b %l0\";
14210 [(set_attr "type" "branch")
14211 (set_attr "length" "*,12,16,16")])
14213 (define_insn "*ctr<mode>_internal2"
14215 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14218 (label_ref (match_operand 0 "" ""))))
14219 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14220 (plus:P (match_dup 1)
14222 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14223 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14227 if (which_alternative != 0)
14229 else if (get_attr_length (insn) == 4)
14230 return \"bdz %l0\";
14232 return \"{bdn|bdnz} $+8\;b %l0\";
14234 [(set_attr "type" "branch")
14235 (set_attr "length" "*,12,16,16")])
14237 ;; Similar but use EQ
14239 (define_insn "*ctr<mode>_internal5"
14241 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14243 (label_ref (match_operand 0 "" ""))
14245 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14246 (plus:P (match_dup 1)
14248 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14249 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14253 if (which_alternative != 0)
14255 else if (get_attr_length (insn) == 4)
14256 return \"bdz %l0\";
14258 return \"{bdn|bdnz} $+8\;b %l0\";
14260 [(set_attr "type" "branch")
14261 (set_attr "length" "*,12,16,16")])
14263 (define_insn "*ctr<mode>_internal6"
14265 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14268 (label_ref (match_operand 0 "" ""))))
14269 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14270 (plus:P (match_dup 1)
14272 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14273 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14277 if (which_alternative != 0)
14279 else if (get_attr_length (insn) == 4)
14280 return \"{bdn|bdnz} %l0\";
14282 return \"bdz $+8\;b %l0\";
14284 [(set_attr "type" "branch")
14285 (set_attr "length" "*,12,16,16")])
14287 ;; Now the splitters if we could not allocate the CTR register
14291 (if_then_else (match_operator 2 "comparison_operator"
14292 [(match_operand:P 1 "gpc_reg_operand" "")
14294 (match_operand 5 "" "")
14295 (match_operand 6 "" "")))
14296 (set (match_operand:P 0 "gpc_reg_operand" "")
14297 (plus:P (match_dup 1) (const_int -1)))
14298 (clobber (match_scratch:CC 3 ""))
14299 (clobber (match_scratch:P 4 ""))]
14301 [(parallel [(set (match_dup 3)
14302 (compare:CC (plus:P (match_dup 1)
14306 (plus:P (match_dup 1)
14308 (set (pc) (if_then_else (match_dup 7)
14312 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14313 operands[3], const0_rtx); }")
14317 (if_then_else (match_operator 2 "comparison_operator"
14318 [(match_operand:P 1 "gpc_reg_operand" "")
14320 (match_operand 5 "" "")
14321 (match_operand 6 "" "")))
14322 (set (match_operand:P 0 "nonimmediate_operand" "")
14323 (plus:P (match_dup 1) (const_int -1)))
14324 (clobber (match_scratch:CC 3 ""))
14325 (clobber (match_scratch:P 4 ""))]
14326 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14327 [(parallel [(set (match_dup 3)
14328 (compare:CC (plus:P (match_dup 1)
14332 (plus:P (match_dup 1)
14336 (set (pc) (if_then_else (match_dup 7)
14340 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14341 operands[3], const0_rtx); }")
14343 (define_insn "trap"
14344 [(trap_if (const_int 1) (const_int 0))]
14347 [(set_attr "type" "trap")])
14349 (define_expand "conditional_trap"
14350 [(trap_if (match_operator 0 "trap_comparison_operator"
14351 [(match_dup 2) (match_dup 3)])
14352 (match_operand 1 "const_int_operand" ""))]
14354 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14355 operands[2] = rs6000_compare_op0;
14356 operands[3] = rs6000_compare_op1;")
14359 [(trap_if (match_operator 0 "trap_comparison_operator"
14360 [(match_operand:GPR 1 "register_operand" "r")
14361 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14364 "{t|t<wd>}%V0%I2 %1,%2"
14365 [(set_attr "type" "trap")])
14367 ;; Insns related to generating the function prologue and epilogue.
14369 (define_expand "prologue"
14370 [(use (const_int 0))]
14371 "TARGET_SCHED_PROLOG"
14374 rs6000_emit_prologue ();
14378 (define_insn "*movesi_from_cr_one"
14379 [(match_parallel 0 "mfcr_operation"
14380 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14381 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14382 (match_operand 3 "immediate_operand" "n")]
14383 UNSPEC_MOVESI_FROM_CR))])]
14389 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14391 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14392 operands[4] = GEN_INT (mask);
14393 output_asm_insn (\"mfcr %1,%4\", operands);
14397 [(set_attr "type" "mfcrf")])
14399 (define_insn "movesi_from_cr"
14400 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14401 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14402 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14403 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14404 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14405 UNSPEC_MOVESI_FROM_CR))]
14408 [(set_attr "type" "mfcr")])
14410 (define_insn "*stmw"
14411 [(match_parallel 0 "stmw_operation"
14412 [(set (match_operand:SI 1 "memory_operand" "=m")
14413 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14416 [(set_attr "type" "store_ux")])
14418 (define_insn "*save_fpregs_<mode>"
14419 [(match_parallel 0 "any_parallel_operand"
14420 [(clobber (reg:P 65))
14421 (use (match_operand:P 1 "call_operand" "s"))
14422 (set (match_operand:DF 2 "memory_operand" "=m")
14423 (match_operand:DF 3 "gpc_reg_operand" "f"))])]
14426 [(set_attr "type" "branch")
14427 (set_attr "length" "4")])
14429 ; These are to explain that changes to the stack pointer should
14430 ; not be moved over stores to stack memory.
14431 (define_insn "stack_tie"
14432 [(set (match_operand:BLK 0 "memory_operand" "+m")
14433 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14436 [(set_attr "length" "0")])
14439 (define_expand "epilogue"
14440 [(use (const_int 0))]
14441 "TARGET_SCHED_PROLOG"
14444 rs6000_emit_epilogue (FALSE);
14448 ; On some processors, doing the mtcrf one CC register at a time is
14449 ; faster (like on the 604e). On others, doing them all at once is
14450 ; faster; for instance, on the 601 and 750.
14452 (define_expand "movsi_to_cr_one"
14453 [(set (match_operand:CC 0 "cc_reg_operand" "")
14454 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14455 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14457 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14459 (define_insn "*movsi_to_cr"
14460 [(match_parallel 0 "mtcrf_operation"
14461 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14462 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14463 (match_operand 3 "immediate_operand" "n")]
14464 UNSPEC_MOVESI_TO_CR))])]
14470 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14471 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14472 operands[4] = GEN_INT (mask);
14473 return \"mtcrf %4,%2\";
14475 [(set_attr "type" "mtcr")])
14477 (define_insn "*mtcrfsi"
14478 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14479 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14480 (match_operand 2 "immediate_operand" "n")]
14481 UNSPEC_MOVESI_TO_CR))]
14482 "GET_CODE (operands[0]) == REG
14483 && CR_REGNO_P (REGNO (operands[0]))
14484 && GET_CODE (operands[2]) == CONST_INT
14485 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14487 [(set_attr "type" "mtcr")])
14489 ; The load-multiple instructions have similar properties.
14490 ; Note that "load_multiple" is a name known to the machine-independent
14491 ; code that actually corresponds to the PowerPC load-string.
14493 (define_insn "*lmw"
14494 [(match_parallel 0 "lmw_operation"
14495 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14496 (match_operand:SI 2 "memory_operand" "m"))])]
14499 [(set_attr "type" "load_ux")])
14501 (define_insn "*return_internal_<mode>"
14503 (use (match_operand:P 0 "register_operand" "lc"))]
14506 [(set_attr "type" "jmpreg")])
14508 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14509 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14511 (define_insn "*return_and_restore_fpregs_<mode>"
14512 [(match_parallel 0 "any_parallel_operand"
14515 (use (match_operand:P 1 "call_operand" "s"))
14516 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
14517 (match_operand:DF 3 "memory_operand" "m"))])]
14521 ; This is used in compiling the unwind routines.
14522 (define_expand "eh_return"
14523 [(use (match_operand 0 "general_operand" ""))]
14528 emit_insn (gen_eh_set_lr_si (operands[0]));
14530 emit_insn (gen_eh_set_lr_di (operands[0]));
14534 ; We can't expand this before we know where the link register is stored.
14535 (define_insn "eh_set_lr_<mode>"
14536 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14538 (clobber (match_scratch:P 1 "=&b"))]
14543 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14544 (clobber (match_scratch 1 ""))]
14549 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14553 (define_insn "prefetch"
14554 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14555 (match_operand:SI 1 "const_int_operand" "n")
14556 (match_operand:SI 2 "const_int_operand" "n"))]
14560 if (GET_CODE (operands[0]) == REG)
14561 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14562 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14564 [(set_attr "type" "load")])
14567 (include "sync.md")
14568 (include "altivec.md")