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)
105 ;; UNSPEC_VOLATILE usage
110 (UNSPECV_LL 1) ; load-locked
111 (UNSPECV_SC 2) ; store-conditional
112 (UNSPECV_EH_RR 9) ; eh_reg_restore
115 ;; Define an insn type attribute. This is used in function unit delay
117 (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"
118 (const_string "integer"))
120 ;; Length (in bytes).
121 ; '(pc)' in the following doesn't include the instruction itself; it is
122 ; calculated as if the instruction had zero size.
123 (define_attr "length" ""
124 (if_then_else (eq_attr "type" "branch")
125 (if_then_else (and (ge (minus (match_dup 0) (pc))
127 (lt (minus (match_dup 0) (pc))
133 ;; Processor type -- this attribute must exactly match the processor_type
134 ;; enumeration in rs6000.h.
136 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,power4,power5,power6,cell"
137 (const (symbol_ref "rs6000_cpu_attr")))
140 ;; If this instruction is microcoded on the CELL processor
141 ; The default for load and stores is conditional
142 ; The default for load extended and the recorded instructions is always microcoded
143 (define_attr "cell_micro" "not,conditional,always"
144 (if_then_else (ior (ior (eq_attr "type" "load")
145 (eq_attr "type" "store"))
146 (ior (eq_attr "type" "fpload")
147 (eq_attr "type" "fpstore")))
148 (const_string "conditional")
149 (if_then_else (ior (eq_attr "type" "load_ext")
150 (ior (eq_attr "type" "compare")
151 (eq_attr "type" "delayed_compare")))
152 (const_string "always")
153 (const_string "not"))))
156 (automata_option "ndfa")
169 (include "e300c2c3.md")
170 (include "e500mc.md")
171 (include "power4.md")
172 (include "power5.md")
173 (include "power6.md")
176 (include "predicates.md")
177 (include "constraints.md")
179 (include "darwin.md")
184 ; This mode iterator allows :GPR to be used to indicate the allowable size
185 ; of whole values in GPRs.
186 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
188 ; Any supported integer mode.
189 (define_mode_iterator INT [QI HI SI DI TI])
191 ; Any supported integer mode that fits in one register.
192 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
194 ; extend modes for DImode
195 (define_mode_iterator QHSI [QI HI SI])
197 ; SImode or DImode, even if DImode doesn't fit in GPRs.
198 (define_mode_iterator SDI [SI DI])
200 ; The size of a pointer. Also, the size of the value that a record-condition
201 ; (one with a '.') will compare.
202 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
204 ; Any hardware-supported floating-point mode
205 (define_mode_iterator FP [
206 (SF "TARGET_HARD_FLOAT
207 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
208 (DF "TARGET_HARD_FLOAT
209 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
210 (TF "!TARGET_IEEEQUAD
212 && (TARGET_FPRS || TARGET_E500_DOUBLE)
213 && TARGET_LONG_DOUBLE_128")
217 ; Various instructions that come in SI and DI forms.
218 ; A generic w/d attribute, for things like cmpw/cmpd.
219 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
222 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
225 ;; Start with fixed-point load and store insns. Here we put only the more
226 ;; complex forms. Basic data transfer is done later.
228 (define_expand "zero_extend<mode>di2"
229 [(set (match_operand:DI 0 "gpc_reg_operand" "")
230 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
234 (define_insn "*zero_extend<mode>di2_internal1"
235 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
236 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
240 rldicl %0,%1,0,<dbits>"
241 [(set_attr "type" "load,*")])
243 (define_insn "*zero_extend<mode>di2_internal2"
244 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
245 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
247 (clobber (match_scratch:DI 2 "=r,r"))]
250 rldicl. %2,%1,0,<dbits>
252 [(set_attr "type" "compare")
253 (set_attr "length" "4,8")])
256 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
257 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
259 (clobber (match_scratch:DI 2 ""))]
260 "TARGET_POWERPC64 && reload_completed"
262 (zero_extend:DI (match_dup 1)))
264 (compare:CC (match_dup 2)
268 (define_insn "*zero_extend<mode>di2_internal3"
269 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
270 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
272 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
273 (zero_extend:DI (match_dup 1)))]
276 rldicl. %0,%1,0,<dbits>
278 [(set_attr "type" "compare")
279 (set_attr "length" "4,8")])
282 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
283 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
285 (set (match_operand:DI 0 "gpc_reg_operand" "")
286 (zero_extend:DI (match_dup 1)))]
287 "TARGET_POWERPC64 && reload_completed"
289 (zero_extend:DI (match_dup 1)))
291 (compare:CC (match_dup 0)
295 (define_insn "extendqidi2"
296 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
297 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
300 [(set_attr "type" "exts")])
303 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
304 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
306 (clobber (match_scratch:DI 2 "=r,r"))]
311 [(set_attr "type" "compare")
312 (set_attr "length" "4,8")])
315 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
316 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
318 (clobber (match_scratch:DI 2 ""))]
319 "TARGET_POWERPC64 && reload_completed"
321 (sign_extend:DI (match_dup 1)))
323 (compare:CC (match_dup 2)
328 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
329 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
331 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
332 (sign_extend:DI (match_dup 1)))]
337 [(set_attr "type" "compare")
338 (set_attr "length" "4,8")])
341 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
342 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
344 (set (match_operand:DI 0 "gpc_reg_operand" "")
345 (sign_extend:DI (match_dup 1)))]
346 "TARGET_POWERPC64 && reload_completed"
348 (sign_extend:DI (match_dup 1)))
350 (compare:CC (match_dup 0)
354 (define_expand "extendhidi2"
355 [(set (match_operand:DI 0 "gpc_reg_operand" "")
356 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
361 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
362 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
367 [(set_attr "type" "load_ext,exts")])
370 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
371 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
373 (clobber (match_scratch:DI 2 "=r,r"))]
378 [(set_attr "type" "compare")
379 (set_attr "length" "4,8")])
382 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
383 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
385 (clobber (match_scratch:DI 2 ""))]
386 "TARGET_POWERPC64 && reload_completed"
388 (sign_extend:DI (match_dup 1)))
390 (compare:CC (match_dup 2)
395 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
396 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
398 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
399 (sign_extend:DI (match_dup 1)))]
404 [(set_attr "type" "compare")
405 (set_attr "length" "4,8")])
408 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
409 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
411 (set (match_operand:DI 0 "gpc_reg_operand" "")
412 (sign_extend:DI (match_dup 1)))]
413 "TARGET_POWERPC64 && reload_completed"
415 (sign_extend:DI (match_dup 1)))
417 (compare:CC (match_dup 0)
421 (define_expand "extendsidi2"
422 [(set (match_operand:DI 0 "gpc_reg_operand" "")
423 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
428 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
429 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
434 [(set_attr "type" "load_ext,exts")])
437 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
438 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
440 (clobber (match_scratch:DI 2 "=r,r"))]
445 [(set_attr "type" "compare")
446 (set_attr "length" "4,8")])
449 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
450 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
452 (clobber (match_scratch:DI 2 ""))]
453 "TARGET_POWERPC64 && reload_completed"
455 (sign_extend:DI (match_dup 1)))
457 (compare:CC (match_dup 2)
462 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
463 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
465 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
466 (sign_extend:DI (match_dup 1)))]
471 [(set_attr "type" "compare")
472 (set_attr "length" "4,8")])
475 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
476 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
478 (set (match_operand:DI 0 "gpc_reg_operand" "")
479 (sign_extend:DI (match_dup 1)))]
480 "TARGET_POWERPC64 && reload_completed"
482 (sign_extend:DI (match_dup 1)))
484 (compare:CC (match_dup 0)
488 (define_expand "zero_extendqisi2"
489 [(set (match_operand:SI 0 "gpc_reg_operand" "")
490 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
495 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
496 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
500 {rlinm|rlwinm} %0,%1,0,0xff"
501 [(set_attr "type" "load,*")])
504 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
505 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
507 (clobber (match_scratch:SI 2 "=r,r"))]
510 {andil.|andi.} %2,%1,0xff
512 [(set_attr "type" "compare")
513 (set_attr "length" "4,8")])
516 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
517 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
519 (clobber (match_scratch:SI 2 ""))]
522 (zero_extend:SI (match_dup 1)))
524 (compare:CC (match_dup 2)
529 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
530 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
532 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
533 (zero_extend:SI (match_dup 1)))]
536 {andil.|andi.} %0,%1,0xff
538 [(set_attr "type" "compare")
539 (set_attr "length" "4,8")])
542 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
543 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
545 (set (match_operand:SI 0 "gpc_reg_operand" "")
546 (zero_extend:SI (match_dup 1)))]
549 (zero_extend:SI (match_dup 1)))
551 (compare:CC (match_dup 0)
555 (define_expand "extendqisi2"
556 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
557 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
562 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
563 else if (TARGET_POWER)
564 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
566 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
570 (define_insn "extendqisi2_ppc"
571 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
572 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
575 [(set_attr "type" "exts")])
578 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
579 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
581 (clobber (match_scratch:SI 2 "=r,r"))]
586 [(set_attr "type" "compare")
587 (set_attr "length" "4,8")])
590 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
591 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
593 (clobber (match_scratch:SI 2 ""))]
594 "TARGET_POWERPC && reload_completed"
596 (sign_extend:SI (match_dup 1)))
598 (compare:CC (match_dup 2)
603 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
604 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
606 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
607 (sign_extend:SI (match_dup 1)))]
612 [(set_attr "type" "compare")
613 (set_attr "length" "4,8")])
616 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
617 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
619 (set (match_operand:SI 0 "gpc_reg_operand" "")
620 (sign_extend:SI (match_dup 1)))]
621 "TARGET_POWERPC && reload_completed"
623 (sign_extend:SI (match_dup 1)))
625 (compare:CC (match_dup 0)
629 (define_expand "extendqisi2_power"
630 [(parallel [(set (match_dup 2)
631 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
633 (clobber (scratch:SI))])
634 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
635 (ashiftrt:SI (match_dup 2)
637 (clobber (scratch:SI))])]
640 { operands[1] = gen_lowpart (SImode, operands[1]);
641 operands[2] = gen_reg_rtx (SImode); }")
643 (define_expand "extendqisi2_no_power"
645 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
647 (set (match_operand:SI 0 "gpc_reg_operand" "")
648 (ashiftrt:SI (match_dup 2)
650 "! TARGET_POWER && ! TARGET_POWERPC"
652 { operands[1] = gen_lowpart (SImode, operands[1]);
653 operands[2] = gen_reg_rtx (SImode); }")
655 (define_expand "zero_extendqihi2"
656 [(set (match_operand:HI 0 "gpc_reg_operand" "")
657 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
662 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
663 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
667 {rlinm|rlwinm} %0,%1,0,0xff"
668 [(set_attr "type" "load,*")])
671 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
672 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
674 (clobber (match_scratch:HI 2 "=r,r"))]
677 {andil.|andi.} %2,%1,0xff
679 [(set_attr "type" "compare")
680 (set_attr "length" "4,8")])
683 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
684 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
686 (clobber (match_scratch:HI 2 ""))]
689 (zero_extend:HI (match_dup 1)))
691 (compare:CC (match_dup 2)
696 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
697 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
699 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
700 (zero_extend:HI (match_dup 1)))]
703 {andil.|andi.} %0,%1,0xff
705 [(set_attr "type" "compare")
706 (set_attr "length" "4,8")])
709 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
710 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
712 (set (match_operand:HI 0 "gpc_reg_operand" "")
713 (zero_extend:HI (match_dup 1)))]
716 (zero_extend:HI (match_dup 1)))
718 (compare:CC (match_dup 0)
722 (define_expand "extendqihi2"
723 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
724 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
729 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
730 else if (TARGET_POWER)
731 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
733 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
737 (define_insn "extendqihi2_ppc"
738 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
739 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
742 [(set_attr "type" "exts")])
745 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
746 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
748 (clobber (match_scratch:HI 2 "=r,r"))]
753 [(set_attr "type" "compare")
754 (set_attr "length" "4,8")])
757 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
758 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
760 (clobber (match_scratch:HI 2 ""))]
761 "TARGET_POWERPC && reload_completed"
763 (sign_extend:HI (match_dup 1)))
765 (compare:CC (match_dup 2)
770 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
771 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
773 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
774 (sign_extend:HI (match_dup 1)))]
779 [(set_attr "type" "compare")
780 (set_attr "length" "4,8")])
783 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
784 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
786 (set (match_operand:HI 0 "gpc_reg_operand" "")
787 (sign_extend:HI (match_dup 1)))]
788 "TARGET_POWERPC && reload_completed"
790 (sign_extend:HI (match_dup 1)))
792 (compare:CC (match_dup 0)
796 (define_expand "extendqihi2_power"
797 [(parallel [(set (match_dup 2)
798 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
800 (clobber (scratch:SI))])
801 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
802 (ashiftrt:SI (match_dup 2)
804 (clobber (scratch:SI))])]
807 { operands[0] = gen_lowpart (SImode, operands[0]);
808 operands[1] = gen_lowpart (SImode, operands[1]);
809 operands[2] = gen_reg_rtx (SImode); }")
811 (define_expand "extendqihi2_no_power"
813 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
815 (set (match_operand:HI 0 "gpc_reg_operand" "")
816 (ashiftrt:SI (match_dup 2)
818 "! TARGET_POWER && ! TARGET_POWERPC"
820 { operands[0] = gen_lowpart (SImode, operands[0]);
821 operands[1] = gen_lowpart (SImode, operands[1]);
822 operands[2] = gen_reg_rtx (SImode); }")
824 (define_expand "zero_extendhisi2"
825 [(set (match_operand:SI 0 "gpc_reg_operand" "")
826 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
831 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
832 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
836 {rlinm|rlwinm} %0,%1,0,0xffff"
837 [(set_attr "type" "load,*")])
840 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
841 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
843 (clobber (match_scratch:SI 2 "=r,r"))]
846 {andil.|andi.} %2,%1,0xffff
848 [(set_attr "type" "compare")
849 (set_attr "length" "4,8")])
852 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
853 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
855 (clobber (match_scratch:SI 2 ""))]
858 (zero_extend:SI (match_dup 1)))
860 (compare:CC (match_dup 2)
865 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
866 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
868 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
869 (zero_extend:SI (match_dup 1)))]
872 {andil.|andi.} %0,%1,0xffff
874 [(set_attr "type" "compare")
875 (set_attr "length" "4,8")])
878 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
879 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
881 (set (match_operand:SI 0 "gpc_reg_operand" "")
882 (zero_extend:SI (match_dup 1)))]
885 (zero_extend:SI (match_dup 1)))
887 (compare:CC (match_dup 0)
891 (define_expand "extendhisi2"
892 [(set (match_operand:SI 0 "gpc_reg_operand" "")
893 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
898 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
899 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
904 [(set_attr "type" "load_ext,exts")])
907 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
908 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
910 (clobber (match_scratch:SI 2 "=r,r"))]
915 [(set_attr "type" "compare")
916 (set_attr "length" "4,8")])
919 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
920 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
922 (clobber (match_scratch:SI 2 ""))]
925 (sign_extend:SI (match_dup 1)))
927 (compare:CC (match_dup 2)
932 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
933 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
935 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
936 (sign_extend:SI (match_dup 1)))]
941 [(set_attr "type" "compare")
942 (set_attr "length" "4,8")])
944 ;; IBM 405, 440 and 464 half-word multiplication operations.
946 (define_insn "*macchwc"
947 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
948 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
949 (match_operand:SI 2 "gpc_reg_operand" "r")
952 (match_operand:HI 1 "gpc_reg_operand" "r")))
953 (match_operand:SI 4 "gpc_reg_operand" "0"))
955 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
956 (plus:SI (mult:SI (ashiftrt:SI
964 [(set_attr "type" "imul3")])
966 (define_insn "*macchw"
967 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
968 (plus:SI (mult:SI (ashiftrt:SI
969 (match_operand:SI 2 "gpc_reg_operand" "r")
972 (match_operand:HI 1 "gpc_reg_operand" "r")))
973 (match_operand:SI 3 "gpc_reg_operand" "0")))]
976 [(set_attr "type" "imul3")])
978 (define_insn "*macchwuc"
979 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
980 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
981 (match_operand:SI 2 "gpc_reg_operand" "r")
984 (match_operand:HI 1 "gpc_reg_operand" "r")))
985 (match_operand:SI 4 "gpc_reg_operand" "0"))
987 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
988 (plus:SI (mult:SI (lshiftrt:SI
995 "macchwu. %0, %1, %2"
996 [(set_attr "type" "imul3")])
998 (define_insn "*macchwu"
999 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1000 (plus:SI (mult:SI (lshiftrt:SI
1001 (match_operand:SI 2 "gpc_reg_operand" "r")
1004 (match_operand:HI 1 "gpc_reg_operand" "r")))
1005 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1007 "macchwu %0, %1, %2"
1008 [(set_attr "type" "imul3")])
1010 (define_insn "*machhwc"
1011 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1012 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1013 (match_operand:SI 1 "gpc_reg_operand" "%r")
1016 (match_operand:SI 2 "gpc_reg_operand" "r")
1018 (match_operand:SI 4 "gpc_reg_operand" "0"))
1020 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1021 (plus:SI (mult:SI (ashiftrt:SI
1029 "machhw. %0, %1, %2"
1030 [(set_attr "type" "imul3")])
1032 (define_insn "*machhw"
1033 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1034 (plus:SI (mult:SI (ashiftrt:SI
1035 (match_operand:SI 1 "gpc_reg_operand" "%r")
1038 (match_operand:SI 2 "gpc_reg_operand" "r")
1040 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1043 [(set_attr "type" "imul3")])
1045 (define_insn "*machhwuc"
1046 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1047 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1048 (match_operand:SI 1 "gpc_reg_operand" "%r")
1051 (match_operand:SI 2 "gpc_reg_operand" "r")
1053 (match_operand:SI 4 "gpc_reg_operand" "0"))
1055 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1056 (plus:SI (mult:SI (lshiftrt:SI
1064 "machhwu. %0, %1, %2"
1065 [(set_attr "type" "imul3")])
1067 (define_insn "*machhwu"
1068 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1069 (plus:SI (mult:SI (lshiftrt:SI
1070 (match_operand:SI 1 "gpc_reg_operand" "%r")
1073 (match_operand:SI 2 "gpc_reg_operand" "r")
1075 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1077 "machhwu %0, %1, %2"
1078 [(set_attr "type" "imul3")])
1080 (define_insn "*maclhwc"
1081 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1082 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1083 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1085 (match_operand:HI 2 "gpc_reg_operand" "r")))
1086 (match_operand:SI 4 "gpc_reg_operand" "0"))
1088 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1089 (plus:SI (mult:SI (sign_extend:SI
1095 "maclhw. %0, %1, %2"
1096 [(set_attr "type" "imul3")])
1098 (define_insn "*maclhw"
1099 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1100 (plus:SI (mult:SI (sign_extend:SI
1101 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1103 (match_operand:HI 2 "gpc_reg_operand" "r")))
1104 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1107 [(set_attr "type" "imul3")])
1109 (define_insn "*maclhwuc"
1110 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1111 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1112 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1114 (match_operand:HI 2 "gpc_reg_operand" "r")))
1115 (match_operand:SI 4 "gpc_reg_operand" "0"))
1117 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1118 (plus:SI (mult:SI (zero_extend:SI
1124 "maclhwu. %0, %1, %2"
1125 [(set_attr "type" "imul3")])
1127 (define_insn "*maclhwu"
1128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1129 (plus:SI (mult:SI (zero_extend:SI
1130 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1132 (match_operand:HI 2 "gpc_reg_operand" "r")))
1133 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1135 "maclhwu %0, %1, %2"
1136 [(set_attr "type" "imul3")])
1138 (define_insn "*nmacchwc"
1139 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1140 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1141 (mult:SI (ashiftrt:SI
1142 (match_operand:SI 2 "gpc_reg_operand" "r")
1145 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1147 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1148 (minus:SI (match_dup 4)
1149 (mult:SI (ashiftrt:SI
1155 "nmacchw. %0, %1, %2"
1156 [(set_attr "type" "imul3")])
1158 (define_insn "*nmacchw"
1159 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1160 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1161 (mult:SI (ashiftrt:SI
1162 (match_operand:SI 2 "gpc_reg_operand" "r")
1165 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1167 "nmacchw %0, %1, %2"
1168 [(set_attr "type" "imul3")])
1170 (define_insn "*nmachhwc"
1171 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1172 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1173 (mult:SI (ashiftrt:SI
1174 (match_operand:SI 1 "gpc_reg_operand" "%r")
1177 (match_operand:SI 2 "gpc_reg_operand" "r")
1180 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1181 (minus:SI (match_dup 4)
1182 (mult:SI (ashiftrt:SI
1189 "nmachhw. %0, %1, %2"
1190 [(set_attr "type" "imul3")])
1192 (define_insn "*nmachhw"
1193 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1194 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1195 (mult:SI (ashiftrt:SI
1196 (match_operand:SI 1 "gpc_reg_operand" "%r")
1199 (match_operand:SI 2 "gpc_reg_operand" "r")
1202 "nmachhw %0, %1, %2"
1203 [(set_attr "type" "imul3")])
1205 (define_insn "*nmaclhwc"
1206 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1207 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1208 (mult:SI (sign_extend:SI
1209 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1211 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1213 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1214 (minus:SI (match_dup 4)
1215 (mult:SI (sign_extend:SI
1220 "nmaclhw. %0, %1, %2"
1221 [(set_attr "type" "imul3")])
1223 (define_insn "*nmaclhw"
1224 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1225 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1226 (mult:SI (sign_extend:SI
1227 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1229 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1231 "nmaclhw %0, %1, %2"
1232 [(set_attr "type" "imul3")])
1234 (define_insn "*mulchwc"
1235 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1236 (compare:CC (mult:SI (ashiftrt:SI
1237 (match_operand:SI 2 "gpc_reg_operand" "r")
1240 (match_operand:HI 1 "gpc_reg_operand" "r")))
1242 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1243 (mult:SI (ashiftrt:SI
1249 "mulchw. %0, %1, %2"
1250 [(set_attr "type" "imul3")])
1252 (define_insn "*mulchw"
1253 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1254 (mult:SI (ashiftrt:SI
1255 (match_operand:SI 2 "gpc_reg_operand" "r")
1258 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1261 [(set_attr "type" "imul3")])
1263 (define_insn "*mulchwuc"
1264 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1265 (compare:CC (mult:SI (lshiftrt:SI
1266 (match_operand:SI 2 "gpc_reg_operand" "r")
1269 (match_operand:HI 1 "gpc_reg_operand" "r")))
1271 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1272 (mult:SI (lshiftrt:SI
1278 "mulchwu. %0, %1, %2"
1279 [(set_attr "type" "imul3")])
1281 (define_insn "*mulchwu"
1282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1283 (mult:SI (lshiftrt:SI
1284 (match_operand:SI 2 "gpc_reg_operand" "r")
1287 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1289 "mulchwu %0, %1, %2"
1290 [(set_attr "type" "imul3")])
1292 (define_insn "*mulhhwc"
1293 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1294 (compare:CC (mult:SI (ashiftrt:SI
1295 (match_operand:SI 1 "gpc_reg_operand" "%r")
1298 (match_operand:SI 2 "gpc_reg_operand" "r")
1301 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1302 (mult:SI (ashiftrt:SI
1309 "mulhhw. %0, %1, %2"
1310 [(set_attr "type" "imul3")])
1312 (define_insn "*mulhhw"
1313 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1314 (mult:SI (ashiftrt:SI
1315 (match_operand:SI 1 "gpc_reg_operand" "%r")
1318 (match_operand:SI 2 "gpc_reg_operand" "r")
1322 [(set_attr "type" "imul3")])
1324 (define_insn "*mulhhwuc"
1325 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1326 (compare:CC (mult:SI (lshiftrt:SI
1327 (match_operand:SI 1 "gpc_reg_operand" "%r")
1330 (match_operand:SI 2 "gpc_reg_operand" "r")
1333 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1334 (mult:SI (lshiftrt:SI
1341 "mulhhwu. %0, %1, %2"
1342 [(set_attr "type" "imul3")])
1344 (define_insn "*mulhhwu"
1345 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1346 (mult:SI (lshiftrt:SI
1347 (match_operand:SI 1 "gpc_reg_operand" "%r")
1350 (match_operand:SI 2 "gpc_reg_operand" "r")
1353 "mulhhwu %0, %1, %2"
1354 [(set_attr "type" "imul3")])
1356 (define_insn "*mullhwc"
1357 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1358 (compare:CC (mult:SI (sign_extend:SI
1359 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1361 (match_operand:HI 2 "gpc_reg_operand" "r")))
1363 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1364 (mult:SI (sign_extend:SI
1369 "mullhw. %0, %1, %2"
1370 [(set_attr "type" "imul3")])
1372 (define_insn "*mullhw"
1373 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1374 (mult:SI (sign_extend:SI
1375 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1377 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1380 [(set_attr "type" "imul3")])
1382 (define_insn "*mullhwuc"
1383 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1384 (compare:CC (mult:SI (zero_extend:SI
1385 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1387 (match_operand:HI 2 "gpc_reg_operand" "r")))
1389 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1390 (mult:SI (zero_extend:SI
1395 "mullhwu. %0, %1, %2"
1396 [(set_attr "type" "imul3")])
1398 (define_insn "*mullhwu"
1399 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1400 (mult:SI (zero_extend:SI
1401 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1403 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1405 "mullhwu %0, %1, %2"
1406 [(set_attr "type" "imul3")])
1408 ;; IBM 405, 440 and 464 string-search dlmzb instruction support.
1409 (define_insn "dlmzb"
1410 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1411 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1412 (match_operand:SI 2 "gpc_reg_operand" "r")]
1414 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1415 (unspec:SI [(match_dup 1)
1419 "dlmzb. %0, %1, %2")
1421 (define_expand "strlensi"
1422 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1423 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1424 (match_operand:QI 2 "const_int_operand" "")
1425 (match_operand 3 "const_int_operand" "")]
1426 UNSPEC_DLMZB_STRLEN))
1427 (clobber (match_scratch:CC 4 "=x"))]
1428 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1430 rtx result = operands[0];
1431 rtx src = operands[1];
1432 rtx search_char = operands[2];
1433 rtx align = operands[3];
1434 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1435 rtx loop_label, end_label, mem, cr0, cond;
1436 if (search_char != const0_rtx
1437 || GET_CODE (align) != CONST_INT
1438 || INTVAL (align) < 8)
1440 word1 = gen_reg_rtx (SImode);
1441 word2 = gen_reg_rtx (SImode);
1442 scratch_dlmzb = gen_reg_rtx (SImode);
1443 scratch_string = gen_reg_rtx (Pmode);
1444 loop_label = gen_label_rtx ();
1445 end_label = gen_label_rtx ();
1446 addr = force_reg (Pmode, XEXP (src, 0));
1447 emit_move_insn (scratch_string, addr);
1448 emit_label (loop_label);
1449 mem = change_address (src, SImode, scratch_string);
1450 emit_move_insn (word1, mem);
1451 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1452 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1453 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1454 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1455 emit_jump_insn (gen_rtx_SET (VOIDmode,
1457 gen_rtx_IF_THEN_ELSE (VOIDmode,
1463 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1464 emit_jump_insn (gen_rtx_SET (VOIDmode,
1466 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1468 emit_label (end_label);
1469 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1470 emit_insn (gen_subsi3 (result, scratch_string, addr));
1471 emit_insn (gen_subsi3 (result, result, const1_rtx));
1476 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1477 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1479 (set (match_operand:SI 0 "gpc_reg_operand" "")
1480 (sign_extend:SI (match_dup 1)))]
1483 (sign_extend:SI (match_dup 1)))
1485 (compare:CC (match_dup 0)
1489 ;; Fixed-point arithmetic insns.
1491 (define_expand "add<mode>3"
1492 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1493 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1494 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1497 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1499 if (non_short_cint_operand (operands[2], DImode))
1502 else if (GET_CODE (operands[2]) == CONST_INT
1503 && ! add_operand (operands[2], <MODE>mode))
1505 rtx tmp = ((!can_create_pseudo_p ()
1506 || rtx_equal_p (operands[0], operands[1]))
1507 ? operands[0] : gen_reg_rtx (<MODE>mode));
1509 HOST_WIDE_INT val = INTVAL (operands[2]);
1510 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1511 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1513 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1516 /* The ordering here is important for the prolog expander.
1517 When space is allocated from the stack, adding 'low' first may
1518 produce a temporary deallocation (which would be bad). */
1519 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1520 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1525 ;; Discourage ai/addic because of carry but provide it in an alternative
1526 ;; allowing register zero as source.
1527 (define_insn "*add<mode>3_internal1"
1528 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1529 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1530 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1531 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1534 {cal %0,%2(%1)|addi %0,%1,%2}
1536 {cau|addis} %0,%1,%v2"
1537 [(set_attr "length" "4,4,4,4")])
1539 (define_insn "addsi3_high"
1540 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1541 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1542 (high:SI (match_operand 2 "" ""))))]
1543 "TARGET_MACHO && !TARGET_64BIT"
1544 "{cau|addis} %0,%1,ha16(%2)"
1545 [(set_attr "length" "4")])
1547 (define_insn "*add<mode>3_internal2"
1548 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1549 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1550 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1552 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1555 {cax.|add.} %3,%1,%2
1556 {ai.|addic.} %3,%1,%2
1559 [(set_attr "type" "fast_compare,compare,compare,compare")
1560 (set_attr "length" "4,4,8,8")])
1563 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1564 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1565 (match_operand:GPR 2 "reg_or_short_operand" ""))
1567 (clobber (match_scratch:GPR 3 ""))]
1570 (plus:GPR (match_dup 1)
1573 (compare:CC (match_dup 3)
1577 (define_insn "*add<mode>3_internal3"
1578 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1579 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1580 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1582 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1583 (plus:P (match_dup 1)
1587 {cax.|add.} %0,%1,%2
1588 {ai.|addic.} %0,%1,%2
1591 [(set_attr "type" "fast_compare,compare,compare,compare")
1592 (set_attr "length" "4,4,8,8")])
1595 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1596 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1597 (match_operand:P 2 "reg_or_short_operand" ""))
1599 (set (match_operand:P 0 "gpc_reg_operand" "")
1600 (plus:P (match_dup 1) (match_dup 2)))]
1603 (plus:P (match_dup 1)
1606 (compare:CC (match_dup 0)
1610 ;; Split an add that we can't do in one insn into two insns, each of which
1611 ;; does one 16-bit part. This is used by combine. Note that the low-order
1612 ;; add should be last in case the result gets used in an address.
1615 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1616 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1617 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1619 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1620 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1622 HOST_WIDE_INT val = INTVAL (operands[2]);
1623 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1624 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1626 operands[4] = GEN_INT (low);
1627 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1628 operands[3] = GEN_INT (rest);
1629 else if (can_create_pseudo_p ())
1631 operands[3] = gen_reg_rtx (DImode);
1632 emit_move_insn (operands[3], operands[2]);
1633 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1640 (define_insn "one_cmpl<mode>2"
1641 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1642 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1647 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1648 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1650 (clobber (match_scratch:P 2 "=r,r"))]
1655 [(set_attr "type" "compare")
1656 (set_attr "length" "4,8")])
1659 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1660 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1662 (clobber (match_scratch:P 2 ""))]
1665 (not:P (match_dup 1)))
1667 (compare:CC (match_dup 2)
1672 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1673 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1675 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1676 (not:P (match_dup 1)))]
1681 [(set_attr "type" "compare")
1682 (set_attr "length" "4,8")])
1685 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1686 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1688 (set (match_operand:P 0 "gpc_reg_operand" "")
1689 (not:P (match_dup 1)))]
1692 (not:P (match_dup 1)))
1694 (compare:CC (match_dup 0)
1699 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1700 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1701 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1703 "{sf%I1|subf%I1c} %0,%2,%1")
1706 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1707 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1708 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1715 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1716 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1717 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1719 (clobber (match_scratch:SI 3 "=r,r"))]
1722 {sf.|subfc.} %3,%2,%1
1724 [(set_attr "type" "compare")
1725 (set_attr "length" "4,8")])
1728 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1729 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1730 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1732 (clobber (match_scratch:P 3 "=r,r"))]
1737 [(set_attr "type" "fast_compare")
1738 (set_attr "length" "4,8")])
1741 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1742 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1743 (match_operand:P 2 "gpc_reg_operand" ""))
1745 (clobber (match_scratch:P 3 ""))]
1748 (minus:P (match_dup 1)
1751 (compare:CC (match_dup 3)
1756 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1757 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1758 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1760 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1761 (minus:SI (match_dup 1) (match_dup 2)))]
1764 {sf.|subfc.} %0,%2,%1
1766 [(set_attr "type" "compare")
1767 (set_attr "length" "4,8")])
1770 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1771 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1772 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1774 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1775 (minus:P (match_dup 1)
1781 [(set_attr "type" "fast_compare")
1782 (set_attr "length" "4,8")])
1785 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1786 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1787 (match_operand:P 2 "gpc_reg_operand" ""))
1789 (set (match_operand:P 0 "gpc_reg_operand" "")
1790 (minus:P (match_dup 1)
1794 (minus:P (match_dup 1)
1797 (compare:CC (match_dup 0)
1801 (define_expand "sub<mode>3"
1802 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1803 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1804 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1808 if (GET_CODE (operands[2]) == CONST_INT)
1810 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1811 negate_rtx (<MODE>mode, operands[2])));
1816 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1817 ;; instruction and some auxiliary computations. Then we just have a single
1818 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1821 (define_expand "sminsi3"
1823 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1824 (match_operand:SI 2 "reg_or_short_operand" ""))
1826 (minus:SI (match_dup 2) (match_dup 1))))
1827 (set (match_operand:SI 0 "gpc_reg_operand" "")
1828 (minus:SI (match_dup 2) (match_dup 3)))]
1829 "TARGET_POWER || TARGET_ISEL"
1834 operands[2] = force_reg (SImode, operands[2]);
1835 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1839 operands[3] = gen_reg_rtx (SImode);
1843 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1844 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1845 (match_operand:SI 2 "reg_or_short_operand" "")))
1846 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1849 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1851 (minus:SI (match_dup 2) (match_dup 1))))
1852 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1855 (define_expand "smaxsi3"
1857 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1858 (match_operand:SI 2 "reg_or_short_operand" ""))
1860 (minus:SI (match_dup 2) (match_dup 1))))
1861 (set (match_operand:SI 0 "gpc_reg_operand" "")
1862 (plus:SI (match_dup 3) (match_dup 1)))]
1863 "TARGET_POWER || TARGET_ISEL"
1868 operands[2] = force_reg (SImode, operands[2]);
1869 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1872 operands[3] = gen_reg_rtx (SImode);
1876 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1877 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1878 (match_operand:SI 2 "reg_or_short_operand" "")))
1879 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1882 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1884 (minus:SI (match_dup 2) (match_dup 1))))
1885 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1888 (define_expand "uminsi3"
1889 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1891 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1893 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1895 (minus:SI (match_dup 4) (match_dup 3))))
1896 (set (match_operand:SI 0 "gpc_reg_operand" "")
1897 (minus:SI (match_dup 2) (match_dup 3)))]
1898 "TARGET_POWER || TARGET_ISEL"
1903 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1906 operands[3] = gen_reg_rtx (SImode);
1907 operands[4] = gen_reg_rtx (SImode);
1908 operands[5] = GEN_INT (-2147483647 - 1);
1911 (define_expand "umaxsi3"
1912 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1914 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1916 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1918 (minus:SI (match_dup 4) (match_dup 3))))
1919 (set (match_operand:SI 0 "gpc_reg_operand" "")
1920 (plus:SI (match_dup 3) (match_dup 1)))]
1921 "TARGET_POWER || TARGET_ISEL"
1926 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1929 operands[3] = gen_reg_rtx (SImode);
1930 operands[4] = gen_reg_rtx (SImode);
1931 operands[5] = GEN_INT (-2147483647 - 1);
1935 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1936 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1937 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1939 (minus:SI (match_dup 2) (match_dup 1))))]
1944 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1946 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1947 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1949 (minus:SI (match_dup 2) (match_dup 1)))
1951 (clobber (match_scratch:SI 3 "=r,r"))]
1956 [(set_attr "type" "delayed_compare")
1957 (set_attr "length" "4,8")])
1960 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1962 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1963 (match_operand:SI 2 "reg_or_short_operand" ""))
1965 (minus:SI (match_dup 2) (match_dup 1)))
1967 (clobber (match_scratch:SI 3 ""))]
1968 "TARGET_POWER && reload_completed"
1970 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1972 (minus:SI (match_dup 2) (match_dup 1))))
1974 (compare:CC (match_dup 3)
1979 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1981 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1982 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1984 (minus:SI (match_dup 2) (match_dup 1)))
1986 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1987 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1989 (minus:SI (match_dup 2) (match_dup 1))))]
1994 [(set_attr "type" "delayed_compare")
1995 (set_attr "length" "4,8")])
1998 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2000 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2001 (match_operand:SI 2 "reg_or_short_operand" ""))
2003 (minus:SI (match_dup 2) (match_dup 1)))
2005 (set (match_operand:SI 0 "gpc_reg_operand" "")
2006 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2008 (minus:SI (match_dup 2) (match_dup 1))))]
2009 "TARGET_POWER && reload_completed"
2011 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2013 (minus:SI (match_dup 2) (match_dup 1))))
2015 (compare:CC (match_dup 0)
2019 ;; We don't need abs with condition code because such comparisons should
2021 (define_expand "abssi2"
2022 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2023 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2029 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2032 else if (! TARGET_POWER)
2034 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2039 (define_insn "*abssi2_power"
2040 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2041 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2045 (define_insn_and_split "abssi2_isel"
2046 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2047 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2048 (clobber (match_scratch:SI 2 "=&b"))
2049 (clobber (match_scratch:CC 3 "=y"))]
2052 "&& reload_completed"
2053 [(set (match_dup 2) (neg:SI (match_dup 1)))
2055 (compare:CC (match_dup 1)
2058 (if_then_else:SI (ge (match_dup 3)
2064 (define_insn_and_split "abssi2_nopower"
2065 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2066 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2067 (clobber (match_scratch:SI 2 "=&r,&r"))]
2068 "! TARGET_POWER && ! TARGET_ISEL"
2070 "&& reload_completed"
2071 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2072 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2073 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2076 (define_insn "*nabs_power"
2077 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2078 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2082 (define_insn_and_split "*nabs_nopower"
2083 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2084 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2085 (clobber (match_scratch:SI 2 "=&r,&r"))]
2088 "&& reload_completed"
2089 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2090 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2091 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2094 (define_expand "neg<mode>2"
2095 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2096 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2100 (define_insn "*neg<mode>2_internal"
2101 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2102 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2107 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2108 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2110 (clobber (match_scratch:P 2 "=r,r"))]
2115 [(set_attr "type" "fast_compare")
2116 (set_attr "length" "4,8")])
2119 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2120 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2122 (clobber (match_scratch:P 2 ""))]
2125 (neg:P (match_dup 1)))
2127 (compare:CC (match_dup 2)
2132 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2133 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2135 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2136 (neg:P (match_dup 1)))]
2141 [(set_attr "type" "fast_compare")
2142 (set_attr "length" "4,8")])
2145 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2146 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2148 (set (match_operand:P 0 "gpc_reg_operand" "")
2149 (neg:P (match_dup 1)))]
2152 (neg:P (match_dup 1)))
2154 (compare:CC (match_dup 0)
2158 (define_insn "clz<mode>2"
2159 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2160 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2162 "{cntlz|cntlz<wd>} %0,%1"
2163 [(set_attr "type" "cntlz")])
2165 (define_expand "ctz<mode>2"
2167 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2168 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2170 (clobber (scratch:CC))])
2171 (set (match_dup 4) (clz:GPR (match_dup 3)))
2172 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2173 (minus:GPR (match_dup 5) (match_dup 4)))]
2176 operands[2] = gen_reg_rtx (<MODE>mode);
2177 operands[3] = gen_reg_rtx (<MODE>mode);
2178 operands[4] = gen_reg_rtx (<MODE>mode);
2179 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2182 (define_expand "ffs<mode>2"
2184 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2185 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2187 (clobber (scratch:CC))])
2188 (set (match_dup 4) (clz:GPR (match_dup 3)))
2189 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2190 (minus:GPR (match_dup 5) (match_dup 4)))]
2193 operands[2] = gen_reg_rtx (<MODE>mode);
2194 operands[3] = gen_reg_rtx (<MODE>mode);
2195 operands[4] = gen_reg_rtx (<MODE>mode);
2196 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2199 (define_insn "popcntb<mode>2"
2200 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2201 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2206 (define_expand "popcount<mode>2"
2207 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2208 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2211 rs6000_emit_popcount (operands[0], operands[1]);
2215 (define_expand "parity<mode>2"
2216 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2217 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2220 rs6000_emit_parity (operands[0], operands[1]);
2224 (define_insn "bswapsi2"
2225 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2226 (bswap:SI (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2230 {stbrx|stwbrx} %1,%y0
2232 [(set_attr "length" "4,4,12")])
2235 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2236 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2239 (rotate:SI (match_dup 1) (const_int 8)))
2240 (set (zero_extract:SI (match_dup 0)
2244 (set (zero_extract:SI (match_dup 0)
2247 (rotate:SI (match_dup 1)
2251 (define_expand "mulsi3"
2252 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2253 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2254 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2259 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2261 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2265 (define_insn "mulsi3_mq"
2266 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2267 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2268 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2269 (clobber (match_scratch:SI 3 "=q,q"))]
2272 {muls|mullw} %0,%1,%2
2273 {muli|mulli} %0,%1,%2"
2275 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2276 (const_string "imul3")
2277 (match_operand:SI 2 "short_cint_operand" "")
2278 (const_string "imul2")]
2279 (const_string "imul")))])
2281 (define_insn "mulsi3_no_mq"
2282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2283 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2284 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2287 {muls|mullw} %0,%1,%2
2288 {muli|mulli} %0,%1,%2"
2290 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2291 (const_string "imul3")
2292 (match_operand:SI 2 "short_cint_operand" "")
2293 (const_string "imul2")]
2294 (const_string "imul")))])
2296 (define_insn "*mulsi3_mq_internal1"
2297 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2298 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2299 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2301 (clobber (match_scratch:SI 3 "=r,r"))
2302 (clobber (match_scratch:SI 4 "=q,q"))]
2305 {muls.|mullw.} %3,%1,%2
2307 [(set_attr "type" "imul_compare")
2308 (set_attr "length" "4,8")])
2311 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2312 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2313 (match_operand:SI 2 "gpc_reg_operand" ""))
2315 (clobber (match_scratch:SI 3 ""))
2316 (clobber (match_scratch:SI 4 ""))]
2317 "TARGET_POWER && reload_completed"
2318 [(parallel [(set (match_dup 3)
2319 (mult:SI (match_dup 1) (match_dup 2)))
2320 (clobber (match_dup 4))])
2322 (compare:CC (match_dup 3)
2326 (define_insn "*mulsi3_no_mq_internal1"
2327 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2328 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2329 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2331 (clobber (match_scratch:SI 3 "=r,r"))]
2334 {muls.|mullw.} %3,%1,%2
2336 [(set_attr "type" "imul_compare")
2337 (set_attr "length" "4,8")])
2340 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2341 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2342 (match_operand:SI 2 "gpc_reg_operand" ""))
2344 (clobber (match_scratch:SI 3 ""))]
2345 "! TARGET_POWER && reload_completed"
2347 (mult:SI (match_dup 1) (match_dup 2)))
2349 (compare:CC (match_dup 3)
2353 (define_insn "*mulsi3_mq_internal2"
2354 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2355 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2356 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2358 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2359 (mult:SI (match_dup 1) (match_dup 2)))
2360 (clobber (match_scratch:SI 4 "=q,q"))]
2363 {muls.|mullw.} %0,%1,%2
2365 [(set_attr "type" "imul_compare")
2366 (set_attr "length" "4,8")])
2369 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2370 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2371 (match_operand:SI 2 "gpc_reg_operand" ""))
2373 (set (match_operand:SI 0 "gpc_reg_operand" "")
2374 (mult:SI (match_dup 1) (match_dup 2)))
2375 (clobber (match_scratch:SI 4 ""))]
2376 "TARGET_POWER && reload_completed"
2377 [(parallel [(set (match_dup 0)
2378 (mult:SI (match_dup 1) (match_dup 2)))
2379 (clobber (match_dup 4))])
2381 (compare:CC (match_dup 0)
2385 (define_insn "*mulsi3_no_mq_internal2"
2386 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2387 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2388 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2390 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2391 (mult:SI (match_dup 1) (match_dup 2)))]
2394 {muls.|mullw.} %0,%1,%2
2396 [(set_attr "type" "imul_compare")
2397 (set_attr "length" "4,8")])
2400 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2401 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2402 (match_operand:SI 2 "gpc_reg_operand" ""))
2404 (set (match_operand:SI 0 "gpc_reg_operand" "")
2405 (mult:SI (match_dup 1) (match_dup 2)))]
2406 "! TARGET_POWER && reload_completed"
2408 (mult:SI (match_dup 1) (match_dup 2)))
2410 (compare:CC (match_dup 0)
2414 ;; Operand 1 is divided by operand 2; quotient goes to operand
2415 ;; 0 and remainder to operand 3.
2416 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2418 (define_expand "divmodsi4"
2419 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2420 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2421 (match_operand:SI 2 "gpc_reg_operand" "")))
2422 (set (match_operand:SI 3 "register_operand" "")
2423 (mod:SI (match_dup 1) (match_dup 2)))])]
2424 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2427 if (! TARGET_POWER && ! TARGET_POWERPC)
2429 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2430 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2431 emit_insn (gen_divss_call ());
2432 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2433 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2438 (define_insn "*divmodsi4_internal"
2439 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2440 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2441 (match_operand:SI 2 "gpc_reg_operand" "r")))
2442 (set (match_operand:SI 3 "register_operand" "=q")
2443 (mod:SI (match_dup 1) (match_dup 2)))]
2446 [(set_attr "type" "idiv")])
2448 (define_expand "udiv<mode>3"
2449 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2450 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2451 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2452 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2455 if (! TARGET_POWER && ! TARGET_POWERPC)
2457 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2458 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2459 emit_insn (gen_quous_call ());
2460 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2463 else if (TARGET_POWER)
2465 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2470 (define_insn "udivsi3_mq"
2471 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2472 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2473 (match_operand:SI 2 "gpc_reg_operand" "r")))
2474 (clobber (match_scratch:SI 3 "=q"))]
2475 "TARGET_POWERPC && TARGET_POWER"
2477 [(set_attr "type" "idiv")])
2479 (define_insn "*udivsi3_no_mq"
2480 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2481 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2482 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2483 "TARGET_POWERPC && ! TARGET_POWER"
2486 (cond [(match_operand:SI 0 "" "")
2487 (const_string "idiv")]
2488 (const_string "ldiv")))])
2491 ;; For powers of two we can do srai/aze for divide and then adjust for
2492 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2493 ;; used; for PowerPC, force operands into register and do a normal divide;
2494 ;; for AIX common-mode, use quoss call on register operands.
2495 (define_expand "div<mode>3"
2496 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2497 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2498 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2502 if (GET_CODE (operands[2]) == CONST_INT
2503 && INTVAL (operands[2]) > 0
2504 && exact_log2 (INTVAL (operands[2])) >= 0)
2506 else if (TARGET_POWERPC)
2508 operands[2] = force_reg (<MODE>mode, operands[2]);
2511 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2515 else if (TARGET_POWER)
2519 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2520 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2521 emit_insn (gen_quoss_call ());
2522 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2527 (define_insn "divsi3_mq"
2528 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2529 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2530 (match_operand:SI 2 "gpc_reg_operand" "r")))
2531 (clobber (match_scratch:SI 3 "=q"))]
2532 "TARGET_POWERPC && TARGET_POWER"
2534 [(set_attr "type" "idiv")])
2536 (define_insn "*div<mode>3_no_mq"
2537 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2538 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2539 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2540 "TARGET_POWERPC && ! TARGET_POWER"
2543 (cond [(match_operand:SI 0 "" "")
2544 (const_string "idiv")]
2545 (const_string "ldiv")))])
2547 (define_expand "mod<mode>3"
2548 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2549 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2550 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2558 if (GET_CODE (operands[2]) != CONST_INT
2559 || INTVAL (operands[2]) <= 0
2560 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2563 temp1 = gen_reg_rtx (<MODE>mode);
2564 temp2 = gen_reg_rtx (<MODE>mode);
2566 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2567 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2568 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2573 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2574 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2575 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2577 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2578 [(set_attr "type" "two")
2579 (set_attr "length" "8")])
2582 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2583 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2584 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2586 (clobber (match_scratch:P 3 "=r,r"))]
2589 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2591 [(set_attr "type" "compare")
2592 (set_attr "length" "8,12")])
2595 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2596 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2597 (match_operand:GPR 2 "exact_log2_cint_operand"
2600 (clobber (match_scratch:GPR 3 ""))]
2603 (div:<MODE> (match_dup 1) (match_dup 2)))
2605 (compare:CC (match_dup 3)
2610 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2611 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2612 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2614 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2615 (div:P (match_dup 1) (match_dup 2)))]
2618 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2620 [(set_attr "type" "compare")
2621 (set_attr "length" "8,12")])
2624 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2625 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2626 (match_operand:GPR 2 "exact_log2_cint_operand"
2629 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2630 (div:GPR (match_dup 1) (match_dup 2)))]
2633 (div:<MODE> (match_dup 1) (match_dup 2)))
2635 (compare:CC (match_dup 0)
2640 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2643 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2645 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2646 (match_operand:SI 3 "gpc_reg_operand" "r")))
2647 (set (match_operand:SI 2 "register_operand" "=*q")
2650 (zero_extend:DI (match_dup 1)) (const_int 32))
2651 (zero_extend:DI (match_dup 4)))
2655 [(set_attr "type" "idiv")])
2657 ;; To do unsigned divide we handle the cases of the divisor looking like a
2658 ;; negative number. If it is a constant that is less than 2**31, we don't
2659 ;; have to worry about the branches. So make a few subroutines here.
2661 ;; First comes the normal case.
2662 (define_expand "udivmodsi4_normal"
2663 [(set (match_dup 4) (const_int 0))
2664 (parallel [(set (match_operand:SI 0 "" "")
2665 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2667 (zero_extend:DI (match_operand:SI 1 "" "")))
2668 (match_operand:SI 2 "" "")))
2669 (set (match_operand:SI 3 "" "")
2670 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2672 (zero_extend:DI (match_dup 1)))
2676 { operands[4] = gen_reg_rtx (SImode); }")
2678 ;; This handles the branches.
2679 (define_expand "udivmodsi4_tests"
2680 [(set (match_operand:SI 0 "" "") (const_int 0))
2681 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2682 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2683 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2684 (label_ref (match_operand:SI 4 "" "")) (pc)))
2685 (set (match_dup 0) (const_int 1))
2686 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2687 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2688 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2689 (label_ref (match_dup 4)) (pc)))]
2692 { operands[5] = gen_reg_rtx (CCUNSmode);
2693 operands[6] = gen_reg_rtx (CCmode);
2696 (define_expand "udivmodsi4"
2697 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2698 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2699 (match_operand:SI 2 "reg_or_cint_operand" "")))
2700 (set (match_operand:SI 3 "gpc_reg_operand" "")
2701 (umod:SI (match_dup 1) (match_dup 2)))])]
2709 if (! TARGET_POWERPC)
2711 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2712 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2713 emit_insn (gen_divus_call ());
2714 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2715 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2722 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2724 operands[2] = force_reg (SImode, operands[2]);
2725 label = gen_label_rtx ();
2726 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2727 operands[3], label));
2730 operands[2] = force_reg (SImode, operands[2]);
2732 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2740 ;; AIX architecture-independent common-mode multiply (DImode),
2741 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2742 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2743 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2744 ;; assumed unused if generating common-mode, so ignore.
2745 (define_insn "mulh_call"
2748 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2749 (sign_extend:DI (reg:SI 4)))
2751 (clobber (reg:SI LR_REGNO))]
2752 "! TARGET_POWER && ! TARGET_POWERPC"
2754 [(set_attr "type" "imul")])
2756 (define_insn "mull_call"
2758 (mult:DI (sign_extend:DI (reg:SI 3))
2759 (sign_extend:DI (reg:SI 4))))
2760 (clobber (reg:SI LR_REGNO))
2761 (clobber (reg:SI 0))]
2762 "! TARGET_POWER && ! TARGET_POWERPC"
2764 [(set_attr "type" "imul")])
2766 (define_insn "divss_call"
2768 (div:SI (reg:SI 3) (reg:SI 4)))
2770 (mod:SI (reg:SI 3) (reg:SI 4)))
2771 (clobber (reg:SI LR_REGNO))
2772 (clobber (reg:SI 0))]
2773 "! TARGET_POWER && ! TARGET_POWERPC"
2775 [(set_attr "type" "idiv")])
2777 (define_insn "divus_call"
2779 (udiv:SI (reg:SI 3) (reg:SI 4)))
2781 (umod:SI (reg:SI 3) (reg:SI 4)))
2782 (clobber (reg:SI LR_REGNO))
2783 (clobber (reg:SI 0))
2784 (clobber (match_scratch:CC 0 "=x"))
2785 (clobber (reg:CC CR1_REGNO))]
2786 "! TARGET_POWER && ! TARGET_POWERPC"
2788 [(set_attr "type" "idiv")])
2790 (define_insn "quoss_call"
2792 (div:SI (reg:SI 3) (reg:SI 4)))
2793 (clobber (reg:SI LR_REGNO))]
2794 "! TARGET_POWER && ! TARGET_POWERPC"
2796 [(set_attr "type" "idiv")])
2798 (define_insn "quous_call"
2800 (udiv:SI (reg:SI 3) (reg:SI 4)))
2801 (clobber (reg:SI LR_REGNO))
2802 (clobber (reg:SI 0))
2803 (clobber (match_scratch:CC 0 "=x"))
2804 (clobber (reg:CC CR1_REGNO))]
2805 "! TARGET_POWER && ! TARGET_POWERPC"
2807 [(set_attr "type" "idiv")])
2809 ;; Logical instructions
2810 ;; The logical instructions are mostly combined by using match_operator,
2811 ;; but the plain AND insns are somewhat different because there is no
2812 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2813 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2815 (define_insn "andsi3"
2816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2817 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2818 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2819 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2823 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2824 {andil.|andi.} %0,%1,%b2
2825 {andiu.|andis.} %0,%1,%u2"
2826 [(set_attr "type" "*,*,compare,compare")])
2828 ;; Note to set cr's other than cr0 we do the and immediate and then
2829 ;; the test again -- this avoids a mfcr which on the higher end
2830 ;; machines causes an execution serialization
2832 (define_insn "*andsi3_internal2"
2833 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2834 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2835 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2837 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2838 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2842 {andil.|andi.} %3,%1,%b2
2843 {andiu.|andis.} %3,%1,%u2
2844 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2849 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2850 (set_attr "length" "4,4,4,4,8,8,8,8")])
2852 (define_insn "*andsi3_internal3"
2853 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2854 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2855 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2857 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2858 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2862 {andil.|andi.} %3,%1,%b2
2863 {andiu.|andis.} %3,%1,%u2
2864 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2869 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2870 (set_attr "length" "8,4,4,4,8,8,8,8")])
2873 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2874 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2875 (match_operand:GPR 2 "and_operand" ""))
2877 (clobber (match_scratch:GPR 3 ""))
2878 (clobber (match_scratch:CC 4 ""))]
2880 [(parallel [(set (match_dup 3)
2881 (and:<MODE> (match_dup 1)
2883 (clobber (match_dup 4))])
2885 (compare:CC (match_dup 3)
2889 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2890 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2893 [(set (match_operand:CC 0 "cc_reg_operand" "")
2894 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2895 (match_operand:SI 2 "gpc_reg_operand" ""))
2897 (clobber (match_scratch:SI 3 ""))
2898 (clobber (match_scratch:CC 4 ""))]
2899 "TARGET_POWERPC64 && reload_completed"
2900 [(parallel [(set (match_dup 3)
2901 (and:SI (match_dup 1)
2903 (clobber (match_dup 4))])
2905 (compare:CC (match_dup 3)
2909 (define_insn "*andsi3_internal4"
2910 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2911 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2912 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2914 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2915 (and:SI (match_dup 1)
2917 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2921 {andil.|andi.} %0,%1,%b2
2922 {andiu.|andis.} %0,%1,%u2
2923 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2928 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2929 (set_attr "length" "4,4,4,4,8,8,8,8")])
2931 (define_insn "*andsi3_internal5"
2932 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2933 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2934 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2936 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2937 (and:SI (match_dup 1)
2939 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2943 {andil.|andi.} %0,%1,%b2
2944 {andiu.|andis.} %0,%1,%u2
2945 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2950 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2951 (set_attr "length" "8,4,4,4,8,8,8,8")])
2954 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2955 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2956 (match_operand:SI 2 "and_operand" ""))
2958 (set (match_operand:SI 0 "gpc_reg_operand" "")
2959 (and:SI (match_dup 1)
2961 (clobber (match_scratch:CC 4 ""))]
2963 [(parallel [(set (match_dup 0)
2964 (and:SI (match_dup 1)
2966 (clobber (match_dup 4))])
2968 (compare:CC (match_dup 0)
2973 [(set (match_operand:CC 3 "cc_reg_operand" "")
2974 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2975 (match_operand:SI 2 "gpc_reg_operand" ""))
2977 (set (match_operand:SI 0 "gpc_reg_operand" "")
2978 (and:SI (match_dup 1)
2980 (clobber (match_scratch:CC 4 ""))]
2981 "TARGET_POWERPC64 && reload_completed"
2982 [(parallel [(set (match_dup 0)
2983 (and:SI (match_dup 1)
2985 (clobber (match_dup 4))])
2987 (compare:CC (match_dup 0)
2991 ;; Handle the PowerPC64 rlwinm corner case
2993 (define_insn_and_split "*andsi3_internal6"
2994 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2995 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2996 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3001 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3004 (rotate:SI (match_dup 0) (match_dup 5)))]
3007 int mb = extract_MB (operands[2]);
3008 int me = extract_ME (operands[2]);
3009 operands[3] = GEN_INT (me + 1);
3010 operands[5] = GEN_INT (32 - (me + 1));
3011 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3013 [(set_attr "length" "8")])
3015 (define_expand "iorsi3"
3016 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3017 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3018 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3022 if (GET_CODE (operands[2]) == CONST_INT
3023 && ! logical_operand (operands[2], SImode))
3025 HOST_WIDE_INT value = INTVAL (operands[2]);
3026 rtx tmp = ((!can_create_pseudo_p ()
3027 || rtx_equal_p (operands[0], operands[1]))
3028 ? operands[0] : gen_reg_rtx (SImode));
3030 emit_insn (gen_iorsi3 (tmp, operands[1],
3031 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3032 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3037 (define_expand "xorsi3"
3038 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3039 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3040 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3044 if (GET_CODE (operands[2]) == CONST_INT
3045 && ! logical_operand (operands[2], SImode))
3047 HOST_WIDE_INT value = INTVAL (operands[2]);
3048 rtx tmp = ((!can_create_pseudo_p ()
3049 || rtx_equal_p (operands[0], operands[1]))
3050 ? operands[0] : gen_reg_rtx (SImode));
3052 emit_insn (gen_xorsi3 (tmp, operands[1],
3053 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3054 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3059 (define_insn "*boolsi3_internal1"
3060 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3061 (match_operator:SI 3 "boolean_or_operator"
3062 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3063 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3067 {%q3il|%q3i} %0,%1,%b2
3068 {%q3iu|%q3is} %0,%1,%u2")
3070 (define_insn "*boolsi3_internal2"
3071 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3072 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3073 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3074 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3076 (clobber (match_scratch:SI 3 "=r,r"))]
3081 [(set_attr "type" "compare")
3082 (set_attr "length" "4,8")])
3085 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3086 (compare:CC (match_operator:SI 4 "boolean_operator"
3087 [(match_operand:SI 1 "gpc_reg_operand" "")
3088 (match_operand:SI 2 "gpc_reg_operand" "")])
3090 (clobber (match_scratch:SI 3 ""))]
3091 "TARGET_32BIT && reload_completed"
3092 [(set (match_dup 3) (match_dup 4))
3094 (compare:CC (match_dup 3)
3098 (define_insn "*boolsi3_internal3"
3099 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3100 (compare:CC (match_operator:SI 4 "boolean_operator"
3101 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3102 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3104 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3110 [(set_attr "type" "compare")
3111 (set_attr "length" "4,8")])
3114 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3115 (compare:CC (match_operator:SI 4 "boolean_operator"
3116 [(match_operand:SI 1 "gpc_reg_operand" "")
3117 (match_operand:SI 2 "gpc_reg_operand" "")])
3119 (set (match_operand:SI 0 "gpc_reg_operand" "")
3121 "TARGET_32BIT && reload_completed"
3122 [(set (match_dup 0) (match_dup 4))
3124 (compare:CC (match_dup 0)
3128 ;; Split a logical operation that we can't do in one insn into two insns,
3129 ;; each of which does one 16-bit part. This is used by combine.
3132 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3133 (match_operator:SI 3 "boolean_or_operator"
3134 [(match_operand:SI 1 "gpc_reg_operand" "")
3135 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3137 [(set (match_dup 0) (match_dup 4))
3138 (set (match_dup 0) (match_dup 5))]
3142 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3143 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3145 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3146 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3150 (define_insn "*boolcsi3_internal1"
3151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3152 (match_operator:SI 3 "boolean_operator"
3153 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3154 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3158 (define_insn "*boolcsi3_internal2"
3159 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3160 (compare:CC (match_operator:SI 4 "boolean_operator"
3161 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3162 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3164 (clobber (match_scratch:SI 3 "=r,r"))]
3169 [(set_attr "type" "compare")
3170 (set_attr "length" "4,8")])
3173 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3174 (compare:CC (match_operator:SI 4 "boolean_operator"
3175 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3176 (match_operand:SI 2 "gpc_reg_operand" "")])
3178 (clobber (match_scratch:SI 3 ""))]
3179 "TARGET_32BIT && reload_completed"
3180 [(set (match_dup 3) (match_dup 4))
3182 (compare:CC (match_dup 3)
3186 (define_insn "*boolcsi3_internal3"
3187 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3188 (compare:CC (match_operator:SI 4 "boolean_operator"
3189 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3190 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3192 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3198 [(set_attr "type" "compare")
3199 (set_attr "length" "4,8")])
3202 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3203 (compare:CC (match_operator:SI 4 "boolean_operator"
3204 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3205 (match_operand:SI 2 "gpc_reg_operand" "")])
3207 (set (match_operand:SI 0 "gpc_reg_operand" "")
3209 "TARGET_32BIT && reload_completed"
3210 [(set (match_dup 0) (match_dup 4))
3212 (compare:CC (match_dup 0)
3216 (define_insn "*boolccsi3_internal1"
3217 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3218 (match_operator:SI 3 "boolean_operator"
3219 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3220 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3224 (define_insn "*boolccsi3_internal2"
3225 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3226 (compare:CC (match_operator:SI 4 "boolean_operator"
3227 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3228 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3230 (clobber (match_scratch:SI 3 "=r,r"))]
3235 [(set_attr "type" "compare")
3236 (set_attr "length" "4,8")])
3239 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3240 (compare:CC (match_operator:SI 4 "boolean_operator"
3241 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3242 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3244 (clobber (match_scratch:SI 3 ""))]
3245 "TARGET_32BIT && reload_completed"
3246 [(set (match_dup 3) (match_dup 4))
3248 (compare:CC (match_dup 3)
3252 (define_insn "*boolccsi3_internal3"
3253 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3254 (compare:CC (match_operator:SI 4 "boolean_operator"
3255 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3256 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3258 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3264 [(set_attr "type" "compare")
3265 (set_attr "length" "4,8")])
3268 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3269 (compare:CC (match_operator:SI 4 "boolean_operator"
3270 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3271 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3273 (set (match_operand:SI 0 "gpc_reg_operand" "")
3275 "TARGET_32BIT && reload_completed"
3276 [(set (match_dup 0) (match_dup 4))
3278 (compare:CC (match_dup 0)
3282 ;; maskir insn. We need four forms because things might be in arbitrary
3283 ;; orders. Don't define forms that only set CR fields because these
3284 ;; would modify an input register.
3286 (define_insn "*maskir_internal1"
3287 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3288 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3289 (match_operand:SI 1 "gpc_reg_operand" "0"))
3290 (and:SI (match_dup 2)
3291 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3295 (define_insn "*maskir_internal2"
3296 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3297 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3298 (match_operand:SI 1 "gpc_reg_operand" "0"))
3299 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3304 (define_insn "*maskir_internal3"
3305 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3306 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3307 (match_operand:SI 3 "gpc_reg_operand" "r"))
3308 (and:SI (not:SI (match_dup 2))
3309 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3313 (define_insn "*maskir_internal4"
3314 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3315 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3316 (match_operand:SI 2 "gpc_reg_operand" "r"))
3317 (and:SI (not:SI (match_dup 2))
3318 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3322 (define_insn "*maskir_internal5"
3323 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3325 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3326 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3327 (and:SI (match_dup 2)
3328 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3330 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3331 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3332 (and:SI (match_dup 2) (match_dup 3))))]
3337 [(set_attr "type" "compare")
3338 (set_attr "length" "4,8")])
3341 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3343 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3344 (match_operand:SI 1 "gpc_reg_operand" ""))
3345 (and:SI (match_dup 2)
3346 (match_operand:SI 3 "gpc_reg_operand" "")))
3348 (set (match_operand:SI 0 "gpc_reg_operand" "")
3349 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3350 (and:SI (match_dup 2) (match_dup 3))))]
3351 "TARGET_POWER && reload_completed"
3353 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3354 (and:SI (match_dup 2) (match_dup 3))))
3356 (compare:CC (match_dup 0)
3360 (define_insn "*maskir_internal6"
3361 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3363 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3364 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3365 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3368 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3369 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3370 (and:SI (match_dup 3) (match_dup 2))))]
3375 [(set_attr "type" "compare")
3376 (set_attr "length" "4,8")])
3379 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3381 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3382 (match_operand:SI 1 "gpc_reg_operand" ""))
3383 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3386 (set (match_operand:SI 0 "gpc_reg_operand" "")
3387 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3388 (and:SI (match_dup 3) (match_dup 2))))]
3389 "TARGET_POWER && reload_completed"
3391 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3392 (and:SI (match_dup 3) (match_dup 2))))
3394 (compare:CC (match_dup 0)
3398 (define_insn "*maskir_internal7"
3399 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3401 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3402 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3403 (and:SI (not:SI (match_dup 2))
3404 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3406 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3407 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3408 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3413 [(set_attr "type" "compare")
3414 (set_attr "length" "4,8")])
3417 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3419 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3420 (match_operand:SI 3 "gpc_reg_operand" ""))
3421 (and:SI (not:SI (match_dup 2))
3422 (match_operand:SI 1 "gpc_reg_operand" "")))
3424 (set (match_operand:SI 0 "gpc_reg_operand" "")
3425 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3426 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3427 "TARGET_POWER && reload_completed"
3429 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3430 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3432 (compare:CC (match_dup 0)
3436 (define_insn "*maskir_internal8"
3437 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3439 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3440 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3441 (and:SI (not:SI (match_dup 2))
3442 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3444 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3445 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3446 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3451 [(set_attr "type" "compare")
3452 (set_attr "length" "4,8")])
3455 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3457 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3458 (match_operand:SI 2 "gpc_reg_operand" ""))
3459 (and:SI (not:SI (match_dup 2))
3460 (match_operand:SI 1 "gpc_reg_operand" "")))
3462 (set (match_operand:SI 0 "gpc_reg_operand" "")
3463 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3464 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3465 "TARGET_POWER && reload_completed"
3467 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3468 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3470 (compare:CC (match_dup 0)
3474 ;; Rotate and shift insns, in all their variants. These support shifts,
3475 ;; field inserts and extracts, and various combinations thereof.
3476 (define_expand "insv"
3477 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3478 (match_operand:SI 1 "const_int_operand" "")
3479 (match_operand:SI 2 "const_int_operand" ""))
3480 (match_operand 3 "gpc_reg_operand" ""))]
3484 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3485 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3486 compiler if the address of the structure is taken later. Likewise, do
3487 not handle invalid E500 subregs. */
3488 if (GET_CODE (operands[0]) == SUBREG
3489 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3490 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3491 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3494 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3495 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3497 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3501 (define_insn "insvsi"
3502 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3503 (match_operand:SI 1 "const_int_operand" "i")
3504 (match_operand:SI 2 "const_int_operand" "i"))
3505 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3509 int start = INTVAL (operands[2]) & 31;
3510 int size = INTVAL (operands[1]) & 31;
3512 operands[4] = GEN_INT (32 - start - size);
3513 operands[1] = GEN_INT (start + size - 1);
3514 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3516 [(set_attr "type" "insert_word")])
3518 (define_insn "*insvsi_internal1"
3519 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3520 (match_operand:SI 1 "const_int_operand" "i")
3521 (match_operand:SI 2 "const_int_operand" "i"))
3522 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3523 (match_operand:SI 4 "const_int_operand" "i")))]
3524 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3527 int shift = INTVAL (operands[4]) & 31;
3528 int start = INTVAL (operands[2]) & 31;
3529 int size = INTVAL (operands[1]) & 31;
3531 operands[4] = GEN_INT (shift - start - size);
3532 operands[1] = GEN_INT (start + size - 1);
3533 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3535 [(set_attr "type" "insert_word")])
3537 (define_insn "*insvsi_internal2"
3538 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3539 (match_operand:SI 1 "const_int_operand" "i")
3540 (match_operand:SI 2 "const_int_operand" "i"))
3541 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3542 (match_operand:SI 4 "const_int_operand" "i")))]
3543 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3546 int shift = INTVAL (operands[4]) & 31;
3547 int start = INTVAL (operands[2]) & 31;
3548 int size = INTVAL (operands[1]) & 31;
3550 operands[4] = GEN_INT (32 - shift - start - size);
3551 operands[1] = GEN_INT (start + size - 1);
3552 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3554 [(set_attr "type" "insert_word")])
3556 (define_insn "*insvsi_internal3"
3557 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3558 (match_operand:SI 1 "const_int_operand" "i")
3559 (match_operand:SI 2 "const_int_operand" "i"))
3560 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3561 (match_operand:SI 4 "const_int_operand" "i")))]
3562 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3565 int shift = INTVAL (operands[4]) & 31;
3566 int start = INTVAL (operands[2]) & 31;
3567 int size = INTVAL (operands[1]) & 31;
3569 operands[4] = GEN_INT (32 - shift - start - size);
3570 operands[1] = GEN_INT (start + size - 1);
3571 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3573 [(set_attr "type" "insert_word")])
3575 (define_insn "*insvsi_internal4"
3576 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3577 (match_operand:SI 1 "const_int_operand" "i")
3578 (match_operand:SI 2 "const_int_operand" "i"))
3579 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3580 (match_operand:SI 4 "const_int_operand" "i")
3581 (match_operand:SI 5 "const_int_operand" "i")))]
3582 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3585 int extract_start = INTVAL (operands[5]) & 31;
3586 int extract_size = INTVAL (operands[4]) & 31;
3587 int insert_start = INTVAL (operands[2]) & 31;
3588 int insert_size = INTVAL (operands[1]) & 31;
3590 /* Align extract field with insert field */
3591 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3592 operands[1] = GEN_INT (insert_start + insert_size - 1);
3593 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3595 [(set_attr "type" "insert_word")])
3597 ;; combine patterns for rlwimi
3598 (define_insn "*insvsi_internal5"
3599 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3600 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3601 (match_operand:SI 1 "mask_operand" "i"))
3602 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3603 (match_operand:SI 2 "const_int_operand" "i"))
3604 (match_operand:SI 5 "mask_operand" "i"))))]
3605 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3608 int me = extract_ME(operands[5]);
3609 int mb = extract_MB(operands[5]);
3610 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3611 operands[2] = GEN_INT(mb);
3612 operands[1] = GEN_INT(me);
3613 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3615 [(set_attr "type" "insert_word")])
3617 (define_insn "*insvsi_internal6"
3618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3619 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3620 (match_operand:SI 2 "const_int_operand" "i"))
3621 (match_operand:SI 5 "mask_operand" "i"))
3622 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3623 (match_operand:SI 1 "mask_operand" "i"))))]
3624 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3627 int me = extract_ME(operands[5]);
3628 int mb = extract_MB(operands[5]);
3629 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3630 operands[2] = GEN_INT(mb);
3631 operands[1] = GEN_INT(me);
3632 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3634 [(set_attr "type" "insert_word")])
3636 (define_insn "insvdi"
3637 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3638 (match_operand:SI 1 "const_int_operand" "i")
3639 (match_operand:SI 2 "const_int_operand" "i"))
3640 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3644 int start = INTVAL (operands[2]) & 63;
3645 int size = INTVAL (operands[1]) & 63;
3647 operands[1] = GEN_INT (64 - start - size);
3648 return \"rldimi %0,%3,%H1,%H2\";
3650 [(set_attr "type" "insert_dword")])
3652 (define_insn "*insvdi_internal2"
3653 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3654 (match_operand:SI 1 "const_int_operand" "i")
3655 (match_operand:SI 2 "const_int_operand" "i"))
3656 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3657 (match_operand:SI 4 "const_int_operand" "i")))]
3659 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3662 int shift = INTVAL (operands[4]) & 63;
3663 int start = (INTVAL (operands[2]) & 63) - 32;
3664 int size = INTVAL (operands[1]) & 63;
3666 operands[4] = GEN_INT (64 - shift - start - size);
3667 operands[2] = GEN_INT (start);
3668 operands[1] = GEN_INT (start + size - 1);
3669 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3672 (define_insn "*insvdi_internal3"
3673 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3674 (match_operand:SI 1 "const_int_operand" "i")
3675 (match_operand:SI 2 "const_int_operand" "i"))
3676 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3677 (match_operand:SI 4 "const_int_operand" "i")))]
3679 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3682 int shift = INTVAL (operands[4]) & 63;
3683 int start = (INTVAL (operands[2]) & 63) - 32;
3684 int size = INTVAL (operands[1]) & 63;
3686 operands[4] = GEN_INT (64 - shift - start - size);
3687 operands[2] = GEN_INT (start);
3688 operands[1] = GEN_INT (start + size - 1);
3689 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3692 (define_expand "extzv"
3693 [(set (match_operand 0 "gpc_reg_operand" "")
3694 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3695 (match_operand:SI 2 "const_int_operand" "")
3696 (match_operand:SI 3 "const_int_operand" "")))]
3700 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3701 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3702 compiler if the address of the structure is taken later. */
3703 if (GET_CODE (operands[0]) == SUBREG
3704 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3707 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3708 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3710 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3714 (define_insn "extzvsi"
3715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3716 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3717 (match_operand:SI 2 "const_int_operand" "i")
3718 (match_operand:SI 3 "const_int_operand" "i")))]
3722 int start = INTVAL (operands[3]) & 31;
3723 int size = INTVAL (operands[2]) & 31;
3725 if (start + size >= 32)
3726 operands[3] = const0_rtx;
3728 operands[3] = GEN_INT (start + size);
3729 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3732 (define_insn "*extzvsi_internal1"
3733 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3734 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3735 (match_operand:SI 2 "const_int_operand" "i,i")
3736 (match_operand:SI 3 "const_int_operand" "i,i"))
3738 (clobber (match_scratch:SI 4 "=r,r"))]
3742 int start = INTVAL (operands[3]) & 31;
3743 int size = INTVAL (operands[2]) & 31;
3745 /* Force split for non-cc0 compare. */
3746 if (which_alternative == 1)
3749 /* If the bit-field being tested fits in the upper or lower half of a
3750 word, it is possible to use andiu. or andil. to test it. This is
3751 useful because the condition register set-use delay is smaller for
3752 andi[ul]. than for rlinm. This doesn't work when the starting bit
3753 position is 0 because the LT and GT bits may be set wrong. */
3755 if ((start > 0 && start + size <= 16) || start >= 16)
3757 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3758 - (1 << (16 - (start & 15) - size))));
3760 return \"{andiu.|andis.} %4,%1,%3\";
3762 return \"{andil.|andi.} %4,%1,%3\";
3765 if (start + size >= 32)
3766 operands[3] = const0_rtx;
3768 operands[3] = GEN_INT (start + size);
3769 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3771 [(set_attr "type" "delayed_compare")
3772 (set_attr "length" "4,8")])
3775 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3776 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3777 (match_operand:SI 2 "const_int_operand" "")
3778 (match_operand:SI 3 "const_int_operand" ""))
3780 (clobber (match_scratch:SI 4 ""))]
3783 (zero_extract:SI (match_dup 1) (match_dup 2)
3786 (compare:CC (match_dup 4)
3790 (define_insn "*extzvsi_internal2"
3791 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3792 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3793 (match_operand:SI 2 "const_int_operand" "i,i")
3794 (match_operand:SI 3 "const_int_operand" "i,i"))
3796 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3797 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3801 int start = INTVAL (operands[3]) & 31;
3802 int size = INTVAL (operands[2]) & 31;
3804 /* Force split for non-cc0 compare. */
3805 if (which_alternative == 1)
3808 /* Since we are using the output value, we can't ignore any need for
3809 a shift. The bit-field must end at the LSB. */
3810 if (start >= 16 && start + size == 32)
3812 operands[3] = GEN_INT ((1 << size) - 1);
3813 return \"{andil.|andi.} %0,%1,%3\";
3816 if (start + size >= 32)
3817 operands[3] = const0_rtx;
3819 operands[3] = GEN_INT (start + size);
3820 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3822 [(set_attr "type" "delayed_compare")
3823 (set_attr "length" "4,8")])
3826 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3827 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3828 (match_operand:SI 2 "const_int_operand" "")
3829 (match_operand:SI 3 "const_int_operand" ""))
3831 (set (match_operand:SI 0 "gpc_reg_operand" "")
3832 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3835 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3837 (compare:CC (match_dup 0)
3841 (define_insn "extzvdi"
3842 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3843 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3844 (match_operand:SI 2 "const_int_operand" "i")
3845 (match_operand:SI 3 "const_int_operand" "i")))]
3849 int start = INTVAL (operands[3]) & 63;
3850 int size = INTVAL (operands[2]) & 63;
3852 if (start + size >= 64)
3853 operands[3] = const0_rtx;
3855 operands[3] = GEN_INT (start + size);
3856 operands[2] = GEN_INT (64 - size);
3857 return \"rldicl %0,%1,%3,%2\";
3860 (define_insn "*extzvdi_internal1"
3861 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3862 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3863 (match_operand:SI 2 "const_int_operand" "i")
3864 (match_operand:SI 3 "const_int_operand" "i"))
3866 (clobber (match_scratch:DI 4 "=r"))]
3870 int start = INTVAL (operands[3]) & 63;
3871 int size = INTVAL (operands[2]) & 63;
3873 if (start + size >= 64)
3874 operands[3] = const0_rtx;
3876 operands[3] = GEN_INT (start + size);
3877 operands[2] = GEN_INT (64 - size);
3878 return \"rldicl. %4,%1,%3,%2\";
3880 [(set_attr "type" "compare")])
3882 (define_insn "*extzvdi_internal2"
3883 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3884 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3885 (match_operand:SI 2 "const_int_operand" "i")
3886 (match_operand:SI 3 "const_int_operand" "i"))
3888 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3889 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3893 int start = INTVAL (operands[3]) & 63;
3894 int size = INTVAL (operands[2]) & 63;
3896 if (start + size >= 64)
3897 operands[3] = const0_rtx;
3899 operands[3] = GEN_INT (start + size);
3900 operands[2] = GEN_INT (64 - size);
3901 return \"rldicl. %0,%1,%3,%2\";
3903 [(set_attr "type" "compare")])
3905 (define_insn "rotlsi3"
3906 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3907 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3908 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3911 {rlnm|rlwnm} %0,%1,%2,0xffffffff
3912 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
3913 [(set_attr "type" "var_shift_rotate,integer")])
3915 (define_insn "*rotlsi3_internal2"
3916 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3917 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3918 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3920 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3923 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
3924 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
3927 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3928 (set_attr "length" "4,4,8,8")])
3931 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3932 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3933 (match_operand:SI 2 "reg_or_cint_operand" ""))
3935 (clobber (match_scratch:SI 3 ""))]
3938 (rotate:SI (match_dup 1) (match_dup 2)))
3940 (compare:CC (match_dup 3)
3944 (define_insn "*rotlsi3_internal3"
3945 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3946 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3947 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3949 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3950 (rotate:SI (match_dup 1) (match_dup 2)))]
3953 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
3954 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
3957 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3958 (set_attr "length" "4,4,8,8")])
3961 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3962 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3963 (match_operand:SI 2 "reg_or_cint_operand" ""))
3965 (set (match_operand:SI 0 "gpc_reg_operand" "")
3966 (rotate:SI (match_dup 1) (match_dup 2)))]
3969 (rotate:SI (match_dup 1) (match_dup 2)))
3971 (compare:CC (match_dup 0)
3975 (define_insn "*rotlsi3_internal4"
3976 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3977 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3978 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3979 (match_operand:SI 3 "mask_operand" "n,n")))]
3982 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
3983 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
3984 [(set_attr "type" "var_shift_rotate,integer")])
3986 (define_insn "*rotlsi3_internal5"
3987 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3989 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3990 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3991 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3993 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3996 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
3997 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4000 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4001 (set_attr "length" "4,4,8,8")])
4004 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4006 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4007 (match_operand:SI 2 "reg_or_cint_operand" ""))
4008 (match_operand:SI 3 "mask_operand" ""))
4010 (clobber (match_scratch:SI 4 ""))]
4013 (and:SI (rotate:SI (match_dup 1)
4017 (compare:CC (match_dup 4)
4021 (define_insn "*rotlsi3_internal6"
4022 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4024 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4025 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4026 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4028 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4029 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4032 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4033 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4036 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4037 (set_attr "length" "4,4,8,8")])
4040 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4042 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4043 (match_operand:SI 2 "reg_or_cint_operand" ""))
4044 (match_operand:SI 3 "mask_operand" ""))
4046 (set (match_operand:SI 0 "gpc_reg_operand" "")
4047 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4050 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4052 (compare:CC (match_dup 0)
4056 (define_insn "*rotlsi3_internal7"
4057 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4060 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4061 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4063 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
4065 (define_insn "*rotlsi3_internal8"
4066 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4067 (compare:CC (zero_extend:SI
4069 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4070 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4072 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4075 {rlnm.|rlwnm.} %3,%1,%2,0xff
4076 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4079 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4080 (set_attr "length" "4,4,8,8")])
4083 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4084 (compare:CC (zero_extend:SI
4086 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4087 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4089 (clobber (match_scratch:SI 3 ""))]
4092 (zero_extend:SI (subreg:QI
4093 (rotate:SI (match_dup 1)
4096 (compare:CC (match_dup 3)
4100 (define_insn "*rotlsi3_internal9"
4101 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4102 (compare:CC (zero_extend:SI
4104 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4105 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4107 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4108 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4111 {rlnm.|rlwnm.} %0,%1,%2,0xff
4112 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4115 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4116 (set_attr "length" "4,4,8,8")])
4119 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4120 (compare:CC (zero_extend:SI
4122 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4123 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4125 (set (match_operand:SI 0 "gpc_reg_operand" "")
4126 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4129 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4131 (compare:CC (match_dup 0)
4135 (define_insn "*rotlsi3_internal10"
4136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4139 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4140 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4143 {rlnm|rlwnm} %0,%1,%2,0xffff
4144 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4145 [(set_attr "type" "var_shift_rotate,integer")])
4148 (define_insn "*rotlsi3_internal11"
4149 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4150 (compare:CC (zero_extend:SI
4152 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4153 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4155 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4158 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4159 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4162 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4163 (set_attr "length" "4,4,8,8")])
4166 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4167 (compare:CC (zero_extend:SI
4169 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4170 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4172 (clobber (match_scratch:SI 3 ""))]
4175 (zero_extend:SI (subreg:HI
4176 (rotate:SI (match_dup 1)
4179 (compare:CC (match_dup 3)
4183 (define_insn "*rotlsi3_internal12"
4184 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4185 (compare:CC (zero_extend:SI
4187 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4188 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4190 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4191 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4194 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4195 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4198 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4199 (set_attr "length" "4,4,8,8")])
4202 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4203 (compare:CC (zero_extend:SI
4205 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4206 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4208 (set (match_operand:SI 0 "gpc_reg_operand" "")
4209 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4212 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4214 (compare:CC (match_dup 0)
4218 ;; Note that we use "sle." instead of "sl." so that we can set
4219 ;; SHIFT_COUNT_TRUNCATED.
4221 (define_expand "ashlsi3"
4222 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4223 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4224 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4229 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4231 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4235 (define_insn "ashlsi3_power"
4236 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4237 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4238 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4239 (clobber (match_scratch:SI 3 "=q,X"))]
4243 {sli|slwi} %0,%1,%h2")
4245 (define_insn "ashlsi3_no_power"
4246 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4247 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4248 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4252 {sli|slwi} %0,%1,%h2"
4253 [(set_attr "type" "var_shift_rotate,shift")])
4256 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4257 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4258 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4260 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4261 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4265 {sli.|slwi.} %3,%1,%h2
4268 [(set_attr "type" "delayed_compare")
4269 (set_attr "length" "4,4,8,8")])
4272 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4273 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4274 (match_operand:SI 2 "reg_or_cint_operand" ""))
4276 (clobber (match_scratch:SI 3 ""))
4277 (clobber (match_scratch:SI 4 ""))]
4278 "TARGET_POWER && reload_completed"
4279 [(parallel [(set (match_dup 3)
4280 (ashift:SI (match_dup 1) (match_dup 2)))
4281 (clobber (match_dup 4))])
4283 (compare:CC (match_dup 3)
4288 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4289 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4290 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4292 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4293 "! TARGET_POWER && TARGET_32BIT"
4296 {sli.|slwi.} %3,%1,%h2
4299 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4300 (set_attr "length" "4,4,8,8")])
4303 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4304 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4305 (match_operand:SI 2 "reg_or_cint_operand" ""))
4307 (clobber (match_scratch:SI 3 ""))]
4308 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4310 (ashift:SI (match_dup 1) (match_dup 2)))
4312 (compare:CC (match_dup 3)
4317 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4318 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4319 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4321 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4322 (ashift:SI (match_dup 1) (match_dup 2)))
4323 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4327 {sli.|slwi.} %0,%1,%h2
4330 [(set_attr "type" "delayed_compare")
4331 (set_attr "length" "4,4,8,8")])
4334 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4335 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4336 (match_operand:SI 2 "reg_or_cint_operand" ""))
4338 (set (match_operand:SI 0 "gpc_reg_operand" "")
4339 (ashift:SI (match_dup 1) (match_dup 2)))
4340 (clobber (match_scratch:SI 4 ""))]
4341 "TARGET_POWER && reload_completed"
4342 [(parallel [(set (match_dup 0)
4343 (ashift:SI (match_dup 1) (match_dup 2)))
4344 (clobber (match_dup 4))])
4346 (compare:CC (match_dup 0)
4351 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4352 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4353 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4355 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4356 (ashift:SI (match_dup 1) (match_dup 2)))]
4357 "! TARGET_POWER && TARGET_32BIT"
4360 {sli.|slwi.} %0,%1,%h2
4363 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4364 (set_attr "length" "4,4,8,8")])
4367 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4368 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4369 (match_operand:SI 2 "reg_or_cint_operand" ""))
4371 (set (match_operand:SI 0 "gpc_reg_operand" "")
4372 (ashift:SI (match_dup 1) (match_dup 2)))]
4373 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4375 (ashift:SI (match_dup 1) (match_dup 2)))
4377 (compare:CC (match_dup 0)
4381 (define_insn "rlwinm"
4382 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4383 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4384 (match_operand:SI 2 "const_int_operand" "i"))
4385 (match_operand:SI 3 "mask_operand" "n")))]
4386 "includes_lshift_p (operands[2], operands[3])"
4387 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4390 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4392 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4393 (match_operand:SI 2 "const_int_operand" "i,i"))
4394 (match_operand:SI 3 "mask_operand" "n,n"))
4396 (clobber (match_scratch:SI 4 "=r,r"))]
4397 "includes_lshift_p (operands[2], operands[3])"
4399 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4401 [(set_attr "type" "delayed_compare")
4402 (set_attr "length" "4,8")])
4405 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4407 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4408 (match_operand:SI 2 "const_int_operand" ""))
4409 (match_operand:SI 3 "mask_operand" ""))
4411 (clobber (match_scratch:SI 4 ""))]
4412 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4414 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4417 (compare:CC (match_dup 4)
4422 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4424 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4425 (match_operand:SI 2 "const_int_operand" "i,i"))
4426 (match_operand:SI 3 "mask_operand" "n,n"))
4428 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4429 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4430 "includes_lshift_p (operands[2], operands[3])"
4432 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4434 [(set_attr "type" "delayed_compare")
4435 (set_attr "length" "4,8")])
4438 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4440 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4441 (match_operand:SI 2 "const_int_operand" ""))
4442 (match_operand:SI 3 "mask_operand" ""))
4444 (set (match_operand:SI 0 "gpc_reg_operand" "")
4445 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4446 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4448 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4450 (compare:CC (match_dup 0)
4454 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4456 (define_expand "lshrsi3"
4457 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4458 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4459 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4464 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4466 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4470 (define_insn "lshrsi3_power"
4471 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4472 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4473 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4474 (clobber (match_scratch:SI 3 "=q,X,X"))]
4479 {s%A2i|s%A2wi} %0,%1,%h2")
4481 (define_insn "lshrsi3_no_power"
4482 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4483 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4484 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4489 {sri|srwi} %0,%1,%h2"
4490 [(set_attr "type" "integer,var_shift_rotate,shift")])
4493 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4494 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4495 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4497 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4498 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4503 {s%A2i.|s%A2wi.} %3,%1,%h2
4507 [(set_attr "type" "delayed_compare")
4508 (set_attr "length" "4,4,4,8,8,8")])
4511 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4512 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4513 (match_operand:SI 2 "reg_or_cint_operand" ""))
4515 (clobber (match_scratch:SI 3 ""))
4516 (clobber (match_scratch:SI 4 ""))]
4517 "TARGET_POWER && reload_completed"
4518 [(parallel [(set (match_dup 3)
4519 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4520 (clobber (match_dup 4))])
4522 (compare:CC (match_dup 3)
4527 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4528 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4529 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4531 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4532 "! TARGET_POWER && TARGET_32BIT"
4536 {sri.|srwi.} %3,%1,%h2
4540 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4541 (set_attr "length" "4,4,4,8,8,8")])
4544 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4545 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4546 (match_operand:SI 2 "reg_or_cint_operand" ""))
4548 (clobber (match_scratch:SI 3 ""))]
4549 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4551 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4553 (compare:CC (match_dup 3)
4558 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4559 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4560 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4562 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4563 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4564 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4569 {s%A2i.|s%A2wi.} %0,%1,%h2
4573 [(set_attr "type" "delayed_compare")
4574 (set_attr "length" "4,4,4,8,8,8")])
4577 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4578 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4579 (match_operand:SI 2 "reg_or_cint_operand" ""))
4581 (set (match_operand:SI 0 "gpc_reg_operand" "")
4582 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4583 (clobber (match_scratch:SI 4 ""))]
4584 "TARGET_POWER && reload_completed"
4585 [(parallel [(set (match_dup 0)
4586 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4587 (clobber (match_dup 4))])
4589 (compare:CC (match_dup 0)
4594 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4595 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4596 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4598 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4599 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4600 "! TARGET_POWER && TARGET_32BIT"
4604 {sri.|srwi.} %0,%1,%h2
4608 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4609 (set_attr "length" "4,4,4,8,8,8")])
4612 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4613 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4614 (match_operand:SI 2 "reg_or_cint_operand" ""))
4616 (set (match_operand:SI 0 "gpc_reg_operand" "")
4617 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4618 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4620 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4622 (compare:CC (match_dup 0)
4627 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4628 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4629 (match_operand:SI 2 "const_int_operand" "i"))
4630 (match_operand:SI 3 "mask_operand" "n")))]
4631 "includes_rshift_p (operands[2], operands[3])"
4632 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4635 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4637 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4638 (match_operand:SI 2 "const_int_operand" "i,i"))
4639 (match_operand:SI 3 "mask_operand" "n,n"))
4641 (clobber (match_scratch:SI 4 "=r,r"))]
4642 "includes_rshift_p (operands[2], operands[3])"
4644 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4646 [(set_attr "type" "delayed_compare")
4647 (set_attr "length" "4,8")])
4650 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4652 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4653 (match_operand:SI 2 "const_int_operand" ""))
4654 (match_operand:SI 3 "mask_operand" ""))
4656 (clobber (match_scratch:SI 4 ""))]
4657 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4659 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4662 (compare:CC (match_dup 4)
4667 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4669 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4670 (match_operand:SI 2 "const_int_operand" "i,i"))
4671 (match_operand:SI 3 "mask_operand" "n,n"))
4673 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4674 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4675 "includes_rshift_p (operands[2], operands[3])"
4677 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4679 [(set_attr "type" "delayed_compare")
4680 (set_attr "length" "4,8")])
4683 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4685 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4686 (match_operand:SI 2 "const_int_operand" ""))
4687 (match_operand:SI 3 "mask_operand" ""))
4689 (set (match_operand:SI 0 "gpc_reg_operand" "")
4690 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4691 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4693 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4695 (compare:CC (match_dup 0)
4700 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4703 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4704 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4705 "includes_rshift_p (operands[2], GEN_INT (255))"
4706 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4709 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4713 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4714 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4716 (clobber (match_scratch:SI 3 "=r,r"))]
4717 "includes_rshift_p (operands[2], GEN_INT (255))"
4719 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4721 [(set_attr "type" "delayed_compare")
4722 (set_attr "length" "4,8")])
4725 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4729 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4730 (match_operand:SI 2 "const_int_operand" "")) 0))
4732 (clobber (match_scratch:SI 3 ""))]
4733 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4735 (zero_extend:SI (subreg:QI
4736 (lshiftrt:SI (match_dup 1)
4739 (compare:CC (match_dup 3)
4744 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4748 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4749 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4751 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4752 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4753 "includes_rshift_p (operands[2], GEN_INT (255))"
4755 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4757 [(set_attr "type" "delayed_compare")
4758 (set_attr "length" "4,8")])
4761 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4765 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4766 (match_operand:SI 2 "const_int_operand" "")) 0))
4768 (set (match_operand:SI 0 "gpc_reg_operand" "")
4769 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4770 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4772 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4774 (compare:CC (match_dup 0)
4779 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4782 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4783 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4784 "includes_rshift_p (operands[2], GEN_INT (65535))"
4785 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4788 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4792 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4793 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4795 (clobber (match_scratch:SI 3 "=r,r"))]
4796 "includes_rshift_p (operands[2], GEN_INT (65535))"
4798 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4800 [(set_attr "type" "delayed_compare")
4801 (set_attr "length" "4,8")])
4804 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4808 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4809 (match_operand:SI 2 "const_int_operand" "")) 0))
4811 (clobber (match_scratch:SI 3 ""))]
4812 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4814 (zero_extend:SI (subreg:HI
4815 (lshiftrt:SI (match_dup 1)
4818 (compare:CC (match_dup 3)
4823 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4827 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4828 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4830 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4831 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4832 "includes_rshift_p (operands[2], GEN_INT (65535))"
4834 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4836 [(set_attr "type" "delayed_compare")
4837 (set_attr "length" "4,8")])
4840 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4844 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4845 (match_operand:SI 2 "const_int_operand" "")) 0))
4847 (set (match_operand:SI 0 "gpc_reg_operand" "")
4848 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4849 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4851 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4853 (compare:CC (match_dup 0)
4858 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4860 (match_operand:SI 1 "gpc_reg_operand" "r"))
4861 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4867 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4869 (match_operand:SI 1 "gpc_reg_operand" "r"))
4870 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4876 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4878 (match_operand:SI 1 "gpc_reg_operand" "r"))
4879 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4885 (define_expand "ashrsi3"
4886 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4887 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4888 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4893 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4895 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4899 (define_insn "ashrsi3_power"
4900 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4901 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4902 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4903 (clobber (match_scratch:SI 3 "=q,X"))]
4907 {srai|srawi} %0,%1,%h2"
4908 [(set_attr "type" "shift")])
4910 (define_insn "ashrsi3_no_power"
4911 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4912 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4913 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4917 {srai|srawi} %0,%1,%h2"
4918 [(set_attr "type" "var_shift_rotate,shift")])
4921 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4922 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4923 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4925 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4926 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4930 {srai.|srawi.} %3,%1,%h2
4933 [(set_attr "type" "delayed_compare")
4934 (set_attr "length" "4,4,8,8")])
4937 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4938 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4939 (match_operand:SI 2 "reg_or_cint_operand" ""))
4941 (clobber (match_scratch:SI 3 ""))
4942 (clobber (match_scratch:SI 4 ""))]
4943 "TARGET_POWER && reload_completed"
4944 [(parallel [(set (match_dup 3)
4945 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4946 (clobber (match_dup 4))])
4948 (compare:CC (match_dup 3)
4953 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4954 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4955 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4957 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4960 {sra.|sraw.} %3,%1,%2
4961 {srai.|srawi.} %3,%1,%h2
4964 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4965 (set_attr "length" "4,4,8,8")])
4968 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4969 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4970 (match_operand:SI 2 "reg_or_cint_operand" ""))
4972 (clobber (match_scratch:SI 3 ""))]
4973 "! TARGET_POWER && reload_completed"
4975 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4977 (compare:CC (match_dup 3)
4982 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4983 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4984 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4986 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4987 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4988 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4992 {srai.|srawi.} %0,%1,%h2
4995 [(set_attr "type" "delayed_compare")
4996 (set_attr "length" "4,4,8,8")])
4999 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5000 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5001 (match_operand:SI 2 "reg_or_cint_operand" ""))
5003 (set (match_operand:SI 0 "gpc_reg_operand" "")
5004 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5005 (clobber (match_scratch:SI 4 ""))]
5006 "TARGET_POWER && reload_completed"
5007 [(parallel [(set (match_dup 0)
5008 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5009 (clobber (match_dup 4))])
5011 (compare:CC (match_dup 0)
5016 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5017 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5018 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5020 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5021 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5024 {sra.|sraw.} %0,%1,%2
5025 {srai.|srawi.} %0,%1,%h2
5028 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5029 (set_attr "length" "4,4,8,8")])
5032 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5033 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5034 (match_operand:SI 2 "reg_or_cint_operand" ""))
5036 (set (match_operand:SI 0 "gpc_reg_operand" "")
5037 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5038 "! TARGET_POWER && reload_completed"
5040 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5042 (compare:CC (match_dup 0)
5046 ;; Floating-point insns, excluding normal data motion.
5048 ;; PowerPC has a full set of single-precision floating point instructions.
5050 ;; For the POWER architecture, we pretend that we have both SFmode and
5051 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5052 ;; The only conversions we will do will be when storing to memory. In that
5053 ;; case, we will use the "frsp" instruction before storing.
5055 ;; Note that when we store into a single-precision memory location, we need to
5056 ;; use the frsp insn first. If the register being stored isn't dead, we
5057 ;; need a scratch register for the frsp. But this is difficult when the store
5058 ;; is done by reload. It is not incorrect to do the frsp on the register in
5059 ;; this case, we just lose precision that we would have otherwise gotten but
5060 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5062 (define_expand "extendsfdf2"
5063 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5064 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5065 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5068 (define_insn_and_split "*extendsfdf2_fpr"
5069 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
5070 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5071 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5076 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5079 emit_note (NOTE_INSN_DELETED);
5082 [(set_attr "type" "fp,fp,fpload")])
5084 (define_expand "truncdfsf2"
5085 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5086 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5087 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5090 (define_insn "*truncdfsf2_fpr"
5091 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5092 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5093 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5095 [(set_attr "type" "fp")])
5097 (define_insn "aux_truncdfsf2"
5098 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5099 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5100 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5102 [(set_attr "type" "fp")])
5104 (define_expand "negsf2"
5105 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5106 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5107 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5110 (define_insn "*negsf2"
5111 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5112 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5113 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5115 [(set_attr "type" "fp")])
5117 (define_expand "abssf2"
5118 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5119 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5120 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5123 (define_insn "*abssf2"
5124 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5125 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5126 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5128 [(set_attr "type" "fp")])
5131 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5132 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5133 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5135 [(set_attr "type" "fp")])
5137 (define_expand "addsf3"
5138 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5139 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5140 (match_operand:SF 2 "gpc_reg_operand" "")))]
5141 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
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 && TARGET_SINGLE_FLOAT"
5150 [(set_attr "type" "fp")])
5153 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5154 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5155 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5156 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5157 "{fa|fadd} %0,%1,%2"
5158 [(set_attr "type" "fp")])
5160 (define_expand "subsf3"
5161 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5162 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5163 (match_operand:SF 2 "gpc_reg_operand" "")))]
5164 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
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 && TARGET_SINGLE_FLOAT"
5173 [(set_attr "type" "fp")])
5176 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5177 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5178 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5179 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5180 "{fs|fsub} %0,%1,%2"
5181 [(set_attr "type" "fp")])
5183 (define_expand "mulsf3"
5184 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5185 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5186 (match_operand:SF 2 "gpc_reg_operand" "")))]
5187 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
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 && TARGET_SINGLE_FLOAT"
5196 [(set_attr "type" "fp")])
5199 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5200 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5201 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5202 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5203 "{fm|fmul} %0,%1,%2"
5204 [(set_attr "type" "dmul")])
5206 (define_expand "divsf3"
5207 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5208 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5209 (match_operand:SF 2 "gpc_reg_operand" "")))]
5210 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5214 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5215 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5216 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5217 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5218 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5220 [(set_attr "type" "sdiv")])
5223 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5224 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5225 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5226 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5227 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5228 "{fd|fdiv} %0,%1,%2"
5229 [(set_attr "type" "ddiv")])
5231 (define_expand "recipsf3"
5232 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5233 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")
5234 (match_operand:SF 2 "gpc_reg_operand" "f")]
5236 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5237 && flag_finite_math_only && !flag_trapping_math"
5239 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5244 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5245 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5246 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5248 [(set_attr "type" "fp")])
5251 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5252 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5253 (match_operand:SF 2 "gpc_reg_operand" "f"))
5254 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5255 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5256 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5257 "fmadds %0,%1,%2,%3"
5258 [(set_attr "type" "fp")])
5261 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5262 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5263 (match_operand:SF 2 "gpc_reg_operand" "f"))
5264 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5265 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5266 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5267 "{fma|fmadd} %0,%1,%2,%3"
5268 [(set_attr "type" "dmul")])
5271 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5272 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5273 (match_operand:SF 2 "gpc_reg_operand" "f"))
5274 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5275 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5276 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5277 "fmsubs %0,%1,%2,%3"
5278 [(set_attr "type" "fp")])
5281 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5282 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5283 (match_operand:SF 2 "gpc_reg_operand" "f"))
5284 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5285 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5286 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5287 "{fms|fmsub} %0,%1,%2,%3"
5288 [(set_attr "type" "dmul")])
5291 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5292 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5293 (match_operand:SF 2 "gpc_reg_operand" "f"))
5294 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5295 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5296 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5297 "fnmadds %0,%1,%2,%3"
5298 [(set_attr "type" "fp")])
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_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5306 && ! HONOR_SIGNED_ZEROS (SFmode)"
5307 "fnmadds %0,%1,%2,%3"
5308 [(set_attr "type" "fp")])
5311 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5312 (neg:SF (plus: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
5316 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5317 "{fnma|fnmadd} %0,%1,%2,%3"
5318 [(set_attr "type" "dmul")])
5321 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5322 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5323 (match_operand:SF 2 "gpc_reg_operand" "f"))
5324 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5325 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5326 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5327 "{fnma|fnmadd} %0,%1,%2,%3"
5328 [(set_attr "type" "dmul")])
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 && TARGET_SINGLE_FLOAT && HONOR_SIGNED_ZEROS (SFmode)"
5337 "fnmsubs %0,%1,%2,%3"
5338 [(set_attr "type" "fp")])
5341 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5342 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5343 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5344 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5345 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5346 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5347 "fnmsubs %0,%1,%2,%3"
5348 [(set_attr "type" "fp")])
5351 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5352 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5353 (match_operand:SF 2 "gpc_reg_operand" "f"))
5354 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5355 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5356 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5357 "{fnms|fnmsub} %0,%1,%2,%3"
5358 [(set_attr "type" "dmul")])
5361 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5362 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5363 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5364 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5365 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5366 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5367 "{fnms|fnmsub} %0,%1,%2,%3"
5368 [(set_attr "type" "dmul")])
5370 (define_expand "sqrtsf2"
5371 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5372 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5373 "(TARGET_PPC_GPOPT || TARGET_POWER2)
5374 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5375 && !TARGET_SIMPLE_FPU"
5379 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5380 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5381 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT
5382 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5384 [(set_attr "type" "ssqrt")])
5387 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5388 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5389 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5390 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5392 [(set_attr "type" "dsqrt")])
5394 (define_expand "rsqrtsf2"
5395 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5396 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5398 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5399 && flag_finite_math_only && !flag_trapping_math"
5401 rs6000_emit_swrsqrtsf (operands[0], operands[1]);
5405 (define_insn "*rsqrt_internal1"
5406 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5407 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5409 "TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT"
5411 [(set_attr "type" "fp")])
5413 (define_expand "copysignsf3"
5415 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5417 (neg:SF (abs:SF (match_dup 1))))
5418 (set (match_operand:SF 0 "gpc_reg_operand" "")
5419 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5423 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5424 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5426 operands[3] = gen_reg_rtx (SFmode);
5427 operands[4] = gen_reg_rtx (SFmode);
5428 operands[5] = CONST0_RTX (SFmode);
5431 (define_expand "copysigndf3"
5433 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5435 (neg:DF (abs:DF (match_dup 1))))
5436 (set (match_operand:DF 0 "gpc_reg_operand" "")
5437 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5441 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5442 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5444 operands[3] = gen_reg_rtx (DFmode);
5445 operands[4] = gen_reg_rtx (DFmode);
5446 operands[5] = CONST0_RTX (DFmode);
5449 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5450 ;; fsel instruction and some auxiliary computations. Then we just have a
5451 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5453 (define_expand "smaxsf3"
5454 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5455 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5456 (match_operand:SF 2 "gpc_reg_operand" ""))
5459 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5460 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5461 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5463 (define_expand "sminsf3"
5464 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5465 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5466 (match_operand:SF 2 "gpc_reg_operand" ""))
5469 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5470 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5471 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5474 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5475 (match_operator:SF 3 "min_max_operator"
5476 [(match_operand:SF 1 "gpc_reg_operand" "")
5477 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5478 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5479 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5482 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5483 operands[1], operands[2]);
5487 (define_expand "movsicc"
5488 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5489 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5490 (match_operand:SI 2 "gpc_reg_operand" "")
5491 (match_operand:SI 3 "gpc_reg_operand" "")))]
5495 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5501 ;; We use the BASE_REGS for the isel input operands because, if rA is
5502 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5503 ;; because we may switch the operands and rB may end up being rA.
5505 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5506 ;; leave out the mode in operand 4 and use one pattern, but reload can
5507 ;; change the mode underneath our feet and then gets confused trying
5508 ;; to reload the value.
5509 (define_insn "isel_signed"
5510 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5512 (match_operator 1 "comparison_operator"
5513 [(match_operand:CC 4 "cc_reg_operand" "y")
5515 (match_operand:SI 2 "gpc_reg_operand" "b")
5516 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5519 { return output_isel (operands); }"
5520 [(set_attr "length" "4")])
5522 (define_insn "isel_unsigned"
5523 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5525 (match_operator 1 "comparison_operator"
5526 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5528 (match_operand:SI 2 "gpc_reg_operand" "b")
5529 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5532 { return output_isel (operands); }"
5533 [(set_attr "length" "4")])
5535 (define_expand "movsfcc"
5536 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5537 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5538 (match_operand:SF 2 "gpc_reg_operand" "")
5539 (match_operand:SF 3 "gpc_reg_operand" "")))]
5540 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5543 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5549 (define_insn "*fselsfsf4"
5550 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5551 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5552 (match_operand:SF 4 "zero_fp_constant" "F"))
5553 (match_operand:SF 2 "gpc_reg_operand" "f")
5554 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5555 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5557 [(set_attr "type" "fp")])
5559 (define_insn "*fseldfsf4"
5560 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5561 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5562 (match_operand:DF 4 "zero_fp_constant" "F"))
5563 (match_operand:SF 2 "gpc_reg_operand" "f")
5564 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5565 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5567 [(set_attr "type" "fp")])
5569 (define_expand "negdf2"
5570 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5571 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5572 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5575 (define_insn "*negdf2_fpr"
5576 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5577 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5578 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5580 [(set_attr "type" "fp")])
5582 (define_expand "absdf2"
5583 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5584 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5585 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5588 (define_insn "*absdf2_fpr"
5589 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5590 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5591 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5593 [(set_attr "type" "fp")])
5595 (define_insn "*nabsdf2_fpr"
5596 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5597 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5598 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5600 [(set_attr "type" "fp")])
5602 (define_expand "adddf3"
5603 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5604 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5605 (match_operand:DF 2 "gpc_reg_operand" "")))]
5606 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5609 (define_insn "*adddf3_fpr"
5610 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5611 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5612 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5613 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5614 "{fa|fadd} %0,%1,%2"
5615 [(set_attr "type" "fp")])
5617 (define_expand "subdf3"
5618 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5619 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5620 (match_operand:DF 2 "gpc_reg_operand" "")))]
5621 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5624 (define_insn "*subdf3_fpr"
5625 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5626 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5627 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5628 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5629 "{fs|fsub} %0,%1,%2"
5630 [(set_attr "type" "fp")])
5632 (define_expand "muldf3"
5633 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5634 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5635 (match_operand:DF 2 "gpc_reg_operand" "")))]
5636 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5639 (define_insn "*muldf3_fpr"
5640 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5641 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5642 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5643 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5644 "{fm|fmul} %0,%1,%2"
5645 [(set_attr "type" "dmul")])
5647 (define_expand "divdf3"
5648 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5649 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5650 (match_operand:DF 2 "gpc_reg_operand" "")))]
5651 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE) && !TARGET_SIMPLE_FPU"
5654 (define_insn "*divdf3_fpr"
5655 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5656 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5657 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5658 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU"
5659 "{fd|fdiv} %0,%1,%2"
5660 [(set_attr "type" "ddiv")])
5662 (define_expand "recipdf3"
5663 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5664 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")
5665 (match_operand:DF 2 "gpc_reg_operand" "f")]
5667 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_POPCNTB && !optimize_size
5668 && flag_finite_math_only && !flag_trapping_math"
5670 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5675 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5676 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5677 "TARGET_POPCNTB && flag_finite_math_only"
5679 [(set_attr "type" "fp")])
5682 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5683 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5684 (match_operand:DF 2 "gpc_reg_operand" "f"))
5685 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5686 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
5687 "{fma|fmadd} %0,%1,%2,%3"
5688 [(set_attr "type" "dmul")])
5691 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5692 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5693 (match_operand:DF 2 "gpc_reg_operand" "f"))
5694 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5695 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
5696 "{fms|fmsub} %0,%1,%2,%3"
5697 [(set_attr "type" "dmul")])
5700 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5701 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5702 (match_operand:DF 2 "gpc_reg_operand" "f"))
5703 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5704 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5705 && HONOR_SIGNED_ZEROS (DFmode)"
5706 "{fnma|fnmadd} %0,%1,%2,%3"
5707 [(set_attr "type" "dmul")])
5710 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5711 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5712 (match_operand:DF 2 "gpc_reg_operand" "f"))
5713 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5714 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5715 && ! HONOR_SIGNED_ZEROS (DFmode)"
5716 "{fnma|fnmadd} %0,%1,%2,%3"
5717 [(set_attr "type" "dmul")])
5720 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5721 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5722 (match_operand:DF 2 "gpc_reg_operand" "f"))
5723 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5724 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5725 && HONOR_SIGNED_ZEROS (DFmode)"
5726 "{fnms|fnmsub} %0,%1,%2,%3"
5727 [(set_attr "type" "dmul")])
5730 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5731 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5732 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5733 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5734 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5735 && ! HONOR_SIGNED_ZEROS (DFmode)"
5736 "{fnms|fnmsub} %0,%1,%2,%3"
5737 [(set_attr "type" "dmul")])
5739 (define_insn "sqrtdf2"
5740 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5741 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5742 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
5743 && TARGET_DOUBLE_FLOAT"
5745 [(set_attr "type" "dsqrt")])
5747 ;; The conditional move instructions allow us to perform max and min
5748 ;; operations even when
5750 (define_expand "smaxdf3"
5751 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5752 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5753 (match_operand:DF 2 "gpc_reg_operand" ""))
5756 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5757 && !flag_trapping_math"
5758 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5760 (define_expand "smindf3"
5761 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5762 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5763 (match_operand:DF 2 "gpc_reg_operand" ""))
5766 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5767 && !flag_trapping_math"
5768 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5771 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5772 (match_operator:DF 3 "min_max_operator"
5773 [(match_operand:DF 1 "gpc_reg_operand" "")
5774 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5775 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5776 && !flag_trapping_math"
5779 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5780 operands[1], operands[2]);
5784 (define_expand "movdfcc"
5785 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5786 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5787 (match_operand:DF 2 "gpc_reg_operand" "")
5788 (match_operand:DF 3 "gpc_reg_operand" "")))]
5789 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5792 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5798 (define_insn "*fseldfdf4"
5799 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5800 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5801 (match_operand:DF 4 "zero_fp_constant" "F"))
5802 (match_operand:DF 2 "gpc_reg_operand" "f")
5803 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5804 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5806 [(set_attr "type" "fp")])
5808 (define_insn "*fselsfdf4"
5809 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5810 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5811 (match_operand:SF 4 "zero_fp_constant" "F"))
5812 (match_operand:DF 2 "gpc_reg_operand" "f")
5813 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5816 [(set_attr "type" "fp")])
5818 ;; Conversions to and from floating-point.
5820 (define_expand "fixuns_truncsfsi2"
5821 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5822 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5823 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5826 (define_expand "fix_truncsfsi2"
5827 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5828 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5829 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5832 ; For each of these conversions, there is a define_expand, a define_insn
5833 ; with a '#' template, and a define_split (with C code). The idea is
5834 ; to allow constant folding with the template of the define_insn,
5835 ; then to have the insns split later (between sched1 and final).
5837 (define_expand "floatsidf2"
5838 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5839 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5842 (clobber (match_dup 4))
5843 (clobber (match_dup 5))
5844 (clobber (match_dup 6))])]
5846 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5849 if (TARGET_E500_DOUBLE)
5851 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5854 if (TARGET_POWERPC64)
5856 rtx x = convert_to_mode (DImode, operands[1], 0);
5857 emit_insn (gen_floatdidf2 (operands[0], x));
5861 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5862 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5863 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5864 operands[5] = gen_reg_rtx (DFmode);
5865 operands[6] = gen_reg_rtx (SImode);
5868 (define_insn_and_split "*floatsidf2_internal"
5869 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5870 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5871 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5872 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5873 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5874 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5875 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5876 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5878 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5882 rtx lowword, highword;
5883 gcc_assert (MEM_P (operands[4]));
5884 highword = adjust_address (operands[4], SImode, 0);
5885 lowword = adjust_address (operands[4], SImode, 4);
5886 if (! WORDS_BIG_ENDIAN)
5889 tmp = highword; highword = lowword; lowword = tmp;
5892 emit_insn (gen_xorsi3 (operands[6], operands[1],
5893 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5894 emit_move_insn (lowword, operands[6]);
5895 emit_move_insn (highword, operands[2]);
5896 emit_move_insn (operands[5], operands[4]);
5897 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5900 [(set_attr "length" "24")])
5902 (define_expand "floatunssisf2"
5903 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5904 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5905 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5908 (define_expand "floatunssidf2"
5909 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5910 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5913 (clobber (match_dup 4))
5914 (clobber (match_dup 5))])]
5915 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5918 if (TARGET_E500_DOUBLE)
5920 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5923 if (TARGET_POWERPC64)
5925 rtx x = convert_to_mode (DImode, operands[1], 1);
5926 emit_insn (gen_floatdidf2 (operands[0], x));
5930 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5931 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5932 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5933 operands[5] = gen_reg_rtx (DFmode);
5936 (define_insn_and_split "*floatunssidf2_internal"
5937 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5938 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5939 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5940 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5941 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5942 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5943 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5945 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5949 rtx lowword, highword;
5950 gcc_assert (MEM_P (operands[4]));
5951 highword = adjust_address (operands[4], SImode, 0);
5952 lowword = adjust_address (operands[4], SImode, 4);
5953 if (! WORDS_BIG_ENDIAN)
5956 tmp = highword; highword = lowword; lowword = tmp;
5959 emit_move_insn (lowword, operands[1]);
5960 emit_move_insn (highword, operands[2]);
5961 emit_move_insn (operands[5], operands[4]);
5962 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5965 [(set_attr "length" "20")])
5967 (define_expand "fix_truncdfsi2"
5968 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5969 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5970 (clobber (match_dup 2))
5971 (clobber (match_dup 3))])]
5972 "(TARGET_POWER2 || TARGET_POWERPC)
5973 && TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5976 if (TARGET_E500_DOUBLE)
5978 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5981 operands[2] = gen_reg_rtx (DImode);
5982 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
5983 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
5985 operands[3] = gen_reg_rtx (DImode);
5986 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
5987 operands[2], operands[3]));
5990 if (TARGET_PPC_GFXOPT)
5992 rtx orig_dest = operands[0];
5993 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5994 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5995 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5997 if (operands[0] != orig_dest)
5998 emit_move_insn (orig_dest, operands[0]);
6001 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
6004 (define_insn_and_split "*fix_truncdfsi2_internal"
6005 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6006 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6007 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
6008 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6009 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6010 && TARGET_DOUBLE_FLOAT"
6012 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[3]))"
6017 gcc_assert (MEM_P (operands[3]));
6018 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6020 emit_insn (gen_fctiwz (operands[2], operands[1]));
6021 emit_move_insn (operands[3], operands[2]);
6022 emit_move_insn (operands[0], lowword);
6025 [(set_attr "length" "16")])
6027 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6028 [(set (match_operand:SI 0 "memory_operand" "=Z")
6029 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6030 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
6031 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6032 && TARGET_DOUBLE_FLOAT
6033 && TARGET_PPC_GFXOPT"
6039 emit_insn (gen_fctiwz (operands[2], operands[1]));
6040 emit_insn (gen_stfiwx (operands[0], operands[2]));
6043 [(set_attr "length" "16")])
6045 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6046 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6047 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6048 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
6049 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6050 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6051 && TARGET_DOUBLE_FLOAT"
6054 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6055 (set (match_dup 3) (match_dup 2))
6056 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6058 [(set_attr "length" "12")])
6060 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6061 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6062 ; because the first makes it clear that operand 0 is not live
6063 ; before the instruction.
6064 (define_insn "fctiwz"
6065 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
6066 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
6068 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6069 && TARGET_DOUBLE_FLOAT"
6070 "{fcirz|fctiwz} %0,%1"
6071 [(set_attr "type" "fp")])
6073 (define_insn "btruncdf2"
6074 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6075 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6076 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6078 [(set_attr "type" "fp")])
6080 (define_insn "btruncsf2"
6081 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6082 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6083 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6085 [(set_attr "type" "fp")])
6087 (define_insn "ceildf2"
6088 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6089 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6090 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6092 [(set_attr "type" "fp")])
6094 (define_insn "ceilsf2"
6095 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6096 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6097 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6099 [(set_attr "type" "fp")])
6101 (define_insn "floordf2"
6102 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6103 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6104 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6106 [(set_attr "type" "fp")])
6108 (define_insn "floorsf2"
6109 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6110 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6111 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6113 [(set_attr "type" "fp")])
6115 (define_insn "rounddf2"
6116 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6117 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6118 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6120 [(set_attr "type" "fp")])
6122 (define_insn "roundsf2"
6123 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6124 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6125 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6127 [(set_attr "type" "fp")])
6129 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6130 (define_insn "stfiwx"
6131 [(set (match_operand:SI 0 "memory_operand" "=Z")
6132 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
6136 [(set_attr "type" "fpstore")])
6138 (define_expand "floatsisf2"
6139 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6140 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6141 "TARGET_HARD_FLOAT && (!TARGET_FPRS || TARGET_SINGLE_FPU)"
6144 (define_insn "floatdidf2"
6145 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6146 (float:DF (match_operand:DI 1 "gpc_reg_operand" "!f#r")))]
6147 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6149 [(set_attr "type" "fp")])
6151 (define_insn "fix_truncdfdi2"
6152 [(set (match_operand:DI 0 "gpc_reg_operand" "=!f#r")
6153 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
6154 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6156 [(set_attr "type" "fp")])
6158 (define_expand "floatdisf2"
6159 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6160 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6161 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6164 rtx val = operands[1];
6165 if (!flag_unsafe_math_optimizations)
6167 rtx label = gen_label_rtx ();
6168 val = gen_reg_rtx (DImode);
6169 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6172 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6176 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6177 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6178 ;; from double rounding.
6179 (define_insn_and_split "floatdisf2_internal1"
6180 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6181 (float:SF (match_operand:DI 1 "gpc_reg_operand" "!f#r")))
6182 (clobber (match_scratch:DF 2 "=f"))]
6183 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6185 "&& reload_completed"
6187 (float:DF (match_dup 1)))
6189 (float_truncate:SF (match_dup 2)))]
6192 ;; Twiddles bits to avoid double rounding.
6193 ;; Bits that might be truncated when converting to DFmode are replaced
6194 ;; by a bit that won't be lost at that stage, but is below the SFmode
6195 ;; rounding position.
6196 (define_expand "floatdisf2_internal2"
6197 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6199 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6201 (clobber (scratch:CC))])
6202 (set (match_dup 3) (plus:DI (match_dup 3)
6204 (set (match_dup 0) (plus:DI (match_dup 0)
6206 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6208 (set (match_dup 0) (ior:DI (match_dup 0)
6210 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6212 (clobber (scratch:CC))])
6213 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6214 (label_ref (match_operand:DI 2 "" ""))
6216 (set (match_dup 0) (match_dup 1))]
6217 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6220 operands[3] = gen_reg_rtx (DImode);
6221 operands[4] = gen_reg_rtx (CCUNSmode);
6224 ;; Define the DImode operations that can be done in a small number
6225 ;; of instructions. The & constraints are to prevent the register
6226 ;; allocator from allocating registers that overlap with the inputs
6227 ;; (for example, having an input in 7,8 and an output in 6,7). We
6228 ;; also allow for the output being the same as one of the inputs.
6230 (define_insn "*adddi3_noppc64"
6231 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6232 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6233 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6234 "! TARGET_POWERPC64"
6237 if (WORDS_BIG_ENDIAN)
6238 return (GET_CODE (operands[2])) != CONST_INT
6239 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6240 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6242 return (GET_CODE (operands[2])) != CONST_INT
6243 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6244 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6246 [(set_attr "type" "two")
6247 (set_attr "length" "8")])
6249 (define_insn "*subdi3_noppc64"
6250 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6251 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6252 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6253 "! TARGET_POWERPC64"
6256 if (WORDS_BIG_ENDIAN)
6257 return (GET_CODE (operands[1]) != CONST_INT)
6258 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6259 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6261 return (GET_CODE (operands[1]) != CONST_INT)
6262 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6263 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6265 [(set_attr "type" "two")
6266 (set_attr "length" "8")])
6268 (define_insn "*negdi2_noppc64"
6269 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6270 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6271 "! TARGET_POWERPC64"
6274 return (WORDS_BIG_ENDIAN)
6275 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6276 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6278 [(set_attr "type" "two")
6279 (set_attr "length" "8")])
6281 (define_expand "mulsidi3"
6282 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6283 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6284 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6285 "! TARGET_POWERPC64"
6288 if (! TARGET_POWER && ! TARGET_POWERPC)
6290 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6291 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6292 emit_insn (gen_mull_call ());
6293 if (WORDS_BIG_ENDIAN)
6294 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6297 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6298 gen_rtx_REG (SImode, 3));
6299 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6300 gen_rtx_REG (SImode, 4));
6304 else if (TARGET_POWER)
6306 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6311 (define_insn "mulsidi3_mq"
6312 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6313 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6314 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6315 (clobber (match_scratch:SI 3 "=q"))]
6317 "mul %0,%1,%2\;mfmq %L0"
6318 [(set_attr "type" "imul")
6319 (set_attr "length" "8")])
6321 (define_insn "*mulsidi3_no_mq"
6322 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6323 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6324 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6325 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6328 return (WORDS_BIG_ENDIAN)
6329 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6330 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6332 [(set_attr "type" "imul")
6333 (set_attr "length" "8")])
6336 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6337 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6338 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6339 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6342 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6343 (sign_extend:DI (match_dup 2)))
6346 (mult:SI (match_dup 1)
6350 int endian = (WORDS_BIG_ENDIAN == 0);
6351 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6352 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6355 (define_expand "umulsidi3"
6356 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6357 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6358 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6359 "TARGET_POWERPC && ! TARGET_POWERPC64"
6364 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6369 (define_insn "umulsidi3_mq"
6370 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6371 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6372 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6373 (clobber (match_scratch:SI 3 "=q"))]
6374 "TARGET_POWERPC && TARGET_POWER"
6377 return (WORDS_BIG_ENDIAN)
6378 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6379 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6381 [(set_attr "type" "imul")
6382 (set_attr "length" "8")])
6384 (define_insn "*umulsidi3_no_mq"
6385 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6386 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6387 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6388 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6391 return (WORDS_BIG_ENDIAN)
6392 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6393 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6395 [(set_attr "type" "imul")
6396 (set_attr "length" "8")])
6399 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6400 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6401 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6402 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6405 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6406 (zero_extend:DI (match_dup 2)))
6409 (mult:SI (match_dup 1)
6413 int endian = (WORDS_BIG_ENDIAN == 0);
6414 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6415 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6418 (define_expand "smulsi3_highpart"
6419 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6421 (lshiftrt:DI (mult:DI (sign_extend:DI
6422 (match_operand:SI 1 "gpc_reg_operand" ""))
6424 (match_operand:SI 2 "gpc_reg_operand" "")))
6429 if (! TARGET_POWER && ! TARGET_POWERPC)
6431 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6432 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6433 emit_insn (gen_mulh_call ());
6434 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6437 else if (TARGET_POWER)
6439 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6444 (define_insn "smulsi3_highpart_mq"
6445 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6447 (lshiftrt:DI (mult:DI (sign_extend:DI
6448 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6450 (match_operand:SI 2 "gpc_reg_operand" "r")))
6452 (clobber (match_scratch:SI 3 "=q"))]
6455 [(set_attr "type" "imul")])
6457 (define_insn "*smulsi3_highpart_no_mq"
6458 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6460 (lshiftrt:DI (mult:DI (sign_extend:DI
6461 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6463 (match_operand:SI 2 "gpc_reg_operand" "r")))
6465 "TARGET_POWERPC && ! TARGET_POWER"
6467 [(set_attr "type" "imul")])
6469 (define_expand "umulsi3_highpart"
6470 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6472 (lshiftrt:DI (mult:DI (zero_extend:DI
6473 (match_operand:SI 1 "gpc_reg_operand" ""))
6475 (match_operand:SI 2 "gpc_reg_operand" "")))
6482 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6487 (define_insn "umulsi3_highpart_mq"
6488 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6490 (lshiftrt:DI (mult:DI (zero_extend:DI
6491 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6493 (match_operand:SI 2 "gpc_reg_operand" "r")))
6495 (clobber (match_scratch:SI 3 "=q"))]
6496 "TARGET_POWERPC && TARGET_POWER"
6498 [(set_attr "type" "imul")])
6500 (define_insn "*umulsi3_highpart_no_mq"
6501 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6503 (lshiftrt:DI (mult:DI (zero_extend:DI
6504 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6506 (match_operand:SI 2 "gpc_reg_operand" "r")))
6508 "TARGET_POWERPC && ! TARGET_POWER"
6510 [(set_attr "type" "imul")])
6512 ;; If operands 0 and 2 are in the same register, we have a problem. But
6513 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6514 ;; why we have the strange constraints below.
6515 (define_insn "ashldi3_power"
6516 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6517 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6518 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6519 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6522 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6523 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6524 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6525 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6526 [(set_attr "length" "8")])
6528 (define_insn "lshrdi3_power"
6529 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6530 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6531 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6532 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6535 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6536 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6537 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6538 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6539 [(set_attr "length" "8")])
6541 ;; Shift by a variable amount is too complex to be worth open-coding. We
6542 ;; just handle shifts by constants.
6543 (define_insn "ashrdi3_power"
6544 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6545 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6546 (match_operand:SI 2 "const_int_operand" "M,i")))
6547 (clobber (match_scratch:SI 3 "=X,q"))]
6550 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6551 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6552 [(set_attr "type" "shift")
6553 (set_attr "length" "8")])
6555 (define_insn "ashrdi3_no_power"
6556 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6557 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6558 (match_operand:SI 2 "const_int_operand" "M,i")))]
6559 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6561 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6562 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6563 [(set_attr "type" "two,three")
6564 (set_attr "length" "8,12")])
6566 (define_insn "*ashrdisi3_noppc64"
6567 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6568 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6569 (const_int 32)) 4))]
6570 "TARGET_32BIT && !TARGET_POWERPC64"
6573 if (REGNO (operands[0]) == REGNO (operands[1]))
6576 return \"mr %0,%1\";
6578 [(set_attr "length" "4")])
6581 ;; PowerPC64 DImode operations.
6583 (define_insn_and_split "absdi2"
6584 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6585 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6586 (clobber (match_scratch:DI 2 "=&r,&r"))]
6589 "&& reload_completed"
6590 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6591 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6592 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6595 (define_insn_and_split "*nabsdi2"
6596 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6597 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6598 (clobber (match_scratch:DI 2 "=&r,&r"))]
6601 "&& reload_completed"
6602 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6603 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6604 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6607 (define_insn "muldi3"
6608 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6609 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6610 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6616 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6617 (const_string "imul3")
6618 (match_operand:SI 2 "short_cint_operand" "")
6619 (const_string "imul2")]
6620 (const_string "lmul")))])
6622 (define_insn "*muldi3_internal1"
6623 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6624 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6625 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6627 (clobber (match_scratch:DI 3 "=r,r"))]
6632 [(set_attr "type" "lmul_compare")
6633 (set_attr "length" "4,8")])
6636 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6637 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6638 (match_operand:DI 2 "gpc_reg_operand" ""))
6640 (clobber (match_scratch:DI 3 ""))]
6641 "TARGET_POWERPC64 && reload_completed"
6643 (mult:DI (match_dup 1) (match_dup 2)))
6645 (compare:CC (match_dup 3)
6649 (define_insn "*muldi3_internal2"
6650 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6651 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6652 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6654 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6655 (mult:DI (match_dup 1) (match_dup 2)))]
6660 [(set_attr "type" "lmul_compare")
6661 (set_attr "length" "4,8")])
6664 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6665 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6666 (match_operand:DI 2 "gpc_reg_operand" ""))
6668 (set (match_operand:DI 0 "gpc_reg_operand" "")
6669 (mult:DI (match_dup 1) (match_dup 2)))]
6670 "TARGET_POWERPC64 && reload_completed"
6672 (mult:DI (match_dup 1) (match_dup 2)))
6674 (compare:CC (match_dup 0)
6678 (define_insn "smuldi3_highpart"
6679 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6681 (lshiftrt:TI (mult:TI (sign_extend:TI
6682 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6684 (match_operand:DI 2 "gpc_reg_operand" "r")))
6688 [(set_attr "type" "lmul")])
6690 (define_insn "umuldi3_highpart"
6691 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6693 (lshiftrt:TI (mult:TI (zero_extend:TI
6694 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6696 (match_operand:DI 2 "gpc_reg_operand" "r")))
6700 [(set_attr "type" "lmul")])
6702 (define_insn "rotldi3"
6703 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6704 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6705 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6710 [(set_attr "type" "var_shift_rotate,integer")])
6712 (define_insn "*rotldi3_internal2"
6713 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6714 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6715 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6717 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6724 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6725 (set_attr "length" "4,4,8,8")])
6728 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6729 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6730 (match_operand:DI 2 "reg_or_cint_operand" ""))
6732 (clobber (match_scratch:DI 3 ""))]
6733 "TARGET_POWERPC64 && reload_completed"
6735 (rotate:DI (match_dup 1) (match_dup 2)))
6737 (compare:CC (match_dup 3)
6741 (define_insn "*rotldi3_internal3"
6742 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6743 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6744 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6746 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6747 (rotate:DI (match_dup 1) (match_dup 2)))]
6754 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6755 (set_attr "length" "4,4,8,8")])
6758 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6759 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6760 (match_operand:DI 2 "reg_or_cint_operand" ""))
6762 (set (match_operand:DI 0 "gpc_reg_operand" "")
6763 (rotate:DI (match_dup 1) (match_dup 2)))]
6764 "TARGET_POWERPC64 && reload_completed"
6766 (rotate:DI (match_dup 1) (match_dup 2)))
6768 (compare:CC (match_dup 0)
6772 (define_insn "*rotldi3_internal4"
6773 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6774 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6775 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6776 (match_operand:DI 3 "mask64_operand" "n,n")))]
6779 rldc%B3 %0,%1,%2,%S3
6780 rldic%B3 %0,%1,%H2,%S3"
6781 [(set_attr "type" "var_shift_rotate,integer")])
6783 (define_insn "*rotldi3_internal5"
6784 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6786 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6787 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6788 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6790 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6793 rldc%B3. %4,%1,%2,%S3
6794 rldic%B3. %4,%1,%H2,%S3
6797 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6798 (set_attr "length" "4,4,8,8")])
6801 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6803 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6804 (match_operand:DI 2 "reg_or_cint_operand" ""))
6805 (match_operand:DI 3 "mask64_operand" ""))
6807 (clobber (match_scratch:DI 4 ""))]
6808 "TARGET_POWERPC64 && reload_completed"
6810 (and:DI (rotate:DI (match_dup 1)
6814 (compare:CC (match_dup 4)
6818 (define_insn "*rotldi3_internal6"
6819 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6821 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6822 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6823 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6825 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6826 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6829 rldc%B3. %0,%1,%2,%S3
6830 rldic%B3. %0,%1,%H2,%S3
6833 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6834 (set_attr "length" "4,4,8,8")])
6837 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6839 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6840 (match_operand:DI 2 "reg_or_cint_operand" ""))
6841 (match_operand:DI 3 "mask64_operand" ""))
6843 (set (match_operand:DI 0 "gpc_reg_operand" "")
6844 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6845 "TARGET_POWERPC64 && reload_completed"
6847 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6849 (compare:CC (match_dup 0)
6853 (define_insn "*rotldi3_internal7"
6854 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6857 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6858 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6862 rldicl %0,%1,%H2,56"
6863 [(set_attr "type" "var_shift_rotate,integer")])
6865 (define_insn "*rotldi3_internal8"
6866 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6867 (compare:CC (zero_extend:DI
6869 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6870 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6872 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6876 rldicl. %3,%1,%H2,56
6879 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6880 (set_attr "length" "4,4,8,8")])
6883 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6884 (compare:CC (zero_extend:DI
6886 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6887 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6889 (clobber (match_scratch:DI 3 ""))]
6890 "TARGET_POWERPC64 && reload_completed"
6892 (zero_extend:DI (subreg:QI
6893 (rotate:DI (match_dup 1)
6896 (compare:CC (match_dup 3)
6900 (define_insn "*rotldi3_internal9"
6901 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6902 (compare:CC (zero_extend:DI
6904 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6905 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6907 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6908 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6912 rldicl. %0,%1,%H2,56
6915 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6916 (set_attr "length" "4,4,8,8")])
6919 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6920 (compare:CC (zero_extend:DI
6922 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6923 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6925 (set (match_operand:DI 0 "gpc_reg_operand" "")
6926 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6927 "TARGET_POWERPC64 && reload_completed"
6929 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6931 (compare:CC (match_dup 0)
6935 (define_insn "*rotldi3_internal10"
6936 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6939 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6940 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6944 rldicl %0,%1,%H2,48"
6945 [(set_attr "type" "var_shift_rotate,integer")])
6947 (define_insn "*rotldi3_internal11"
6948 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6949 (compare:CC (zero_extend:DI
6951 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6952 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6954 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6958 rldicl. %3,%1,%H2,48
6961 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6962 (set_attr "length" "4,4,8,8")])
6965 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6966 (compare:CC (zero_extend:DI
6968 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6969 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6971 (clobber (match_scratch:DI 3 ""))]
6972 "TARGET_POWERPC64 && reload_completed"
6974 (zero_extend:DI (subreg:HI
6975 (rotate:DI (match_dup 1)
6978 (compare:CC (match_dup 3)
6982 (define_insn "*rotldi3_internal12"
6983 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6984 (compare:CC (zero_extend:DI
6986 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6987 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6989 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6990 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6994 rldicl. %0,%1,%H2,48
6997 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6998 (set_attr "length" "4,4,8,8")])
7001 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7002 (compare:CC (zero_extend:DI
7004 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7005 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7007 (set (match_operand:DI 0 "gpc_reg_operand" "")
7008 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7009 "TARGET_POWERPC64 && reload_completed"
7011 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7013 (compare:CC (match_dup 0)
7017 (define_insn "*rotldi3_internal13"
7018 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7021 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7022 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7026 rldicl %0,%1,%H2,32"
7027 [(set_attr "type" "var_shift_rotate,integer")])
7029 (define_insn "*rotldi3_internal14"
7030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7031 (compare:CC (zero_extend:DI
7033 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7034 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7036 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7040 rldicl. %3,%1,%H2,32
7043 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7044 (set_attr "length" "4,4,8,8")])
7047 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7048 (compare:CC (zero_extend:DI
7050 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7051 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7053 (clobber (match_scratch:DI 3 ""))]
7054 "TARGET_POWERPC64 && reload_completed"
7056 (zero_extend:DI (subreg:SI
7057 (rotate:DI (match_dup 1)
7060 (compare:CC (match_dup 3)
7064 (define_insn "*rotldi3_internal15"
7065 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7066 (compare:CC (zero_extend:DI
7068 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7069 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7071 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7072 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7076 rldicl. %0,%1,%H2,32
7079 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7080 (set_attr "length" "4,4,8,8")])
7083 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7084 (compare:CC (zero_extend:DI
7086 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7087 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7089 (set (match_operand:DI 0 "gpc_reg_operand" "")
7090 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7091 "TARGET_POWERPC64 && reload_completed"
7093 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7095 (compare:CC (match_dup 0)
7099 (define_expand "ashldi3"
7100 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7101 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7102 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7103 "TARGET_POWERPC64 || TARGET_POWER"
7106 if (TARGET_POWERPC64)
7108 else if (TARGET_POWER)
7110 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7117 (define_insn "*ashldi3_internal1"
7118 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7119 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7120 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7125 [(set_attr "type" "var_shift_rotate,shift")])
7127 (define_insn "*ashldi3_internal2"
7128 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7129 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7130 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7132 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7139 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7140 (set_attr "length" "4,4,8,8")])
7143 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7144 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7145 (match_operand:SI 2 "reg_or_cint_operand" ""))
7147 (clobber (match_scratch:DI 3 ""))]
7148 "TARGET_POWERPC64 && reload_completed"
7150 (ashift:DI (match_dup 1) (match_dup 2)))
7152 (compare:CC (match_dup 3)
7156 (define_insn "*ashldi3_internal3"
7157 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7158 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7159 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7161 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7162 (ashift:DI (match_dup 1) (match_dup 2)))]
7169 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7170 (set_attr "length" "4,4,8,8")])
7173 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7174 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7175 (match_operand:SI 2 "reg_or_cint_operand" ""))
7177 (set (match_operand:DI 0 "gpc_reg_operand" "")
7178 (ashift:DI (match_dup 1) (match_dup 2)))]
7179 "TARGET_POWERPC64 && reload_completed"
7181 (ashift:DI (match_dup 1) (match_dup 2)))
7183 (compare:CC (match_dup 0)
7187 (define_insn "*ashldi3_internal4"
7188 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7189 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7190 (match_operand:SI 2 "const_int_operand" "i"))
7191 (match_operand:DI 3 "const_int_operand" "n")))]
7192 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7193 "rldic %0,%1,%H2,%W3")
7195 (define_insn "ashldi3_internal5"
7196 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7198 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7199 (match_operand:SI 2 "const_int_operand" "i,i"))
7200 (match_operand:DI 3 "const_int_operand" "n,n"))
7202 (clobber (match_scratch:DI 4 "=r,r"))]
7203 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7205 rldic. %4,%1,%H2,%W3
7207 [(set_attr "type" "compare")
7208 (set_attr "length" "4,8")])
7211 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7213 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7214 (match_operand:SI 2 "const_int_operand" ""))
7215 (match_operand:DI 3 "const_int_operand" ""))
7217 (clobber (match_scratch:DI 4 ""))]
7218 "TARGET_POWERPC64 && reload_completed
7219 && includes_rldic_lshift_p (operands[2], operands[3])"
7221 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7224 (compare:CC (match_dup 4)
7228 (define_insn "*ashldi3_internal6"
7229 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7231 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7232 (match_operand:SI 2 "const_int_operand" "i,i"))
7233 (match_operand:DI 3 "const_int_operand" "n,n"))
7235 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7236 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7237 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7239 rldic. %0,%1,%H2,%W3
7241 [(set_attr "type" "compare")
7242 (set_attr "length" "4,8")])
7245 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7247 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7248 (match_operand:SI 2 "const_int_operand" ""))
7249 (match_operand:DI 3 "const_int_operand" ""))
7251 (set (match_operand:DI 0 "gpc_reg_operand" "")
7252 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7253 "TARGET_POWERPC64 && reload_completed
7254 && includes_rldic_lshift_p (operands[2], operands[3])"
7256 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7259 (compare:CC (match_dup 0)
7263 (define_insn "*ashldi3_internal7"
7264 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7265 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7266 (match_operand:SI 2 "const_int_operand" "i"))
7267 (match_operand:DI 3 "mask64_operand" "n")))]
7268 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7269 "rldicr %0,%1,%H2,%S3")
7271 (define_insn "ashldi3_internal8"
7272 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7274 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7275 (match_operand:SI 2 "const_int_operand" "i,i"))
7276 (match_operand:DI 3 "mask64_operand" "n,n"))
7278 (clobber (match_scratch:DI 4 "=r,r"))]
7279 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7281 rldicr. %4,%1,%H2,%S3
7283 [(set_attr "type" "compare")
7284 (set_attr "length" "4,8")])
7287 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7289 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7290 (match_operand:SI 2 "const_int_operand" ""))
7291 (match_operand:DI 3 "mask64_operand" ""))
7293 (clobber (match_scratch:DI 4 ""))]
7294 "TARGET_POWERPC64 && reload_completed
7295 && includes_rldicr_lshift_p (operands[2], operands[3])"
7297 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7300 (compare:CC (match_dup 4)
7304 (define_insn "*ashldi3_internal9"
7305 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7307 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7308 (match_operand:SI 2 "const_int_operand" "i,i"))
7309 (match_operand:DI 3 "mask64_operand" "n,n"))
7311 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7312 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7313 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7315 rldicr. %0,%1,%H2,%S3
7317 [(set_attr "type" "compare")
7318 (set_attr "length" "4,8")])
7321 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7323 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7324 (match_operand:SI 2 "const_int_operand" ""))
7325 (match_operand:DI 3 "mask64_operand" ""))
7327 (set (match_operand:DI 0 "gpc_reg_operand" "")
7328 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7329 "TARGET_POWERPC64 && reload_completed
7330 && includes_rldicr_lshift_p (operands[2], operands[3])"
7332 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7335 (compare:CC (match_dup 0)
7339 (define_expand "lshrdi3"
7340 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7341 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7342 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7343 "TARGET_POWERPC64 || TARGET_POWER"
7346 if (TARGET_POWERPC64)
7348 else if (TARGET_POWER)
7350 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7357 (define_insn "*lshrdi3_internal1"
7358 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7359 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7360 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7365 [(set_attr "type" "var_shift_rotate,shift")])
7367 (define_insn "*lshrdi3_internal2"
7368 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7369 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7370 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7372 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7379 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7380 (set_attr "length" "4,4,8,8")])
7383 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7384 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7385 (match_operand:SI 2 "reg_or_cint_operand" ""))
7387 (clobber (match_scratch:DI 3 ""))]
7388 "TARGET_POWERPC64 && reload_completed"
7390 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7392 (compare:CC (match_dup 3)
7396 (define_insn "*lshrdi3_internal3"
7397 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7398 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7399 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7401 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7402 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7409 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7410 (set_attr "length" "4,4,8,8")])
7413 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7414 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7415 (match_operand:SI 2 "reg_or_cint_operand" ""))
7417 (set (match_operand:DI 0 "gpc_reg_operand" "")
7418 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7419 "TARGET_POWERPC64 && reload_completed"
7421 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7423 (compare:CC (match_dup 0)
7427 (define_expand "ashrdi3"
7428 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7429 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7430 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7434 if (TARGET_POWERPC64)
7436 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7438 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7441 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7442 && WORDS_BIG_ENDIAN)
7444 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7451 (define_insn "*ashrdi3_internal1"
7452 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7453 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7454 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7459 [(set_attr "type" "var_shift_rotate,shift")])
7461 (define_insn "*ashrdi3_internal2"
7462 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7463 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7464 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7466 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7473 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7474 (set_attr "length" "4,4,8,8")])
7477 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7478 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7479 (match_operand:SI 2 "reg_or_cint_operand" ""))
7481 (clobber (match_scratch:DI 3 ""))]
7482 "TARGET_POWERPC64 && reload_completed"
7484 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7486 (compare:CC (match_dup 3)
7490 (define_insn "*ashrdi3_internal3"
7491 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7492 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7493 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7495 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7496 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7503 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7504 (set_attr "length" "4,4,8,8")])
7507 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7508 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7509 (match_operand:SI 2 "reg_or_cint_operand" ""))
7511 (set (match_operand:DI 0 "gpc_reg_operand" "")
7512 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7513 "TARGET_POWERPC64 && reload_completed"
7515 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7517 (compare:CC (match_dup 0)
7521 (define_insn "anddi3"
7522 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7523 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7524 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7525 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7529 rldic%B2 %0,%1,0,%S2
7530 rlwinm %0,%1,0,%m2,%M2
7534 [(set_attr "type" "*,*,*,compare,compare,*")
7535 (set_attr "length" "4,4,4,4,4,8")])
7538 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7539 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7540 (match_operand:DI 2 "mask64_2_operand" "")))
7541 (clobber (match_scratch:CC 3 ""))]
7543 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7544 && !mask_operand (operands[2], DImode)
7545 && !mask64_operand (operands[2], DImode)"
7547 (and:DI (rotate:DI (match_dup 1)
7551 (and:DI (rotate:DI (match_dup 0)
7555 build_mask64_2_operands (operands[2], &operands[4]);
7558 (define_insn "*anddi3_internal2"
7559 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7560 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7561 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7563 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7564 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7568 rldic%B2. %3,%1,0,%S2
7569 rlwinm. %3,%1,0,%m2,%M2
7579 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7580 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7583 [(set (match_operand:CC 0 "cc_reg_operand" "")
7584 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7585 (match_operand:DI 2 "mask64_2_operand" ""))
7587 (clobber (match_scratch:DI 3 ""))
7588 (clobber (match_scratch:CC 4 ""))]
7589 "TARGET_64BIT && reload_completed
7590 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7591 && !mask_operand (operands[2], DImode)
7592 && !mask64_operand (operands[2], DImode)"
7594 (and:DI (rotate:DI (match_dup 1)
7597 (parallel [(set (match_dup 0)
7598 (compare:CC (and:DI (rotate:DI (match_dup 3)
7602 (clobber (match_dup 3))])]
7605 build_mask64_2_operands (operands[2], &operands[5]);
7608 (define_insn "*anddi3_internal3"
7609 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7610 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7611 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7613 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7614 (and:DI (match_dup 1) (match_dup 2)))
7615 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7619 rldic%B2. %0,%1,0,%S2
7620 rlwinm. %0,%1,0,%m2,%M2
7630 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7631 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7634 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7635 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7636 (match_operand:DI 2 "and64_2_operand" ""))
7638 (set (match_operand:DI 0 "gpc_reg_operand" "")
7639 (and:DI (match_dup 1) (match_dup 2)))
7640 (clobber (match_scratch:CC 4 ""))]
7641 "TARGET_64BIT && reload_completed"
7642 [(parallel [(set (match_dup 0)
7643 (and:DI (match_dup 1) (match_dup 2)))
7644 (clobber (match_dup 4))])
7646 (compare:CC (match_dup 0)
7651 [(set (match_operand:CC 3 "cc_reg_operand" "")
7652 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7653 (match_operand:DI 2 "mask64_2_operand" ""))
7655 (set (match_operand:DI 0 "gpc_reg_operand" "")
7656 (and:DI (match_dup 1) (match_dup 2)))
7657 (clobber (match_scratch:CC 4 ""))]
7658 "TARGET_64BIT && reload_completed
7659 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7660 && !mask_operand (operands[2], DImode)
7661 && !mask64_operand (operands[2], DImode)"
7663 (and:DI (rotate:DI (match_dup 1)
7666 (parallel [(set (match_dup 3)
7667 (compare:CC (and:DI (rotate:DI (match_dup 0)
7672 (and:DI (rotate:DI (match_dup 0)
7677 build_mask64_2_operands (operands[2], &operands[5]);
7680 (define_expand "iordi3"
7681 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7682 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7683 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7687 if (non_logical_cint_operand (operands[2], DImode))
7689 HOST_WIDE_INT value;
7690 rtx tmp = ((!can_create_pseudo_p ()
7691 || rtx_equal_p (operands[0], operands[1]))
7692 ? operands[0] : gen_reg_rtx (DImode));
7694 if (GET_CODE (operands[2]) == CONST_INT)
7696 value = INTVAL (operands[2]);
7697 emit_insn (gen_iordi3 (tmp, operands[1],
7698 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7702 value = CONST_DOUBLE_LOW (operands[2]);
7703 emit_insn (gen_iordi3 (tmp, operands[1],
7704 immed_double_const (value
7705 & (~ (HOST_WIDE_INT) 0xffff),
7709 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7714 (define_expand "xordi3"
7715 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7716 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7717 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7721 if (non_logical_cint_operand (operands[2], DImode))
7723 HOST_WIDE_INT value;
7724 rtx tmp = ((!can_create_pseudo_p ()
7725 || rtx_equal_p (operands[0], operands[1]))
7726 ? operands[0] : gen_reg_rtx (DImode));
7728 if (GET_CODE (operands[2]) == CONST_INT)
7730 value = INTVAL (operands[2]);
7731 emit_insn (gen_xordi3 (tmp, operands[1],
7732 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7736 value = CONST_DOUBLE_LOW (operands[2]);
7737 emit_insn (gen_xordi3 (tmp, operands[1],
7738 immed_double_const (value
7739 & (~ (HOST_WIDE_INT) 0xffff),
7743 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7748 (define_insn "*booldi3_internal1"
7749 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7750 (match_operator:DI 3 "boolean_or_operator"
7751 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7752 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7759 (define_insn "*booldi3_internal2"
7760 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7761 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7762 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7763 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7765 (clobber (match_scratch:DI 3 "=r,r"))]
7770 [(set_attr "type" "compare")
7771 (set_attr "length" "4,8")])
7774 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7775 (compare:CC (match_operator:DI 4 "boolean_operator"
7776 [(match_operand:DI 1 "gpc_reg_operand" "")
7777 (match_operand:DI 2 "gpc_reg_operand" "")])
7779 (clobber (match_scratch:DI 3 ""))]
7780 "TARGET_POWERPC64 && reload_completed"
7781 [(set (match_dup 3) (match_dup 4))
7783 (compare:CC (match_dup 3)
7787 (define_insn "*booldi3_internal3"
7788 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7789 (compare:CC (match_operator:DI 4 "boolean_operator"
7790 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7791 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7793 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7799 [(set_attr "type" "compare")
7800 (set_attr "length" "4,8")])
7803 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7804 (compare:CC (match_operator:DI 4 "boolean_operator"
7805 [(match_operand:DI 1 "gpc_reg_operand" "")
7806 (match_operand:DI 2 "gpc_reg_operand" "")])
7808 (set (match_operand:DI 0 "gpc_reg_operand" "")
7810 "TARGET_POWERPC64 && reload_completed"
7811 [(set (match_dup 0) (match_dup 4))
7813 (compare:CC (match_dup 0)
7817 ;; Split a logical operation that we can't do in one insn into two insns,
7818 ;; each of which does one 16-bit part. This is used by combine.
7821 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7822 (match_operator:DI 3 "boolean_or_operator"
7823 [(match_operand:DI 1 "gpc_reg_operand" "")
7824 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7826 [(set (match_dup 0) (match_dup 4))
7827 (set (match_dup 0) (match_dup 5))]
7832 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7834 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7835 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7837 i4 = GEN_INT (value & 0xffff);
7841 i3 = GEN_INT (INTVAL (operands[2])
7842 & (~ (HOST_WIDE_INT) 0xffff));
7843 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7845 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7847 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7851 (define_insn "*boolcdi3_internal1"
7852 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7853 (match_operator:DI 3 "boolean_operator"
7854 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7855 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7859 (define_insn "*boolcdi3_internal2"
7860 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7861 (compare:CC (match_operator:DI 4 "boolean_operator"
7862 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7863 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7865 (clobber (match_scratch:DI 3 "=r,r"))]
7870 [(set_attr "type" "compare")
7871 (set_attr "length" "4,8")])
7874 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7875 (compare:CC (match_operator:DI 4 "boolean_operator"
7876 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7877 (match_operand:DI 2 "gpc_reg_operand" "")])
7879 (clobber (match_scratch:DI 3 ""))]
7880 "TARGET_POWERPC64 && reload_completed"
7881 [(set (match_dup 3) (match_dup 4))
7883 (compare:CC (match_dup 3)
7887 (define_insn "*boolcdi3_internal3"
7888 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7889 (compare:CC (match_operator:DI 4 "boolean_operator"
7890 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7891 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7893 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7899 [(set_attr "type" "compare")
7900 (set_attr "length" "4,8")])
7903 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7904 (compare:CC (match_operator:DI 4 "boolean_operator"
7905 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7906 (match_operand:DI 2 "gpc_reg_operand" "")])
7908 (set (match_operand:DI 0 "gpc_reg_operand" "")
7910 "TARGET_POWERPC64 && reload_completed"
7911 [(set (match_dup 0) (match_dup 4))
7913 (compare:CC (match_dup 0)
7917 (define_insn "*boolccdi3_internal1"
7918 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7919 (match_operator:DI 3 "boolean_operator"
7920 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7921 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7925 (define_insn "*boolccdi3_internal2"
7926 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7927 (compare:CC (match_operator:DI 4 "boolean_operator"
7928 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7929 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7931 (clobber (match_scratch:DI 3 "=r,r"))]
7936 [(set_attr "type" "compare")
7937 (set_attr "length" "4,8")])
7940 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7941 (compare:CC (match_operator:DI 4 "boolean_operator"
7942 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7943 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7945 (clobber (match_scratch:DI 3 ""))]
7946 "TARGET_POWERPC64 && reload_completed"
7947 [(set (match_dup 3) (match_dup 4))
7949 (compare:CC (match_dup 3)
7953 (define_insn "*boolccdi3_internal3"
7954 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7955 (compare:CC (match_operator:DI 4 "boolean_operator"
7956 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7957 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7959 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7965 [(set_attr "type" "compare")
7966 (set_attr "length" "4,8")])
7969 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7970 (compare:CC (match_operator:DI 4 "boolean_operator"
7971 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7972 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7974 (set (match_operand:DI 0 "gpc_reg_operand" "")
7976 "TARGET_POWERPC64 && reload_completed"
7977 [(set (match_dup 0) (match_dup 4))
7979 (compare:CC (match_dup 0)
7983 ;; Now define ways of moving data around.
7985 ;; Set up a register with a value from the GOT table
7987 (define_expand "movsi_got"
7988 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7989 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7990 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7991 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7994 if (GET_CODE (operands[1]) == CONST)
7996 rtx offset = const0_rtx;
7997 HOST_WIDE_INT value;
7999 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8000 value = INTVAL (offset);
8003 rtx tmp = (!can_create_pseudo_p ()
8005 : gen_reg_rtx (Pmode));
8006 emit_insn (gen_movsi_got (tmp, operands[1]));
8007 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8012 operands[2] = rs6000_got_register (operands[1]);
8015 (define_insn "*movsi_got_internal"
8016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8017 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8018 (match_operand:SI 2 "gpc_reg_operand" "b")]
8020 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8021 "{l|lwz} %0,%a1@got(%2)"
8022 [(set_attr "type" "load")])
8024 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8025 ;; didn't get allocated to a hard register.
8027 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8028 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8029 (match_operand:SI 2 "memory_operand" "")]
8031 "DEFAULT_ABI == ABI_V4
8033 && (reload_in_progress || reload_completed)"
8034 [(set (match_dup 0) (match_dup 2))
8035 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8039 ;; For SI, we special-case integers that can't be loaded in one insn. We
8040 ;; do the load 16-bits at a time. We could do this by loading from memory,
8041 ;; and this is even supposed to be faster, but it is simpler not to get
8042 ;; integers in the TOC.
8043 (define_insn "movsi_low"
8044 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8045 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8046 (match_operand 2 "" ""))))]
8047 "TARGET_MACHO && ! TARGET_64BIT"
8048 "{l|lwz} %0,lo16(%2)(%1)"
8049 [(set_attr "type" "load")
8050 (set_attr "length" "4")])
8052 (define_insn "*movsi_internal1"
8053 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8054 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8055 "gpc_reg_operand (operands[0], SImode)
8056 || gpc_reg_operand (operands[1], SImode)"
8060 {l%U1%X1|lwz%U1%X1} %0,%1
8061 {st%U0%X0|stw%U0%X0} %1,%0
8071 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8072 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8074 ;; Split a load of a large constant into the appropriate two-insn
8078 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8079 (match_operand:SI 1 "const_int_operand" ""))]
8080 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8081 && (INTVAL (operands[1]) & 0xffff) != 0"
8085 (ior:SI (match_dup 0)
8088 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8090 if (tem == operands[0])
8096 (define_insn "*mov<mode>_internal2"
8097 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8098 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8100 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8103 {cmpi|cmp<wd>i} %2,%0,0
8106 [(set_attr "type" "cmp,compare,cmp")
8107 (set_attr "length" "4,4,8")])
8110 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8111 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8113 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8115 [(set (match_dup 0) (match_dup 1))
8117 (compare:CC (match_dup 0)
8121 (define_insn "*movhi_internal"
8122 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8123 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8124 "gpc_reg_operand (operands[0], HImode)
8125 || gpc_reg_operand (operands[1], HImode)"
8135 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8137 (define_expand "mov<mode>"
8138 [(set (match_operand:INT 0 "general_operand" "")
8139 (match_operand:INT 1 "any_operand" ""))]
8141 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8143 (define_insn "*movqi_internal"
8144 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8145 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8146 "gpc_reg_operand (operands[0], QImode)
8147 || gpc_reg_operand (operands[1], QImode)"
8157 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8159 ;; Here is how to move condition codes around. When we store CC data in
8160 ;; an integer register or memory, we store just the high-order 4 bits.
8161 ;; This lets us not shift in the most common case of CR0.
8162 (define_expand "movcc"
8163 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8164 (match_operand:CC 1 "nonimmediate_operand" ""))]
8168 (define_insn "*movcc_internal1"
8169 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8170 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8171 "register_operand (operands[0], CCmode)
8172 || register_operand (operands[1], CCmode)"
8176 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8179 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8185 {l%U1%X1|lwz%U1%X1} %0,%1
8186 {st%U0%U1|stw%U0%U1} %1,%0"
8188 (cond [(eq_attr "alternative" "0,3")
8189 (const_string "cr_logical")
8190 (eq_attr "alternative" "1,2")
8191 (const_string "mtcr")
8192 (eq_attr "alternative" "6,7,9")
8193 (const_string "integer")
8194 (eq_attr "alternative" "8")
8195 (const_string "mfjmpr")
8196 (eq_attr "alternative" "10")
8197 (const_string "mtjmpr")
8198 (eq_attr "alternative" "11")
8199 (const_string "load")
8200 (eq_attr "alternative" "12")
8201 (const_string "store")
8202 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8203 (const_string "mfcrf")
8205 (const_string "mfcr")))
8206 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8208 ;; For floating-point, we normally deal with the floating-point registers
8209 ;; unless -msoft-float is used. The sole exception is that parameter passing
8210 ;; can produce floating-point values in fixed-point registers. Unless the
8211 ;; value is a simple constant or already in memory, we deal with this by
8212 ;; allocating memory and copying the value explicitly via that memory location.
8213 (define_expand "movsf"
8214 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8215 (match_operand:SF 1 "any_operand" ""))]
8217 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8220 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8221 (match_operand:SF 1 "const_double_operand" ""))]
8223 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8224 || (GET_CODE (operands[0]) == SUBREG
8225 && GET_CODE (SUBREG_REG (operands[0])) == REG
8226 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8227 [(set (match_dup 2) (match_dup 3))]
8233 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8234 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8236 if (! TARGET_POWERPC64)
8237 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8239 operands[2] = gen_lowpart (SImode, operands[0]);
8241 operands[3] = gen_int_mode (l, SImode);
8244 (define_insn "*movsf_hardfloat"
8245 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8246 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8247 "(gpc_reg_operand (operands[0], SFmode)
8248 || gpc_reg_operand (operands[1], SFmode))
8249 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8252 {l%U1%X1|lwz%U1%X1} %0,%1
8253 {st%U0%X0|stw%U0%X0} %1,%0
8263 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8264 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8266 (define_insn "*movsf_softfloat"
8267 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8268 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8269 "(gpc_reg_operand (operands[0], SFmode)
8270 || gpc_reg_operand (operands[1], SFmode))
8271 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8277 {l%U1%X1|lwz%U1%X1} %0,%1
8278 {st%U0%X0|stw%U0%X0} %1,%0
8285 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8286 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8289 (define_expand "movdf"
8290 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8291 (match_operand:DF 1 "any_operand" ""))]
8293 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8296 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8297 (match_operand:DF 1 "const_int_operand" ""))]
8298 "! TARGET_POWERPC64 && reload_completed
8299 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8300 || (GET_CODE (operands[0]) == SUBREG
8301 && GET_CODE (SUBREG_REG (operands[0])) == REG
8302 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8303 [(set (match_dup 2) (match_dup 4))
8304 (set (match_dup 3) (match_dup 1))]
8307 int endian = (WORDS_BIG_ENDIAN == 0);
8308 HOST_WIDE_INT value = INTVAL (operands[1]);
8310 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8311 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8312 #if HOST_BITS_PER_WIDE_INT == 32
8313 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8315 operands[4] = GEN_INT (value >> 32);
8316 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8321 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8322 (match_operand:DF 1 "const_double_operand" ""))]
8323 "! TARGET_POWERPC64 && reload_completed
8324 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8325 || (GET_CODE (operands[0]) == SUBREG
8326 && GET_CODE (SUBREG_REG (operands[0])) == REG
8327 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8328 [(set (match_dup 2) (match_dup 4))
8329 (set (match_dup 3) (match_dup 5))]
8332 int endian = (WORDS_BIG_ENDIAN == 0);
8336 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8337 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8339 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8340 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8341 operands[4] = gen_int_mode (l[endian], SImode);
8342 operands[5] = gen_int_mode (l[1 - endian], SImode);
8346 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8347 (match_operand:DF 1 "const_double_operand" ""))]
8348 "TARGET_POWERPC64 && reload_completed
8349 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8350 || (GET_CODE (operands[0]) == SUBREG
8351 && GET_CODE (SUBREG_REG (operands[0])) == REG
8352 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8353 [(set (match_dup 2) (match_dup 3))]
8356 int endian = (WORDS_BIG_ENDIAN == 0);
8359 #if HOST_BITS_PER_WIDE_INT >= 64
8363 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8364 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8366 operands[2] = gen_lowpart (DImode, operands[0]);
8367 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8368 #if HOST_BITS_PER_WIDE_INT >= 64
8369 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8370 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8372 operands[3] = gen_int_mode (val, DImode);
8374 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8378 ;; Don't have reload use general registers to load a constant. First,
8379 ;; it might not work if the output operand is the equivalent of
8380 ;; a non-offsettable memref, but also it is less efficient than loading
8381 ;; the constant into an FP register, since it will probably be used there.
8382 ;; The "??" is a kludge until we can figure out a more reasonable way
8383 ;; of handling these non-offsettable values.
8384 (define_insn "*movdf_hardfloat32"
8385 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8386 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8387 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8388 && (gpc_reg_operand (operands[0], DFmode)
8389 || gpc_reg_operand (operands[1], DFmode))"
8392 switch (which_alternative)
8397 /* We normally copy the low-numbered register first. However, if
8398 the first register operand 0 is the same as the second register
8399 of operand 1, we must copy in the opposite order. */
8400 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8401 return \"mr %L0,%L1\;mr %0,%1\";
8403 return \"mr %0,%1\;mr %L0,%L1\";
8405 if (rs6000_offsettable_memref_p (operands[1])
8406 || (GET_CODE (operands[1]) == MEM
8407 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8408 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8409 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC
8410 || GET_CODE (XEXP (operands[1], 0)) == PRE_MODIFY)))
8412 /* If the low-address word is used in the address, we must load
8413 it last. Otherwise, load it first. Note that we cannot have
8414 auto-increment in that case since the address register is
8415 known to be dead. */
8416 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8418 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8420 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8426 addreg = find_addr_reg (XEXP (operands[1], 0));
8427 if (refers_to_regno_p (REGNO (operands[0]),
8428 REGNO (operands[0]) + 1,
8431 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8432 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8433 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8434 return \"{l%X1|lwz%X1} %0,%1\";
8438 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
8439 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8440 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8441 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8446 if (rs6000_offsettable_memref_p (operands[0])
8447 || (GET_CODE (operands[0]) == MEM
8448 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8449 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8450 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
8451 || GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)))
8452 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8457 addreg = find_addr_reg (XEXP (operands[0], 0));
8458 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
8459 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8460 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
8461 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8465 return \"fmr %0,%1\";
8467 return \"lfd%U1%X1 %0,%1\";
8469 return \"stfd%U0%X0 %1,%0\";
8476 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8477 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8479 (define_insn "*movdf_softfloat32"
8480 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8481 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8483 && ((TARGET_FPRS && !TARGET_DOUBLE_FLOAT)
8484 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8485 && (gpc_reg_operand (operands[0], DFmode)
8486 || gpc_reg_operand (operands[1], DFmode))"
8489 switch (which_alternative)
8494 /* We normally copy the low-numbered register first. However, if
8495 the first register operand 0 is the same as the second register of
8496 operand 1, we must copy in the opposite order. */
8497 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8498 return \"mr %L0,%L1\;mr %0,%1\";
8500 return \"mr %0,%1\;mr %L0,%L1\";
8502 /* If the low-address word is used in the address, we must load
8503 it last. Otherwise, load it first. Note that we cannot have
8504 auto-increment in that case since the address register is
8505 known to be dead. */
8506 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8508 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8510 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8512 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8519 [(set_attr "type" "two,load,store,*,*,*")
8520 (set_attr "length" "8,8,8,8,12,16")])
8522 ; ld/std require word-aligned displacements -> 'Y' constraint.
8523 ; List Y->r and r->Y before r->r for reload.
8524 (define_insn "*movdf_hardfloat64_mfpgpr"
8525 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
8526 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
8527 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8528 && TARGET_DOUBLE_FLOAT
8529 && (gpc_reg_operand (operands[0], DFmode)
8530 || gpc_reg_operand (operands[1], DFmode))"
8546 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8547 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8549 ; ld/std require word-aligned displacements -> 'Y' constraint.
8550 ; List Y->r and r->Y before r->r for reload.
8551 (define_insn "*movdf_hardfloat64"
8552 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8553 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8554 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8555 && TARGET_DOUBLE_FLOAT
8556 && (gpc_reg_operand (operands[0], DFmode)
8557 || gpc_reg_operand (operands[1], DFmode))"
8571 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8572 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8574 (define_insn "*movdf_softfloat64"
8575 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8576 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8577 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8578 && (gpc_reg_operand (operands[0], DFmode)
8579 || gpc_reg_operand (operands[1], DFmode))"
8590 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8591 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8593 (define_expand "movtf"
8594 [(set (match_operand:TF 0 "general_operand" "")
8595 (match_operand:TF 1 "any_operand" ""))]
8596 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8597 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8599 ; It's important to list the o->f and f->o moves before f->f because
8600 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8601 ; which doesn't make progress. Likewise r->Y must be before r->r.
8602 (define_insn_and_split "*movtf_internal"
8603 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8604 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8606 && TARGET_HARD_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" "8,8,8,20,20,16")])
8615 (define_insn_and_split "*movtf_softfloat"
8616 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
8617 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
8619 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8620 && (gpc_reg_operand (operands[0], TFmode)
8621 || gpc_reg_operand (operands[1], TFmode))"
8623 "&& reload_completed"
8625 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8626 [(set_attr "length" "20,20,16")])
8628 (define_expand "extenddftf2"
8629 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8630 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8632 && TARGET_HARD_FLOAT
8633 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8634 && TARGET_LONG_DOUBLE_128"
8636 if (TARGET_E500_DOUBLE)
8637 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8639 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8643 (define_expand "extenddftf2_fprs"
8644 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8645 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8646 (use (match_dup 2))])]
8648 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8649 && TARGET_LONG_DOUBLE_128"
8651 operands[2] = CONST0_RTX (DFmode);
8652 /* Generate GOT reference early for SVR4 PIC. */
8653 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8654 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8657 (define_insn_and_split "*extenddftf2_internal"
8658 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8659 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8660 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8662 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8663 && TARGET_LONG_DOUBLE_128"
8665 "&& reload_completed"
8668 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8669 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8670 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8672 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8677 (define_expand "extendsftf2"
8678 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8679 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8681 && TARGET_HARD_FLOAT
8682 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8683 && TARGET_LONG_DOUBLE_128"
8685 rtx tmp = gen_reg_rtx (DFmode);
8686 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8687 emit_insn (gen_extenddftf2 (operands[0], tmp));
8691 (define_expand "trunctfdf2"
8692 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8693 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8695 && TARGET_HARD_FLOAT
8696 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8697 && TARGET_LONG_DOUBLE_128"
8700 (define_insn_and_split "trunctfdf2_internal1"
8701 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8702 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8703 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8704 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8708 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8711 emit_note (NOTE_INSN_DELETED);
8714 [(set_attr "type" "fp")])
8716 (define_insn "trunctfdf2_internal2"
8717 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8718 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8719 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8720 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8721 && TARGET_LONG_DOUBLE_128"
8723 [(set_attr "type" "fp")])
8725 (define_expand "trunctfsf2"
8726 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8727 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8729 && TARGET_HARD_FLOAT
8730 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8731 && TARGET_LONG_DOUBLE_128"
8733 if (TARGET_E500_DOUBLE)
8734 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8736 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8740 (define_insn_and_split "trunctfsf2_fprs"
8741 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8742 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8743 (clobber (match_scratch:DF 2 "=f"))]
8745 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
8746 && TARGET_LONG_DOUBLE_128"
8748 "&& reload_completed"
8750 (float_truncate:DF (match_dup 1)))
8752 (float_truncate:SF (match_dup 2)))]
8755 (define_expand "floatsitf2"
8756 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8757 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8759 && TARGET_HARD_FLOAT
8760 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8761 && TARGET_LONG_DOUBLE_128"
8763 rtx tmp = gen_reg_rtx (DFmode);
8764 expand_float (tmp, operands[1], false);
8765 emit_insn (gen_extenddftf2 (operands[0], tmp));
8769 ; fadd, but rounding towards zero.
8770 ; This is probably not the optimal code sequence.
8771 (define_insn "fix_trunc_helper"
8772 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8773 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8774 UNSPEC_FIX_TRUNC_TF))
8775 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8776 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
8777 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8778 [(set_attr "type" "fp")
8779 (set_attr "length" "20")])
8781 (define_expand "fix_trunctfsi2"
8782 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8783 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8785 && (TARGET_POWER2 || TARGET_POWERPC)
8786 && TARGET_HARD_FLOAT
8787 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8788 && TARGET_LONG_DOUBLE_128"
8790 if (TARGET_E500_DOUBLE)
8791 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8793 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8797 (define_expand "fix_trunctfsi2_fprs"
8798 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8799 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8800 (clobber (match_dup 2))
8801 (clobber (match_dup 3))
8802 (clobber (match_dup 4))
8803 (clobber (match_dup 5))])]
8805 && (TARGET_POWER2 || TARGET_POWERPC)
8806 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8808 operands[2] = gen_reg_rtx (DFmode);
8809 operands[3] = gen_reg_rtx (DFmode);
8810 operands[4] = gen_reg_rtx (DImode);
8811 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8814 (define_insn_and_split "*fix_trunctfsi2_internal"
8815 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8816 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8817 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8818 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8819 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8820 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
8822 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8824 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[5]))"
8828 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8830 gcc_assert (MEM_P (operands[5]));
8831 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8833 emit_insn (gen_fctiwz (operands[4], operands[2]));
8834 emit_move_insn (operands[5], operands[4]);
8835 emit_move_insn (operands[0], lowword);
8839 (define_expand "negtf2"
8840 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8841 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8843 && TARGET_HARD_FLOAT
8844 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8845 && TARGET_LONG_DOUBLE_128"
8848 (define_insn "negtf2_internal"
8849 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8850 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8852 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8855 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8856 return \"fneg %L0,%L1\;fneg %0,%1\";
8858 return \"fneg %0,%1\;fneg %L0,%L1\";
8860 [(set_attr "type" "fp")
8861 (set_attr "length" "8")])
8863 (define_expand "abstf2"
8864 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8865 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8867 && TARGET_HARD_FLOAT
8868 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8869 && TARGET_LONG_DOUBLE_128"
8872 rtx label = gen_label_rtx ();
8873 if (TARGET_E500_DOUBLE)
8875 if (flag_unsafe_math_optimizations)
8876 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8878 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8881 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8886 (define_expand "abstf2_internal"
8887 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8888 (match_operand:TF 1 "gpc_reg_operand" ""))
8889 (set (match_dup 3) (match_dup 5))
8890 (set (match_dup 5) (abs:DF (match_dup 5)))
8891 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8892 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8893 (label_ref (match_operand 2 "" ""))
8895 (set (match_dup 6) (neg:DF (match_dup 6)))]
8897 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8898 && TARGET_LONG_DOUBLE_128"
8901 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8902 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8903 operands[3] = gen_reg_rtx (DFmode);
8904 operands[4] = gen_reg_rtx (CCFPmode);
8905 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8906 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8909 ;; Next come the multi-word integer load and store and the load and store
8912 ; List r->r after r->"o<>", otherwise reload will try to reload a
8913 ; non-offsettable address by using r->r which won't make progress.
8914 (define_insn "*movdi_internal32"
8915 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8916 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8918 && (gpc_reg_operand (operands[0], DImode)
8919 || gpc_reg_operand (operands[1], DImode))"
8928 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8931 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8932 (match_operand:DI 1 "const_int_operand" ""))]
8933 "! TARGET_POWERPC64 && reload_completed"
8934 [(set (match_dup 2) (match_dup 4))
8935 (set (match_dup 3) (match_dup 1))]
8938 HOST_WIDE_INT value = INTVAL (operands[1]);
8939 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8941 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8943 #if HOST_BITS_PER_WIDE_INT == 32
8944 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8946 operands[4] = GEN_INT (value >> 32);
8947 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8952 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
8953 (match_operand:DI 1 "input_operand" ""))]
8954 "reload_completed && !TARGET_POWERPC64
8955 && gpr_or_gpr_p (operands[0], operands[1])"
8957 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8959 (define_insn "*movdi_mfpgpr"
8960 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
8961 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
8962 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8963 && (gpc_reg_operand (operands[0], DImode)
8964 || gpc_reg_operand (operands[1], DImode))"
8981 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8982 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
8984 (define_insn "*movdi_internal64"
8985 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8986 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8987 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
8988 && (gpc_reg_operand (operands[0], DImode)
8989 || gpc_reg_operand (operands[1], DImode))"
9004 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9005 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9007 ;; immediate value valid for a single instruction hiding in a const_double
9009 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9010 (match_operand:DI 1 "const_double_operand" "F"))]
9011 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9012 && GET_CODE (operands[1]) == CONST_DOUBLE
9013 && num_insns_constant (operands[1], DImode) == 1"
9016 return ((unsigned HOST_WIDE_INT)
9017 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9018 ? \"li %0,%1\" : \"lis %0,%v1\";
9021 ;; Generate all one-bits and clear left or right.
9022 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9024 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9025 (match_operand:DI 1 "mask64_operand" ""))]
9026 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9027 [(set (match_dup 0) (const_int -1))
9029 (and:DI (rotate:DI (match_dup 0)
9034 ;; Split a load of a large constant into the appropriate five-instruction
9035 ;; sequence. Handle anything in a constant number of insns.
9036 ;; When non-easy constants can go in the TOC, this should use
9037 ;; easy_fp_constant predicate.
9039 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9040 (match_operand:DI 1 "const_int_operand" ""))]
9041 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9042 [(set (match_dup 0) (match_dup 2))
9043 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9045 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9047 if (tem == operands[0])
9054 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9055 (match_operand:DI 1 "const_double_operand" ""))]
9056 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9057 [(set (match_dup 0) (match_dup 2))
9058 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9060 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9062 if (tem == operands[0])
9068 ;; TImode is similar, except that we usually want to compute the address into
9069 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9070 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9072 ;; We say that MQ is clobbered in the last alternative because the first
9073 ;; alternative would never get used otherwise since it would need a reload
9074 ;; while the 2nd alternative would not. We put memory cases first so they
9075 ;; are preferred. Otherwise, we'd try to reload the output instead of
9076 ;; giving the SCRATCH mq.
9078 (define_insn "*movti_power"
9079 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9080 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9081 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9082 "TARGET_POWER && ! TARGET_POWERPC64
9083 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9086 switch (which_alternative)
9093 return \"{stsi|stswi} %1,%P0,16\";
9098 /* If the address is not used in the output, we can use lsi. Otherwise,
9099 fall through to generating four loads. */
9101 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9102 return \"{lsi|lswi} %0,%P1,16\";
9103 /* ... fall through ... */
9109 [(set_attr "type" "store,store,*,load,load,*")])
9111 (define_insn "*movti_string"
9112 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9113 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9114 "! TARGET_POWER && ! TARGET_POWERPC64
9115 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9118 switch (which_alternative)
9124 return \"{stsi|stswi} %1,%P0,16\";
9129 /* If the address is not used in the output, we can use lsi. Otherwise,
9130 fall through to generating four loads. */
9132 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9133 return \"{lsi|lswi} %0,%P1,16\";
9134 /* ... fall through ... */
9140 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
9142 (define_insn "*movti_ppc64"
9143 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9144 (match_operand:TI 1 "input_operand" "r,r,m"))]
9145 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9146 || gpc_reg_operand (operands[1], TImode))"
9148 [(set_attr "type" "*,load,store")])
9151 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9152 (match_operand:TI 1 "const_double_operand" ""))]
9154 [(set (match_dup 2) (match_dup 4))
9155 (set (match_dup 3) (match_dup 5))]
9158 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9160 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9162 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9164 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9165 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9167 else if (GET_CODE (operands[1]) == CONST_INT)
9169 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9170 operands[5] = operands[1];
9177 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9178 (match_operand:TI 1 "input_operand" ""))]
9180 && gpr_or_gpr_p (operands[0], operands[1])"
9182 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9184 (define_expand "load_multiple"
9185 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9186 (match_operand:SI 1 "" ""))
9187 (use (match_operand:SI 2 "" ""))])]
9188 "TARGET_STRING && !TARGET_POWERPC64"
9196 /* Support only loading a constant number of fixed-point registers from
9197 memory and only bother with this if more than two; the machine
9198 doesn't support more than eight. */
9199 if (GET_CODE (operands[2]) != CONST_INT
9200 || INTVAL (operands[2]) <= 2
9201 || INTVAL (operands[2]) > 8
9202 || GET_CODE (operands[1]) != MEM
9203 || GET_CODE (operands[0]) != REG
9204 || REGNO (operands[0]) >= 32)
9207 count = INTVAL (operands[2]);
9208 regno = REGNO (operands[0]);
9210 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9211 op1 = replace_equiv_address (operands[1],
9212 force_reg (SImode, XEXP (operands[1], 0)));
9214 for (i = 0; i < count; i++)
9215 XVECEXP (operands[3], 0, i)
9216 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9217 adjust_address_nv (op1, SImode, i * 4));
9220 (define_insn "*ldmsi8"
9221 [(match_parallel 0 "load_multiple_operation"
9222 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9223 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9224 (set (match_operand:SI 3 "gpc_reg_operand" "")
9225 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9226 (set (match_operand:SI 4 "gpc_reg_operand" "")
9227 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9228 (set (match_operand:SI 5 "gpc_reg_operand" "")
9229 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9230 (set (match_operand:SI 6 "gpc_reg_operand" "")
9231 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9232 (set (match_operand:SI 7 "gpc_reg_operand" "")
9233 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9234 (set (match_operand:SI 8 "gpc_reg_operand" "")
9235 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9236 (set (match_operand:SI 9 "gpc_reg_operand" "")
9237 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9238 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9240 { return rs6000_output_load_multiple (operands); }"
9241 [(set_attr "type" "load_ux")
9242 (set_attr "length" "32")])
9244 (define_insn "*ldmsi7"
9245 [(match_parallel 0 "load_multiple_operation"
9246 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9247 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9248 (set (match_operand:SI 3 "gpc_reg_operand" "")
9249 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9250 (set (match_operand:SI 4 "gpc_reg_operand" "")
9251 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9252 (set (match_operand:SI 5 "gpc_reg_operand" "")
9253 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9254 (set (match_operand:SI 6 "gpc_reg_operand" "")
9255 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9256 (set (match_operand:SI 7 "gpc_reg_operand" "")
9257 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9258 (set (match_operand:SI 8 "gpc_reg_operand" "")
9259 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9260 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9262 { return rs6000_output_load_multiple (operands); }"
9263 [(set_attr "type" "load_ux")
9264 (set_attr "length" "32")])
9266 (define_insn "*ldmsi6"
9267 [(match_parallel 0 "load_multiple_operation"
9268 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9269 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9270 (set (match_operand:SI 3 "gpc_reg_operand" "")
9271 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9272 (set (match_operand:SI 4 "gpc_reg_operand" "")
9273 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9274 (set (match_operand:SI 5 "gpc_reg_operand" "")
9275 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9276 (set (match_operand:SI 6 "gpc_reg_operand" "")
9277 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9278 (set (match_operand:SI 7 "gpc_reg_operand" "")
9279 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9280 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9282 { return rs6000_output_load_multiple (operands); }"
9283 [(set_attr "type" "load_ux")
9284 (set_attr "length" "32")])
9286 (define_insn "*ldmsi5"
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 (set (match_operand:SI 6 "gpc_reg_operand" "")
9297 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9298 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9300 { return rs6000_output_load_multiple (operands); }"
9301 [(set_attr "type" "load_ux")
9302 (set_attr "length" "32")])
9304 (define_insn "*ldmsi4"
9305 [(match_parallel 0 "load_multiple_operation"
9306 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9307 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9308 (set (match_operand:SI 3 "gpc_reg_operand" "")
9309 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9310 (set (match_operand:SI 4 "gpc_reg_operand" "")
9311 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9312 (set (match_operand:SI 5 "gpc_reg_operand" "")
9313 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9314 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9316 { return rs6000_output_load_multiple (operands); }"
9317 [(set_attr "type" "load_ux")
9318 (set_attr "length" "32")])
9320 (define_insn "*ldmsi3"
9321 [(match_parallel 0 "load_multiple_operation"
9322 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9323 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9324 (set (match_operand:SI 3 "gpc_reg_operand" "")
9325 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9326 (set (match_operand:SI 4 "gpc_reg_operand" "")
9327 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9328 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9330 { return rs6000_output_load_multiple (operands); }"
9331 [(set_attr "type" "load_ux")
9332 (set_attr "length" "32")])
9334 (define_expand "store_multiple"
9335 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9336 (match_operand:SI 1 "" ""))
9337 (clobber (scratch:SI))
9338 (use (match_operand:SI 2 "" ""))])]
9339 "TARGET_STRING && !TARGET_POWERPC64"
9348 /* Support only storing a constant number of fixed-point registers to
9349 memory and only bother with this if more than two; the machine
9350 doesn't support more than eight. */
9351 if (GET_CODE (operands[2]) != CONST_INT
9352 || INTVAL (operands[2]) <= 2
9353 || INTVAL (operands[2]) > 8
9354 || GET_CODE (operands[0]) != MEM
9355 || GET_CODE (operands[1]) != REG
9356 || REGNO (operands[1]) >= 32)
9359 count = INTVAL (operands[2]);
9360 regno = REGNO (operands[1]);
9362 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9363 to = force_reg (SImode, XEXP (operands[0], 0));
9364 op0 = replace_equiv_address (operands[0], to);
9366 XVECEXP (operands[3], 0, 0)
9367 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9368 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9369 gen_rtx_SCRATCH (SImode));
9371 for (i = 1; i < count; i++)
9372 XVECEXP (operands[3], 0, i + 1)
9373 = gen_rtx_SET (VOIDmode,
9374 adjust_address_nv (op0, SImode, i * 4),
9375 gen_rtx_REG (SImode, regno + i));
9378 (define_insn "*stmsi8"
9379 [(match_parallel 0 "store_multiple_operation"
9380 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9381 (match_operand:SI 2 "gpc_reg_operand" "r"))
9382 (clobber (match_scratch:SI 3 "=X"))
9383 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9384 (match_operand:SI 4 "gpc_reg_operand" "r"))
9385 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9386 (match_operand:SI 5 "gpc_reg_operand" "r"))
9387 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9388 (match_operand:SI 6 "gpc_reg_operand" "r"))
9389 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9390 (match_operand:SI 7 "gpc_reg_operand" "r"))
9391 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9392 (match_operand:SI 8 "gpc_reg_operand" "r"))
9393 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9394 (match_operand:SI 9 "gpc_reg_operand" "r"))
9395 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9396 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9397 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9398 "{stsi|stswi} %2,%1,%O0"
9399 [(set_attr "type" "store_ux")])
9401 (define_insn "*stmsi7"
9402 [(match_parallel 0 "store_multiple_operation"
9403 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9404 (match_operand:SI 2 "gpc_reg_operand" "r"))
9405 (clobber (match_scratch:SI 3 "=X"))
9406 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9407 (match_operand:SI 4 "gpc_reg_operand" "r"))
9408 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9409 (match_operand:SI 5 "gpc_reg_operand" "r"))
9410 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9411 (match_operand:SI 6 "gpc_reg_operand" "r"))
9412 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9413 (match_operand:SI 7 "gpc_reg_operand" "r"))
9414 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9415 (match_operand:SI 8 "gpc_reg_operand" "r"))
9416 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9417 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9418 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9419 "{stsi|stswi} %2,%1,%O0"
9420 [(set_attr "type" "store_ux")])
9422 (define_insn "*stmsi6"
9423 [(match_parallel 0 "store_multiple_operation"
9424 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9425 (match_operand:SI 2 "gpc_reg_operand" "r"))
9426 (clobber (match_scratch:SI 3 "=X"))
9427 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9428 (match_operand:SI 4 "gpc_reg_operand" "r"))
9429 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9430 (match_operand:SI 5 "gpc_reg_operand" "r"))
9431 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9432 (match_operand:SI 6 "gpc_reg_operand" "r"))
9433 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9434 (match_operand:SI 7 "gpc_reg_operand" "r"))
9435 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9436 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9437 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9438 "{stsi|stswi} %2,%1,%O0"
9439 [(set_attr "type" "store_ux")])
9441 (define_insn "*stmsi5"
9442 [(match_parallel 0 "store_multiple_operation"
9443 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9444 (match_operand:SI 2 "gpc_reg_operand" "r"))
9445 (clobber (match_scratch:SI 3 "=X"))
9446 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9447 (match_operand:SI 4 "gpc_reg_operand" "r"))
9448 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9449 (match_operand:SI 5 "gpc_reg_operand" "r"))
9450 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9451 (match_operand:SI 6 "gpc_reg_operand" "r"))
9452 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9453 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9454 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9455 "{stsi|stswi} %2,%1,%O0"
9456 [(set_attr "type" "store_ux")])
9458 (define_insn "*stmsi4"
9459 [(match_parallel 0 "store_multiple_operation"
9460 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9461 (match_operand:SI 2 "gpc_reg_operand" "r"))
9462 (clobber (match_scratch:SI 3 "=X"))
9463 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9464 (match_operand:SI 4 "gpc_reg_operand" "r"))
9465 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9466 (match_operand:SI 5 "gpc_reg_operand" "r"))
9467 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9468 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9469 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9470 "{stsi|stswi} %2,%1,%O0"
9471 [(set_attr "type" "store_ux")])
9473 (define_insn "*stmsi3"
9474 [(match_parallel 0 "store_multiple_operation"
9475 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9476 (match_operand:SI 2 "gpc_reg_operand" "r"))
9477 (clobber (match_scratch:SI 3 "=X"))
9478 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9479 (match_operand:SI 4 "gpc_reg_operand" "r"))
9480 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9481 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9482 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9483 "{stsi|stswi} %2,%1,%O0"
9484 [(set_attr "type" "store_ux")])
9486 (define_insn "*stmsi8_power"
9487 [(match_parallel 0 "store_multiple_operation"
9488 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9489 (match_operand:SI 2 "gpc_reg_operand" "r"))
9490 (clobber (match_scratch:SI 3 "=q"))
9491 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9492 (match_operand:SI 4 "gpc_reg_operand" "r"))
9493 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9494 (match_operand:SI 5 "gpc_reg_operand" "r"))
9495 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9496 (match_operand:SI 6 "gpc_reg_operand" "r"))
9497 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9498 (match_operand:SI 7 "gpc_reg_operand" "r"))
9499 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9500 (match_operand:SI 8 "gpc_reg_operand" "r"))
9501 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9502 (match_operand:SI 9 "gpc_reg_operand" "r"))
9503 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9504 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9505 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9506 "{stsi|stswi} %2,%1,%O0"
9507 [(set_attr "type" "store_ux")])
9509 (define_insn "*stmsi7_power"
9510 [(match_parallel 0 "store_multiple_operation"
9511 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9512 (match_operand:SI 2 "gpc_reg_operand" "r"))
9513 (clobber (match_scratch:SI 3 "=q"))
9514 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9515 (match_operand:SI 4 "gpc_reg_operand" "r"))
9516 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9517 (match_operand:SI 5 "gpc_reg_operand" "r"))
9518 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9519 (match_operand:SI 6 "gpc_reg_operand" "r"))
9520 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9521 (match_operand:SI 7 "gpc_reg_operand" "r"))
9522 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9523 (match_operand:SI 8 "gpc_reg_operand" "r"))
9524 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9525 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9526 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9527 "{stsi|stswi} %2,%1,%O0"
9528 [(set_attr "type" "store_ux")])
9530 (define_insn "*stmsi6_power"
9531 [(match_parallel 0 "store_multiple_operation"
9532 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9533 (match_operand:SI 2 "gpc_reg_operand" "r"))
9534 (clobber (match_scratch:SI 3 "=q"))
9535 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9536 (match_operand:SI 4 "gpc_reg_operand" "r"))
9537 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9538 (match_operand:SI 5 "gpc_reg_operand" "r"))
9539 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9540 (match_operand:SI 6 "gpc_reg_operand" "r"))
9541 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9542 (match_operand:SI 7 "gpc_reg_operand" "r"))
9543 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9544 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9545 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9546 "{stsi|stswi} %2,%1,%O0"
9547 [(set_attr "type" "store_ux")])
9549 (define_insn "*stmsi5_power"
9550 [(match_parallel 0 "store_multiple_operation"
9551 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9552 (match_operand:SI 2 "gpc_reg_operand" "r"))
9553 (clobber (match_scratch:SI 3 "=q"))
9554 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9555 (match_operand:SI 4 "gpc_reg_operand" "r"))
9556 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9557 (match_operand:SI 5 "gpc_reg_operand" "r"))
9558 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9559 (match_operand:SI 6 "gpc_reg_operand" "r"))
9560 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9561 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9562 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9563 "{stsi|stswi} %2,%1,%O0"
9564 [(set_attr "type" "store_ux")])
9566 (define_insn "*stmsi4_power"
9567 [(match_parallel 0 "store_multiple_operation"
9568 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9569 (match_operand:SI 2 "gpc_reg_operand" "r"))
9570 (clobber (match_scratch:SI 3 "=q"))
9571 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9572 (match_operand:SI 4 "gpc_reg_operand" "r"))
9573 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9574 (match_operand:SI 5 "gpc_reg_operand" "r"))
9575 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9576 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9577 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9578 "{stsi|stswi} %2,%1,%O0"
9579 [(set_attr "type" "store_ux")])
9581 (define_insn "*stmsi3_power"
9582 [(match_parallel 0 "store_multiple_operation"
9583 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9584 (match_operand:SI 2 "gpc_reg_operand" "r"))
9585 (clobber (match_scratch:SI 3 "=q"))
9586 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9587 (match_operand:SI 4 "gpc_reg_operand" "r"))
9588 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9589 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9590 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9591 "{stsi|stswi} %2,%1,%O0"
9592 [(set_attr "type" "store_ux")])
9594 (define_expand "setmemsi"
9595 [(parallel [(set (match_operand:BLK 0 "" "")
9596 (match_operand 2 "const_int_operand" ""))
9597 (use (match_operand:SI 1 "" ""))
9598 (use (match_operand:SI 3 "" ""))])]
9602 /* If value to set is not zero, use the library routine. */
9603 if (operands[2] != const0_rtx)
9606 if (expand_block_clear (operands))
9612 ;; String/block move insn.
9613 ;; Argument 0 is the destination
9614 ;; Argument 1 is the source
9615 ;; Argument 2 is the length
9616 ;; Argument 3 is the alignment
9618 (define_expand "movmemsi"
9619 [(parallel [(set (match_operand:BLK 0 "" "")
9620 (match_operand:BLK 1 "" ""))
9621 (use (match_operand:SI 2 "" ""))
9622 (use (match_operand:SI 3 "" ""))])]
9626 if (expand_block_move (operands))
9632 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9633 ;; register allocator doesn't have a clue about allocating 8 word registers.
9634 ;; rD/rS = r5 is preferred, efficient form.
9635 (define_expand "movmemsi_8reg"
9636 [(parallel [(set (match_operand 0 "" "")
9637 (match_operand 1 "" ""))
9638 (use (match_operand 2 "" ""))
9639 (use (match_operand 3 "" ""))
9640 (clobber (reg:SI 5))
9641 (clobber (reg:SI 6))
9642 (clobber (reg:SI 7))
9643 (clobber (reg:SI 8))
9644 (clobber (reg:SI 9))
9645 (clobber (reg:SI 10))
9646 (clobber (reg:SI 11))
9647 (clobber (reg:SI 12))
9648 (clobber (match_scratch:SI 4 ""))])]
9653 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9654 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9655 (use (match_operand:SI 2 "immediate_operand" "i"))
9656 (use (match_operand:SI 3 "immediate_operand" "i"))
9657 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9658 (clobber (reg:SI 6))
9659 (clobber (reg:SI 7))
9660 (clobber (reg:SI 8))
9661 (clobber (reg:SI 9))
9662 (clobber (reg:SI 10))
9663 (clobber (reg:SI 11))
9664 (clobber (reg:SI 12))
9665 (clobber (match_scratch:SI 5 "=q"))]
9666 "TARGET_STRING && TARGET_POWER
9667 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9668 || INTVAL (operands[2]) == 0)
9669 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9670 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9671 && REGNO (operands[4]) == 5"
9672 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9673 [(set_attr "type" "store_ux")
9674 (set_attr "length" "8")])
9677 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9678 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9679 (use (match_operand:SI 2 "immediate_operand" "i"))
9680 (use (match_operand:SI 3 "immediate_operand" "i"))
9681 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9682 (clobber (reg:SI 6))
9683 (clobber (reg:SI 7))
9684 (clobber (reg:SI 8))
9685 (clobber (reg:SI 9))
9686 (clobber (reg:SI 10))
9687 (clobber (reg:SI 11))
9688 (clobber (reg:SI 12))
9689 (clobber (match_scratch:SI 5 "=X"))]
9690 "TARGET_STRING && ! TARGET_POWER
9691 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9692 || INTVAL (operands[2]) == 0)
9693 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9694 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9695 && REGNO (operands[4]) == 5"
9696 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9697 [(set_attr "type" "store_ux")
9698 (set_attr "length" "8")])
9700 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9701 ;; register allocator doesn't have a clue about allocating 6 word registers.
9702 ;; rD/rS = r5 is preferred, efficient form.
9703 (define_expand "movmemsi_6reg"
9704 [(parallel [(set (match_operand 0 "" "")
9705 (match_operand 1 "" ""))
9706 (use (match_operand 2 "" ""))
9707 (use (match_operand 3 "" ""))
9708 (clobber (reg:SI 5))
9709 (clobber (reg:SI 6))
9710 (clobber (reg:SI 7))
9711 (clobber (reg:SI 8))
9712 (clobber (reg:SI 9))
9713 (clobber (reg:SI 10))
9714 (clobber (match_scratch:SI 4 ""))])]
9719 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9720 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9721 (use (match_operand:SI 2 "immediate_operand" "i"))
9722 (use (match_operand:SI 3 "immediate_operand" "i"))
9723 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9724 (clobber (reg:SI 6))
9725 (clobber (reg:SI 7))
9726 (clobber (reg:SI 8))
9727 (clobber (reg:SI 9))
9728 (clobber (reg:SI 10))
9729 (clobber (match_scratch:SI 5 "=q"))]
9730 "TARGET_STRING && TARGET_POWER
9731 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9732 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9733 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9734 && REGNO (operands[4]) == 5"
9735 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9736 [(set_attr "type" "store_ux")
9737 (set_attr "length" "8")])
9740 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9741 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9742 (use (match_operand:SI 2 "immediate_operand" "i"))
9743 (use (match_operand:SI 3 "immediate_operand" "i"))
9744 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9745 (clobber (reg:SI 6))
9746 (clobber (reg:SI 7))
9747 (clobber (reg:SI 8))
9748 (clobber (reg:SI 9))
9749 (clobber (reg:SI 10))
9750 (clobber (match_scratch:SI 5 "=X"))]
9751 "TARGET_STRING && ! TARGET_POWER
9752 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9753 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9754 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9755 && REGNO (operands[4]) == 5"
9756 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9757 [(set_attr "type" "store_ux")
9758 (set_attr "length" "8")])
9760 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9761 ;; problems with TImode.
9762 ;; rD/rS = r5 is preferred, efficient form.
9763 (define_expand "movmemsi_4reg"
9764 [(parallel [(set (match_operand 0 "" "")
9765 (match_operand 1 "" ""))
9766 (use (match_operand 2 "" ""))
9767 (use (match_operand 3 "" ""))
9768 (clobber (reg:SI 5))
9769 (clobber (reg:SI 6))
9770 (clobber (reg:SI 7))
9771 (clobber (reg:SI 8))
9772 (clobber (match_scratch:SI 4 ""))])]
9777 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9778 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9779 (use (match_operand:SI 2 "immediate_operand" "i"))
9780 (use (match_operand:SI 3 "immediate_operand" "i"))
9781 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9782 (clobber (reg:SI 6))
9783 (clobber (reg:SI 7))
9784 (clobber (reg:SI 8))
9785 (clobber (match_scratch:SI 5 "=q"))]
9786 "TARGET_STRING && TARGET_POWER
9787 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9788 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9789 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9790 && REGNO (operands[4]) == 5"
9791 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9792 [(set_attr "type" "store_ux")
9793 (set_attr "length" "8")])
9796 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9797 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9798 (use (match_operand:SI 2 "immediate_operand" "i"))
9799 (use (match_operand:SI 3 "immediate_operand" "i"))
9800 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9801 (clobber (reg:SI 6))
9802 (clobber (reg:SI 7))
9803 (clobber (reg:SI 8))
9804 (clobber (match_scratch:SI 5 "=X"))]
9805 "TARGET_STRING && ! TARGET_POWER
9806 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9807 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9808 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9809 && REGNO (operands[4]) == 5"
9810 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9811 [(set_attr "type" "store_ux")
9812 (set_attr "length" "8")])
9814 ;; Move up to 8 bytes at a time.
9815 (define_expand "movmemsi_2reg"
9816 [(parallel [(set (match_operand 0 "" "")
9817 (match_operand 1 "" ""))
9818 (use (match_operand 2 "" ""))
9819 (use (match_operand 3 "" ""))
9820 (clobber (match_scratch:DI 4 ""))
9821 (clobber (match_scratch:SI 5 ""))])]
9822 "TARGET_STRING && ! TARGET_POWERPC64"
9826 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9827 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9828 (use (match_operand:SI 2 "immediate_operand" "i"))
9829 (use (match_operand:SI 3 "immediate_operand" "i"))
9830 (clobber (match_scratch:DI 4 "=&r"))
9831 (clobber (match_scratch:SI 5 "=q"))]
9832 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9833 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9834 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9835 [(set_attr "type" "store_ux")
9836 (set_attr "length" "8")])
9839 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9840 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9841 (use (match_operand:SI 2 "immediate_operand" "i"))
9842 (use (match_operand:SI 3 "immediate_operand" "i"))
9843 (clobber (match_scratch:DI 4 "=&r"))
9844 (clobber (match_scratch:SI 5 "=X"))]
9845 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9846 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9847 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9848 [(set_attr "type" "store_ux")
9849 (set_attr "length" "8")])
9851 ;; Move up to 4 bytes at a time.
9852 (define_expand "movmemsi_1reg"
9853 [(parallel [(set (match_operand 0 "" "")
9854 (match_operand 1 "" ""))
9855 (use (match_operand 2 "" ""))
9856 (use (match_operand 3 "" ""))
9857 (clobber (match_scratch:SI 4 ""))
9858 (clobber (match_scratch:SI 5 ""))])]
9863 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9864 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9865 (use (match_operand:SI 2 "immediate_operand" "i"))
9866 (use (match_operand:SI 3 "immediate_operand" "i"))
9867 (clobber (match_scratch:SI 4 "=&r"))
9868 (clobber (match_scratch:SI 5 "=q"))]
9869 "TARGET_STRING && TARGET_POWER
9870 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9871 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9872 [(set_attr "type" "store_ux")
9873 (set_attr "length" "8")])
9876 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9877 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9878 (use (match_operand:SI 2 "immediate_operand" "i"))
9879 (use (match_operand:SI 3 "immediate_operand" "i"))
9880 (clobber (match_scratch:SI 4 "=&r"))
9881 (clobber (match_scratch:SI 5 "=X"))]
9882 "TARGET_STRING && ! TARGET_POWER
9883 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9884 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9885 [(set_attr "type" "store_ux")
9886 (set_attr "length" "8")])
9888 ;; Define insns that do load or store with update. Some of these we can
9889 ;; get by using pre-decrement or pre-increment, but the hardware can also
9890 ;; do cases where the increment is not the size of the object.
9892 ;; In all these cases, we use operands 0 and 1 for the register being
9893 ;; incremented because those are the operands that local-alloc will
9894 ;; tie and these are the pair most likely to be tieable (and the ones
9895 ;; that will benefit the most).
9897 (define_insn "*movdi_update1"
9898 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9899 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9900 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9901 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9902 (plus:DI (match_dup 1) (match_dup 2)))]
9903 "TARGET_POWERPC64 && TARGET_UPDATE"
9907 [(set_attr "type" "load_ux,load_u")])
9909 (define_insn "movdi_<mode>_update"
9910 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9911 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9912 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9913 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9914 (plus:P (match_dup 1) (match_dup 2)))]
9915 "TARGET_POWERPC64 && TARGET_UPDATE"
9919 [(set_attr "type" "store_ux,store_u")])
9921 (define_insn "*movsi_update1"
9922 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9923 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9924 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9925 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9926 (plus:SI (match_dup 1) (match_dup 2)))]
9929 {lux|lwzux} %3,%0,%2
9930 {lu|lwzu} %3,%2(%0)"
9931 [(set_attr "type" "load_ux,load_u")])
9933 (define_insn "*movsi_update2"
9934 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9936 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9937 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9938 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9939 (plus:DI (match_dup 1) (match_dup 2)))]
9942 [(set_attr "type" "load_ext_ux")])
9944 (define_insn "movsi_update"
9945 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9946 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9947 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9948 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9949 (plus:SI (match_dup 1) (match_dup 2)))]
9952 {stux|stwux} %3,%0,%2
9953 {stu|stwu} %3,%2(%0)"
9954 [(set_attr "type" "store_ux,store_u")])
9956 (define_insn "*movhi_update1"
9957 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9958 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9959 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9960 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9961 (plus:SI (match_dup 1) (match_dup 2)))]
9966 [(set_attr "type" "load_ux,load_u")])
9968 (define_insn "*movhi_update2"
9969 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9971 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9972 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9973 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9974 (plus:SI (match_dup 1) (match_dup 2)))]
9979 [(set_attr "type" "load_ux,load_u")])
9981 (define_insn "*movhi_update3"
9982 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9984 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9985 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9986 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9987 (plus:SI (match_dup 1) (match_dup 2)))]
9992 [(set_attr "type" "load_ext_ux,load_ext_u")])
9994 (define_insn "*movhi_update4"
9995 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9996 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9997 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9998 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9999 (plus:SI (match_dup 1) (match_dup 2)))]
10004 [(set_attr "type" "store_ux,store_u")])
10006 (define_insn "*movqi_update1"
10007 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10008 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10009 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10010 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10011 (plus:SI (match_dup 1) (match_dup 2)))]
10016 [(set_attr "type" "load_ux,load_u")])
10018 (define_insn "*movqi_update2"
10019 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10021 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10022 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10023 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10024 (plus:SI (match_dup 1) (match_dup 2)))]
10029 [(set_attr "type" "load_ux,load_u")])
10031 (define_insn "*movqi_update3"
10032 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10033 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10034 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10035 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10036 (plus:SI (match_dup 1) (match_dup 2)))]
10041 [(set_attr "type" "store_ux,store_u")])
10043 (define_insn "*movsf_update1"
10044 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10045 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10046 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10047 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10048 (plus:SI (match_dup 1) (match_dup 2)))]
10049 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE"
10053 [(set_attr "type" "fpload_ux,fpload_u")])
10055 (define_insn "*movsf_update2"
10056 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10057 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10058 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10059 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10060 (plus:SI (match_dup 1) (match_dup 2)))]
10061 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE"
10065 [(set_attr "type" "fpstore_ux,fpstore_u")])
10067 (define_insn "*movsf_update3"
10068 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10069 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10070 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10071 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10072 (plus:SI (match_dup 1) (match_dup 2)))]
10073 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10075 {lux|lwzux} %3,%0,%2
10076 {lu|lwzu} %3,%2(%0)"
10077 [(set_attr "type" "load_ux,load_u")])
10079 (define_insn "*movsf_update4"
10080 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10081 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10082 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10083 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10084 (plus:SI (match_dup 1) (match_dup 2)))]
10085 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10087 {stux|stwux} %3,%0,%2
10088 {stu|stwu} %3,%2(%0)"
10089 [(set_attr "type" "store_ux,store_u")])
10091 (define_insn "*movdf_update1"
10092 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10093 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10094 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10095 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10096 (plus:SI (match_dup 1) (match_dup 2)))]
10097 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE"
10101 [(set_attr "type" "fpload_ux,fpload_u")])
10103 (define_insn "*movdf_update2"
10104 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10105 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10106 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10107 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10108 (plus:SI (match_dup 1) (match_dup 2)))]
10109 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE"
10113 [(set_attr "type" "fpstore_ux,fpstore_u")])
10115 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10117 (define_insn "*lfq_power2"
10118 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10119 (match_operand:V2DF 1 "memory_operand" ""))]
10121 && TARGET_HARD_FLOAT && TARGET_FPRS"
10125 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10126 (match_operand:DF 1 "memory_operand" ""))
10127 (set (match_operand:DF 2 "gpc_reg_operand" "")
10128 (match_operand:DF 3 "memory_operand" ""))]
10130 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10131 && registers_ok_for_quad_peep (operands[0], operands[2])
10132 && mems_ok_for_quad_peep (operands[1], operands[3])"
10133 [(set (match_dup 0)
10135 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10136 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10138 (define_insn "*stfq_power2"
10139 [(set (match_operand:V2DF 0 "memory_operand" "")
10140 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10142 && TARGET_HARD_FLOAT && TARGET_FPRS"
10143 "stfq%U0%X0 %1,%0")
10147 [(set (match_operand:DF 0 "memory_operand" "")
10148 (match_operand:DF 1 "gpc_reg_operand" ""))
10149 (set (match_operand:DF 2 "memory_operand" "")
10150 (match_operand:DF 3 "gpc_reg_operand" ""))]
10152 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10153 && registers_ok_for_quad_peep (operands[1], operands[3])
10154 && mems_ok_for_quad_peep (operands[0], operands[2])"
10155 [(set (match_dup 0)
10157 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10158 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10160 ;; After inserting conditional returns we can sometimes have
10161 ;; unnecessary register moves. Unfortunately we cannot have a
10162 ;; modeless peephole here, because some single SImode sets have early
10163 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10164 ;; sequences, using get_attr_length here will smash the operands
10165 ;; array. Neither is there an early_cobbler_p predicate.
10166 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10168 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10169 (match_operand:DF 1 "any_operand" ""))
10170 (set (match_operand:DF 2 "gpc_reg_operand" "")
10172 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10173 && peep2_reg_dead_p (2, operands[0])"
10174 [(set (match_dup 2) (match_dup 1))])
10177 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10178 (match_operand:SF 1 "any_operand" ""))
10179 (set (match_operand:SF 2 "gpc_reg_operand" "")
10181 "peep2_reg_dead_p (2, operands[0])"
10182 [(set (match_dup 2) (match_dup 1))])
10187 ;; Mode attributes for different ABIs.
10188 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10189 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10190 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10191 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10193 (define_insn "tls_gd_aix<TLSmode:tls_abi_suffix>"
10194 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10195 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10196 (match_operand 4 "" "g")))
10197 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10198 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10200 (clobber (reg:SI LR_REGNO))]
10201 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10202 "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
10203 [(set_attr "type" "two")
10204 (set_attr "length" "12")])
10206 (define_insn "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10207 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10208 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10209 (match_operand 4 "" "g")))
10210 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10211 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10213 (clobber (reg:SI LR_REGNO))]
10214 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10218 if (TARGET_SECURE_PLT && flag_pic == 2)
10219 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
10221 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
10224 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
10226 [(set_attr "type" "two")
10227 (set_attr "length" "8")])
10229 (define_insn "tls_ld_aix<TLSmode:tls_abi_suffix>"
10230 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10231 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10232 (match_operand 3 "" "g")))
10233 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10235 (clobber (reg:SI LR_REGNO))]
10236 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10237 "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
10238 [(set_attr "length" "12")])
10240 (define_insn "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
10241 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10242 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10243 (match_operand 3 "" "g")))
10244 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10246 (clobber (reg:SI LR_REGNO))]
10247 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10251 if (TARGET_SECURE_PLT && flag_pic == 2)
10252 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
10254 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
10257 return "addi %0,%1,%&@got@tlsld\;bl %z2";
10259 [(set_attr "length" "8")])
10261 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
10262 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10263 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10264 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10265 UNSPEC_TLSDTPREL))]
10267 "addi %0,%1,%2@dtprel")
10269 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
10270 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10271 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10272 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10273 UNSPEC_TLSDTPRELHA))]
10275 "addis %0,%1,%2@dtprel@ha")
10277 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
10278 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10279 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10280 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10281 UNSPEC_TLSDTPRELLO))]
10283 "addi %0,%1,%2@dtprel@l")
10285 (define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
10286 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10287 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10288 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10289 UNSPEC_TLSGOTDTPREL))]
10291 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
10293 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
10294 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10295 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10296 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10299 "addi %0,%1,%2@tprel")
10301 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
10302 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10303 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10304 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10305 UNSPEC_TLSTPRELHA))]
10307 "addis %0,%1,%2@tprel@ha")
10309 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
10310 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10311 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10312 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10313 UNSPEC_TLSTPRELLO))]
10315 "addi %0,%1,%2@tprel@l")
10317 ;; "b" output constraint here and on tls_tls input to support linker tls
10318 ;; optimization. The linker may edit the instructions emitted by a
10319 ;; tls_got_tprel/tls_tls pair to addis,addi.
10320 (define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
10321 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10322 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10323 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10324 UNSPEC_TLSGOTTPREL))]
10326 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
10328 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
10329 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10330 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10331 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10334 "add %0,%1,%2@tls")
10337 ;; Next come insns related to the calling sequence.
10339 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10340 ;; We move the back-chain and decrement the stack pointer.
10342 (define_expand "allocate_stack"
10343 [(set (match_operand 0 "gpc_reg_operand" "")
10344 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10346 (minus (reg 1) (match_dup 1)))]
10349 { rtx chain = gen_reg_rtx (Pmode);
10350 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10353 emit_move_insn (chain, stack_bot);
10355 /* Check stack bounds if necessary. */
10356 if (crtl->limit_stack)
10359 available = expand_binop (Pmode, sub_optab,
10360 stack_pointer_rtx, stack_limit_rtx,
10361 NULL_RTX, 1, OPTAB_WIDEN);
10362 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10365 if (GET_CODE (operands[1]) != CONST_INT
10366 || INTVAL (operands[1]) < -32767
10367 || INTVAL (operands[1]) > 32768)
10369 neg_op0 = gen_reg_rtx (Pmode);
10371 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10373 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10376 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10380 rtx insn, par, set, mem;
10382 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update
10383 : gen_movdi_di_update))
10384 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
10386 /* Since we didn't use gen_frame_mem to generate the MEM, grab
10387 it now and set the alias set/attributes. The above gen_*_update
10388 calls will generate a PARALLEL with the MEM set being the first
10390 par = PATTERN (insn);
10391 gcc_assert (GET_CODE (par) == PARALLEL);
10392 set = XVECEXP (par, 0, 0);
10393 gcc_assert (GET_CODE (set) == SET);
10394 mem = SET_DEST (set);
10395 gcc_assert (MEM_P (mem));
10396 MEM_NOTRAP_P (mem) = 1;
10397 set_mem_alias_set (mem, get_frame_alias_set ());
10402 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10403 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10404 emit_move_insn (gen_frame_mem (Pmode, stack_pointer_rtx), chain);
10407 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10411 ;; These patterns say how to save and restore the stack pointer. We need not
10412 ;; save the stack pointer at function level since we are careful to
10413 ;; preserve the backchain. At block level, we have to restore the backchain
10414 ;; when we restore the stack pointer.
10416 ;; For nonlocal gotos, we must save both the stack pointer and its
10417 ;; backchain and restore both. Note that in the nonlocal case, the
10418 ;; save area is a memory location.
10420 (define_expand "save_stack_function"
10421 [(match_operand 0 "any_operand" "")
10422 (match_operand 1 "any_operand" "")]
10426 (define_expand "restore_stack_function"
10427 [(match_operand 0 "any_operand" "")
10428 (match_operand 1 "any_operand" "")]
10432 ;; Adjust stack pointer (op0) to a new value (op1).
10433 ;; First copy old stack backchain to new location, and ensure that the
10434 ;; scheduler won't reorder the sp assignment before the backchain write.
10435 (define_expand "restore_stack_block"
10436 [(set (match_dup 2) (match_dup 3))
10437 (set (match_dup 4) (match_dup 2))
10438 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10439 (set (match_operand 0 "register_operand" "")
10440 (match_operand 1 "register_operand" ""))]
10444 operands[1] = force_reg (Pmode, operands[1]);
10445 operands[2] = gen_reg_rtx (Pmode);
10446 operands[3] = gen_frame_mem (Pmode, operands[0]);
10447 operands[4] = gen_frame_mem (Pmode, operands[1]);
10448 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10451 (define_expand "save_stack_nonlocal"
10452 [(set (match_dup 3) (match_dup 4))
10453 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10454 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10458 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10460 /* Copy the backchain to the first word, sp to the second. */
10461 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10462 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10463 operands[3] = gen_reg_rtx (Pmode);
10464 operands[4] = gen_frame_mem (Pmode, operands[1]);
10467 (define_expand "restore_stack_nonlocal"
10468 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10469 (set (match_dup 3) (match_dup 4))
10470 (set (match_dup 5) (match_dup 2))
10471 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10472 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10476 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10478 /* Restore the backchain from the first word, sp from the second. */
10479 operands[2] = gen_reg_rtx (Pmode);
10480 operands[3] = gen_reg_rtx (Pmode);
10481 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10482 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10483 operands[5] = gen_frame_mem (Pmode, operands[3]);
10484 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10487 ;; TOC register handling.
10489 ;; Code to initialize the TOC register...
10491 (define_insn "load_toc_aix_si"
10492 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10493 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10494 (use (reg:SI 2))])]
10495 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10499 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10500 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10501 operands[2] = gen_rtx_REG (Pmode, 2);
10502 return \"{l|lwz} %0,%1(%2)\";
10504 [(set_attr "type" "load")])
10506 (define_insn "load_toc_aix_di"
10507 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10508 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10509 (use (reg:DI 2))])]
10510 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10514 #ifdef TARGET_RELOCATABLE
10515 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10516 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10518 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10521 strcat (buf, \"@toc\");
10522 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10523 operands[2] = gen_rtx_REG (Pmode, 2);
10524 return \"ld %0,%1(%2)\";
10526 [(set_attr "type" "load")])
10528 (define_insn "load_toc_v4_pic_si"
10529 [(set (reg:SI LR_REGNO)
10530 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10531 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10532 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10533 [(set_attr "type" "branch")
10534 (set_attr "length" "4")])
10536 (define_insn "load_toc_v4_PIC_1"
10537 [(set (reg:SI LR_REGNO)
10538 (match_operand:SI 0 "immediate_operand" "s"))
10539 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10540 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10541 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10542 "bcl 20,31,%0\\n%0:"
10543 [(set_attr "type" "branch")
10544 (set_attr "length" "4")])
10546 (define_insn "load_toc_v4_PIC_1b"
10547 [(set (reg:SI LR_REGNO)
10548 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
10550 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10551 "bcl 20,31,$+8\\n\\t.long %0-$"
10552 [(set_attr "type" "branch")
10553 (set_attr "length" "8")])
10555 (define_insn "load_toc_v4_PIC_2"
10556 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10557 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10558 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10559 (match_operand:SI 3 "immediate_operand" "s")))))]
10560 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10561 "{l|lwz} %0,%2-%3(%1)"
10562 [(set_attr "type" "load")])
10564 (define_insn "load_toc_v4_PIC_3b"
10565 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10566 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10568 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10569 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10570 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10571 "{cau|addis} %0,%1,%2-%3@ha")
10573 (define_insn "load_toc_v4_PIC_3c"
10574 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10575 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10576 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10577 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10578 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10579 "{cal|addi} %0,%1,%2-%3@l")
10581 ;; If the TOC is shared over a translation unit, as happens with all
10582 ;; the kinds of PIC that we support, we need to restore the TOC
10583 ;; pointer only when jumping over units of translation.
10584 ;; On Darwin, we need to reload the picbase.
10586 (define_expand "builtin_setjmp_receiver"
10587 [(use (label_ref (match_operand 0 "" "")))]
10588 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10589 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10590 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10594 if (DEFAULT_ABI == ABI_DARWIN)
10596 const char *picbase = machopic_function_base_name ();
10597 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10598 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10602 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10603 CODE_LABEL_NUMBER (operands[0]));
10604 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10606 emit_insn (gen_load_macho_picbase (tmplabrtx));
10607 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
10608 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10612 rs6000_emit_load_toc_table (FALSE);
10616 ;; Elf specific ways of loading addresses for non-PIC code.
10617 ;; The output of this could be r0, but we make a very strong
10618 ;; preference for a base register because it will usually
10619 ;; be needed there.
10620 (define_insn "elf_high"
10621 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10622 (high:SI (match_operand 1 "" "")))]
10623 "TARGET_ELF && ! TARGET_64BIT"
10624 "{liu|lis} %0,%1@ha")
10626 (define_insn "elf_low"
10627 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10628 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10629 (match_operand 2 "" "")))]
10630 "TARGET_ELF && ! TARGET_64BIT"
10632 {cal|la} %0,%2@l(%1)
10633 {ai|addic} %0,%1,%K2")
10635 ;; A function pointer under AIX is a pointer to a data area whose first word
10636 ;; contains the actual address of the function, whose second word contains a
10637 ;; pointer to its TOC, and whose third word contains a value to place in the
10638 ;; static chain register (r11). Note that if we load the static chain, our
10639 ;; "trampoline" need not have any executable code.
10641 (define_expand "call_indirect_aix32"
10642 [(set (match_dup 2)
10643 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10644 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10647 (mem:SI (plus:SI (match_dup 0)
10650 (mem:SI (plus:SI (match_dup 0)
10652 (parallel [(call (mem:SI (match_dup 2))
10653 (match_operand 1 "" ""))
10657 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10658 (clobber (reg:SI LR_REGNO))])]
10661 { operands[2] = gen_reg_rtx (SImode); }")
10663 (define_expand "call_indirect_aix64"
10664 [(set (match_dup 2)
10665 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10666 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10669 (mem:DI (plus:DI (match_dup 0)
10672 (mem:DI (plus:DI (match_dup 0)
10674 (parallel [(call (mem:SI (match_dup 2))
10675 (match_operand 1 "" ""))
10679 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10680 (clobber (reg:SI LR_REGNO))])]
10683 { operands[2] = gen_reg_rtx (DImode); }")
10685 (define_expand "call_value_indirect_aix32"
10686 [(set (match_dup 3)
10687 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10688 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10691 (mem:SI (plus:SI (match_dup 1)
10694 (mem:SI (plus:SI (match_dup 1)
10696 (parallel [(set (match_operand 0 "" "")
10697 (call (mem:SI (match_dup 3))
10698 (match_operand 2 "" "")))
10702 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10703 (clobber (reg:SI LR_REGNO))])]
10706 { operands[3] = gen_reg_rtx (SImode); }")
10708 (define_expand "call_value_indirect_aix64"
10709 [(set (match_dup 3)
10710 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10711 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10714 (mem:DI (plus:DI (match_dup 1)
10717 (mem:DI (plus:DI (match_dup 1)
10719 (parallel [(set (match_operand 0 "" "")
10720 (call (mem:SI (match_dup 3))
10721 (match_operand 2 "" "")))
10725 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10726 (clobber (reg:SI LR_REGNO))])]
10729 { operands[3] = gen_reg_rtx (DImode); }")
10731 ;; Now the definitions for the call and call_value insns
10732 (define_expand "call"
10733 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10734 (match_operand 1 "" ""))
10735 (use (match_operand 2 "" ""))
10736 (clobber (reg:SI LR_REGNO))])]
10741 if (MACHOPIC_INDIRECT)
10742 operands[0] = machopic_indirect_call_target (operands[0]);
10745 gcc_assert (GET_CODE (operands[0]) == MEM);
10746 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10748 operands[0] = XEXP (operands[0], 0);
10750 if (GET_CODE (operands[0]) != SYMBOL_REF
10751 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10752 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10754 if (INTVAL (operands[2]) & CALL_LONG)
10755 operands[0] = rs6000_longcall_ref (operands[0]);
10757 switch (DEFAULT_ABI)
10761 operands[0] = force_reg (Pmode, operands[0]);
10765 /* AIX function pointers are really pointers to a three word
10767 emit_call_insn (TARGET_32BIT
10768 ? gen_call_indirect_aix32 (force_reg (SImode,
10771 : gen_call_indirect_aix64 (force_reg (DImode,
10777 gcc_unreachable ();
10782 (define_expand "call_value"
10783 [(parallel [(set (match_operand 0 "" "")
10784 (call (mem:SI (match_operand 1 "address_operand" ""))
10785 (match_operand 2 "" "")))
10786 (use (match_operand 3 "" ""))
10787 (clobber (reg:SI LR_REGNO))])]
10792 if (MACHOPIC_INDIRECT)
10793 operands[1] = machopic_indirect_call_target (operands[1]);
10796 gcc_assert (GET_CODE (operands[1]) == MEM);
10797 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10799 operands[1] = XEXP (operands[1], 0);
10801 if (GET_CODE (operands[1]) != SYMBOL_REF
10802 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10803 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10805 if (INTVAL (operands[3]) & CALL_LONG)
10806 operands[1] = rs6000_longcall_ref (operands[1]);
10808 switch (DEFAULT_ABI)
10812 operands[1] = force_reg (Pmode, operands[1]);
10816 /* AIX function pointers are really pointers to a three word
10818 emit_call_insn (TARGET_32BIT
10819 ? gen_call_value_indirect_aix32 (operands[0],
10823 : gen_call_value_indirect_aix64 (operands[0],
10830 gcc_unreachable ();
10835 ;; Call to function in current module. No TOC pointer reload needed.
10836 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10837 ;; either the function was not prototyped, or it was prototyped as a
10838 ;; variable argument function. It is > 0 if FP registers were passed
10839 ;; and < 0 if they were not.
10841 (define_insn "*call_local32"
10842 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10843 (match_operand 1 "" "g,g"))
10844 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10845 (clobber (reg:SI LR_REGNO))]
10846 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10849 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10850 output_asm_insn (\"crxor 6,6,6\", operands);
10852 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10853 output_asm_insn (\"creqv 6,6,6\", operands);
10855 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10857 [(set_attr "type" "branch")
10858 (set_attr "length" "4,8")])
10860 (define_insn "*call_local64"
10861 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10862 (match_operand 1 "" "g,g"))
10863 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10864 (clobber (reg:SI LR_REGNO))]
10865 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10868 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10869 output_asm_insn (\"crxor 6,6,6\", operands);
10871 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10872 output_asm_insn (\"creqv 6,6,6\", operands);
10874 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10876 [(set_attr "type" "branch")
10877 (set_attr "length" "4,8")])
10879 (define_insn "*call_value_local32"
10880 [(set (match_operand 0 "" "")
10881 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10882 (match_operand 2 "" "g,g")))
10883 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10884 (clobber (reg:SI LR_REGNO))]
10885 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10888 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10889 output_asm_insn (\"crxor 6,6,6\", operands);
10891 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10892 output_asm_insn (\"creqv 6,6,6\", operands);
10894 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10896 [(set_attr "type" "branch")
10897 (set_attr "length" "4,8")])
10900 (define_insn "*call_value_local64"
10901 [(set (match_operand 0 "" "")
10902 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10903 (match_operand 2 "" "g,g")))
10904 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10905 (clobber (reg:SI LR_REGNO))]
10906 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10909 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10910 output_asm_insn (\"crxor 6,6,6\", operands);
10912 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10913 output_asm_insn (\"creqv 6,6,6\", operands);
10915 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10917 [(set_attr "type" "branch")
10918 (set_attr "length" "4,8")])
10920 ;; Call to function which may be in another module. Restore the TOC
10921 ;; pointer (r2) after the call unless this is System V.
10922 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10923 ;; either the function was not prototyped, or it was prototyped as a
10924 ;; variable argument function. It is > 0 if FP registers were passed
10925 ;; and < 0 if they were not.
10927 (define_insn "*call_indirect_nonlocal_aix32"
10928 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10929 (match_operand 1 "" "g,g"))
10933 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10934 (clobber (reg:SI LR_REGNO))]
10935 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10936 "b%T0l\;{l|lwz} 2,20(1)"
10937 [(set_attr "type" "jmpreg")
10938 (set_attr "length" "8")])
10940 (define_insn "*call_nonlocal_aix32"
10941 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10942 (match_operand 1 "" "g"))
10943 (use (match_operand:SI 2 "immediate_operand" "O"))
10944 (clobber (reg:SI LR_REGNO))]
10946 && DEFAULT_ABI == ABI_AIX
10947 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10949 [(set_attr "type" "branch")
10950 (set_attr "length" "8")])
10952 (define_insn "*call_indirect_nonlocal_aix64"
10953 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10954 (match_operand 1 "" "g,g"))
10958 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10959 (clobber (reg:SI LR_REGNO))]
10960 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10961 "b%T0l\;ld 2,40(1)"
10962 [(set_attr "type" "jmpreg")
10963 (set_attr "length" "8")])
10965 (define_insn "*call_nonlocal_aix64"
10966 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10967 (match_operand 1 "" "g"))
10968 (use (match_operand:SI 2 "immediate_operand" "O"))
10969 (clobber (reg:SI LR_REGNO))]
10971 && DEFAULT_ABI == ABI_AIX
10972 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10974 [(set_attr "type" "branch")
10975 (set_attr "length" "8")])
10977 (define_insn "*call_value_indirect_nonlocal_aix32"
10978 [(set (match_operand 0 "" "")
10979 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10980 (match_operand 2 "" "g,g")))
10984 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10985 (clobber (reg:SI LR_REGNO))]
10986 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10987 "b%T1l\;{l|lwz} 2,20(1)"
10988 [(set_attr "type" "jmpreg")
10989 (set_attr "length" "8")])
10991 (define_insn "*call_value_nonlocal_aix32"
10992 [(set (match_operand 0 "" "")
10993 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10994 (match_operand 2 "" "g")))
10995 (use (match_operand:SI 3 "immediate_operand" "O"))
10996 (clobber (reg:SI LR_REGNO))]
10998 && DEFAULT_ABI == ABI_AIX
10999 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11001 [(set_attr "type" "branch")
11002 (set_attr "length" "8")])
11004 (define_insn "*call_value_indirect_nonlocal_aix64"
11005 [(set (match_operand 0 "" "")
11006 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11007 (match_operand 2 "" "g,g")))
11011 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11012 (clobber (reg:SI LR_REGNO))]
11013 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11014 "b%T1l\;ld 2,40(1)"
11015 [(set_attr "type" "jmpreg")
11016 (set_attr "length" "8")])
11018 (define_insn "*call_value_nonlocal_aix64"
11019 [(set (match_operand 0 "" "")
11020 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11021 (match_operand 2 "" "g")))
11022 (use (match_operand:SI 3 "immediate_operand" "O"))
11023 (clobber (reg:SI LR_REGNO))]
11025 && DEFAULT_ABI == ABI_AIX
11026 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11028 [(set_attr "type" "branch")
11029 (set_attr "length" "8")])
11031 ;; A function pointer under System V is just a normal pointer
11032 ;; operands[0] is the function pointer
11033 ;; operands[1] is the stack size to clean up
11034 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11035 ;; which indicates how to set cr1
11037 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11038 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11039 (match_operand 1 "" "g,g,g,g"))
11040 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11041 (clobber (reg:SI LR_REGNO))]
11042 "DEFAULT_ABI == ABI_V4
11043 || DEFAULT_ABI == ABI_DARWIN"
11045 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11046 output_asm_insn ("crxor 6,6,6", operands);
11048 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11049 output_asm_insn ("creqv 6,6,6", operands);
11053 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11054 (set_attr "length" "4,4,8,8")])
11056 (define_insn_and_split "*call_nonlocal_sysv<mode>"
11057 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11058 (match_operand 1 "" "g,g"))
11059 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11060 (clobber (reg:SI LR_REGNO))]
11061 "(DEFAULT_ABI == ABI_DARWIN
11062 || (DEFAULT_ABI == ABI_V4
11063 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11065 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11066 output_asm_insn ("crxor 6,6,6", operands);
11068 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11069 output_asm_insn ("creqv 6,6,6", operands);
11072 return output_call(insn, operands, 0, 2);
11074 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11076 gcc_assert (!TARGET_SECURE_PLT);
11077 return "bl %z0@plt";
11083 "DEFAULT_ABI == ABI_V4
11084 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11085 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11086 [(parallel [(call (mem:SI (match_dup 0))
11088 (use (match_dup 2))
11089 (use (match_dup 3))
11090 (clobber (reg:SI LR_REGNO))])]
11092 operands[3] = pic_offset_table_rtx;
11094 [(set_attr "type" "branch,branch")
11095 (set_attr "length" "4,8")])
11097 (define_insn "*call_nonlocal_sysv_secure<mode>"
11098 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11099 (match_operand 1 "" "g,g"))
11100 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11101 (use (match_operand:SI 3 "register_operand" "r,r"))
11102 (clobber (reg:SI LR_REGNO))]
11103 "(DEFAULT_ABI == ABI_V4
11104 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11105 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
11107 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11108 output_asm_insn ("crxor 6,6,6", operands);
11110 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11111 output_asm_insn ("creqv 6,6,6", operands);
11114 /* The magic 32768 offset here and in the other sysv call insns
11115 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11116 See sysv4.h:toc_section. */
11117 return "bl %z0+32768@plt";
11119 return "bl %z0@plt";
11121 [(set_attr "type" "branch,branch")
11122 (set_attr "length" "4,8")])
11124 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11125 [(set (match_operand 0 "" "")
11126 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11127 (match_operand 2 "" "g,g,g,g")))
11128 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11129 (clobber (reg:SI LR_REGNO))]
11130 "DEFAULT_ABI == ABI_V4
11131 || DEFAULT_ABI == ABI_DARWIN"
11133 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11134 output_asm_insn ("crxor 6,6,6", operands);
11136 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11137 output_asm_insn ("creqv 6,6,6", operands);
11141 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11142 (set_attr "length" "4,4,8,8")])
11144 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
11145 [(set (match_operand 0 "" "")
11146 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11147 (match_operand 2 "" "g,g")))
11148 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11149 (clobber (reg:SI LR_REGNO))]
11150 "(DEFAULT_ABI == ABI_DARWIN
11151 || (DEFAULT_ABI == ABI_V4
11152 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11154 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11155 output_asm_insn ("crxor 6,6,6", operands);
11157 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11158 output_asm_insn ("creqv 6,6,6", operands);
11161 return output_call(insn, operands, 1, 3);
11163 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11165 gcc_assert (!TARGET_SECURE_PLT);
11166 return "bl %z1@plt";
11172 "DEFAULT_ABI == ABI_V4
11173 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11174 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11175 [(parallel [(set (match_dup 0)
11176 (call (mem:SI (match_dup 1))
11178 (use (match_dup 3))
11179 (use (match_dup 4))
11180 (clobber (reg:SI LR_REGNO))])]
11182 operands[4] = pic_offset_table_rtx;
11184 [(set_attr "type" "branch,branch")
11185 (set_attr "length" "4,8")])
11187 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
11188 [(set (match_operand 0 "" "")
11189 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11190 (match_operand 2 "" "g,g")))
11191 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11192 (use (match_operand:SI 4 "register_operand" "r,r"))
11193 (clobber (reg:SI LR_REGNO))]
11194 "(DEFAULT_ABI == ABI_V4
11195 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11196 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
11198 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11199 output_asm_insn ("crxor 6,6,6", operands);
11201 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11202 output_asm_insn ("creqv 6,6,6", operands);
11205 return "bl %z1+32768@plt";
11207 return "bl %z1@plt";
11209 [(set_attr "type" "branch,branch")
11210 (set_attr "length" "4,8")])
11212 ;; Call subroutine returning any type.
11213 (define_expand "untyped_call"
11214 [(parallel [(call (match_operand 0 "" "")
11216 (match_operand 1 "" "")
11217 (match_operand 2 "" "")])]
11223 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11225 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11227 rtx set = XVECEXP (operands[2], 0, i);
11228 emit_move_insn (SET_DEST (set), SET_SRC (set));
11231 /* The optimizer does not know that the call sets the function value
11232 registers we stored in the result block. We avoid problems by
11233 claiming that all hard registers are used and clobbered at this
11235 emit_insn (gen_blockage ());
11240 ;; sibling call patterns
11241 (define_expand "sibcall"
11242 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11243 (match_operand 1 "" ""))
11244 (use (match_operand 2 "" ""))
11245 (use (reg:SI LR_REGNO))
11251 if (MACHOPIC_INDIRECT)
11252 operands[0] = machopic_indirect_call_target (operands[0]);
11255 gcc_assert (GET_CODE (operands[0]) == MEM);
11256 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11258 operands[0] = XEXP (operands[0], 0);
11261 ;; this and similar patterns must be marked as using LR, otherwise
11262 ;; dataflow will try to delete the store into it. This is true
11263 ;; even when the actual reg to jump to is in CTR, when LR was
11264 ;; saved and restored around the PIC-setting BCL.
11265 (define_insn "*sibcall_local32"
11266 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11267 (match_operand 1 "" "g,g"))
11268 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11269 (use (reg:SI LR_REGNO))
11271 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11274 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11275 output_asm_insn (\"crxor 6,6,6\", operands);
11277 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11278 output_asm_insn (\"creqv 6,6,6\", operands);
11280 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11282 [(set_attr "type" "branch")
11283 (set_attr "length" "4,8")])
11285 (define_insn "*sibcall_local64"
11286 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11287 (match_operand 1 "" "g,g"))
11288 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11289 (use (reg:SI LR_REGNO))
11291 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11294 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11295 output_asm_insn (\"crxor 6,6,6\", operands);
11297 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11298 output_asm_insn (\"creqv 6,6,6\", operands);
11300 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11302 [(set_attr "type" "branch")
11303 (set_attr "length" "4,8")])
11305 (define_insn "*sibcall_value_local32"
11306 [(set (match_operand 0 "" "")
11307 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11308 (match_operand 2 "" "g,g")))
11309 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11310 (use (reg:SI LR_REGNO))
11312 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11315 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11316 output_asm_insn (\"crxor 6,6,6\", operands);
11318 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11319 output_asm_insn (\"creqv 6,6,6\", operands);
11321 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11323 [(set_attr "type" "branch")
11324 (set_attr "length" "4,8")])
11327 (define_insn "*sibcall_value_local64"
11328 [(set (match_operand 0 "" "")
11329 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11330 (match_operand 2 "" "g,g")))
11331 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11332 (use (reg:SI LR_REGNO))
11334 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11337 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11338 output_asm_insn (\"crxor 6,6,6\", operands);
11340 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11341 output_asm_insn (\"creqv 6,6,6\", operands);
11343 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11345 [(set_attr "type" "branch")
11346 (set_attr "length" "4,8")])
11348 (define_insn "*sibcall_nonlocal_aix32"
11349 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11350 (match_operand 1 "" "g"))
11351 (use (match_operand:SI 2 "immediate_operand" "O"))
11352 (use (reg:SI LR_REGNO))
11355 && DEFAULT_ABI == ABI_AIX
11356 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11358 [(set_attr "type" "branch")
11359 (set_attr "length" "4")])
11361 (define_insn "*sibcall_nonlocal_aix64"
11362 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11363 (match_operand 1 "" "g"))
11364 (use (match_operand:SI 2 "immediate_operand" "O"))
11365 (use (reg:SI LR_REGNO))
11368 && DEFAULT_ABI == ABI_AIX
11369 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11371 [(set_attr "type" "branch")
11372 (set_attr "length" "4")])
11374 (define_insn "*sibcall_value_nonlocal_aix32"
11375 [(set (match_operand 0 "" "")
11376 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11377 (match_operand 2 "" "g")))
11378 (use (match_operand:SI 3 "immediate_operand" "O"))
11379 (use (reg:SI LR_REGNO))
11382 && DEFAULT_ABI == ABI_AIX
11383 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11385 [(set_attr "type" "branch")
11386 (set_attr "length" "4")])
11388 (define_insn "*sibcall_value_nonlocal_aix64"
11389 [(set (match_operand 0 "" "")
11390 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11391 (match_operand 2 "" "g")))
11392 (use (match_operand:SI 3 "immediate_operand" "O"))
11393 (use (reg:SI LR_REGNO))
11396 && DEFAULT_ABI == ABI_AIX
11397 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11399 [(set_attr "type" "branch")
11400 (set_attr "length" "4")])
11402 (define_insn "*sibcall_nonlocal_sysv<mode>"
11403 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11404 (match_operand 1 "" ""))
11405 (use (match_operand 2 "immediate_operand" "O,n"))
11406 (use (reg:SI LR_REGNO))
11408 "(DEFAULT_ABI == ABI_DARWIN
11409 || DEFAULT_ABI == ABI_V4)
11410 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11413 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11414 output_asm_insn (\"crxor 6,6,6\", operands);
11416 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11417 output_asm_insn (\"creqv 6,6,6\", operands);
11419 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11421 gcc_assert (!TARGET_SECURE_PLT);
11422 return \"b %z0@plt\";
11427 [(set_attr "type" "branch,branch")
11428 (set_attr "length" "4,8")])
11430 (define_expand "sibcall_value"
11431 [(parallel [(set (match_operand 0 "register_operand" "")
11432 (call (mem:SI (match_operand 1 "address_operand" ""))
11433 (match_operand 2 "" "")))
11434 (use (match_operand 3 "" ""))
11435 (use (reg:SI LR_REGNO))
11441 if (MACHOPIC_INDIRECT)
11442 operands[1] = machopic_indirect_call_target (operands[1]);
11445 gcc_assert (GET_CODE (operands[1]) == MEM);
11446 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11448 operands[1] = XEXP (operands[1], 0);
11451 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11452 [(set (match_operand 0 "" "")
11453 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11454 (match_operand 2 "" "")))
11455 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11456 (use (reg:SI LR_REGNO))
11458 "(DEFAULT_ABI == ABI_DARWIN
11459 || DEFAULT_ABI == ABI_V4)
11460 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11463 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11464 output_asm_insn (\"crxor 6,6,6\", operands);
11466 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11467 output_asm_insn (\"creqv 6,6,6\", operands);
11469 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11471 gcc_assert (!TARGET_SECURE_PLT);
11472 return \"b %z1@plt\";
11477 [(set_attr "type" "branch,branch")
11478 (set_attr "length" "4,8")])
11480 (define_expand "sibcall_epilogue"
11481 [(use (const_int 0))]
11482 "TARGET_SCHED_PROLOG"
11485 rs6000_emit_epilogue (TRUE);
11489 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11490 ;; all of memory. This blocks insns from being moved across this point.
11492 (define_insn "blockage"
11493 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11497 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11498 ;; signed & unsigned, and one type of branch.
11500 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11501 ;; insns, and branches. We store the operands of compares until we see
11503 (define_expand "cmp<mode>"
11505 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11506 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11510 /* Take care of the possibility that operands[1] might be negative but
11511 this might be a logical operation. That insn doesn't exist. */
11512 if (GET_CODE (operands[1]) == CONST_INT
11513 && INTVAL (operands[1]) < 0)
11514 operands[1] = force_reg (<MODE>mode, operands[1]);
11516 rs6000_compare_op0 = operands[0];
11517 rs6000_compare_op1 = operands[1];
11518 rs6000_compare_fp_p = 0;
11522 (define_expand "cmp<mode>"
11523 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11524 (match_operand:FP 1 "gpc_reg_operand" "")))]
11528 rs6000_compare_op0 = operands[0];
11529 rs6000_compare_op1 = operands[1];
11530 rs6000_compare_fp_p = 1;
11534 (define_expand "beq"
11535 [(use (match_operand 0 "" ""))]
11537 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11539 (define_expand "bne"
11540 [(use (match_operand 0 "" ""))]
11542 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11544 (define_expand "bge"
11545 [(use (match_operand 0 "" ""))]
11547 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11549 (define_expand "bgt"
11550 [(use (match_operand 0 "" ""))]
11552 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11554 (define_expand "ble"
11555 [(use (match_operand 0 "" ""))]
11557 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11559 (define_expand "blt"
11560 [(use (match_operand 0 "" ""))]
11562 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11564 (define_expand "bgeu"
11565 [(use (match_operand 0 "" ""))]
11567 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11569 (define_expand "bgtu"
11570 [(use (match_operand 0 "" ""))]
11572 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11574 (define_expand "bleu"
11575 [(use (match_operand 0 "" ""))]
11577 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11579 (define_expand "bltu"
11580 [(use (match_operand 0 "" ""))]
11582 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11584 (define_expand "bunordered"
11585 [(use (match_operand 0 "" ""))]
11586 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11587 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11589 (define_expand "bordered"
11590 [(use (match_operand 0 "" ""))]
11591 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11592 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11594 (define_expand "buneq"
11595 [(use (match_operand 0 "" ""))]
11596 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11597 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11599 (define_expand "bunge"
11600 [(use (match_operand 0 "" ""))]
11601 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11602 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11604 (define_expand "bungt"
11605 [(use (match_operand 0 "" ""))]
11606 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11607 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11609 (define_expand "bunle"
11610 [(use (match_operand 0 "" ""))]
11611 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11612 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11614 (define_expand "bunlt"
11615 [(use (match_operand 0 "" ""))]
11616 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11617 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11619 (define_expand "bltgt"
11620 [(use (match_operand 0 "" ""))]
11622 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11624 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11625 ;; For SEQ, likewise, except that comparisons with zero should be done
11626 ;; with an scc insns. However, due to the order that combine see the
11627 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11628 ;; the cases we don't want to handle.
11629 (define_expand "seq"
11630 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11632 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11634 (define_expand "sne"
11635 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11639 if (! rs6000_compare_fp_p)
11642 rs6000_emit_sCOND (NE, operands[0]);
11646 ;; A >= 0 is best done the portable way for A an integer.
11647 (define_expand "sge"
11648 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11652 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11655 rs6000_emit_sCOND (GE, operands[0]);
11659 ;; A > 0 is best done using the portable sequence, so fail in that case.
11660 (define_expand "sgt"
11661 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11665 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11668 rs6000_emit_sCOND (GT, operands[0]);
11672 ;; A <= 0 is best done the portable way for A an integer.
11673 (define_expand "sle"
11674 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11678 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11681 rs6000_emit_sCOND (LE, operands[0]);
11685 ;; A < 0 is best done in the portable way for A an integer.
11686 (define_expand "slt"
11687 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11691 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11694 rs6000_emit_sCOND (LT, operands[0]);
11698 (define_expand "sgeu"
11699 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11701 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11703 (define_expand "sgtu"
11704 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11706 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11708 (define_expand "sleu"
11709 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11711 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11713 (define_expand "sltu"
11714 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11716 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11718 (define_expand "sunordered"
11719 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11720 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11721 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11723 (define_expand "sordered"
11724 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11725 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11726 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11728 (define_expand "suneq"
11729 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11730 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11731 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11733 (define_expand "sunge"
11734 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11735 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11736 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11738 (define_expand "sungt"
11739 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11740 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11741 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11743 (define_expand "sunle"
11744 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11745 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11746 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11748 (define_expand "sunlt"
11749 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11750 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11751 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11753 (define_expand "sltgt"
11754 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11756 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11758 (define_expand "stack_protect_set"
11759 [(match_operand 0 "memory_operand" "")
11760 (match_operand 1 "memory_operand" "")]
11763 #ifdef TARGET_THREAD_SSP_OFFSET
11764 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11765 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11766 operands[1] = gen_rtx_MEM (Pmode, addr);
11769 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11771 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11775 (define_insn "stack_protect_setsi"
11776 [(set (match_operand:SI 0 "memory_operand" "=m")
11777 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11778 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11780 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11781 [(set_attr "type" "three")
11782 (set_attr "length" "12")])
11784 (define_insn "stack_protect_setdi"
11785 [(set (match_operand:DI 0 "memory_operand" "=m")
11786 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11787 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11789 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11790 [(set_attr "type" "three")
11791 (set_attr "length" "12")])
11793 (define_expand "stack_protect_test"
11794 [(match_operand 0 "memory_operand" "")
11795 (match_operand 1 "memory_operand" "")
11796 (match_operand 2 "" "")]
11799 #ifdef TARGET_THREAD_SSP_OFFSET
11800 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11801 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11802 operands[1] = gen_rtx_MEM (Pmode, addr);
11804 rs6000_compare_op0 = operands[0];
11805 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11807 rs6000_compare_fp_p = 0;
11808 emit_jump_insn (gen_beq (operands[2]));
11812 (define_insn "stack_protect_testsi"
11813 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11814 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11815 (match_operand:SI 2 "memory_operand" "m,m")]
11817 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11818 (clobber (match_scratch:SI 3 "=&r,&r"))]
11821 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11822 {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"
11823 [(set_attr "length" "16,20")])
11825 (define_insn "stack_protect_testdi"
11826 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11827 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11828 (match_operand:DI 2 "memory_operand" "m,m")]
11830 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11831 (clobber (match_scratch:DI 3 "=&r,&r"))]
11834 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11835 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11836 [(set_attr "length" "16,20")])
11839 ;; Here are the actual compare insns.
11840 (define_insn "*cmp<mode>_internal1"
11841 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11842 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11843 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11845 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11846 [(set_attr "type" "cmp")])
11848 ;; If we are comparing a register for equality with a large constant,
11849 ;; we can do this with an XOR followed by a compare. But this is profitable
11850 ;; only if the large constant is only used for the comparison (and in this
11851 ;; case we already have a register to reuse as scratch).
11853 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11854 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11857 [(set (match_operand:SI 0 "register_operand")
11858 (match_operand:SI 1 "logical_const_operand" ""))
11859 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11861 (match_operand:SI 2 "logical_const_operand" "")]))
11862 (set (match_operand:CC 4 "cc_reg_operand" "")
11863 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11866 (if_then_else (match_operator 6 "equality_operator"
11867 [(match_dup 4) (const_int 0)])
11868 (match_operand 7 "" "")
11869 (match_operand 8 "" "")))]
11870 "peep2_reg_dead_p (3, operands[0])
11871 && peep2_reg_dead_p (4, operands[4])"
11872 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11873 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11874 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11877 /* Get the constant we are comparing against, and see what it looks like
11878 when sign-extended from 16 to 32 bits. Then see what constant we could
11879 XOR with SEXTC to get the sign-extended value. */
11880 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11882 operands[1], operands[2]);
11883 HOST_WIDE_INT c = INTVAL (cnst);
11884 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11885 HOST_WIDE_INT xorv = c ^ sextc;
11887 operands[9] = GEN_INT (xorv);
11888 operands[10] = GEN_INT (sextc);
11891 (define_insn "*cmpsi_internal2"
11892 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11893 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11894 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11896 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11897 [(set_attr "type" "cmp")])
11899 (define_insn "*cmpdi_internal2"
11900 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11901 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11902 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11904 "cmpld%I2 %0,%1,%b2"
11905 [(set_attr "type" "cmp")])
11907 ;; The following two insns don't exist as single insns, but if we provide
11908 ;; them, we can swap an add and compare, which will enable us to overlap more
11909 ;; of the required delay between a compare and branch. We generate code for
11910 ;; them by splitting.
11913 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11914 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11915 (match_operand:SI 2 "short_cint_operand" "i")))
11916 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11917 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11920 [(set_attr "length" "8")])
11923 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11924 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11925 (match_operand:SI 2 "u_short_cint_operand" "i")))
11926 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11927 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11930 [(set_attr "length" "8")])
11933 [(set (match_operand:CC 3 "cc_reg_operand" "")
11934 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11935 (match_operand:SI 2 "short_cint_operand" "")))
11936 (set (match_operand:SI 0 "gpc_reg_operand" "")
11937 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11939 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11940 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11943 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11944 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11945 (match_operand:SI 2 "u_short_cint_operand" "")))
11946 (set (match_operand:SI 0 "gpc_reg_operand" "")
11947 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11949 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11950 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11952 (define_insn "*cmpsf_internal1"
11953 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11954 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11955 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11956 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
11958 [(set_attr "type" "fpcompare")])
11960 (define_insn "*cmpdf_internal1"
11961 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11962 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11963 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11964 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
11966 [(set_attr "type" "fpcompare")])
11968 ;; Only need to compare second words if first words equal
11969 (define_insn "*cmptf_internal1"
11970 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11971 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11972 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11973 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11974 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11975 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11976 [(set_attr "type" "fpcompare")
11977 (set_attr "length" "12")])
11979 (define_insn_and_split "*cmptf_internal2"
11980 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11981 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11982 (match_operand:TF 2 "gpc_reg_operand" "f")))
11983 (clobber (match_scratch:DF 3 "=f"))
11984 (clobber (match_scratch:DF 4 "=f"))
11985 (clobber (match_scratch:DF 5 "=f"))
11986 (clobber (match_scratch:DF 6 "=f"))
11987 (clobber (match_scratch:DF 7 "=f"))
11988 (clobber (match_scratch:DF 8 "=f"))
11989 (clobber (match_scratch:DF 9 "=f"))
11990 (clobber (match_scratch:DF 10 "=f"))]
11991 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11992 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11994 "&& reload_completed"
11995 [(set (match_dup 3) (match_dup 13))
11996 (set (match_dup 4) (match_dup 14))
11997 (set (match_dup 9) (abs:DF (match_dup 5)))
11998 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11999 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12000 (label_ref (match_dup 11))
12002 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12003 (set (pc) (label_ref (match_dup 12)))
12005 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12006 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12007 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12008 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
12011 REAL_VALUE_TYPE rv;
12012 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12013 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12015 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12016 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12017 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12018 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12019 operands[11] = gen_label_rtx ();
12020 operands[12] = gen_label_rtx ();
12022 operands[13] = force_const_mem (DFmode,
12023 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12024 operands[14] = force_const_mem (DFmode,
12025 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12029 operands[13] = gen_const_mem (DFmode,
12030 create_TOC_reference (XEXP (operands[13], 0)));
12031 operands[14] = gen_const_mem (DFmode,
12032 create_TOC_reference (XEXP (operands[14], 0)));
12033 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12034 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12038 ;; Now we have the scc insns. We can do some combinations because of the
12039 ;; way the machine works.
12041 ;; Note that this is probably faster if we can put an insn between the
12042 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12043 ;; cases the insns below which don't use an intermediate CR field will
12044 ;; be used instead.
12046 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12047 (match_operator:SI 1 "scc_comparison_operator"
12048 [(match_operand 2 "cc_reg_operand" "y")
12051 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12052 [(set (attr "type")
12053 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12054 (const_string "mfcrf")
12056 (const_string "mfcr")))
12057 (set_attr "length" "8")])
12059 ;; Same as above, but get the GT bit.
12060 (define_insn "move_from_CR_gt_bit"
12061 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12062 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12064 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12065 [(set_attr "type" "mfcr")
12066 (set_attr "length" "8")])
12068 ;; Same as above, but get the OV/ORDERED bit.
12069 (define_insn "move_from_CR_ov_bit"
12070 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12071 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12073 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12074 [(set_attr "type" "mfcr")
12075 (set_attr "length" "8")])
12078 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12079 (match_operator:DI 1 "scc_comparison_operator"
12080 [(match_operand 2 "cc_reg_operand" "y")
12083 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12084 [(set (attr "type")
12085 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12086 (const_string "mfcrf")
12088 (const_string "mfcr")))
12089 (set_attr "length" "8")])
12092 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12093 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12094 [(match_operand 2 "cc_reg_operand" "y,y")
12097 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12098 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12101 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12103 [(set_attr "type" "delayed_compare")
12104 (set_attr "length" "8,16")])
12107 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12108 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12109 [(match_operand 2 "cc_reg_operand" "")
12112 (set (match_operand:SI 3 "gpc_reg_operand" "")
12113 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12114 "TARGET_32BIT && reload_completed"
12115 [(set (match_dup 3)
12116 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12118 (compare:CC (match_dup 3)
12123 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12124 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12125 [(match_operand 2 "cc_reg_operand" "y")
12127 (match_operand:SI 3 "const_int_operand" "n")))]
12131 int is_bit = ccr_bit (operands[1], 1);
12132 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12135 if (is_bit >= put_bit)
12136 count = is_bit - put_bit;
12138 count = 32 - (put_bit - is_bit);
12140 operands[4] = GEN_INT (count);
12141 operands[5] = GEN_INT (put_bit);
12143 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12145 [(set (attr "type")
12146 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12147 (const_string "mfcrf")
12149 (const_string "mfcr")))
12150 (set_attr "length" "8")])
12153 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12155 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12156 [(match_operand 2 "cc_reg_operand" "y,y")
12158 (match_operand:SI 3 "const_int_operand" "n,n"))
12160 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12161 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12166 int is_bit = ccr_bit (operands[1], 1);
12167 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12170 /* Force split for non-cc0 compare. */
12171 if (which_alternative == 1)
12174 if (is_bit >= put_bit)
12175 count = is_bit - put_bit;
12177 count = 32 - (put_bit - is_bit);
12179 operands[5] = GEN_INT (count);
12180 operands[6] = GEN_INT (put_bit);
12182 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
12184 [(set_attr "type" "delayed_compare")
12185 (set_attr "length" "8,16")])
12188 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12190 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12191 [(match_operand 2 "cc_reg_operand" "")
12193 (match_operand:SI 3 "const_int_operand" ""))
12195 (set (match_operand:SI 4 "gpc_reg_operand" "")
12196 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12199 [(set (match_dup 4)
12200 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12203 (compare:CC (match_dup 4)
12207 ;; There is a 3 cycle delay between consecutive mfcr instructions
12208 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12211 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12212 (match_operator:SI 1 "scc_comparison_operator"
12213 [(match_operand 2 "cc_reg_operand" "y")
12215 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12216 (match_operator:SI 4 "scc_comparison_operator"
12217 [(match_operand 5 "cc_reg_operand" "y")
12219 "REGNO (operands[2]) != REGNO (operands[5])"
12220 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12221 [(set_attr "type" "mfcr")
12222 (set_attr "length" "12")])
12225 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12226 (match_operator:DI 1 "scc_comparison_operator"
12227 [(match_operand 2 "cc_reg_operand" "y")
12229 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12230 (match_operator:DI 4 "scc_comparison_operator"
12231 [(match_operand 5 "cc_reg_operand" "y")
12233 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12234 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12235 [(set_attr "type" "mfcr")
12236 (set_attr "length" "12")])
12238 ;; There are some scc insns that can be done directly, without a compare.
12239 ;; These are faster because they don't involve the communications between
12240 ;; the FXU and branch units. In fact, we will be replacing all of the
12241 ;; integer scc insns here or in the portable methods in emit_store_flag.
12243 ;; Also support (neg (scc ..)) since that construct is used to replace
12244 ;; branches, (plus (scc ..) ..) since that construct is common and
12245 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12246 ;; cases where it is no more expensive than (neg (scc ..)).
12248 ;; Have reload force a constant into a register for the simple insns that
12249 ;; otherwise won't accept constants. We do this because it is faster than
12250 ;; the cmp/mfcr sequence we would otherwise generate.
12252 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12255 (define_insn_and_split "*eq<mode>"
12256 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12257 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12258 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12262 [(set (match_dup 0)
12263 (clz:GPR (match_dup 3)))
12265 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12267 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12269 /* Use output operand as intermediate. */
12270 operands[3] = operands[0];
12272 if (logical_operand (operands[2], <MODE>mode))
12273 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12274 gen_rtx_XOR (<MODE>mode,
12275 operands[1], operands[2])));
12277 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12278 gen_rtx_PLUS (<MODE>mode, operands[1],
12279 negate_rtx (<MODE>mode,
12283 operands[3] = operands[1];
12285 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12288 (define_insn_and_split "*eq<mode>_compare"
12289 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12291 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12292 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12294 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12295 (eq:P (match_dup 1) (match_dup 2)))]
12296 "!TARGET_POWER && optimize_size"
12298 "!TARGET_POWER && optimize_size"
12299 [(set (match_dup 0)
12300 (clz:P (match_dup 4)))
12301 (parallel [(set (match_dup 3)
12302 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12305 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12307 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12309 /* Use output operand as intermediate. */
12310 operands[4] = operands[0];
12312 if (logical_operand (operands[2], <MODE>mode))
12313 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12314 gen_rtx_XOR (<MODE>mode,
12315 operands[1], operands[2])));
12317 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12318 gen_rtx_PLUS (<MODE>mode, operands[1],
12319 negate_rtx (<MODE>mode,
12323 operands[4] = operands[1];
12325 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12328 (define_insn "*eqsi_power"
12329 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12330 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12331 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
12332 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
12335 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12336 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
12337 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12338 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12339 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
12340 [(set_attr "type" "three,two,three,three,three")
12341 (set_attr "length" "12,8,12,12,12")])
12343 ;; We have insns of the form shown by the first define_insn below. If
12344 ;; there is something inside the comparison operation, we must split it.
12346 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12347 (plus:SI (match_operator 1 "comparison_operator"
12348 [(match_operand:SI 2 "" "")
12349 (match_operand:SI 3
12350 "reg_or_cint_operand" "")])
12351 (match_operand:SI 4 "gpc_reg_operand" "")))
12352 (clobber (match_operand:SI 5 "register_operand" ""))]
12353 "! gpc_reg_operand (operands[2], SImode)"
12354 [(set (match_dup 5) (match_dup 2))
12355 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
12358 (define_insn "*plus_eqsi"
12359 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12360 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12361 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12362 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12365 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12366 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
12367 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12368 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12369 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12370 [(set_attr "type" "three,two,three,three,three")
12371 (set_attr "length" "12,8,12,12,12")])
12373 (define_insn "*compare_plus_eqsi"
12374 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12377 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12378 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12379 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12381 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12382 "TARGET_32BIT && optimize_size"
12384 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12385 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12386 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12387 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12388 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12394 [(set_attr "type" "compare")
12395 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12398 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12401 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12402 (match_operand:SI 2 "scc_eq_operand" ""))
12403 (match_operand:SI 3 "gpc_reg_operand" ""))
12405 (clobber (match_scratch:SI 4 ""))]
12406 "TARGET_32BIT && optimize_size && reload_completed"
12407 [(set (match_dup 4)
12408 (plus:SI (eq:SI (match_dup 1)
12412 (compare:CC (match_dup 4)
12416 (define_insn "*plus_eqsi_compare"
12417 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12420 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12421 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12422 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12424 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12425 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12426 "TARGET_32BIT && optimize_size"
12428 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12429 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12430 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12431 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12432 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12438 [(set_attr "type" "compare")
12439 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12442 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12445 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12446 (match_operand:SI 2 "scc_eq_operand" ""))
12447 (match_operand:SI 3 "gpc_reg_operand" ""))
12449 (set (match_operand:SI 0 "gpc_reg_operand" "")
12450 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12451 "TARGET_32BIT && optimize_size && reload_completed"
12452 [(set (match_dup 0)
12453 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12455 (compare:CC (match_dup 0)
12459 (define_insn "*neg_eq0<mode>"
12460 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12461 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12464 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12465 [(set_attr "type" "two")
12466 (set_attr "length" "8")])
12468 (define_insn_and_split "*neg_eq<mode>"
12469 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12470 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12471 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12475 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12477 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12479 /* Use output operand as intermediate. */
12480 operands[3] = operands[0];
12482 if (logical_operand (operands[2], <MODE>mode))
12483 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12484 gen_rtx_XOR (<MODE>mode,
12485 operands[1], operands[2])));
12487 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12488 gen_rtx_PLUS (<MODE>mode, operands[1],
12489 negate_rtx (<MODE>mode,
12493 operands[3] = operands[1];
12496 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12497 ;; since it nabs/sr is just as fast.
12498 (define_insn "*ne0si"
12499 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12500 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12502 (clobber (match_scratch:SI 2 "=&r"))]
12503 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12504 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12505 [(set_attr "type" "two")
12506 (set_attr "length" "8")])
12508 (define_insn "*ne0di"
12509 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12510 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12512 (clobber (match_scratch:DI 2 "=&r"))]
12514 "addic %2,%1,-1\;subfe %0,%2,%1"
12515 [(set_attr "type" "two")
12516 (set_attr "length" "8")])
12518 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12519 (define_insn "*plus_ne0si"
12520 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12521 (plus:SI (lshiftrt:SI
12522 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12524 (match_operand:SI 2 "gpc_reg_operand" "r")))
12525 (clobber (match_scratch:SI 3 "=&r"))]
12527 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12528 [(set_attr "type" "two")
12529 (set_attr "length" "8")])
12531 (define_insn "*plus_ne0di"
12532 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12533 (plus:DI (lshiftrt:DI
12534 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12536 (match_operand:DI 2 "gpc_reg_operand" "r")))
12537 (clobber (match_scratch:DI 3 "=&r"))]
12539 "addic %3,%1,-1\;addze %0,%2"
12540 [(set_attr "type" "two")
12541 (set_attr "length" "8")])
12543 (define_insn "*compare_plus_ne0si"
12544 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12546 (plus:SI (lshiftrt:SI
12547 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12549 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12551 (clobber (match_scratch:SI 3 "=&r,&r"))
12552 (clobber (match_scratch:SI 4 "=X,&r"))]
12555 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12557 [(set_attr "type" "compare")
12558 (set_attr "length" "8,12")])
12561 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12563 (plus:SI (lshiftrt:SI
12564 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12566 (match_operand:SI 2 "gpc_reg_operand" ""))
12568 (clobber (match_scratch:SI 3 ""))
12569 (clobber (match_scratch:SI 4 ""))]
12570 "TARGET_32BIT && reload_completed"
12571 [(parallel [(set (match_dup 3)
12572 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12575 (clobber (match_dup 4))])
12577 (compare:CC (match_dup 3)
12581 (define_insn "*compare_plus_ne0di"
12582 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12584 (plus:DI (lshiftrt:DI
12585 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12587 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12589 (clobber (match_scratch:DI 3 "=&r,&r"))]
12592 addic %3,%1,-1\;addze. %3,%2
12594 [(set_attr "type" "compare")
12595 (set_attr "length" "8,12")])
12598 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12600 (plus:DI (lshiftrt:DI
12601 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12603 (match_operand:DI 2 "gpc_reg_operand" ""))
12605 (clobber (match_scratch:DI 3 ""))]
12606 "TARGET_64BIT && reload_completed"
12607 [(set (match_dup 3)
12608 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12612 (compare:CC (match_dup 3)
12616 (define_insn "*plus_ne0si_compare"
12617 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12619 (plus:SI (lshiftrt:SI
12620 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12622 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12624 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12625 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12627 (clobber (match_scratch:SI 3 "=&r,&r"))]
12630 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12632 [(set_attr "type" "compare")
12633 (set_attr "length" "8,12")])
12636 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12638 (plus:SI (lshiftrt:SI
12639 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12641 (match_operand:SI 2 "gpc_reg_operand" ""))
12643 (set (match_operand:SI 0 "gpc_reg_operand" "")
12644 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12646 (clobber (match_scratch:SI 3 ""))]
12647 "TARGET_32BIT && reload_completed"
12648 [(parallel [(set (match_dup 0)
12649 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12651 (clobber (match_dup 3))])
12653 (compare:CC (match_dup 0)
12657 (define_insn "*plus_ne0di_compare"
12658 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12660 (plus:DI (lshiftrt:DI
12661 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12663 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12665 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12666 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12668 (clobber (match_scratch:DI 3 "=&r,&r"))]
12671 addic %3,%1,-1\;addze. %0,%2
12673 [(set_attr "type" "compare")
12674 (set_attr "length" "8,12")])
12677 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12679 (plus:DI (lshiftrt:DI
12680 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12682 (match_operand:DI 2 "gpc_reg_operand" ""))
12684 (set (match_operand:DI 0 "gpc_reg_operand" "")
12685 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12687 (clobber (match_scratch:DI 3 ""))]
12688 "TARGET_64BIT && reload_completed"
12689 [(parallel [(set (match_dup 0)
12690 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12692 (clobber (match_dup 3))])
12694 (compare:CC (match_dup 0)
12699 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12700 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12701 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12702 (clobber (match_scratch:SI 3 "=r,X"))]
12705 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12706 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12707 [(set_attr "length" "12")])
12710 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12712 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12713 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12715 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12716 (le:SI (match_dup 1) (match_dup 2)))
12717 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12720 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12721 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12724 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12725 (set_attr "length" "12,12,16,16")])
12728 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12730 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12731 (match_operand:SI 2 "reg_or_short_operand" ""))
12733 (set (match_operand:SI 0 "gpc_reg_operand" "")
12734 (le:SI (match_dup 1) (match_dup 2)))
12735 (clobber (match_scratch:SI 3 ""))]
12736 "TARGET_POWER && reload_completed"
12737 [(parallel [(set (match_dup 0)
12738 (le:SI (match_dup 1) (match_dup 2)))
12739 (clobber (match_dup 3))])
12741 (compare:CC (match_dup 0)
12746 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12747 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12748 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12749 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12752 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12753 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12754 [(set_attr "length" "12")])
12757 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12759 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12760 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12761 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12763 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12766 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12767 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12770 [(set_attr "type" "compare")
12771 (set_attr "length" "12,12,16,16")])
12774 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12776 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12777 (match_operand:SI 2 "reg_or_short_operand" ""))
12778 (match_operand:SI 3 "gpc_reg_operand" ""))
12780 (clobber (match_scratch:SI 4 ""))]
12781 "TARGET_POWER && reload_completed"
12782 [(set (match_dup 4)
12783 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12786 (compare:CC (match_dup 4)
12791 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12793 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12794 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12795 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12797 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12798 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12801 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12802 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12805 [(set_attr "type" "compare")
12806 (set_attr "length" "12,12,16,16")])
12809 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12811 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12812 (match_operand:SI 2 "reg_or_short_operand" ""))
12813 (match_operand:SI 3 "gpc_reg_operand" ""))
12815 (set (match_operand:SI 0 "gpc_reg_operand" "")
12816 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12817 "TARGET_POWER && reload_completed"
12818 [(set (match_dup 0)
12819 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12821 (compare:CC (match_dup 0)
12826 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12827 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12828 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12831 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12832 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12833 [(set_attr "length" "12")])
12835 (define_insn "*leu<mode>"
12836 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12837 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12838 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12840 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12841 [(set_attr "type" "three")
12842 (set_attr "length" "12")])
12844 (define_insn "*leu<mode>_compare"
12845 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12847 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12848 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12850 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12851 (leu:P (match_dup 1) (match_dup 2)))]
12854 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12856 [(set_attr "type" "compare")
12857 (set_attr "length" "12,16")])
12860 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12862 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12863 (match_operand:P 2 "reg_or_short_operand" ""))
12865 (set (match_operand:P 0 "gpc_reg_operand" "")
12866 (leu:P (match_dup 1) (match_dup 2)))]
12868 [(set (match_dup 0)
12869 (leu:P (match_dup 1) (match_dup 2)))
12871 (compare:CC (match_dup 0)
12875 (define_insn "*plus_leu<mode>"
12876 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12877 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12878 (match_operand:P 2 "reg_or_short_operand" "rI"))
12879 (match_operand:P 3 "gpc_reg_operand" "r")))]
12881 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12882 [(set_attr "type" "two")
12883 (set_attr "length" "8")])
12886 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12888 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12889 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12890 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12892 (clobber (match_scratch:SI 4 "=&r,&r"))]
12895 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12897 [(set_attr "type" "compare")
12898 (set_attr "length" "8,12")])
12901 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12903 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12904 (match_operand:SI 2 "reg_or_short_operand" ""))
12905 (match_operand:SI 3 "gpc_reg_operand" ""))
12907 (clobber (match_scratch:SI 4 ""))]
12908 "TARGET_32BIT && reload_completed"
12909 [(set (match_dup 4)
12910 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12913 (compare:CC (match_dup 4)
12918 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12920 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12921 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12922 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12924 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12925 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12928 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12930 [(set_attr "type" "compare")
12931 (set_attr "length" "8,12")])
12934 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12936 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12937 (match_operand:SI 2 "reg_or_short_operand" ""))
12938 (match_operand:SI 3 "gpc_reg_operand" ""))
12940 (set (match_operand:SI 0 "gpc_reg_operand" "")
12941 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12942 "TARGET_32BIT && reload_completed"
12943 [(set (match_dup 0)
12944 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12946 (compare:CC (match_dup 0)
12950 (define_insn "*neg_leu<mode>"
12951 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12952 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12953 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12955 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12956 [(set_attr "type" "three")
12957 (set_attr "length" "12")])
12959 (define_insn "*and_neg_leu<mode>"
12960 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12962 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12963 (match_operand:P 2 "reg_or_short_operand" "rI")))
12964 (match_operand:P 3 "gpc_reg_operand" "r")))]
12966 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12967 [(set_attr "type" "three")
12968 (set_attr "length" "12")])
12971 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12974 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12975 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12976 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12978 (clobber (match_scratch:SI 4 "=&r,&r"))]
12981 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12983 [(set_attr "type" "compare")
12984 (set_attr "length" "12,16")])
12987 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12990 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12991 (match_operand:SI 2 "reg_or_short_operand" "")))
12992 (match_operand:SI 3 "gpc_reg_operand" ""))
12994 (clobber (match_scratch:SI 4 ""))]
12995 "TARGET_32BIT && reload_completed"
12996 [(set (match_dup 4)
12997 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13000 (compare:CC (match_dup 4)
13005 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13008 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13009 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13010 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13012 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13013 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13016 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13018 [(set_attr "type" "compare")
13019 (set_attr "length" "12,16")])
13022 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13025 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13026 (match_operand:SI 2 "reg_or_short_operand" "")))
13027 (match_operand:SI 3 "gpc_reg_operand" ""))
13029 (set (match_operand:SI 0 "gpc_reg_operand" "")
13030 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13031 "TARGET_32BIT && reload_completed"
13032 [(set (match_dup 0)
13033 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13036 (compare:CC (match_dup 0)
13041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13042 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13043 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13045 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13046 [(set_attr "length" "12")])
13049 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13051 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13052 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13054 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13055 (lt:SI (match_dup 1) (match_dup 2)))]
13058 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13060 [(set_attr "type" "delayed_compare")
13061 (set_attr "length" "12,16")])
13064 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13066 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13067 (match_operand:SI 2 "reg_or_short_operand" ""))
13069 (set (match_operand:SI 0 "gpc_reg_operand" "")
13070 (lt:SI (match_dup 1) (match_dup 2)))]
13071 "TARGET_POWER && reload_completed"
13072 [(set (match_dup 0)
13073 (lt:SI (match_dup 1) (match_dup 2)))
13075 (compare:CC (match_dup 0)
13080 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13081 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13082 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13083 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13085 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13086 [(set_attr "length" "12")])
13089 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13091 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13092 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13093 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13095 (clobber (match_scratch:SI 4 "=&r,&r"))]
13098 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13100 [(set_attr "type" "compare")
13101 (set_attr "length" "12,16")])
13104 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13106 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13107 (match_operand:SI 2 "reg_or_short_operand" ""))
13108 (match_operand:SI 3 "gpc_reg_operand" ""))
13110 (clobber (match_scratch:SI 4 ""))]
13111 "TARGET_POWER && reload_completed"
13112 [(set (match_dup 4)
13113 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13116 (compare:CC (match_dup 4)
13121 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13123 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13124 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13125 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13127 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13128 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13131 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13133 [(set_attr "type" "compare")
13134 (set_attr "length" "12,16")])
13137 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13139 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13140 (match_operand:SI 2 "reg_or_short_operand" ""))
13141 (match_operand:SI 3 "gpc_reg_operand" ""))
13143 (set (match_operand:SI 0 "gpc_reg_operand" "")
13144 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13145 "TARGET_POWER && reload_completed"
13146 [(set (match_dup 0)
13147 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13149 (compare:CC (match_dup 0)
13154 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13155 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13156 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13158 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13159 [(set_attr "length" "12")])
13161 (define_insn_and_split "*ltu<mode>"
13162 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13163 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13164 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13168 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13169 (set (match_dup 0) (neg:P (match_dup 0)))]
13172 (define_insn_and_split "*ltu<mode>_compare"
13173 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13175 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13176 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13178 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13179 (ltu:P (match_dup 1) (match_dup 2)))]
13183 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13184 (parallel [(set (match_dup 3)
13185 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13186 (set (match_dup 0) (neg:P (match_dup 0)))])]
13189 (define_insn_and_split "*plus_ltu<mode>"
13190 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13191 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13192 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13193 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13196 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13197 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13198 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13201 (define_insn_and_split "*plus_ltu<mode>_compare"
13202 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13204 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13205 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13206 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13208 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13209 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13212 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13213 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13214 (parallel [(set (match_dup 4)
13215 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13217 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13220 (define_insn "*neg_ltu<mode>"
13221 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13222 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13223 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13226 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
13227 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
13228 [(set_attr "type" "two")
13229 (set_attr "length" "8")])
13232 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13233 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13234 (match_operand:SI 2 "reg_or_short_operand" "rI")))
13235 (clobber (match_scratch:SI 3 "=r"))]
13237 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
13238 [(set_attr "length" "12")])
13241 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13243 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13244 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13246 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13247 (ge:SI (match_dup 1) (match_dup 2)))
13248 (clobber (match_scratch:SI 3 "=r,r"))]
13251 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13253 [(set_attr "type" "compare")
13254 (set_attr "length" "12,16")])
13257 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13259 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13260 (match_operand:SI 2 "reg_or_short_operand" ""))
13262 (set (match_operand:SI 0 "gpc_reg_operand" "")
13263 (ge:SI (match_dup 1) (match_dup 2)))
13264 (clobber (match_scratch:SI 3 ""))]
13265 "TARGET_POWER && reload_completed"
13266 [(parallel [(set (match_dup 0)
13267 (ge:SI (match_dup 1) (match_dup 2)))
13268 (clobber (match_dup 3))])
13270 (compare:CC (match_dup 0)
13275 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13276 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13277 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13278 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13280 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13281 [(set_attr "length" "12")])
13284 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13286 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13287 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13288 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13290 (clobber (match_scratch:SI 4 "=&r,&r"))]
13293 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13295 [(set_attr "type" "compare")
13296 (set_attr "length" "12,16")])
13299 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13301 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13302 (match_operand:SI 2 "reg_or_short_operand" ""))
13303 (match_operand:SI 3 "gpc_reg_operand" ""))
13305 (clobber (match_scratch:SI 4 ""))]
13306 "TARGET_POWER && reload_completed"
13307 [(set (match_dup 4)
13308 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13311 (compare:CC (match_dup 4)
13316 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13318 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13319 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13320 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13322 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13323 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13326 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13328 [(set_attr "type" "compare")
13329 (set_attr "length" "12,16")])
13332 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13334 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13335 (match_operand:SI 2 "reg_or_short_operand" ""))
13336 (match_operand:SI 3 "gpc_reg_operand" ""))
13338 (set (match_operand:SI 0 "gpc_reg_operand" "")
13339 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13340 "TARGET_POWER && reload_completed"
13341 [(set (match_dup 0)
13342 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13344 (compare:CC (match_dup 0)
13349 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13350 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13351 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13353 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13354 [(set_attr "length" "12")])
13356 (define_insn "*geu<mode>"
13357 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13358 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13359 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13362 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13363 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13364 [(set_attr "type" "three")
13365 (set_attr "length" "12")])
13367 (define_insn "*geu<mode>_compare"
13368 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13370 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13371 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13373 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13374 (geu:P (match_dup 1) (match_dup 2)))]
13377 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13378 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13381 [(set_attr "type" "compare")
13382 (set_attr "length" "12,12,16,16")])
13385 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13387 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13388 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13390 (set (match_operand:P 0 "gpc_reg_operand" "")
13391 (geu:P (match_dup 1) (match_dup 2)))]
13393 [(set (match_dup 0)
13394 (geu:P (match_dup 1) (match_dup 2)))
13396 (compare:CC (match_dup 0)
13400 (define_insn "*plus_geu<mode>"
13401 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13402 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13403 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13404 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13407 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13408 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13409 [(set_attr "type" "two")
13410 (set_attr "length" "8")])
13413 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13415 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13416 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13417 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13419 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13422 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13423 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13426 [(set_attr "type" "compare")
13427 (set_attr "length" "8,8,12,12")])
13430 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13432 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13433 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13434 (match_operand:SI 3 "gpc_reg_operand" ""))
13436 (clobber (match_scratch:SI 4 ""))]
13437 "TARGET_32BIT && reload_completed"
13438 [(set (match_dup 4)
13439 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13442 (compare:CC (match_dup 4)
13447 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13449 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13450 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13451 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13453 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13454 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13457 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13458 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13461 [(set_attr "type" "compare")
13462 (set_attr "length" "8,8,12,12")])
13465 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13467 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13468 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13469 (match_operand:SI 3 "gpc_reg_operand" ""))
13471 (set (match_operand:SI 0 "gpc_reg_operand" "")
13472 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13473 "TARGET_32BIT && reload_completed"
13474 [(set (match_dup 0)
13475 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13477 (compare:CC (match_dup 0)
13481 (define_insn "*neg_geu<mode>"
13482 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13483 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13484 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13487 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13488 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13489 [(set_attr "type" "three")
13490 (set_attr "length" "12")])
13492 (define_insn "*and_neg_geu<mode>"
13493 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13495 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13496 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13497 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13500 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13501 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13502 [(set_attr "type" "three")
13503 (set_attr "length" "12")])
13506 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13509 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13510 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13511 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13513 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13516 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13517 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13520 [(set_attr "type" "compare")
13521 (set_attr "length" "12,12,16,16")])
13524 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13527 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13528 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13529 (match_operand:SI 3 "gpc_reg_operand" ""))
13531 (clobber (match_scratch:SI 4 ""))]
13532 "TARGET_32BIT && reload_completed"
13533 [(set (match_dup 4)
13534 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13537 (compare:CC (match_dup 4)
13542 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13545 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13546 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13547 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13549 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13550 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13553 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13554 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13557 [(set_attr "type" "compare")
13558 (set_attr "length" "12,12,16,16")])
13561 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13564 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13565 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13566 (match_operand:SI 3 "gpc_reg_operand" ""))
13568 (set (match_operand:SI 0 "gpc_reg_operand" "")
13569 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13570 "TARGET_32BIT && reload_completed"
13571 [(set (match_dup 0)
13572 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13574 (compare:CC (match_dup 0)
13579 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13580 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13581 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13583 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13584 [(set_attr "length" "12")])
13587 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13589 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13590 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13592 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13593 (gt:SI (match_dup 1) (match_dup 2)))]
13596 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13598 [(set_attr "type" "delayed_compare")
13599 (set_attr "length" "12,16")])
13602 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13604 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13605 (match_operand:SI 2 "reg_or_short_operand" ""))
13607 (set (match_operand:SI 0 "gpc_reg_operand" "")
13608 (gt:SI (match_dup 1) (match_dup 2)))]
13609 "TARGET_POWER && reload_completed"
13610 [(set (match_dup 0)
13611 (gt:SI (match_dup 1) (match_dup 2)))
13613 (compare:CC (match_dup 0)
13617 (define_insn "*plus_gt0<mode>"
13618 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13619 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13621 (match_operand:P 2 "gpc_reg_operand" "r")))]
13623 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13624 [(set_attr "type" "three")
13625 (set_attr "length" "12")])
13628 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13630 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13632 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13634 (clobber (match_scratch:SI 3 "=&r,&r"))]
13637 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13639 [(set_attr "type" "compare")
13640 (set_attr "length" "12,16")])
13643 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13645 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13647 (match_operand:SI 2 "gpc_reg_operand" ""))
13649 (clobber (match_scratch:SI 3 ""))]
13650 "TARGET_32BIT && reload_completed"
13651 [(set (match_dup 3)
13652 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13655 (compare:CC (match_dup 3)
13660 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13662 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13664 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13666 (clobber (match_scratch:DI 3 "=&r,&r"))]
13669 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13671 [(set_attr "type" "compare")
13672 (set_attr "length" "12,16")])
13675 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13677 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13679 (match_operand:DI 2 "gpc_reg_operand" ""))
13681 (clobber (match_scratch:DI 3 ""))]
13682 "TARGET_64BIT && reload_completed"
13683 [(set (match_dup 3)
13684 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13687 (compare:CC (match_dup 3)
13692 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13694 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13696 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13698 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13699 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13702 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13704 [(set_attr "type" "compare")
13705 (set_attr "length" "12,16")])
13708 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13710 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13712 (match_operand:SI 2 "gpc_reg_operand" ""))
13714 (set (match_operand:SI 0 "gpc_reg_operand" "")
13715 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13716 "TARGET_32BIT && reload_completed"
13717 [(set (match_dup 0)
13718 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13720 (compare:CC (match_dup 0)
13725 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13727 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13729 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13731 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13732 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13735 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13737 [(set_attr "type" "compare")
13738 (set_attr "length" "12,16")])
13741 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13743 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13745 (match_operand:DI 2 "gpc_reg_operand" ""))
13747 (set (match_operand:DI 0 "gpc_reg_operand" "")
13748 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13749 "TARGET_64BIT && reload_completed"
13750 [(set (match_dup 0)
13751 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13753 (compare:CC (match_dup 0)
13758 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13759 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13760 (match_operand:SI 2 "reg_or_short_operand" "r"))
13761 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13763 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13764 [(set_attr "length" "12")])
13767 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13769 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13770 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13771 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13773 (clobber (match_scratch:SI 4 "=&r,&r"))]
13776 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13778 [(set_attr "type" "compare")
13779 (set_attr "length" "12,16")])
13782 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13784 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13785 (match_operand:SI 2 "reg_or_short_operand" ""))
13786 (match_operand:SI 3 "gpc_reg_operand" ""))
13788 (clobber (match_scratch:SI 4 ""))]
13789 "TARGET_POWER && reload_completed"
13790 [(set (match_dup 4)
13791 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13793 (compare:CC (match_dup 4)
13798 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13800 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13801 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13802 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13804 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13805 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13808 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13810 [(set_attr "type" "compare")
13811 (set_attr "length" "12,16")])
13814 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13816 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13817 (match_operand:SI 2 "reg_or_short_operand" ""))
13818 (match_operand:SI 3 "gpc_reg_operand" ""))
13820 (set (match_operand:SI 0 "gpc_reg_operand" "")
13821 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13822 "TARGET_POWER && reload_completed"
13823 [(set (match_dup 0)
13824 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13826 (compare:CC (match_dup 0)
13831 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13832 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13833 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13835 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13836 [(set_attr "length" "12")])
13838 (define_insn_and_split "*gtu<mode>"
13839 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13840 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13841 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13845 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13846 (set (match_dup 0) (neg:P (match_dup 0)))]
13849 (define_insn_and_split "*gtu<mode>_compare"
13850 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13852 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13853 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13855 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13856 (gtu:P (match_dup 1) (match_dup 2)))]
13860 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13861 (parallel [(set (match_dup 3)
13862 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13863 (set (match_dup 0) (neg:P (match_dup 0)))])]
13866 (define_insn_and_split "*plus_gtu<mode>"
13867 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13868 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13869 (match_operand:P 2 "reg_or_short_operand" "rI"))
13870 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13873 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13874 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13875 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13878 (define_insn_and_split "*plus_gtu<mode>_compare"
13879 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13881 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13882 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13883 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13885 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13886 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13889 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13890 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13891 (parallel [(set (match_dup 4)
13892 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13894 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13897 (define_insn "*neg_gtu<mode>"
13898 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13899 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13900 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13902 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13903 [(set_attr "type" "two")
13904 (set_attr "length" "8")])
13907 ;; Define both directions of branch and return. If we need a reload
13908 ;; register, we'd rather use CR0 since it is much easier to copy a
13909 ;; register CC value to there.
13913 (if_then_else (match_operator 1 "branch_comparison_operator"
13915 "cc_reg_operand" "y")
13917 (label_ref (match_operand 0 "" ""))
13922 return output_cbranch (operands[1], \"%l0\", 0, insn);
13924 [(set_attr "type" "branch")])
13928 (if_then_else (match_operator 0 "branch_comparison_operator"
13930 "cc_reg_operand" "y")
13937 return output_cbranch (operands[0], NULL, 0, insn);
13939 [(set_attr "type" "jmpreg")
13940 (set_attr "length" "4")])
13944 (if_then_else (match_operator 1 "branch_comparison_operator"
13946 "cc_reg_operand" "y")
13949 (label_ref (match_operand 0 "" ""))))]
13953 return output_cbranch (operands[1], \"%l0\", 1, insn);
13955 [(set_attr "type" "branch")])
13959 (if_then_else (match_operator 0 "branch_comparison_operator"
13961 "cc_reg_operand" "y")
13968 return output_cbranch (operands[0], NULL, 1, insn);
13970 [(set_attr "type" "jmpreg")
13971 (set_attr "length" "4")])
13973 ;; Logic on condition register values.
13975 ; This pattern matches things like
13976 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13977 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13979 ; which are generated by the branch logic.
13980 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13982 (define_insn "*cceq_ior_compare"
13983 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13984 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13985 [(match_operator:SI 2
13986 "branch_positive_comparison_operator"
13988 "cc_reg_operand" "y,y")
13990 (match_operator:SI 4
13991 "branch_positive_comparison_operator"
13993 "cc_reg_operand" "0,y")
13997 "cr%q1 %E0,%j2,%j4"
13998 [(set_attr "type" "cr_logical,delayed_cr")])
14000 ; Why is the constant -1 here, but 1 in the previous pattern?
14001 ; Because ~1 has all but the low bit set.
14003 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14004 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14005 [(not:SI (match_operator:SI 2
14006 "branch_positive_comparison_operator"
14008 "cc_reg_operand" "y,y")
14010 (match_operator:SI 4
14011 "branch_positive_comparison_operator"
14013 "cc_reg_operand" "0,y")
14017 "cr%q1 %E0,%j2,%j4"
14018 [(set_attr "type" "cr_logical,delayed_cr")])
14020 (define_insn "*cceq_rev_compare"
14021 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14022 (compare:CCEQ (match_operator:SI 1
14023 "branch_positive_comparison_operator"
14025 "cc_reg_operand" "0,y")
14029 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14030 [(set_attr "type" "cr_logical,delayed_cr")])
14032 ;; If we are comparing the result of two comparisons, this can be done
14033 ;; using creqv or crxor.
14035 (define_insn_and_split ""
14036 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14037 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14038 [(match_operand 2 "cc_reg_operand" "y")
14040 (match_operator 3 "branch_comparison_operator"
14041 [(match_operand 4 "cc_reg_operand" "y")
14046 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14050 int positive_1, positive_2;
14052 positive_1 = branch_positive_comparison_operator (operands[1],
14053 GET_MODE (operands[1]));
14054 positive_2 = branch_positive_comparison_operator (operands[3],
14055 GET_MODE (operands[3]));
14058 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14059 GET_CODE (operands[1])),
14061 operands[2], const0_rtx);
14062 else if (GET_MODE (operands[1]) != SImode)
14063 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14064 operands[2], const0_rtx);
14067 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14068 GET_CODE (operands[3])),
14070 operands[4], const0_rtx);
14071 else if (GET_MODE (operands[3]) != SImode)
14072 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14073 operands[4], const0_rtx);
14075 if (positive_1 == positive_2)
14077 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14078 operands[5] = constm1_rtx;
14082 operands[5] = const1_rtx;
14086 ;; Unconditional branch and return.
14088 (define_insn "jump"
14090 (label_ref (match_operand 0 "" "")))]
14093 [(set_attr "type" "branch")])
14095 (define_insn "return"
14099 [(set_attr "type" "jmpreg")])
14101 (define_expand "indirect_jump"
14102 [(set (pc) (match_operand 0 "register_operand" ""))])
14104 (define_insn "*indirect_jump<mode>"
14105 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14110 [(set_attr "type" "jmpreg")])
14112 ;; Table jump for switch statements:
14113 (define_expand "tablejump"
14114 [(use (match_operand 0 "" ""))
14115 (use (label_ref (match_operand 1 "" "")))]
14120 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14122 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14126 (define_expand "tablejumpsi"
14127 [(set (match_dup 3)
14128 (plus:SI (match_operand:SI 0 "" "")
14130 (parallel [(set (pc) (match_dup 3))
14131 (use (label_ref (match_operand 1 "" "")))])]
14134 { operands[0] = force_reg (SImode, operands[0]);
14135 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14136 operands[3] = gen_reg_rtx (SImode);
14139 (define_expand "tablejumpdi"
14140 [(set (match_dup 4)
14141 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14143 (plus:DI (match_dup 4)
14145 (parallel [(set (pc) (match_dup 3))
14146 (use (label_ref (match_operand 1 "" "")))])]
14149 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14150 operands[3] = gen_reg_rtx (DImode);
14151 operands[4] = gen_reg_rtx (DImode);
14154 (define_insn "*tablejump<mode>_internal1"
14156 (match_operand:P 0 "register_operand" "c,*l"))
14157 (use (label_ref (match_operand 1 "" "")))]
14162 [(set_attr "type" "jmpreg")])
14167 "{cror 0,0,0|nop}")
14169 ;; Define the subtract-one-and-jump insns, starting with the template
14170 ;; so loop.c knows what to generate.
14172 (define_expand "doloop_end"
14173 [(use (match_operand 0 "" "")) ; loop pseudo
14174 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14175 (use (match_operand 2 "" "")) ; max iterations
14176 (use (match_operand 3 "" "")) ; loop level
14177 (use (match_operand 4 "" ""))] ; label
14181 /* Only use this on innermost loops. */
14182 if (INTVAL (operands[3]) > 1)
14186 if (GET_MODE (operands[0]) != DImode)
14188 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14192 if (GET_MODE (operands[0]) != SImode)
14194 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14199 (define_expand "ctr<mode>"
14200 [(parallel [(set (pc)
14201 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14203 (label_ref (match_operand 1 "" ""))
14206 (plus:P (match_dup 0)
14208 (clobber (match_scratch:CC 2 ""))
14209 (clobber (match_scratch:P 3 ""))])]
14213 ;; We need to be able to do this for any operand, including MEM, or we
14214 ;; will cause reload to blow up since we don't allow output reloads on
14216 ;; For the length attribute to be calculated correctly, the
14217 ;; label MUST be operand 0.
14219 (define_insn "*ctr<mode>_internal1"
14221 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14223 (label_ref (match_operand 0 "" ""))
14225 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14226 (plus:P (match_dup 1)
14228 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14229 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14233 if (which_alternative != 0)
14235 else if (get_attr_length (insn) == 4)
14236 return \"{bdn|bdnz} %l0\";
14238 return \"bdz $+8\;b %l0\";
14240 [(set_attr "type" "branch")
14241 (set_attr "length" "*,12,16,16")])
14243 (define_insn "*ctr<mode>_internal2"
14245 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14248 (label_ref (match_operand 0 "" ""))))
14249 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14250 (plus:P (match_dup 1)
14252 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14253 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14257 if (which_alternative != 0)
14259 else if (get_attr_length (insn) == 4)
14260 return \"bdz %l0\";
14262 return \"{bdn|bdnz} $+8\;b %l0\";
14264 [(set_attr "type" "branch")
14265 (set_attr "length" "*,12,16,16")])
14267 ;; Similar but use EQ
14269 (define_insn "*ctr<mode>_internal5"
14271 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14273 (label_ref (match_operand 0 "" ""))
14275 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14276 (plus:P (match_dup 1)
14278 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14279 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14283 if (which_alternative != 0)
14285 else if (get_attr_length (insn) == 4)
14286 return \"bdz %l0\";
14288 return \"{bdn|bdnz} $+8\;b %l0\";
14290 [(set_attr "type" "branch")
14291 (set_attr "length" "*,12,16,16")])
14293 (define_insn "*ctr<mode>_internal6"
14295 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14298 (label_ref (match_operand 0 "" ""))))
14299 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14300 (plus:P (match_dup 1)
14302 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14303 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14307 if (which_alternative != 0)
14309 else if (get_attr_length (insn) == 4)
14310 return \"{bdn|bdnz} %l0\";
14312 return \"bdz $+8\;b %l0\";
14314 [(set_attr "type" "branch")
14315 (set_attr "length" "*,12,16,16")])
14317 ;; Now the splitters if we could not allocate the CTR register
14321 (if_then_else (match_operator 2 "comparison_operator"
14322 [(match_operand:P 1 "gpc_reg_operand" "")
14324 (match_operand 5 "" "")
14325 (match_operand 6 "" "")))
14326 (set (match_operand:P 0 "gpc_reg_operand" "")
14327 (plus:P (match_dup 1) (const_int -1)))
14328 (clobber (match_scratch:CC 3 ""))
14329 (clobber (match_scratch:P 4 ""))]
14331 [(parallel [(set (match_dup 3)
14332 (compare:CC (plus:P (match_dup 1)
14336 (plus:P (match_dup 1)
14338 (set (pc) (if_then_else (match_dup 7)
14342 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14343 operands[3], const0_rtx); }")
14347 (if_then_else (match_operator 2 "comparison_operator"
14348 [(match_operand:P 1 "gpc_reg_operand" "")
14350 (match_operand 5 "" "")
14351 (match_operand 6 "" "")))
14352 (set (match_operand:P 0 "nonimmediate_operand" "")
14353 (plus:P (match_dup 1) (const_int -1)))
14354 (clobber (match_scratch:CC 3 ""))
14355 (clobber (match_scratch:P 4 ""))]
14356 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14357 [(parallel [(set (match_dup 3)
14358 (compare:CC (plus:P (match_dup 1)
14362 (plus:P (match_dup 1)
14366 (set (pc) (if_then_else (match_dup 7)
14370 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14371 operands[3], const0_rtx); }")
14373 (define_insn "trap"
14374 [(trap_if (const_int 1) (const_int 0))]
14377 [(set_attr "type" "trap")])
14379 (define_expand "conditional_trap"
14380 [(trap_if (match_operator 0 "trap_comparison_operator"
14381 [(match_dup 2) (match_dup 3)])
14382 (match_operand 1 "const_int_operand" ""))]
14384 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14385 operands[2] = rs6000_compare_op0;
14386 operands[3] = rs6000_compare_op1;")
14389 [(trap_if (match_operator 0 "trap_comparison_operator"
14390 [(match_operand:GPR 1 "register_operand" "r")
14391 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14394 "{t|t<wd>}%V0%I2 %1,%2"
14395 [(set_attr "type" "trap")])
14397 ;; Insns related to generating the function prologue and epilogue.
14399 (define_expand "prologue"
14400 [(use (const_int 0))]
14401 "TARGET_SCHED_PROLOG"
14404 rs6000_emit_prologue ();
14408 (define_insn "*movesi_from_cr_one"
14409 [(match_parallel 0 "mfcr_operation"
14410 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14411 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14412 (match_operand 3 "immediate_operand" "n")]
14413 UNSPEC_MOVESI_FROM_CR))])]
14419 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14421 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14422 operands[4] = GEN_INT (mask);
14423 output_asm_insn (\"mfcr %1,%4\", operands);
14427 [(set_attr "type" "mfcrf")])
14429 (define_insn "movesi_from_cr"
14430 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14431 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14432 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14433 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14434 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14435 UNSPEC_MOVESI_FROM_CR))]
14438 [(set_attr "type" "mfcr")])
14440 (define_insn "*stmw"
14441 [(match_parallel 0 "stmw_operation"
14442 [(set (match_operand:SI 1 "memory_operand" "=m")
14443 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14446 [(set_attr "type" "store_ux")])
14448 (define_insn "*save_gpregs_<mode>"
14449 [(match_parallel 0 "any_parallel_operand"
14450 [(clobber (reg:P 65))
14451 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14452 (use (match_operand:P 2 "gpc_reg_operand" "r"))
14453 (set (match_operand:P 3 "memory_operand" "=m")
14454 (match_operand:P 4 "gpc_reg_operand" "r"))])]
14457 [(set_attr "type" "branch")
14458 (set_attr "length" "4")])
14460 (define_insn "*save_fpregs_<mode>"
14461 [(match_parallel 0 "any_parallel_operand"
14462 [(clobber (reg:P 65))
14463 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14464 (use (match_operand:P 2 "gpc_reg_operand" "r"))
14465 (set (match_operand:DF 3 "memory_operand" "=m")
14466 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14469 [(set_attr "type" "branch")
14470 (set_attr "length" "4")])
14472 ; These are to explain that changes to the stack pointer should
14473 ; not be moved over stores to stack memory.
14474 (define_insn "stack_tie"
14475 [(set (match_operand:BLK 0 "memory_operand" "+m")
14476 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14479 [(set_attr "length" "0")])
14482 (define_expand "epilogue"
14483 [(use (const_int 0))]
14484 "TARGET_SCHED_PROLOG"
14487 rs6000_emit_epilogue (FALSE);
14491 ; On some processors, doing the mtcrf one CC register at a time is
14492 ; faster (like on the 604e). On others, doing them all at once is
14493 ; faster; for instance, on the 601 and 750.
14495 (define_expand "movsi_to_cr_one"
14496 [(set (match_operand:CC 0 "cc_reg_operand" "")
14497 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14498 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14500 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14502 (define_insn "*movsi_to_cr"
14503 [(match_parallel 0 "mtcrf_operation"
14504 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14505 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14506 (match_operand 3 "immediate_operand" "n")]
14507 UNSPEC_MOVESI_TO_CR))])]
14513 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14514 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14515 operands[4] = GEN_INT (mask);
14516 return \"mtcrf %4,%2\";
14518 [(set_attr "type" "mtcr")])
14520 (define_insn "*mtcrfsi"
14521 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14522 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14523 (match_operand 2 "immediate_operand" "n")]
14524 UNSPEC_MOVESI_TO_CR))]
14525 "GET_CODE (operands[0]) == REG
14526 && CR_REGNO_P (REGNO (operands[0]))
14527 && GET_CODE (operands[2]) == CONST_INT
14528 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14530 [(set_attr "type" "mtcr")])
14532 ; The load-multiple instructions have similar properties.
14533 ; Note that "load_multiple" is a name known to the machine-independent
14534 ; code that actually corresponds to the PowerPC load-string.
14536 (define_insn "*lmw"
14537 [(match_parallel 0 "lmw_operation"
14538 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14539 (match_operand:SI 2 "memory_operand" "m"))])]
14542 [(set_attr "type" "load_ux")])
14544 (define_insn "*return_internal_<mode>"
14546 (use (match_operand:P 0 "register_operand" "lc"))]
14549 [(set_attr "type" "jmpreg")])
14551 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14552 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14554 (define_insn "*restore_gpregs_<mode>"
14555 [(match_parallel 0 "any_parallel_operand"
14556 [(clobber (match_operand:P 1 "register_operand" "=l"))
14557 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14558 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14559 (set (match_operand:P 4 "gpc_reg_operand" "=r")
14560 (match_operand:P 5 "memory_operand" "m"))])]
14563 [(set_attr "type" "branch")
14564 (set_attr "length" "4")])
14566 (define_insn "*return_and_restore_gpregs_<mode>"
14567 [(match_parallel 0 "any_parallel_operand"
14569 (clobber (match_operand:P 1 "register_operand" "=l"))
14570 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14571 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14572 (set (match_operand:P 4 "gpc_reg_operand" "=r")
14573 (match_operand:P 5 "memory_operand" "m"))])]
14576 [(set_attr "type" "branch")
14577 (set_attr "length" "4")])
14579 (define_insn "*return_and_restore_fpregs_<mode>"
14580 [(match_parallel 0 "any_parallel_operand"
14582 (clobber (match_operand:P 1 "register_operand" "=l"))
14583 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14584 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14585 (set (match_operand:DF 4 "gpc_reg_operand" "=f")
14586 (match_operand:DF 5 "memory_operand" "m"))])]
14589 [(set_attr "type" "branch")
14590 (set_attr "length" "4")])
14592 ; This is used in compiling the unwind routines.
14593 (define_expand "eh_return"
14594 [(use (match_operand 0 "general_operand" ""))]
14599 emit_insn (gen_eh_set_lr_si (operands[0]));
14601 emit_insn (gen_eh_set_lr_di (operands[0]));
14605 ; We can't expand this before we know where the link register is stored.
14606 (define_insn "eh_set_lr_<mode>"
14607 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14609 (clobber (match_scratch:P 1 "=&b"))]
14614 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14615 (clobber (match_scratch 1 ""))]
14620 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14624 (define_insn "prefetch"
14625 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14626 (match_operand:SI 1 "const_int_operand" "n")
14627 (match_operand:SI 2 "const_int_operand" "n"))]
14631 if (GET_CODE (operands[0]) == REG)
14632 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14633 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14635 [(set_attr "type" "load")])
14638 (include "sync.md")
14639 (include "altivec.md")
14642 (include "paired.md")