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 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 2, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 ;; MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 [(UNSPEC_FRSP 0) ; frsp for POWER machines
31 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
32 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
33 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
35 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
37 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
38 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
41 (UNSPEC_MOVESI_FROM_CR 19)
42 (UNSPEC_MOVESI_TO_CR 20)
44 (UNSPEC_TLSDTPRELHA 22)
45 (UNSPEC_TLSDTPRELLO 23)
46 (UNSPEC_TLSGOTDTPREL 24)
48 (UNSPEC_TLSTPRELHA 26)
49 (UNSPEC_TLSTPRELLO 27)
50 (UNSPEC_TLSGOTTPREL 28)
52 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
53 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
57 ;; UNSPEC_VOLATILE usage
62 (UNSPECV_EH_RR 9) ; eh_reg_restore
65 ;; Define an insn type attribute. This is used in function unit delay
67 (define_attr "type" "integer,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv"
68 (const_string "integer"))
71 ; '(pc)' in the following doesn't include the instruction itself; it is
72 ; calculated as if the instruction had zero size.
73 (define_attr "length" ""
74 (if_then_else (eq_attr "type" "branch")
75 (if_then_else (and (ge (minus (match_dup 0) (pc))
77 (lt (minus (match_dup 0) (pc))
83 ;; Processor type -- this attribute must exactly match the processor_type
84 ;; enumeration in rs6000.h.
86 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
87 (const (symbol_ref "rs6000_cpu_attr")))
89 (automata_option "ndfa")
102 (include "power4.md")
103 (include "power5.md")
106 ;; Start with fixed-point load and store insns. Here we put only the more
107 ;; complex forms. Basic data transfer is done later.
109 (define_expand "zero_extendqidi2"
110 [(set (match_operand:DI 0 "gpc_reg_operand" "")
111 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
116 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
117 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
122 [(set_attr "type" "load,*")])
125 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
126 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
128 (clobber (match_scratch:DI 2 "=r,r"))]
133 [(set_attr "type" "compare")
134 (set_attr "length" "4,8")])
137 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
138 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
140 (clobber (match_scratch:DI 2 ""))]
141 "TARGET_POWERPC64 && reload_completed"
143 (zero_extend:DI (match_dup 1)))
145 (compare:CC (match_dup 2)
150 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
151 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
153 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
154 (zero_extend:DI (match_dup 1)))]
159 [(set_attr "type" "compare")
160 (set_attr "length" "4,8")])
163 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
164 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
166 (set (match_operand:DI 0 "gpc_reg_operand" "")
167 (zero_extend:DI (match_dup 1)))]
168 "TARGET_POWERPC64 && reload_completed"
170 (zero_extend:DI (match_dup 1)))
172 (compare:CC (match_dup 0)
176 (define_insn "extendqidi2"
177 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
178 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
183 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
184 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
186 (clobber (match_scratch:DI 2 "=r,r"))]
191 [(set_attr "type" "compare")
192 (set_attr "length" "4,8")])
195 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
196 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
198 (clobber (match_scratch:DI 2 ""))]
199 "TARGET_POWERPC64 && reload_completed"
201 (sign_extend:DI (match_dup 1)))
203 (compare:CC (match_dup 2)
208 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
209 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
211 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
212 (sign_extend:DI (match_dup 1)))]
217 [(set_attr "type" "compare")
218 (set_attr "length" "4,8")])
221 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
222 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
224 (set (match_operand:DI 0 "gpc_reg_operand" "")
225 (sign_extend:DI (match_dup 1)))]
226 "TARGET_POWERPC64 && reload_completed"
228 (sign_extend:DI (match_dup 1)))
230 (compare:CC (match_dup 0)
234 (define_expand "zero_extendhidi2"
235 [(set (match_operand:DI 0 "gpc_reg_operand" "")
236 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
241 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
242 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
247 [(set_attr "type" "load,*")])
250 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
251 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
253 (clobber (match_scratch:DI 2 "=r,r"))]
258 [(set_attr "type" "compare")
259 (set_attr "length" "4,8")])
262 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
263 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
265 (clobber (match_scratch:DI 2 ""))]
266 "TARGET_POWERPC64 && reload_completed"
268 (zero_extend:DI (match_dup 1)))
270 (compare:CC (match_dup 2)
275 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
276 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
278 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
279 (zero_extend:DI (match_dup 1)))]
284 [(set_attr "type" "compare")
285 (set_attr "length" "4,8")])
288 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
289 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
291 (set (match_operand:DI 0 "gpc_reg_operand" "")
292 (zero_extend:DI (match_dup 1)))]
293 "TARGET_POWERPC64 && reload_completed"
295 (zero_extend:DI (match_dup 1)))
297 (compare:CC (match_dup 0)
301 (define_expand "extendhidi2"
302 [(set (match_operand:DI 0 "gpc_reg_operand" "")
303 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
308 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
309 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
314 [(set_attr "type" "load_ext,*")])
317 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
318 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
320 (clobber (match_scratch:DI 2 "=r,r"))]
325 [(set_attr "type" "compare")
326 (set_attr "length" "4,8")])
329 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
330 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
332 (clobber (match_scratch:DI 2 ""))]
333 "TARGET_POWERPC64 && reload_completed"
335 (sign_extend:DI (match_dup 1)))
337 (compare:CC (match_dup 2)
342 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
343 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
345 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
346 (sign_extend:DI (match_dup 1)))]
351 [(set_attr "type" "compare")
352 (set_attr "length" "4,8")])
355 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
356 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
358 (set (match_operand:DI 0 "gpc_reg_operand" "")
359 (sign_extend:DI (match_dup 1)))]
360 "TARGET_POWERPC64 && reload_completed"
362 (sign_extend:DI (match_dup 1)))
364 (compare:CC (match_dup 0)
368 (define_expand "zero_extendsidi2"
369 [(set (match_operand:DI 0 "gpc_reg_operand" "")
370 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
375 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
376 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
381 [(set_attr "type" "load,*")])
384 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
385 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
387 (clobber (match_scratch:DI 2 "=r,r"))]
392 [(set_attr "type" "compare")
393 (set_attr "length" "4,8")])
396 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
397 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
399 (clobber (match_scratch:DI 2 ""))]
400 "TARGET_POWERPC64 && reload_completed"
402 (zero_extend:DI (match_dup 1)))
404 (compare:CC (match_dup 2)
409 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
410 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
412 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
413 (zero_extend:DI (match_dup 1)))]
418 [(set_attr "type" "compare")
419 (set_attr "length" "4,8")])
422 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
423 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
425 (set (match_operand:DI 0 "gpc_reg_operand" "")
426 (zero_extend:DI (match_dup 1)))]
427 "TARGET_POWERPC64 && reload_completed"
429 (zero_extend:DI (match_dup 1)))
431 (compare:CC (match_dup 0)
435 (define_expand "extendsidi2"
436 [(set (match_operand:DI 0 "gpc_reg_operand" "")
437 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
442 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
443 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
448 [(set_attr "type" "load_ext,*")])
451 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
452 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
454 (clobber (match_scratch:DI 2 "=r,r"))]
459 [(set_attr "type" "compare")
460 (set_attr "length" "4,8")])
463 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
464 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
466 (clobber (match_scratch:DI 2 ""))]
467 "TARGET_POWERPC64 && reload_completed"
469 (sign_extend:DI (match_dup 1)))
471 (compare:CC (match_dup 2)
476 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
477 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
479 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
480 (sign_extend:DI (match_dup 1)))]
485 [(set_attr "type" "compare")
486 (set_attr "length" "4,8")])
489 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
490 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
492 (set (match_operand:DI 0 "gpc_reg_operand" "")
493 (sign_extend:DI (match_dup 1)))]
494 "TARGET_POWERPC64 && reload_completed"
496 (sign_extend:DI (match_dup 1)))
498 (compare:CC (match_dup 0)
502 (define_expand "zero_extendqisi2"
503 [(set (match_operand:SI 0 "gpc_reg_operand" "")
504 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
509 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
510 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
514 {rlinm|rlwinm} %0,%1,0,0xff"
515 [(set_attr "type" "load,*")])
518 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
519 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
521 (clobber (match_scratch:SI 2 "=r,r"))]
524 {andil.|andi.} %2,%1,0xff
526 [(set_attr "type" "compare")
527 (set_attr "length" "4,8")])
530 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
531 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
533 (clobber (match_scratch:SI 2 ""))]
536 (zero_extend:SI (match_dup 1)))
538 (compare:CC (match_dup 2)
543 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
544 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
546 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
547 (zero_extend:SI (match_dup 1)))]
550 {andil.|andi.} %0,%1,0xff
552 [(set_attr "type" "compare")
553 (set_attr "length" "4,8")])
556 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
557 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
559 (set (match_operand:SI 0 "gpc_reg_operand" "")
560 (zero_extend:SI (match_dup 1)))]
563 (zero_extend:SI (match_dup 1)))
565 (compare:CC (match_dup 0)
569 (define_expand "extendqisi2"
570 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
571 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
576 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
577 else if (TARGET_POWER)
578 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
580 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
584 (define_insn "extendqisi2_ppc"
585 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
586 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
591 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
592 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
594 (clobber (match_scratch:SI 2 "=r,r"))]
599 [(set_attr "type" "compare")
600 (set_attr "length" "4,8")])
603 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
604 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
606 (clobber (match_scratch:SI 2 ""))]
607 "TARGET_POWERPC && reload_completed"
609 (sign_extend:SI (match_dup 1)))
611 (compare:CC (match_dup 2)
616 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
617 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
619 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
620 (sign_extend:SI (match_dup 1)))]
625 [(set_attr "type" "compare")
626 (set_attr "length" "4,8")])
629 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
630 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
632 (set (match_operand:SI 0 "gpc_reg_operand" "")
633 (sign_extend:SI (match_dup 1)))]
634 "TARGET_POWERPC && reload_completed"
636 (sign_extend:SI (match_dup 1)))
638 (compare:CC (match_dup 0)
642 (define_expand "extendqisi2_power"
643 [(parallel [(set (match_dup 2)
644 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
646 (clobber (scratch:SI))])
647 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
648 (ashiftrt:SI (match_dup 2)
650 (clobber (scratch:SI))])]
653 { operands[1] = gen_lowpart (SImode, operands[1]);
654 operands[2] = gen_reg_rtx (SImode); }")
656 (define_expand "extendqisi2_no_power"
658 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
660 (set (match_operand:SI 0 "gpc_reg_operand" "")
661 (ashiftrt:SI (match_dup 2)
663 "! TARGET_POWER && ! TARGET_POWERPC"
665 { operands[1] = gen_lowpart (SImode, operands[1]);
666 operands[2] = gen_reg_rtx (SImode); }")
668 (define_expand "zero_extendqihi2"
669 [(set (match_operand:HI 0 "gpc_reg_operand" "")
670 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
675 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
676 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
680 {rlinm|rlwinm} %0,%1,0,0xff"
681 [(set_attr "type" "load,*")])
684 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
685 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
687 (clobber (match_scratch:HI 2 "=r,r"))]
690 {andil.|andi.} %2,%1,0xff
692 [(set_attr "type" "compare")
693 (set_attr "length" "4,8")])
696 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
697 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
699 (clobber (match_scratch:HI 2 ""))]
702 (zero_extend:HI (match_dup 1)))
704 (compare:CC (match_dup 2)
709 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
710 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
712 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
713 (zero_extend:HI (match_dup 1)))]
716 {andil.|andi.} %0,%1,0xff
718 [(set_attr "type" "compare")
719 (set_attr "length" "4,8")])
722 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
723 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
725 (set (match_operand:HI 0 "gpc_reg_operand" "")
726 (zero_extend:HI (match_dup 1)))]
729 (zero_extend:HI (match_dup 1)))
731 (compare:CC (match_dup 0)
735 (define_expand "extendqihi2"
736 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
737 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
742 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
743 else if (TARGET_POWER)
744 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
746 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
750 (define_insn "extendqihi2_ppc"
751 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
752 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
757 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
758 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
760 (clobber (match_scratch:HI 2 "=r,r"))]
765 [(set_attr "type" "compare")
766 (set_attr "length" "4,8")])
769 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
770 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
772 (clobber (match_scratch:HI 2 ""))]
773 "TARGET_POWERPC && reload_completed"
775 (sign_extend:HI (match_dup 1)))
777 (compare:CC (match_dup 2)
782 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
783 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
785 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
786 (sign_extend:HI (match_dup 1)))]
791 [(set_attr "type" "compare")
792 (set_attr "length" "4,8")])
795 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
796 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
798 (set (match_operand:HI 0 "gpc_reg_operand" "")
799 (sign_extend:HI (match_dup 1)))]
800 "TARGET_POWERPC && reload_completed"
802 (sign_extend:HI (match_dup 1)))
804 (compare:CC (match_dup 0)
808 (define_expand "extendqihi2_power"
809 [(parallel [(set (match_dup 2)
810 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
812 (clobber (scratch:SI))])
813 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
814 (ashiftrt:SI (match_dup 2)
816 (clobber (scratch:SI))])]
819 { operands[0] = gen_lowpart (SImode, operands[0]);
820 operands[1] = gen_lowpart (SImode, operands[1]);
821 operands[2] = gen_reg_rtx (SImode); }")
823 (define_expand "extendqihi2_no_power"
825 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
827 (set (match_operand:HI 0 "gpc_reg_operand" "")
828 (ashiftrt:SI (match_dup 2)
830 "! TARGET_POWER && ! TARGET_POWERPC"
832 { operands[0] = gen_lowpart (SImode, operands[0]);
833 operands[1] = gen_lowpart (SImode, operands[1]);
834 operands[2] = gen_reg_rtx (SImode); }")
836 (define_expand "zero_extendhisi2"
837 [(set (match_operand:SI 0 "gpc_reg_operand" "")
838 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
843 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
844 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
848 {rlinm|rlwinm} %0,%1,0,0xffff"
849 [(set_attr "type" "load,*")])
852 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
853 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
855 (clobber (match_scratch:SI 2 "=r,r"))]
858 {andil.|andi.} %2,%1,0xffff
860 [(set_attr "type" "compare")
861 (set_attr "length" "4,8")])
864 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
865 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
867 (clobber (match_scratch:SI 2 ""))]
870 (zero_extend:SI (match_dup 1)))
872 (compare:CC (match_dup 2)
877 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
878 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
880 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
881 (zero_extend:SI (match_dup 1)))]
884 {andil.|andi.} %0,%1,0xffff
886 [(set_attr "type" "compare")
887 (set_attr "length" "4,8")])
890 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
891 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
893 (set (match_operand:SI 0 "gpc_reg_operand" "")
894 (zero_extend:SI (match_dup 1)))]
897 (zero_extend:SI (match_dup 1)))
899 (compare:CC (match_dup 0)
903 (define_expand "extendhisi2"
904 [(set (match_operand:SI 0 "gpc_reg_operand" "")
905 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
910 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
911 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
916 [(set_attr "type" "load_ext,*")])
919 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
920 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
922 (clobber (match_scratch:SI 2 "=r,r"))]
927 [(set_attr "type" "compare")
928 (set_attr "length" "4,8")])
931 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
932 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
934 (clobber (match_scratch:SI 2 ""))]
937 (sign_extend:SI (match_dup 1)))
939 (compare:CC (match_dup 2)
944 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
945 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
947 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
948 (sign_extend:SI (match_dup 1)))]
953 [(set_attr "type" "compare")
954 (set_attr "length" "4,8")])
957 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
958 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
960 (set (match_operand:SI 0 "gpc_reg_operand" "")
961 (sign_extend:SI (match_dup 1)))]
964 (sign_extend:SI (match_dup 1)))
966 (compare:CC (match_dup 0)
970 ;; Fixed-point arithmetic insns.
972 ;; Discourage ai/addic because of carry but provide it in an alternative
973 ;; allowing register zero as source.
974 (define_expand "addsi3"
975 [(set (match_operand:SI 0 "gpc_reg_operand" "")
976 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
977 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
981 if (GET_CODE (operands[2]) == CONST_INT
982 && ! add_operand (operands[2], SImode))
984 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
985 ? operands[0] : gen_reg_rtx (SImode));
987 HOST_WIDE_INT val = INTVAL (operands[2]);
988 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
989 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
991 /* The ordering here is important for the prolog expander.
992 When space is allocated from the stack, adding 'low' first may
993 produce a temporary deallocation (which would be bad). */
994 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
995 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
1000 (define_insn "*addsi3_internal1"
1001 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1002 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1003 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1007 {cal %0,%2(%1)|addi %0,%1,%2}
1009 {cau|addis} %0,%1,%v2"
1010 [(set_attr "length" "4,4,4,4")])
1012 (define_insn "addsi3_high"
1013 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1014 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1015 (high:SI (match_operand 2 "" ""))))]
1016 "TARGET_MACHO && !TARGET_64BIT"
1017 "{cau|addis} %0,%1,ha16(%2)"
1018 [(set_attr "length" "4")])
1020 (define_insn "*addsi3_internal2"
1021 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1022 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1023 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1025 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1028 {cax.|add.} %3,%1,%2
1029 {ai.|addic.} %3,%1,%2
1032 [(set_attr "type" "fast_compare,compare,compare,compare")
1033 (set_attr "length" "4,4,8,8")])
1036 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1037 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1038 (match_operand:SI 2 "reg_or_short_operand" ""))
1040 (clobber (match_scratch:SI 3 ""))]
1041 "TARGET_32BIT && reload_completed"
1043 (plus:SI (match_dup 1)
1046 (compare:CC (match_dup 3)
1050 (define_insn "*addsi3_internal3"
1051 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1052 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1053 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1055 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1056 (plus:SI (match_dup 1)
1060 {cax.|add.} %0,%1,%2
1061 {ai.|addic.} %0,%1,%2
1064 [(set_attr "type" "fast_compare,compare,compare,compare")
1065 (set_attr "length" "4,4,8,8")])
1068 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1069 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1070 (match_operand:SI 2 "reg_or_short_operand" ""))
1072 (set (match_operand:SI 0 "gpc_reg_operand" "")
1073 (plus:SI (match_dup 1) (match_dup 2)))]
1074 "TARGET_32BIT && reload_completed"
1076 (plus:SI (match_dup 1)
1079 (compare:CC (match_dup 0)
1083 ;; Split an add that we can't do in one insn into two insns, each of which
1084 ;; does one 16-bit part. This is used by combine. Note that the low-order
1085 ;; add should be last in case the result gets used in an address.
1088 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1089 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1090 (match_operand:SI 2 "non_add_cint_operand" "")))]
1092 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1093 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1096 HOST_WIDE_INT val = INTVAL (operands[2]);
1097 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1098 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1100 operands[3] = GEN_INT (rest);
1101 operands[4] = GEN_INT (low);
1104 (define_insn "one_cmplsi2"
1105 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1106 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1111 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1112 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1114 (clobber (match_scratch:SI 2 "=r,r"))]
1119 [(set_attr "type" "compare")
1120 (set_attr "length" "4,8")])
1123 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1124 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1126 (clobber (match_scratch:SI 2 ""))]
1127 "TARGET_32BIT && reload_completed"
1129 (not:SI (match_dup 1)))
1131 (compare:CC (match_dup 2)
1136 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1137 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1139 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1140 (not:SI (match_dup 1)))]
1145 [(set_attr "type" "compare")
1146 (set_attr "length" "4,8")])
1149 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1150 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1152 (set (match_operand:SI 0 "gpc_reg_operand" "")
1153 (not:SI (match_dup 1)))]
1154 "TARGET_32BIT && reload_completed"
1156 (not:SI (match_dup 1)))
1158 (compare:CC (match_dup 0)
1163 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1164 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1165 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1167 "{sf%I1|subf%I1c} %0,%2,%1")
1170 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1171 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1172 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1179 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1180 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1181 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1183 (clobber (match_scratch:SI 3 "=r,r"))]
1186 {sf.|subfc.} %3,%2,%1
1188 [(set_attr "type" "compare")
1189 (set_attr "length" "4,8")])
1192 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1193 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1194 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1196 (clobber (match_scratch:SI 3 "=r,r"))]
1197 "TARGET_POWERPC && TARGET_32BIT"
1201 [(set_attr "type" "fast_compare")
1202 (set_attr "length" "4,8")])
1205 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1206 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1207 (match_operand:SI 2 "gpc_reg_operand" ""))
1209 (clobber (match_scratch:SI 3 ""))]
1210 "TARGET_32BIT && reload_completed"
1212 (minus:SI (match_dup 1)
1215 (compare:CC (match_dup 3)
1220 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1221 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1222 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1224 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1225 (minus:SI (match_dup 1) (match_dup 2)))]
1228 {sf.|subfc.} %0,%2,%1
1230 [(set_attr "type" "compare")
1231 (set_attr "length" "4,8")])
1234 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1235 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1236 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1238 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1239 (minus:SI (match_dup 1)
1241 "TARGET_POWERPC && TARGET_32BIT"
1245 [(set_attr "type" "fast_compare")
1246 (set_attr "length" "4,8")])
1249 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1250 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1251 (match_operand:SI 2 "gpc_reg_operand" ""))
1253 (set (match_operand:SI 0 "gpc_reg_operand" "")
1254 (minus:SI (match_dup 1)
1256 "TARGET_32BIT && reload_completed"
1258 (minus:SI (match_dup 1)
1261 (compare:CC (match_dup 0)
1265 (define_expand "subsi3"
1266 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1267 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1268 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1272 if (GET_CODE (operands[2]) == CONST_INT)
1274 emit_insn (gen_addsi3 (operands[0], operands[1],
1275 negate_rtx (SImode, operands[2])));
1280 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1281 ;; instruction and some auxiliary computations. Then we just have a single
1282 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1285 (define_expand "sminsi3"
1287 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1288 (match_operand:SI 2 "reg_or_short_operand" ""))
1290 (minus:SI (match_dup 2) (match_dup 1))))
1291 (set (match_operand:SI 0 "gpc_reg_operand" "")
1292 (minus:SI (match_dup 2) (match_dup 3)))]
1293 "TARGET_POWER || TARGET_ISEL"
1298 operands[2] = force_reg (SImode, operands[2]);
1299 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1303 operands[3] = gen_reg_rtx (SImode);
1307 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1308 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1309 (match_operand:SI 2 "reg_or_short_operand" "")))
1310 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1313 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1315 (minus:SI (match_dup 2) (match_dup 1))))
1316 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1319 (define_expand "smaxsi3"
1321 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1322 (match_operand:SI 2 "reg_or_short_operand" ""))
1324 (minus:SI (match_dup 2) (match_dup 1))))
1325 (set (match_operand:SI 0 "gpc_reg_operand" "")
1326 (plus:SI (match_dup 3) (match_dup 1)))]
1327 "TARGET_POWER || TARGET_ISEL"
1332 operands[2] = force_reg (SImode, operands[2]);
1333 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1336 operands[3] = gen_reg_rtx (SImode);
1340 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1341 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1342 (match_operand:SI 2 "reg_or_short_operand" "")))
1343 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1346 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1348 (minus:SI (match_dup 2) (match_dup 1))))
1349 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1352 (define_expand "uminsi3"
1353 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1355 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1357 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1359 (minus:SI (match_dup 4) (match_dup 3))))
1360 (set (match_operand:SI 0 "gpc_reg_operand" "")
1361 (minus:SI (match_dup 2) (match_dup 3)))]
1362 "TARGET_POWER || TARGET_ISEL"
1367 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1370 operands[3] = gen_reg_rtx (SImode);
1371 operands[4] = gen_reg_rtx (SImode);
1372 operands[5] = GEN_INT (-2147483647 - 1);
1375 (define_expand "umaxsi3"
1376 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1378 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1380 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1382 (minus:SI (match_dup 4) (match_dup 3))))
1383 (set (match_operand:SI 0 "gpc_reg_operand" "")
1384 (plus:SI (match_dup 3) (match_dup 1)))]
1385 "TARGET_POWER || TARGET_ISEL"
1390 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1393 operands[3] = gen_reg_rtx (SImode);
1394 operands[4] = gen_reg_rtx (SImode);
1395 operands[5] = GEN_INT (-2147483647 - 1);
1399 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1400 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1401 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1403 (minus:SI (match_dup 2) (match_dup 1))))]
1408 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1410 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1411 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1413 (minus:SI (match_dup 2) (match_dup 1)))
1415 (clobber (match_scratch:SI 3 "=r,r"))]
1420 [(set_attr "type" "delayed_compare")
1421 (set_attr "length" "4,8")])
1424 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1426 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1427 (match_operand:SI 2 "reg_or_short_operand" ""))
1429 (minus:SI (match_dup 2) (match_dup 1)))
1431 (clobber (match_scratch:SI 3 ""))]
1432 "TARGET_POWER && reload_completed"
1434 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1436 (minus:SI (match_dup 2) (match_dup 1))))
1438 (compare:CC (match_dup 3)
1443 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1445 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1446 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1448 (minus:SI (match_dup 2) (match_dup 1)))
1450 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1451 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1453 (minus:SI (match_dup 2) (match_dup 1))))]
1458 [(set_attr "type" "delayed_compare")
1459 (set_attr "length" "4,8")])
1462 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1464 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1465 (match_operand:SI 2 "reg_or_short_operand" ""))
1467 (minus:SI (match_dup 2) (match_dup 1)))
1469 (set (match_operand:SI 0 "gpc_reg_operand" "")
1470 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1472 (minus:SI (match_dup 2) (match_dup 1))))]
1473 "TARGET_POWER && reload_completed"
1475 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1477 (minus:SI (match_dup 2) (match_dup 1))))
1479 (compare:CC (match_dup 0)
1483 ;; We don't need abs with condition code because such comparisons should
1485 (define_expand "abssi2"
1486 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1487 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1493 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1496 else if (! TARGET_POWER)
1498 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1503 (define_insn "*abssi2_power"
1504 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1505 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1509 (define_insn_and_split "abssi2_isel"
1510 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1511 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1512 (clobber (match_scratch:SI 2 "=&b"))
1513 (clobber (match_scratch:CC 3 "=y"))]
1516 "&& reload_completed"
1517 [(set (match_dup 2) (neg:SI (match_dup 1)))
1519 (compare:CC (match_dup 1)
1522 (if_then_else:SI (ge (match_dup 3)
1528 (define_insn_and_split "abssi2_nopower"
1529 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1530 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1531 (clobber (match_scratch:SI 2 "=&r,&r"))]
1532 "! TARGET_POWER && ! TARGET_ISEL"
1534 "&& reload_completed"
1535 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1536 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1537 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1540 (define_insn "*nabs_power"
1541 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1542 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1546 (define_insn_and_split "*nabs_nopower"
1547 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1548 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1549 (clobber (match_scratch:SI 2 "=&r,&r"))]
1552 "&& reload_completed"
1553 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1554 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1555 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1558 (define_insn "negsi2"
1559 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1560 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1565 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1566 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1568 (clobber (match_scratch:SI 2 "=r,r"))]
1573 [(set_attr "type" "fast_compare")
1574 (set_attr "length" "4,8")])
1577 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1578 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1580 (clobber (match_scratch:SI 2 ""))]
1581 "TARGET_32BIT && reload_completed"
1583 (neg:SI (match_dup 1)))
1585 (compare:CC (match_dup 2)
1590 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1591 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1593 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1594 (neg:SI (match_dup 1)))]
1599 [(set_attr "type" "fast_compare")
1600 (set_attr "length" "4,8")])
1603 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1604 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1606 (set (match_operand:SI 0 "gpc_reg_operand" "")
1607 (neg:SI (match_dup 1)))]
1608 "TARGET_32BIT && reload_completed"
1610 (neg:SI (match_dup 1)))
1612 (compare:CC (match_dup 0)
1616 (define_insn "clzsi2"
1617 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1618 (clz:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1620 "{cntlz|cntlzw} %0,%1")
1622 (define_expand "ctzsi2"
1624 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1625 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1627 (clobber (scratch:CC))])
1628 (set (match_dup 4) (clz:SI (match_dup 3)))
1629 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1630 (minus:SI (const_int 31) (match_dup 4)))]
1633 operands[2] = gen_reg_rtx (SImode);
1634 operands[3] = gen_reg_rtx (SImode);
1635 operands[4] = gen_reg_rtx (SImode);
1638 (define_expand "ffssi2"
1640 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1641 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1643 (clobber (scratch:CC))])
1644 (set (match_dup 4) (clz:SI (match_dup 3)))
1645 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1646 (minus:SI (const_int 32) (match_dup 4)))]
1649 operands[2] = gen_reg_rtx (SImode);
1650 operands[3] = gen_reg_rtx (SImode);
1651 operands[4] = gen_reg_rtx (SImode);
1654 (define_expand "mulsi3"
1655 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1656 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1657 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1662 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1664 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1668 (define_insn "mulsi3_mq"
1669 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1670 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1671 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1672 (clobber (match_scratch:SI 3 "=q,q"))]
1675 {muls|mullw} %0,%1,%2
1676 {muli|mulli} %0,%1,%2"
1678 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1679 (const_string "imul3")
1680 (match_operand:SI 2 "short_cint_operand" "")
1681 (const_string "imul2")]
1682 (const_string "imul")))])
1684 (define_insn "mulsi3_no_mq"
1685 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1686 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1687 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1690 {muls|mullw} %0,%1,%2
1691 {muli|mulli} %0,%1,%2"
1693 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1694 (const_string "imul3")
1695 (match_operand:SI 2 "short_cint_operand" "")
1696 (const_string "imul2")]
1697 (const_string "imul")))])
1699 (define_insn "*mulsi3_mq_internal1"
1700 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1701 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1702 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1704 (clobber (match_scratch:SI 3 "=r,r"))
1705 (clobber (match_scratch:SI 4 "=q,q"))]
1708 {muls.|mullw.} %3,%1,%2
1710 [(set_attr "type" "imul_compare")
1711 (set_attr "length" "4,8")])
1714 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1715 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1716 (match_operand:SI 2 "gpc_reg_operand" ""))
1718 (clobber (match_scratch:SI 3 ""))
1719 (clobber (match_scratch:SI 4 ""))]
1720 "TARGET_POWER && reload_completed"
1721 [(parallel [(set (match_dup 3)
1722 (mult:SI (match_dup 1) (match_dup 2)))
1723 (clobber (match_dup 4))])
1725 (compare:CC (match_dup 3)
1729 (define_insn "*mulsi3_no_mq_internal1"
1730 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1731 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1732 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1734 (clobber (match_scratch:SI 3 "=r,r"))]
1737 {muls.|mullw.} %3,%1,%2
1739 [(set_attr "type" "imul_compare")
1740 (set_attr "length" "4,8")])
1743 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1744 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1745 (match_operand:SI 2 "gpc_reg_operand" ""))
1747 (clobber (match_scratch:SI 3 ""))]
1748 "! TARGET_POWER && reload_completed"
1750 (mult:SI (match_dup 1) (match_dup 2)))
1752 (compare:CC (match_dup 3)
1756 (define_insn "*mulsi3_mq_internal2"
1757 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1758 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1759 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1761 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1762 (mult:SI (match_dup 1) (match_dup 2)))
1763 (clobber (match_scratch:SI 4 "=q,q"))]
1766 {muls.|mullw.} %0,%1,%2
1768 [(set_attr "type" "imul_compare")
1769 (set_attr "length" "4,8")])
1772 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1773 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1774 (match_operand:SI 2 "gpc_reg_operand" ""))
1776 (set (match_operand:SI 0 "gpc_reg_operand" "")
1777 (mult:SI (match_dup 1) (match_dup 2)))
1778 (clobber (match_scratch:SI 4 ""))]
1779 "TARGET_POWER && reload_completed"
1780 [(parallel [(set (match_dup 0)
1781 (mult:SI (match_dup 1) (match_dup 2)))
1782 (clobber (match_dup 4))])
1784 (compare:CC (match_dup 0)
1788 (define_insn "*mulsi3_no_mq_internal2"
1789 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1790 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1791 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1793 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1794 (mult:SI (match_dup 1) (match_dup 2)))]
1797 {muls.|mullw.} %0,%1,%2
1799 [(set_attr "type" "imul_compare")
1800 (set_attr "length" "4,8")])
1803 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1804 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1805 (match_operand:SI 2 "gpc_reg_operand" ""))
1807 (set (match_operand:SI 0 "gpc_reg_operand" "")
1808 (mult:SI (match_dup 1) (match_dup 2)))]
1809 "! TARGET_POWER && reload_completed"
1811 (mult:SI (match_dup 1) (match_dup 2)))
1813 (compare:CC (match_dup 0)
1817 ;; Operand 1 is divided by operand 2; quotient goes to operand
1818 ;; 0 and remainder to operand 3.
1819 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1821 (define_expand "divmodsi4"
1822 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1823 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1824 (match_operand:SI 2 "gpc_reg_operand" "")))
1825 (set (match_operand:SI 3 "register_operand" "")
1826 (mod:SI (match_dup 1) (match_dup 2)))])]
1827 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1830 if (! TARGET_POWER && ! TARGET_POWERPC)
1832 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1833 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1834 emit_insn (gen_divss_call ());
1835 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1836 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1841 (define_insn "*divmodsi4_internal"
1842 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1843 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1844 (match_operand:SI 2 "gpc_reg_operand" "r")))
1845 (set (match_operand:SI 3 "register_operand" "=q")
1846 (mod:SI (match_dup 1) (match_dup 2)))]
1849 [(set_attr "type" "idiv")])
1851 (define_expand "udivsi3"
1852 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1853 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1854 (match_operand:SI 2 "gpc_reg_operand" "")))]
1855 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1858 if (! TARGET_POWER && ! TARGET_POWERPC)
1860 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1861 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1862 emit_insn (gen_quous_call ());
1863 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1866 else if (TARGET_POWER)
1868 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1873 (define_insn "udivsi3_mq"
1874 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1875 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1876 (match_operand:SI 2 "gpc_reg_operand" "r")))
1877 (clobber (match_scratch:SI 3 "=q"))]
1878 "TARGET_POWERPC && TARGET_POWER"
1880 [(set_attr "type" "idiv")])
1882 (define_insn "*udivsi3_no_mq"
1883 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1884 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1885 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1886 "TARGET_POWERPC && ! TARGET_POWER"
1888 [(set_attr "type" "idiv")])
1890 ;; For powers of two we can do srai/aze for divide and then adjust for
1891 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1892 ;; used; for PowerPC, force operands into register and do a normal divide;
1893 ;; for AIX common-mode, use quoss call on register operands.
1894 (define_expand "divsi3"
1895 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1896 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1897 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1901 if (GET_CODE (operands[2]) == CONST_INT
1902 && INTVAL (operands[2]) > 0
1903 && exact_log2 (INTVAL (operands[2])) >= 0)
1905 else if (TARGET_POWERPC)
1907 operands[2] = force_reg (SImode, operands[2]);
1910 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1914 else if (TARGET_POWER)
1918 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1919 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1920 emit_insn (gen_quoss_call ());
1921 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1926 (define_insn "divsi3_mq"
1927 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1928 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1929 (match_operand:SI 2 "gpc_reg_operand" "r")))
1930 (clobber (match_scratch:SI 3 "=q"))]
1931 "TARGET_POWERPC && TARGET_POWER"
1933 [(set_attr "type" "idiv")])
1935 (define_insn "*divsi3_no_mq"
1936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1937 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1938 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1939 "TARGET_POWERPC && ! TARGET_POWER"
1941 [(set_attr "type" "idiv")])
1943 (define_expand "modsi3"
1944 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1945 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1946 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1954 if (GET_CODE (operands[2]) != CONST_INT
1955 || INTVAL (operands[2]) <= 0
1956 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
1959 temp1 = gen_reg_rtx (SImode);
1960 temp2 = gen_reg_rtx (SImode);
1962 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1963 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1964 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1969 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1970 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1971 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
1973 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1974 [(set_attr "length" "8")])
1977 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1978 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1979 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1981 (clobber (match_scratch:SI 3 "=r,r"))]
1984 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
1986 [(set_attr "type" "compare")
1987 (set_attr "length" "8,12")])
1990 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1991 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1992 (match_operand:SI 2 "exact_log2_cint_operand" ""))
1994 (clobber (match_scratch:SI 3 ""))]
1997 (div:SI (match_dup 1) (match_dup 2)))
1999 (compare:CC (match_dup 3)
2004 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2005 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2006 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2008 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2009 (div:SI (match_dup 1) (match_dup 2)))]
2012 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2014 [(set_attr "type" "compare")
2015 (set_attr "length" "8,12")])
2018 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2019 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2020 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2022 (set (match_operand:SI 0 "gpc_reg_operand" "")
2023 (div:SI (match_dup 1) (match_dup 2)))]
2026 (div:SI (match_dup 1) (match_dup 2)))
2028 (compare:CC (match_dup 0)
2033 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2036 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2038 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2039 (match_operand:SI 3 "gpc_reg_operand" "r")))
2040 (set (match_operand:SI 2 "register_operand" "=*q")
2043 (zero_extend:DI (match_dup 1)) (const_int 32))
2044 (zero_extend:DI (match_dup 4)))
2048 [(set_attr "type" "idiv")])
2050 ;; To do unsigned divide we handle the cases of the divisor looking like a
2051 ;; negative number. If it is a constant that is less than 2**31, we don't
2052 ;; have to worry about the branches. So make a few subroutines here.
2054 ;; First comes the normal case.
2055 (define_expand "udivmodsi4_normal"
2056 [(set (match_dup 4) (const_int 0))
2057 (parallel [(set (match_operand:SI 0 "" "")
2058 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2060 (zero_extend:DI (match_operand:SI 1 "" "")))
2061 (match_operand:SI 2 "" "")))
2062 (set (match_operand:SI 3 "" "")
2063 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2065 (zero_extend:DI (match_dup 1)))
2069 { operands[4] = gen_reg_rtx (SImode); }")
2071 ;; This handles the branches.
2072 (define_expand "udivmodsi4_tests"
2073 [(set (match_operand:SI 0 "" "") (const_int 0))
2074 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2075 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2076 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2077 (label_ref (match_operand:SI 4 "" "")) (pc)))
2078 (set (match_dup 0) (const_int 1))
2079 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2080 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2081 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2082 (label_ref (match_dup 4)) (pc)))]
2085 { operands[5] = gen_reg_rtx (CCUNSmode);
2086 operands[6] = gen_reg_rtx (CCmode);
2089 (define_expand "udivmodsi4"
2090 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2091 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2092 (match_operand:SI 2 "reg_or_cint_operand" "")))
2093 (set (match_operand:SI 3 "gpc_reg_operand" "")
2094 (umod:SI (match_dup 1) (match_dup 2)))])]
2102 if (! TARGET_POWERPC)
2104 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2105 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2106 emit_insn (gen_divus_call ());
2107 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2108 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2115 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2117 operands[2] = force_reg (SImode, operands[2]);
2118 label = gen_label_rtx ();
2119 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2120 operands[3], label));
2123 operands[2] = force_reg (SImode, operands[2]);
2125 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2133 ;; AIX architecture-independent common-mode multiply (DImode),
2134 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2135 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2136 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2137 ;; assumed unused if generating common-mode, so ignore.
2138 (define_insn "mulh_call"
2141 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2142 (sign_extend:DI (reg:SI 4)))
2144 (clobber (match_scratch:SI 0 "=l"))]
2145 "! TARGET_POWER && ! TARGET_POWERPC"
2147 [(set_attr "type" "imul")])
2149 (define_insn "mull_call"
2151 (mult:DI (sign_extend:DI (reg:SI 3))
2152 (sign_extend:DI (reg:SI 4))))
2153 (clobber (match_scratch:SI 0 "=l"))
2154 (clobber (reg:SI 0))]
2155 "! TARGET_POWER && ! TARGET_POWERPC"
2157 [(set_attr "type" "imul")])
2159 (define_insn "divss_call"
2161 (div:SI (reg:SI 3) (reg:SI 4)))
2163 (mod:SI (reg:SI 3) (reg:SI 4)))
2164 (clobber (match_scratch:SI 0 "=l"))
2165 (clobber (reg:SI 0))]
2166 "! TARGET_POWER && ! TARGET_POWERPC"
2168 [(set_attr "type" "idiv")])
2170 (define_insn "divus_call"
2172 (udiv:SI (reg:SI 3) (reg:SI 4)))
2174 (umod:SI (reg:SI 3) (reg:SI 4)))
2175 (clobber (match_scratch:SI 0 "=l"))
2176 (clobber (reg:SI 0))
2177 (clobber (match_scratch:CC 1 "=x"))
2178 (clobber (reg:CC 69))]
2179 "! TARGET_POWER && ! TARGET_POWERPC"
2181 [(set_attr "type" "idiv")])
2183 (define_insn "quoss_call"
2185 (div:SI (reg:SI 3) (reg:SI 4)))
2186 (clobber (match_scratch:SI 0 "=l"))]
2187 "! TARGET_POWER && ! TARGET_POWERPC"
2189 [(set_attr "type" "idiv")])
2191 (define_insn "quous_call"
2193 (udiv:SI (reg:SI 3) (reg:SI 4)))
2194 (clobber (match_scratch:SI 0 "=l"))
2195 (clobber (reg:SI 0))
2196 (clobber (match_scratch:CC 1 "=x"))
2197 (clobber (reg:CC 69))]
2198 "! TARGET_POWER && ! TARGET_POWERPC"
2200 [(set_attr "type" "idiv")])
2202 ;; Logical instructions
2203 ;; The logical instructions are mostly combined by using match_operator,
2204 ;; but the plain AND insns are somewhat different because there is no
2205 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2206 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2208 (define_insn "andsi3"
2209 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2210 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2211 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2212 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2216 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2217 {andil.|andi.} %0,%1,%b2
2218 {andiu.|andis.} %0,%1,%u2")
2220 ;; Note to set cr's other than cr0 we do the and immediate and then
2221 ;; the test again -- this avoids a mfcr which on the higher end
2222 ;; machines causes an execution serialization
2224 (define_insn "*andsi3_internal2"
2225 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2226 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2227 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2229 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2230 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2234 {andil.|andi.} %3,%1,%b2
2235 {andiu.|andis.} %3,%1,%u2
2236 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2241 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2242 (set_attr "length" "4,4,4,4,8,8,8,8")])
2244 (define_insn "*andsi3_internal3"
2245 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2246 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2247 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2249 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2250 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2254 {andil.|andi.} %3,%1,%b2
2255 {andiu.|andis.} %3,%1,%u2
2256 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2261 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2262 (set_attr "length" "8,4,4,4,8,8,8,8")])
2265 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2266 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2267 (match_operand:SI 2 "and_operand" ""))
2269 (clobber (match_scratch:SI 3 ""))
2270 (clobber (match_scratch:CC 4 ""))]
2272 [(parallel [(set (match_dup 3)
2273 (and:SI (match_dup 1)
2275 (clobber (match_dup 4))])
2277 (compare:CC (match_dup 3)
2281 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2282 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2285 [(set (match_operand:CC 0 "cc_reg_operand" "")
2286 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2287 (match_operand:SI 2 "gpc_reg_operand" ""))
2289 (clobber (match_scratch:SI 3 ""))
2290 (clobber (match_scratch:CC 4 ""))]
2291 "TARGET_POWERPC64 && reload_completed"
2292 [(parallel [(set (match_dup 3)
2293 (and:SI (match_dup 1)
2295 (clobber (match_dup 4))])
2297 (compare:CC (match_dup 3)
2301 (define_insn "*andsi3_internal4"
2302 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2303 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2304 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2306 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2307 (and:SI (match_dup 1)
2309 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2313 {andil.|andi.} %0,%1,%b2
2314 {andiu.|andis.} %0,%1,%u2
2315 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2320 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2321 (set_attr "length" "4,4,4,4,8,8,8,8")])
2323 (define_insn "*andsi3_internal5"
2324 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2325 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2326 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2328 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2329 (and:SI (match_dup 1)
2331 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2335 {andil.|andi.} %0,%1,%b2
2336 {andiu.|andis.} %0,%1,%u2
2337 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2342 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2343 (set_attr "length" "8,4,4,4,8,8,8,8")])
2346 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2347 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2348 (match_operand:SI 2 "and_operand" ""))
2350 (set (match_operand:SI 0 "gpc_reg_operand" "")
2351 (and:SI (match_dup 1)
2353 (clobber (match_scratch:CC 4 ""))]
2355 [(parallel [(set (match_dup 0)
2356 (and:SI (match_dup 1)
2358 (clobber (match_dup 4))])
2360 (compare:CC (match_dup 0)
2365 [(set (match_operand:CC 3 "cc_reg_operand" "")
2366 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2367 (match_operand:SI 2 "gpc_reg_operand" ""))
2369 (set (match_operand:SI 0 "gpc_reg_operand" "")
2370 (and:SI (match_dup 1)
2372 (clobber (match_scratch:CC 4 ""))]
2373 "TARGET_POWERPC64 && reload_completed"
2374 [(parallel [(set (match_dup 0)
2375 (and:SI (match_dup 1)
2377 (clobber (match_dup 4))])
2379 (compare:CC (match_dup 0)
2383 ;; Handle the PowerPC64 rlwinm corner case
2385 (define_insn_and_split "*andsi3_internal6"
2386 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2387 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2388 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2393 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2396 (rotate:SI (match_dup 0) (match_dup 5)))]
2399 int mb = extract_MB (operands[2]);
2400 int me = extract_ME (operands[2]);
2401 operands[3] = GEN_INT (me + 1);
2402 operands[5] = GEN_INT (32 - (me + 1));
2403 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2405 [(set_attr "length" "8")])
2407 (define_insn_and_split "*andsi3_internal7"
2408 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2409 (compare:CC (and:SI (match_operand:SI 0 "gpc_reg_operand" "r,r")
2410 (match_operand:SI 1 "mask_operand_wrap" "i,i"))
2412 (clobber (match_scratch:SI 3 "=r,r"))]
2416 [(parallel [(set (match_dup 2)
2417 (compare:CC (and:SI (rotate:SI (match_dup 0) (match_dup 4))
2420 (clobber (match_dup 3))])]
2423 int mb = extract_MB (operands[1]);
2424 int me = extract_ME (operands[1]);
2425 operands[4] = GEN_INT (me + 1);
2426 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2428 [(set_attr "type" "delayed_compare,compare")
2429 (set_attr "length" "4,8")])
2431 (define_insn_and_split "*andsi3_internal8"
2432 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2433 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2434 (match_operand:SI 2 "mask_operand_wrap" "i,i"))
2436 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2437 (and:SI (match_dup 1)
2442 [(parallel [(set (match_dup 3)
2443 (compare:CC (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2447 (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2450 (rotate:SI (match_dup 0) (match_dup 6)))]
2453 int mb = extract_MB (operands[2]);
2454 int me = extract_ME (operands[2]);
2455 operands[4] = GEN_INT (me + 1);
2456 operands[6] = GEN_INT (32 - (me + 1));
2457 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2459 [(set_attr "type" "delayed_compare,compare")
2460 (set_attr "length" "8,12")])
2462 (define_expand "iorsi3"
2463 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2464 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2465 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2469 if (GET_CODE (operands[2]) == CONST_INT
2470 && ! logical_operand (operands[2], SImode))
2472 HOST_WIDE_INT value = INTVAL (operands[2]);
2473 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2474 ? operands[0] : gen_reg_rtx (SImode));
2476 emit_insn (gen_iorsi3 (tmp, operands[1],
2477 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2478 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2483 (define_expand "xorsi3"
2484 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2485 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2486 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2490 if (GET_CODE (operands[2]) == CONST_INT
2491 && ! logical_operand (operands[2], SImode))
2493 HOST_WIDE_INT value = INTVAL (operands[2]);
2494 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2495 ? operands[0] : gen_reg_rtx (SImode));
2497 emit_insn (gen_xorsi3 (tmp, operands[1],
2498 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2499 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2504 (define_insn "*boolsi3_internal1"
2505 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2506 (match_operator:SI 3 "boolean_or_operator"
2507 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2508 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2512 {%q3il|%q3i} %0,%1,%b2
2513 {%q3iu|%q3is} %0,%1,%u2")
2515 (define_insn "*boolsi3_internal2"
2516 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2517 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2518 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2519 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2521 (clobber (match_scratch:SI 3 "=r,r"))]
2526 [(set_attr "type" "compare")
2527 (set_attr "length" "4,8")])
2530 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2531 (compare:CC (match_operator:SI 4 "boolean_operator"
2532 [(match_operand:SI 1 "gpc_reg_operand" "")
2533 (match_operand:SI 2 "gpc_reg_operand" "")])
2535 (clobber (match_scratch:SI 3 ""))]
2536 "TARGET_32BIT && reload_completed"
2537 [(set (match_dup 3) (match_dup 4))
2539 (compare:CC (match_dup 3)
2543 (define_insn "*boolsi3_internal3"
2544 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2545 (compare:CC (match_operator:SI 4 "boolean_operator"
2546 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2547 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2549 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2555 [(set_attr "type" "compare")
2556 (set_attr "length" "4,8")])
2559 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2560 (compare:CC (match_operator:SI 4 "boolean_operator"
2561 [(match_operand:SI 1 "gpc_reg_operand" "")
2562 (match_operand:SI 2 "gpc_reg_operand" "")])
2564 (set (match_operand:SI 0 "gpc_reg_operand" "")
2566 "TARGET_32BIT && reload_completed"
2567 [(set (match_dup 0) (match_dup 4))
2569 (compare:CC (match_dup 0)
2573 ;; Split a logical operation that we can't do in one insn into two insns,
2574 ;; each of which does one 16-bit part. This is used by combine.
2577 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2578 (match_operator:SI 3 "boolean_or_operator"
2579 [(match_operand:SI 1 "gpc_reg_operand" "")
2580 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2582 [(set (match_dup 0) (match_dup 4))
2583 (set (match_dup 0) (match_dup 5))]
2587 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2588 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2590 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2591 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2595 (define_insn "*boolcsi3_internal1"
2596 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2597 (match_operator:SI 3 "boolean_operator"
2598 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2599 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2603 (define_insn "*boolcsi3_internal2"
2604 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2605 (compare:CC (match_operator:SI 4 "boolean_operator"
2606 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2607 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2609 (clobber (match_scratch:SI 3 "=r,r"))]
2614 [(set_attr "type" "compare")
2615 (set_attr "length" "4,8")])
2618 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2619 (compare:CC (match_operator:SI 4 "boolean_operator"
2620 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2621 (match_operand:SI 2 "gpc_reg_operand" "")])
2623 (clobber (match_scratch:SI 3 ""))]
2624 "TARGET_32BIT && reload_completed"
2625 [(set (match_dup 3) (match_dup 4))
2627 (compare:CC (match_dup 3)
2631 (define_insn "*boolcsi3_internal3"
2632 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2633 (compare:CC (match_operator:SI 4 "boolean_operator"
2634 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2635 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2637 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2643 [(set_attr "type" "compare")
2644 (set_attr "length" "4,8")])
2647 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2648 (compare:CC (match_operator:SI 4 "boolean_operator"
2649 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2650 (match_operand:SI 2 "gpc_reg_operand" "")])
2652 (set (match_operand:SI 0 "gpc_reg_operand" "")
2654 "TARGET_32BIT && reload_completed"
2655 [(set (match_dup 0) (match_dup 4))
2657 (compare:CC (match_dup 0)
2661 (define_insn "*boolccsi3_internal1"
2662 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2663 (match_operator:SI 3 "boolean_operator"
2664 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2665 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2669 (define_insn "*boolccsi3_internal2"
2670 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2671 (compare:CC (match_operator:SI 4 "boolean_operator"
2672 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2673 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2675 (clobber (match_scratch:SI 3 "=r,r"))]
2680 [(set_attr "type" "compare")
2681 (set_attr "length" "4,8")])
2684 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2685 (compare:CC (match_operator:SI 4 "boolean_operator"
2686 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2687 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2689 (clobber (match_scratch:SI 3 ""))]
2690 "TARGET_32BIT && reload_completed"
2691 [(set (match_dup 3) (match_dup 4))
2693 (compare:CC (match_dup 3)
2697 (define_insn "*boolccsi3_internal3"
2698 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2699 (compare:CC (match_operator:SI 4 "boolean_operator"
2700 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2701 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2703 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2709 [(set_attr "type" "compare")
2710 (set_attr "length" "4,8")])
2713 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2714 (compare:CC (match_operator:SI 4 "boolean_operator"
2715 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2716 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2718 (set (match_operand:SI 0 "gpc_reg_operand" "")
2720 "TARGET_32BIT && reload_completed"
2721 [(set (match_dup 0) (match_dup 4))
2723 (compare:CC (match_dup 0)
2727 ;; maskir insn. We need four forms because things might be in arbitrary
2728 ;; orders. Don't define forms that only set CR fields because these
2729 ;; would modify an input register.
2731 (define_insn "*maskir_internal1"
2732 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2733 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2734 (match_operand:SI 1 "gpc_reg_operand" "0"))
2735 (and:SI (match_dup 2)
2736 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2740 (define_insn "*maskir_internal2"
2741 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2742 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2743 (match_operand:SI 1 "gpc_reg_operand" "0"))
2744 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2749 (define_insn "*maskir_internal3"
2750 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2751 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2752 (match_operand:SI 3 "gpc_reg_operand" "r"))
2753 (and:SI (not:SI (match_dup 2))
2754 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2758 (define_insn "*maskir_internal4"
2759 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2760 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2761 (match_operand:SI 2 "gpc_reg_operand" "r"))
2762 (and:SI (not:SI (match_dup 2))
2763 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2767 (define_insn "*maskir_internal5"
2768 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2770 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2771 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2772 (and:SI (match_dup 2)
2773 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2775 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2776 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2777 (and:SI (match_dup 2) (match_dup 3))))]
2782 [(set_attr "type" "compare")
2783 (set_attr "length" "4,8")])
2786 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2788 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2789 (match_operand:SI 1 "gpc_reg_operand" ""))
2790 (and:SI (match_dup 2)
2791 (match_operand:SI 3 "gpc_reg_operand" "")))
2793 (set (match_operand:SI 0 "gpc_reg_operand" "")
2794 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2795 (and:SI (match_dup 2) (match_dup 3))))]
2796 "TARGET_POWER && reload_completed"
2798 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2799 (and:SI (match_dup 2) (match_dup 3))))
2801 (compare:CC (match_dup 0)
2805 (define_insn "*maskir_internal6"
2806 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2808 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2809 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2810 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2813 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2814 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2815 (and:SI (match_dup 3) (match_dup 2))))]
2820 [(set_attr "type" "compare")
2821 (set_attr "length" "4,8")])
2824 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2826 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2827 (match_operand:SI 1 "gpc_reg_operand" ""))
2828 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2831 (set (match_operand:SI 0 "gpc_reg_operand" "")
2832 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2833 (and:SI (match_dup 3) (match_dup 2))))]
2834 "TARGET_POWER && reload_completed"
2836 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2837 (and:SI (match_dup 3) (match_dup 2))))
2839 (compare:CC (match_dup 0)
2843 (define_insn "*maskir_internal7"
2844 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2846 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2847 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2848 (and:SI (not:SI (match_dup 2))
2849 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2851 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2852 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2853 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2858 [(set_attr "type" "compare")
2859 (set_attr "length" "4,8")])
2862 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2864 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2865 (match_operand:SI 3 "gpc_reg_operand" ""))
2866 (and:SI (not:SI (match_dup 2))
2867 (match_operand:SI 1 "gpc_reg_operand" "")))
2869 (set (match_operand:SI 0 "gpc_reg_operand" "")
2870 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2871 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2872 "TARGET_POWER && reload_completed"
2874 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2875 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2877 (compare:CC (match_dup 0)
2881 (define_insn "*maskir_internal8"
2882 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2884 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2885 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2886 (and:SI (not:SI (match_dup 2))
2887 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2889 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2890 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2891 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2896 [(set_attr "type" "compare")
2897 (set_attr "length" "4,8")])
2900 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2902 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2903 (match_operand:SI 2 "gpc_reg_operand" ""))
2904 (and:SI (not:SI (match_dup 2))
2905 (match_operand:SI 1 "gpc_reg_operand" "")))
2907 (set (match_operand:SI 0 "gpc_reg_operand" "")
2908 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2909 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2910 "TARGET_POWER && reload_completed"
2912 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2913 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2915 (compare:CC (match_dup 0)
2919 ;; Rotate and shift insns, in all their variants. These support shifts,
2920 ;; field inserts and extracts, and various combinations thereof.
2921 (define_expand "insv"
2922 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2923 (match_operand:SI 1 "const_int_operand" "")
2924 (match_operand:SI 2 "const_int_operand" ""))
2925 (match_operand 3 "gpc_reg_operand" ""))]
2929 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2930 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2931 compiler if the address of the structure is taken later. */
2932 if (GET_CODE (operands[0]) == SUBREG
2933 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2936 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2937 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2939 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2943 (define_insn "insvsi"
2944 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2945 (match_operand:SI 1 "const_int_operand" "i")
2946 (match_operand:SI 2 "const_int_operand" "i"))
2947 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2951 int start = INTVAL (operands[2]) & 31;
2952 int size = INTVAL (operands[1]) & 31;
2954 operands[4] = GEN_INT (32 - start - size);
2955 operands[1] = GEN_INT (start + size - 1);
2956 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2958 [(set_attr "type" "insert_word")])
2960 (define_insn "*insvsi_internal1"
2961 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2962 (match_operand:SI 1 "const_int_operand" "i")
2963 (match_operand:SI 2 "const_int_operand" "i"))
2964 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2965 (match_operand:SI 4 "const_int_operand" "i")))]
2966 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2969 int shift = INTVAL (operands[4]) & 31;
2970 int start = INTVAL (operands[2]) & 31;
2971 int size = INTVAL (operands[1]) & 31;
2973 operands[4] = GEN_INT (shift - start - size);
2974 operands[1] = GEN_INT (start + size - 1);
2975 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2977 [(set_attr "type" "insert_word")])
2979 (define_insn "*insvsi_internal2"
2980 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2981 (match_operand:SI 1 "const_int_operand" "i")
2982 (match_operand:SI 2 "const_int_operand" "i"))
2983 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2984 (match_operand:SI 4 "const_int_operand" "i")))]
2985 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2988 int shift = INTVAL (operands[4]) & 31;
2989 int start = INTVAL (operands[2]) & 31;
2990 int size = INTVAL (operands[1]) & 31;
2992 operands[4] = GEN_INT (32 - shift - start - size);
2993 operands[1] = GEN_INT (start + size - 1);
2994 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2996 [(set_attr "type" "insert_word")])
2998 (define_insn "*insvsi_internal3"
2999 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3000 (match_operand:SI 1 "const_int_operand" "i")
3001 (match_operand:SI 2 "const_int_operand" "i"))
3002 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3003 (match_operand:SI 4 "const_int_operand" "i")))]
3004 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3007 int shift = INTVAL (operands[4]) & 31;
3008 int start = INTVAL (operands[2]) & 31;
3009 int size = INTVAL (operands[1]) & 31;
3011 operands[4] = GEN_INT (32 - shift - start - size);
3012 operands[1] = GEN_INT (start + size - 1);
3013 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3015 [(set_attr "type" "insert_word")])
3017 (define_insn "*insvsi_internal4"
3018 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3019 (match_operand:SI 1 "const_int_operand" "i")
3020 (match_operand:SI 2 "const_int_operand" "i"))
3021 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3022 (match_operand:SI 4 "const_int_operand" "i")
3023 (match_operand:SI 5 "const_int_operand" "i")))]
3024 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3027 int extract_start = INTVAL (operands[5]) & 31;
3028 int extract_size = INTVAL (operands[4]) & 31;
3029 int insert_start = INTVAL (operands[2]) & 31;
3030 int insert_size = INTVAL (operands[1]) & 31;
3032 /* Align extract field with insert field */
3033 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3034 operands[1] = GEN_INT (insert_start + insert_size - 1);
3035 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3037 [(set_attr "type" "insert_word")])
3039 (define_insn "insvdi"
3040 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3041 (match_operand:SI 1 "const_int_operand" "i")
3042 (match_operand:SI 2 "const_int_operand" "i"))
3043 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3047 int start = INTVAL (operands[2]) & 63;
3048 int size = INTVAL (operands[1]) & 63;
3050 operands[1] = GEN_INT (64 - start - size);
3051 return \"rldimi %0,%3,%H1,%H2\";
3054 (define_expand "extzv"
3055 [(set (match_operand 0 "gpc_reg_operand" "")
3056 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3057 (match_operand:SI 2 "const_int_operand" "")
3058 (match_operand:SI 3 "const_int_operand" "")))]
3062 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3063 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3064 compiler if the address of the structure is taken later. */
3065 if (GET_CODE (operands[0]) == SUBREG
3066 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3069 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3070 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3072 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3076 (define_insn "extzvsi"
3077 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3078 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3079 (match_operand:SI 2 "const_int_operand" "i")
3080 (match_operand:SI 3 "const_int_operand" "i")))]
3084 int start = INTVAL (operands[3]) & 31;
3085 int size = INTVAL (operands[2]) & 31;
3087 if (start + size >= 32)
3088 operands[3] = const0_rtx;
3090 operands[3] = GEN_INT (start + size);
3091 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3094 (define_insn "*extzvsi_internal1"
3095 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3096 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3097 (match_operand:SI 2 "const_int_operand" "i,i")
3098 (match_operand:SI 3 "const_int_operand" "i,i"))
3100 (clobber (match_scratch:SI 4 "=r,r"))]
3104 int start = INTVAL (operands[3]) & 31;
3105 int size = INTVAL (operands[2]) & 31;
3107 /* Force split for non-cc0 compare. */
3108 if (which_alternative == 1)
3111 /* If the bit-field being tested fits in the upper or lower half of a
3112 word, it is possible to use andiu. or andil. to test it. This is
3113 useful because the condition register set-use delay is smaller for
3114 andi[ul]. than for rlinm. This doesn't work when the starting bit
3115 position is 0 because the LT and GT bits may be set wrong. */
3117 if ((start > 0 && start + size <= 16) || start >= 16)
3119 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3120 - (1 << (16 - (start & 15) - size))));
3122 return \"{andiu.|andis.} %4,%1,%3\";
3124 return \"{andil.|andi.} %4,%1,%3\";
3127 if (start + size >= 32)
3128 operands[3] = const0_rtx;
3130 operands[3] = GEN_INT (start + size);
3131 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3133 [(set_attr "type" "compare")
3134 (set_attr "length" "4,8")])
3137 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3138 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3139 (match_operand:SI 2 "const_int_operand" "")
3140 (match_operand:SI 3 "const_int_operand" ""))
3142 (clobber (match_scratch:SI 4 ""))]
3145 (zero_extract:SI (match_dup 1) (match_dup 2)
3148 (compare:CC (match_dup 4)
3152 (define_insn "*extzvsi_internal2"
3153 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3154 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3155 (match_operand:SI 2 "const_int_operand" "i,i")
3156 (match_operand:SI 3 "const_int_operand" "i,i"))
3158 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3159 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3163 int start = INTVAL (operands[3]) & 31;
3164 int size = INTVAL (operands[2]) & 31;
3166 /* Force split for non-cc0 compare. */
3167 if (which_alternative == 1)
3170 /* Since we are using the output value, we can't ignore any need for
3171 a shift. The bit-field must end at the LSB. */
3172 if (start >= 16 && start + size == 32)
3174 operands[3] = GEN_INT ((1 << size) - 1);
3175 return \"{andil.|andi.} %0,%1,%3\";
3178 if (start + size >= 32)
3179 operands[3] = const0_rtx;
3181 operands[3] = GEN_INT (start + size);
3182 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3184 [(set_attr "type" "compare")
3185 (set_attr "length" "4,8")])
3188 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3189 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3190 (match_operand:SI 2 "const_int_operand" "")
3191 (match_operand:SI 3 "const_int_operand" ""))
3193 (set (match_operand:SI 0 "gpc_reg_operand" "")
3194 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3197 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3199 (compare:CC (match_dup 0)
3203 (define_insn "extzvdi"
3204 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3205 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3206 (match_operand:SI 2 "const_int_operand" "i")
3207 (match_operand:SI 3 "const_int_operand" "i")))]
3211 int start = INTVAL (operands[3]) & 63;
3212 int size = INTVAL (operands[2]) & 63;
3214 if (start + size >= 64)
3215 operands[3] = const0_rtx;
3217 operands[3] = GEN_INT (start + size);
3218 operands[2] = GEN_INT (64 - size);
3219 return \"rldicl %0,%1,%3,%2\";
3222 (define_insn "*extzvdi_internal1"
3223 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3224 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3225 (match_operand:SI 2 "const_int_operand" "i")
3226 (match_operand:SI 3 "const_int_operand" "i"))
3228 (clobber (match_scratch:DI 4 "=r"))]
3232 int start = INTVAL (operands[3]) & 63;
3233 int size = INTVAL (operands[2]) & 63;
3235 if (start + size >= 64)
3236 operands[3] = const0_rtx;
3238 operands[3] = GEN_INT (start + size);
3239 operands[2] = GEN_INT (64 - size);
3240 return \"rldicl. %4,%1,%3,%2\";
3243 (define_insn "*extzvdi_internal2"
3244 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3245 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3246 (match_operand:SI 2 "const_int_operand" "i")
3247 (match_operand:SI 3 "const_int_operand" "i"))
3249 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3250 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3254 int start = INTVAL (operands[3]) & 63;
3255 int size = INTVAL (operands[2]) & 63;
3257 if (start + size >= 64)
3258 operands[3] = const0_rtx;
3260 operands[3] = GEN_INT (start + size);
3261 operands[2] = GEN_INT (64 - size);
3262 return \"rldicl. %0,%1,%3,%2\";
3265 (define_insn "rotlsi3"
3266 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3267 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3268 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3270 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3272 (define_insn "*rotlsi3_internal2"
3273 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3274 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3275 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3277 (clobber (match_scratch:SI 3 "=r,r"))]
3280 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3282 [(set_attr "type" "delayed_compare")
3283 (set_attr "length" "4,8")])
3286 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3287 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3288 (match_operand:SI 2 "reg_or_cint_operand" ""))
3290 (clobber (match_scratch:SI 3 ""))]
3293 (rotate:SI (match_dup 1) (match_dup 2)))
3295 (compare:CC (match_dup 3)
3299 (define_insn "*rotlsi3_internal3"
3300 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3301 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3302 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3304 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3305 (rotate:SI (match_dup 1) (match_dup 2)))]
3308 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3310 [(set_attr "type" "delayed_compare")
3311 (set_attr "length" "4,8")])
3314 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3315 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3316 (match_operand:SI 2 "reg_or_cint_operand" ""))
3318 (set (match_operand:SI 0 "gpc_reg_operand" "")
3319 (rotate:SI (match_dup 1) (match_dup 2)))]
3322 (rotate:SI (match_dup 1) (match_dup 2)))
3324 (compare:CC (match_dup 0)
3328 (define_insn "*rotlsi3_internal4"
3329 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3330 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3331 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3332 (match_operand:SI 3 "mask_operand" "n")))]
3334 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3336 (define_insn "*rotlsi3_internal5"
3337 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3339 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3340 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3341 (match_operand:SI 3 "mask_operand" "n,n"))
3343 (clobber (match_scratch:SI 4 "=r,r"))]
3346 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3348 [(set_attr "type" "delayed_compare")
3349 (set_attr "length" "4,8")])
3352 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3354 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3355 (match_operand:SI 2 "reg_or_cint_operand" ""))
3356 (match_operand:SI 3 "mask_operand" ""))
3358 (clobber (match_scratch:SI 4 ""))]
3361 (and:SI (rotate:SI (match_dup 1)
3365 (compare:CC (match_dup 4)
3369 (define_insn "*rotlsi3_internal6"
3370 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3372 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3373 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3374 (match_operand:SI 3 "mask_operand" "n,n"))
3376 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3377 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3380 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3382 [(set_attr "type" "delayed_compare")
3383 (set_attr "length" "4,8")])
3386 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3388 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3389 (match_operand:SI 2 "reg_or_cint_operand" ""))
3390 (match_operand:SI 3 "mask_operand" ""))
3392 (set (match_operand:SI 0 "gpc_reg_operand" "")
3393 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3396 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3398 (compare:CC (match_dup 0)
3402 (define_insn "*rotlsi3_internal7"
3403 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3406 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3407 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3409 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3411 (define_insn "*rotlsi3_internal8"
3412 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3413 (compare:CC (zero_extend:SI
3415 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3416 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3418 (clobber (match_scratch:SI 3 "=r,r"))]
3421 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3423 [(set_attr "type" "delayed_compare")
3424 (set_attr "length" "4,8")])
3427 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3428 (compare:CC (zero_extend:SI
3430 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3431 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3433 (clobber (match_scratch:SI 3 ""))]
3436 (zero_extend:SI (subreg:QI
3437 (rotate:SI (match_dup 1)
3440 (compare:CC (match_dup 3)
3444 (define_insn "*rotlsi3_internal9"
3445 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3446 (compare:CC (zero_extend:SI
3448 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3449 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3451 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3452 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3455 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3457 [(set_attr "type" "delayed_compare")
3458 (set_attr "length" "4,8")])
3461 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3462 (compare:CC (zero_extend:SI
3464 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3465 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3467 (set (match_operand:SI 0 "gpc_reg_operand" "")
3468 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3471 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3473 (compare:CC (match_dup 0)
3477 (define_insn "*rotlsi3_internal10"
3478 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3481 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3482 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3484 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3486 (define_insn "*rotlsi3_internal11"
3487 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3488 (compare:CC (zero_extend:SI
3490 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3491 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3493 (clobber (match_scratch:SI 3 "=r,r"))]
3496 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3498 [(set_attr "type" "delayed_compare")
3499 (set_attr "length" "4,8")])
3502 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3503 (compare:CC (zero_extend:SI
3505 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3506 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3508 (clobber (match_scratch:SI 3 ""))]
3511 (zero_extend:SI (subreg:HI
3512 (rotate:SI (match_dup 1)
3515 (compare:CC (match_dup 3)
3519 (define_insn "*rotlsi3_internal12"
3520 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3521 (compare:CC (zero_extend:SI
3523 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3524 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3526 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3527 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3530 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3532 [(set_attr "type" "delayed_compare")
3533 (set_attr "length" "4,8")])
3536 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3537 (compare:CC (zero_extend:SI
3539 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3540 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3542 (set (match_operand:SI 0 "gpc_reg_operand" "")
3543 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3546 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3548 (compare:CC (match_dup 0)
3552 ;; Note that we use "sle." instead of "sl." so that we can set
3553 ;; SHIFT_COUNT_TRUNCATED.
3555 (define_expand "ashlsi3"
3556 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3557 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3558 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3563 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3565 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3569 (define_insn "ashlsi3_power"
3570 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3571 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3572 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3573 (clobber (match_scratch:SI 3 "=q,X"))]
3577 {sli|slwi} %0,%1,%h2")
3579 (define_insn "ashlsi3_no_power"
3580 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3581 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3582 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3584 "{sl|slw}%I2 %0,%1,%h2")
3587 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3588 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3589 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3591 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3592 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3596 {sli.|slwi.} %3,%1,%h2
3599 [(set_attr "type" "delayed_compare")
3600 (set_attr "length" "4,4,8,8")])
3603 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3604 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3605 (match_operand:SI 2 "reg_or_cint_operand" ""))
3607 (clobber (match_scratch:SI 3 ""))
3608 (clobber (match_scratch:SI 4 ""))]
3609 "TARGET_POWER && reload_completed"
3610 [(parallel [(set (match_dup 3)
3611 (ashift:SI (match_dup 1) (match_dup 2)))
3612 (clobber (match_dup 4))])
3614 (compare:CC (match_dup 3)
3619 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3620 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3621 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3623 (clobber (match_scratch:SI 3 "=r,r"))]
3624 "! TARGET_POWER && TARGET_32BIT"
3626 {sl|slw}%I2. %3,%1,%h2
3628 [(set_attr "type" "delayed_compare")
3629 (set_attr "length" "4,8")])
3632 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3633 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3634 (match_operand:SI 2 "reg_or_cint_operand" ""))
3636 (clobber (match_scratch:SI 3 ""))]
3637 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3639 (ashift:SI (match_dup 1) (match_dup 2)))
3641 (compare:CC (match_dup 3)
3646 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3647 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3648 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3650 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3651 (ashift:SI (match_dup 1) (match_dup 2)))
3652 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3656 {sli.|slwi.} %0,%1,%h2
3659 [(set_attr "type" "delayed_compare")
3660 (set_attr "length" "4,4,8,8")])
3663 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3664 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3665 (match_operand:SI 2 "reg_or_cint_operand" ""))
3667 (set (match_operand:SI 0 "gpc_reg_operand" "")
3668 (ashift:SI (match_dup 1) (match_dup 2)))
3669 (clobber (match_scratch:SI 4 ""))]
3670 "TARGET_POWER && reload_completed"
3671 [(parallel [(set (match_dup 0)
3672 (ashift:SI (match_dup 1) (match_dup 2)))
3673 (clobber (match_dup 4))])
3675 (compare:CC (match_dup 0)
3680 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3681 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3682 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3684 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3685 (ashift:SI (match_dup 1) (match_dup 2)))]
3686 "! TARGET_POWER && TARGET_32BIT"
3688 {sl|slw}%I2. %0,%1,%h2
3690 [(set_attr "type" "delayed_compare")
3691 (set_attr "length" "4,8")])
3694 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3695 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3696 (match_operand:SI 2 "reg_or_cint_operand" ""))
3698 (set (match_operand:SI 0 "gpc_reg_operand" "")
3699 (ashift:SI (match_dup 1) (match_dup 2)))]
3700 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3702 (ashift:SI (match_dup 1) (match_dup 2)))
3704 (compare:CC (match_dup 0)
3709 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3710 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3711 (match_operand:SI 2 "const_int_operand" "i"))
3712 (match_operand:SI 3 "mask_operand" "n")))]
3713 "includes_lshift_p (operands[2], operands[3])"
3714 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3717 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3719 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3720 (match_operand:SI 2 "const_int_operand" "i,i"))
3721 (match_operand:SI 3 "mask_operand" "n,n"))
3723 (clobber (match_scratch:SI 4 "=r,r"))]
3724 "includes_lshift_p (operands[2], operands[3])"
3726 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3728 [(set_attr "type" "delayed_compare")
3729 (set_attr "length" "4,8")])
3732 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3734 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3735 (match_operand:SI 2 "const_int_operand" ""))
3736 (match_operand:SI 3 "mask_operand" ""))
3738 (clobber (match_scratch:SI 4 ""))]
3739 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3741 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3744 (compare:CC (match_dup 4)
3749 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3751 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3752 (match_operand:SI 2 "const_int_operand" "i,i"))
3753 (match_operand:SI 3 "mask_operand" "n,n"))
3755 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3756 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3757 "includes_lshift_p (operands[2], operands[3])"
3759 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3761 [(set_attr "type" "delayed_compare")
3762 (set_attr "length" "4,8")])
3765 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3767 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3768 (match_operand:SI 2 "const_int_operand" ""))
3769 (match_operand:SI 3 "mask_operand" ""))
3771 (set (match_operand:SI 0 "gpc_reg_operand" "")
3772 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3773 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3775 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3777 (compare:CC (match_dup 0)
3781 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3783 (define_expand "lshrsi3"
3784 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3785 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3786 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3791 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3793 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3797 (define_insn "lshrsi3_power"
3798 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3799 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3800 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3801 (clobber (match_scratch:SI 3 "=q,X,X"))]
3806 {s%A2i|s%A2wi} %0,%1,%h2")
3808 (define_insn "lshrsi3_no_power"
3809 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3810 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3811 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3815 {sr|srw}%I2 %0,%1,%h2")
3818 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3819 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3820 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3822 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3823 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3828 {s%A2i.|s%A2wi.} %3,%1,%h2
3832 [(set_attr "type" "delayed_compare")
3833 (set_attr "length" "4,4,4,8,8,8")])
3836 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3837 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3838 (match_operand:SI 2 "reg_or_cint_operand" ""))
3840 (clobber (match_scratch:SI 3 ""))
3841 (clobber (match_scratch:SI 4 ""))]
3842 "TARGET_POWER && reload_completed"
3843 [(parallel [(set (match_dup 3)
3844 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3845 (clobber (match_dup 4))])
3847 (compare:CC (match_dup 3)
3852 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3853 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3854 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3856 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3857 "! TARGET_POWER && TARGET_32BIT"
3860 {sr|srw}%I2. %3,%1,%h2
3863 [(set_attr "type" "delayed_compare")
3864 (set_attr "length" "4,4,8,8")])
3867 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3868 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3869 (match_operand:SI 2 "reg_or_cint_operand" ""))
3871 (clobber (match_scratch:SI 3 ""))]
3872 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3874 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3876 (compare:CC (match_dup 3)
3881 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3882 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3883 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3885 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3886 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3887 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3892 {s%A2i.|s%A2wi.} %0,%1,%h2
3896 [(set_attr "type" "delayed_compare")
3897 (set_attr "length" "4,4,4,8,8,8")])
3900 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3901 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3902 (match_operand:SI 2 "reg_or_cint_operand" ""))
3904 (set (match_operand:SI 0 "gpc_reg_operand" "")
3905 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3906 (clobber (match_scratch:SI 4 ""))]
3907 "TARGET_POWER && reload_completed"
3908 [(parallel [(set (match_dup 0)
3909 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3910 (clobber (match_dup 4))])
3912 (compare:CC (match_dup 0)
3917 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3918 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3919 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3921 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3922 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3923 "! TARGET_POWER && TARGET_32BIT"
3926 {sr|srw}%I2. %0,%1,%h2
3929 [(set_attr "type" "delayed_compare")
3930 (set_attr "length" "4,4,8,8")])
3933 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3934 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3935 (match_operand:SI 2 "reg_or_cint_operand" ""))
3937 (set (match_operand:SI 0 "gpc_reg_operand" "")
3938 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3939 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3941 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3943 (compare:CC (match_dup 0)
3948 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3949 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3950 (match_operand:SI 2 "const_int_operand" "i"))
3951 (match_operand:SI 3 "mask_operand" "n")))]
3952 "includes_rshift_p (operands[2], operands[3])"
3953 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3956 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3958 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3959 (match_operand:SI 2 "const_int_operand" "i,i"))
3960 (match_operand:SI 3 "mask_operand" "n,n"))
3962 (clobber (match_scratch:SI 4 "=r,r"))]
3963 "includes_rshift_p (operands[2], operands[3])"
3965 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
3967 [(set_attr "type" "delayed_compare")
3968 (set_attr "length" "4,8")])
3971 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3973 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3974 (match_operand:SI 2 "const_int_operand" ""))
3975 (match_operand:SI 3 "mask_operand" ""))
3977 (clobber (match_scratch:SI 4 ""))]
3978 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
3980 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
3983 (compare:CC (match_dup 4)
3988 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3990 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3991 (match_operand:SI 2 "const_int_operand" "i,i"))
3992 (match_operand:SI 3 "mask_operand" "n,n"))
3994 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3995 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3996 "includes_rshift_p (operands[2], operands[3])"
3998 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4000 [(set_attr "type" "delayed_compare")
4001 (set_attr "length" "4,8")])
4004 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4006 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4007 (match_operand:SI 2 "const_int_operand" ""))
4008 (match_operand:SI 3 "mask_operand" ""))
4010 (set (match_operand:SI 0 "gpc_reg_operand" "")
4011 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4012 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4014 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4016 (compare:CC (match_dup 0)
4021 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4024 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4025 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4026 "includes_rshift_p (operands[2], GEN_INT (255))"
4027 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4034 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4035 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4037 (clobber (match_scratch:SI 3 "=r,r"))]
4038 "includes_rshift_p (operands[2], GEN_INT (255))"
4040 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4042 [(set_attr "type" "delayed_compare")
4043 (set_attr "length" "4,8")])
4046 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4050 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4051 (match_operand:SI 2 "const_int_operand" "")) 0))
4053 (clobber (match_scratch:SI 3 ""))]
4054 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4056 (zero_extend:SI (subreg:QI
4057 (lshiftrt:SI (match_dup 1)
4060 (compare:CC (match_dup 3)
4065 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4069 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4070 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4072 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4073 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4074 "includes_rshift_p (operands[2], GEN_INT (255))"
4076 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4078 [(set_attr "type" "delayed_compare")
4079 (set_attr "length" "4,8")])
4082 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4086 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4087 (match_operand:SI 2 "const_int_operand" "")) 0))
4089 (set (match_operand:SI 0 "gpc_reg_operand" "")
4090 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4091 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4093 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4095 (compare:CC (match_dup 0)
4100 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4103 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4104 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4105 "includes_rshift_p (operands[2], GEN_INT (65535))"
4106 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4109 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4113 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4114 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4116 (clobber (match_scratch:SI 3 "=r,r"))]
4117 "includes_rshift_p (operands[2], GEN_INT (65535))"
4119 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4121 [(set_attr "type" "delayed_compare")
4122 (set_attr "length" "4,8")])
4125 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4129 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4130 (match_operand:SI 2 "const_int_operand" "")) 0))
4132 (clobber (match_scratch:SI 3 ""))]
4133 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4135 (zero_extend:SI (subreg:HI
4136 (lshiftrt:SI (match_dup 1)
4139 (compare:CC (match_dup 3)
4144 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4148 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4149 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4151 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4152 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4153 "includes_rshift_p (operands[2], GEN_INT (65535))"
4155 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4157 [(set_attr "type" "delayed_compare")
4158 (set_attr "length" "4,8")])
4161 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4165 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4166 (match_operand:SI 2 "const_int_operand" "")) 0))
4168 (set (match_operand:SI 0 "gpc_reg_operand" "")
4169 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4170 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4172 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4174 (compare:CC (match_dup 0)
4179 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4181 (match_operand:SI 1 "gpc_reg_operand" "r"))
4182 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4188 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4190 (match_operand:SI 1 "gpc_reg_operand" "r"))
4191 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4197 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4199 (match_operand:SI 1 "gpc_reg_operand" "r"))
4200 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4206 (define_expand "ashrsi3"
4207 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4208 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4209 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4214 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4216 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4220 (define_insn "ashrsi3_power"
4221 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4222 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4223 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4224 (clobber (match_scratch:SI 3 "=q,X"))]
4228 {srai|srawi} %0,%1,%h2")
4230 (define_insn "ashrsi3_no_power"
4231 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4232 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4233 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4235 "{sra|sraw}%I2 %0,%1,%h2")
4238 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4239 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4240 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4242 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4243 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4247 {srai.|srawi.} %3,%1,%h2
4250 [(set_attr "type" "delayed_compare")
4251 (set_attr "length" "4,4,8,8")])
4254 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4255 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4256 (match_operand:SI 2 "reg_or_cint_operand" ""))
4258 (clobber (match_scratch:SI 3 ""))
4259 (clobber (match_scratch:SI 4 ""))]
4260 "TARGET_POWER && reload_completed"
4261 [(parallel [(set (match_dup 3)
4262 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4263 (clobber (match_dup 4))])
4265 (compare:CC (match_dup 3)
4270 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4271 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4272 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4274 (clobber (match_scratch:SI 3 "=r,r"))]
4277 {sra|sraw}%I2. %3,%1,%h2
4279 [(set_attr "type" "delayed_compare")
4280 (set_attr "length" "4,8")])
4283 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4284 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4285 (match_operand:SI 2 "reg_or_cint_operand" ""))
4287 (clobber (match_scratch:SI 3 ""))]
4288 "! TARGET_POWER && reload_completed"
4290 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4292 (compare:CC (match_dup 3)
4297 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4298 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4299 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4301 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4302 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4303 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4307 {srai.|srawi.} %0,%1,%h2
4310 [(set_attr "type" "delayed_compare")
4311 (set_attr "length" "4,4,8,8")])
4314 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4315 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4316 (match_operand:SI 2 "reg_or_cint_operand" ""))
4318 (set (match_operand:SI 0 "gpc_reg_operand" "")
4319 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4320 (clobber (match_scratch:SI 4 ""))]
4321 "TARGET_POWER && reload_completed"
4322 [(parallel [(set (match_dup 0)
4323 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4324 (clobber (match_dup 4))])
4326 (compare:CC (match_dup 0)
4331 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4332 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4333 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4335 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4336 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4339 {sra|sraw}%I2. %0,%1,%h2
4341 [(set_attr "type" "delayed_compare")
4342 (set_attr "length" "4,8")])
4345 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4346 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4347 (match_operand:SI 2 "reg_or_cint_operand" ""))
4349 (set (match_operand:SI 0 "gpc_reg_operand" "")
4350 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4351 "! TARGET_POWER && reload_completed"
4353 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4355 (compare:CC (match_dup 0)
4359 ;; Floating-point insns, excluding normal data motion.
4361 ;; PowerPC has a full set of single-precision floating point instructions.
4363 ;; For the POWER architecture, we pretend that we have both SFmode and
4364 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4365 ;; The only conversions we will do will be when storing to memory. In that
4366 ;; case, we will use the "frsp" instruction before storing.
4368 ;; Note that when we store into a single-precision memory location, we need to
4369 ;; use the frsp insn first. If the register being stored isn't dead, we
4370 ;; need a scratch register for the frsp. But this is difficult when the store
4371 ;; is done by reload. It is not incorrect to do the frsp on the register in
4372 ;; this case, we just lose precision that we would have otherwise gotten but
4373 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4375 (define_insn "extendsfdf2"
4376 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4377 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4378 "TARGET_HARD_FLOAT && TARGET_FPRS"
4381 if (REGNO (operands[0]) == REGNO (operands[1]))
4384 return \"fmr %0,%1\";
4386 [(set_attr "type" "fp")])
4388 (define_insn "truncdfsf2"
4389 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4390 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4391 "TARGET_HARD_FLOAT && TARGET_FPRS"
4393 [(set_attr "type" "fp")])
4395 (define_insn "aux_truncdfsf2"
4396 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4397 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4398 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4400 [(set_attr "type" "fp")])
4402 (define_expand "negsf2"
4403 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4404 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4408 (define_insn "*negsf2"
4409 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4410 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4411 "TARGET_HARD_FLOAT && TARGET_FPRS"
4413 [(set_attr "type" "fp")])
4415 (define_expand "abssf2"
4416 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4417 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4421 (define_insn "*abssf2"
4422 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4423 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4424 "TARGET_HARD_FLOAT && TARGET_FPRS"
4426 [(set_attr "type" "fp")])
4429 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4430 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4431 "TARGET_HARD_FLOAT && TARGET_FPRS"
4433 [(set_attr "type" "fp")])
4435 (define_expand "addsf3"
4436 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4437 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4438 (match_operand:SF 2 "gpc_reg_operand" "")))]
4443 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4444 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4445 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4446 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4448 [(set_attr "type" "fp")])
4451 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4452 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4453 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4454 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4455 "{fa|fadd} %0,%1,%2"
4456 [(set_attr "type" "fp")])
4458 (define_expand "subsf3"
4459 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4460 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4461 (match_operand:SF 2 "gpc_reg_operand" "")))]
4466 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4467 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4468 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4469 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4471 [(set_attr "type" "fp")])
4474 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4475 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4476 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4477 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4478 "{fs|fsub} %0,%1,%2"
4479 [(set_attr "type" "fp")])
4481 (define_expand "mulsf3"
4482 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4483 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4484 (match_operand:SF 2 "gpc_reg_operand" "")))]
4489 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4490 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4491 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4492 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4494 [(set_attr "type" "fp")])
4497 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4498 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4499 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4500 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4501 "{fm|fmul} %0,%1,%2"
4502 [(set_attr "type" "dmul")])
4504 (define_expand "divsf3"
4505 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4506 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4507 (match_operand:SF 2 "gpc_reg_operand" "")))]
4512 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4513 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4514 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4515 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4517 [(set_attr "type" "sdiv")])
4520 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4521 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4522 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4523 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4524 "{fd|fdiv} %0,%1,%2"
4525 [(set_attr "type" "ddiv")])
4528 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4529 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4530 (match_operand:SF 2 "gpc_reg_operand" "f"))
4531 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4532 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4533 "fmadds %0,%1,%2,%3"
4534 [(set_attr "type" "fp")])
4537 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4538 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4539 (match_operand:SF 2 "gpc_reg_operand" "f"))
4540 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4541 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4542 "{fma|fmadd} %0,%1,%2,%3"
4543 [(set_attr "type" "dmul")])
4546 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4547 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4548 (match_operand:SF 2 "gpc_reg_operand" "f"))
4549 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4550 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4551 "fmsubs %0,%1,%2,%3"
4552 [(set_attr "type" "fp")])
4555 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4556 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4557 (match_operand:SF 2 "gpc_reg_operand" "f"))
4558 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4559 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4560 "{fms|fmsub} %0,%1,%2,%3"
4561 [(set_attr "type" "dmul")])
4564 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4565 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4566 (match_operand:SF 2 "gpc_reg_operand" "f"))
4567 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4568 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4569 && HONOR_SIGNED_ZEROS (SFmode)"
4570 "fnmadds %0,%1,%2,%3"
4571 [(set_attr "type" "fp")])
4574 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4575 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4576 (match_operand:SF 2 "gpc_reg_operand" "f"))
4577 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4578 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4579 && ! HONOR_SIGNED_ZEROS (SFmode)"
4580 "fnmadds %0,%1,%2,%3"
4581 [(set_attr "type" "fp")])
4584 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4585 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4586 (match_operand:SF 2 "gpc_reg_operand" "f"))
4587 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4588 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4589 "{fnma|fnmadd} %0,%1,%2,%3"
4590 [(set_attr "type" "dmul")])
4593 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4594 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4595 (match_operand:SF 2 "gpc_reg_operand" "f"))
4596 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4597 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4598 && ! HONOR_SIGNED_ZEROS (SFmode)"
4599 "{fnma|fnmadd} %0,%1,%2,%3"
4600 [(set_attr "type" "dmul")])
4603 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4604 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4605 (match_operand:SF 2 "gpc_reg_operand" "f"))
4606 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4607 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4608 && HONOR_SIGNED_ZEROS (SFmode)"
4609 "fnmsubs %0,%1,%2,%3"
4610 [(set_attr "type" "fp")])
4613 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4614 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4615 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4616 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4617 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4618 && ! HONOR_SIGNED_ZEROS (SFmode)"
4619 "fnmsubs %0,%1,%2,%3"
4620 [(set_attr "type" "fp")])
4623 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4624 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4625 (match_operand:SF 2 "gpc_reg_operand" "f"))
4626 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4627 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4628 "{fnms|fnmsub} %0,%1,%2,%3"
4629 [(set_attr "type" "dmul")])
4632 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4633 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4634 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4635 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4636 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4637 && ! HONOR_SIGNED_ZEROS (SFmode)"
4638 "{fnms|fnmsub} %0,%1,%2,%3"
4639 [(set_attr "type" "fp")])
4641 (define_expand "sqrtsf2"
4642 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4643 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4644 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4648 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4649 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4650 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4652 [(set_attr "type" "ssqrt")])
4655 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4656 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4657 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4659 [(set_attr "type" "dsqrt")])
4661 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4662 ;; fsel instruction and some auxiliary computations. Then we just have a
4663 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4665 (define_expand "maxsf3"
4666 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4667 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4668 (match_operand:SF 2 "gpc_reg_operand" ""))
4671 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4672 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4674 (define_expand "minsf3"
4675 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4676 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4677 (match_operand:SF 2 "gpc_reg_operand" ""))
4680 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4681 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4684 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4685 (match_operator:SF 3 "min_max_operator"
4686 [(match_operand:SF 1 "gpc_reg_operand" "")
4687 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4688 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4691 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4692 operands[1], operands[2]);
4696 (define_expand "movsicc"
4697 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4698 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4699 (match_operand:SI 2 "gpc_reg_operand" "")
4700 (match_operand:SI 3 "gpc_reg_operand" "")))]
4704 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4710 ;; We use the BASE_REGS for the isel input operands because, if rA is
4711 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4712 ;; because we may switch the operands and rB may end up being rA.
4714 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4715 ;; leave out the mode in operand 4 and use one pattern, but reload can
4716 ;; change the mode underneath our feet and then gets confused trying
4717 ;; to reload the value.
4718 (define_insn "isel_signed"
4719 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4721 (match_operator 1 "comparison_operator"
4722 [(match_operand:CC 4 "cc_reg_operand" "y")
4724 (match_operand:SI 2 "gpc_reg_operand" "b")
4725 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4728 { return output_isel (operands); }"
4729 [(set_attr "length" "4")])
4731 (define_insn "isel_unsigned"
4732 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4734 (match_operator 1 "comparison_operator"
4735 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4737 (match_operand:SI 2 "gpc_reg_operand" "b")
4738 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4741 { return output_isel (operands); }"
4742 [(set_attr "length" "4")])
4744 (define_expand "movsfcc"
4745 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4746 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4747 (match_operand:SF 2 "gpc_reg_operand" "")
4748 (match_operand:SF 3 "gpc_reg_operand" "")))]
4749 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4752 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4758 (define_insn "*fselsfsf4"
4759 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4760 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4761 (match_operand:SF 4 "zero_fp_constant" "F"))
4762 (match_operand:SF 2 "gpc_reg_operand" "f")
4763 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4764 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4766 [(set_attr "type" "fp")])
4768 (define_insn "*fseldfsf4"
4769 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4770 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4771 (match_operand:DF 4 "zero_fp_constant" "F"))
4772 (match_operand:SF 2 "gpc_reg_operand" "f")
4773 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4774 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4776 [(set_attr "type" "fp")])
4778 (define_insn "negdf2"
4779 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4780 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4781 "TARGET_HARD_FLOAT && TARGET_FPRS"
4783 [(set_attr "type" "fp")])
4785 (define_insn "absdf2"
4786 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4787 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4788 "TARGET_HARD_FLOAT && TARGET_FPRS"
4790 [(set_attr "type" "fp")])
4793 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4794 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4795 "TARGET_HARD_FLOAT && TARGET_FPRS"
4797 [(set_attr "type" "fp")])
4799 (define_insn "adddf3"
4800 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4801 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4802 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4803 "TARGET_HARD_FLOAT && TARGET_FPRS"
4804 "{fa|fadd} %0,%1,%2"
4805 [(set_attr "type" "fp")])
4807 (define_insn "subdf3"
4808 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4809 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4810 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4811 "TARGET_HARD_FLOAT && TARGET_FPRS"
4812 "{fs|fsub} %0,%1,%2"
4813 [(set_attr "type" "fp")])
4815 (define_insn "muldf3"
4816 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4817 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4818 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4819 "TARGET_HARD_FLOAT && TARGET_FPRS"
4820 "{fm|fmul} %0,%1,%2"
4821 [(set_attr "type" "dmul")])
4823 (define_insn "divdf3"
4824 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4825 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4826 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4827 "TARGET_HARD_FLOAT && TARGET_FPRS"
4828 "{fd|fdiv} %0,%1,%2"
4829 [(set_attr "type" "ddiv")])
4832 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4833 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4834 (match_operand:DF 2 "gpc_reg_operand" "f"))
4835 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4836 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4837 "{fma|fmadd} %0,%1,%2,%3"
4838 [(set_attr "type" "dmul")])
4841 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4842 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4843 (match_operand:DF 2 "gpc_reg_operand" "f"))
4844 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4845 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4846 "{fms|fmsub} %0,%1,%2,%3"
4847 [(set_attr "type" "dmul")])
4850 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4851 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4852 (match_operand:DF 2 "gpc_reg_operand" "f"))
4853 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4854 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4855 && HONOR_SIGNED_ZEROS (DFmode)"
4856 "{fnma|fnmadd} %0,%1,%2,%3"
4857 [(set_attr "type" "dmul")])
4860 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4861 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
4862 (match_operand:DF 2 "gpc_reg_operand" "f"))
4863 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4864 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4865 && ! HONOR_SIGNED_ZEROS (DFmode)"
4866 "{fnma|fnmadd} %0,%1,%2,%3"
4867 [(set_attr "type" "dmul")])
4870 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4871 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4872 (match_operand:DF 2 "gpc_reg_operand" "f"))
4873 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4874 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4875 && HONOR_SIGNED_ZEROS (DFmode)"
4876 "{fnms|fnmsub} %0,%1,%2,%3"
4877 [(set_attr "type" "dmul")])
4880 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4881 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
4882 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4883 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
4884 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4885 && ! HONOR_SIGNED_ZEROS (DFmode)"
4886 "{fnms|fnmsub} %0,%1,%2,%3"
4887 [(set_attr "type" "dmul")])
4889 (define_insn "sqrtdf2"
4890 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4891 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4892 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4894 [(set_attr "type" "dsqrt")])
4896 ;; The conditional move instructions allow us to perform max and min
4897 ;; operations even when
4899 (define_expand "maxdf3"
4900 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4901 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4902 (match_operand:DF 2 "gpc_reg_operand" ""))
4905 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4906 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4908 (define_expand "mindf3"
4909 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4910 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4911 (match_operand:DF 2 "gpc_reg_operand" ""))
4914 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4915 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4918 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4919 (match_operator:DF 3 "min_max_operator"
4920 [(match_operand:DF 1 "gpc_reg_operand" "")
4921 (match_operand:DF 2 "gpc_reg_operand" "")]))]
4922 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4925 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4926 operands[1], operands[2]);
4930 (define_expand "movdfcc"
4931 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4932 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4933 (match_operand:DF 2 "gpc_reg_operand" "")
4934 (match_operand:DF 3 "gpc_reg_operand" "")))]
4935 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4938 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4944 (define_insn "*fseldfdf4"
4945 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4946 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4947 (match_operand:DF 4 "zero_fp_constant" "F"))
4948 (match_operand:DF 2 "gpc_reg_operand" "f")
4949 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4950 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4952 [(set_attr "type" "fp")])
4954 (define_insn "*fselsfdf4"
4955 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4956 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4957 (match_operand:SF 4 "zero_fp_constant" "F"))
4958 (match_operand:DF 2 "gpc_reg_operand" "f")
4959 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4962 [(set_attr "type" "fp")])
4964 ;; Conversions to and from floating-point.
4966 (define_expand "fixuns_truncsfsi2"
4967 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4968 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
4969 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4972 (define_expand "fix_truncsfsi2"
4973 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4974 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
4975 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4978 ; For each of these conversions, there is a define_expand, a define_insn
4979 ; with a '#' template, and a define_split (with C code). The idea is
4980 ; to allow constant folding with the template of the define_insn,
4981 ; then to have the insns split later (between sched1 and final).
4983 (define_expand "floatsidf2"
4984 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
4985 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4988 (clobber (match_dup 4))
4989 (clobber (match_dup 5))
4990 (clobber (match_dup 6))])]
4991 "TARGET_HARD_FLOAT && TARGET_FPRS"
4994 if (TARGET_POWERPC64)
4996 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
4997 rtx t1 = gen_reg_rtx (DImode);
4998 rtx t2 = gen_reg_rtx (DImode);
4999 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5003 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5004 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5005 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5006 operands[5] = gen_reg_rtx (DFmode);
5007 operands[6] = gen_reg_rtx (SImode);
5010 (define_insn "*floatsidf2_internal"
5011 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5012 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5013 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5014 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5015 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5016 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5017 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5018 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5020 [(set_attr "length" "24")])
5023 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5024 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5025 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5026 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5027 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5028 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5029 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5030 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5031 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5032 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5033 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5034 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5035 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5036 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5037 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5040 rtx lowword, highword;
5041 if (GET_CODE (operands[4]) != MEM)
5043 highword = XEXP (operands[4], 0);
5044 lowword = plus_constant (highword, 4);
5045 if (! WORDS_BIG_ENDIAN)
5048 tmp = highword; highword = lowword; lowword = tmp;
5051 emit_insn (gen_xorsi3 (operands[6], operands[1],
5052 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5053 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5054 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5055 emit_move_insn (operands[5], operands[4]);
5056 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5060 (define_expand "floatunssisf2"
5061 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5062 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5063 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5066 (define_expand "floatunssidf2"
5067 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5068 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5071 (clobber (match_dup 4))
5072 (clobber (match_dup 5))])]
5073 "TARGET_HARD_FLOAT && TARGET_FPRS"
5076 if (TARGET_POWERPC64)
5078 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5079 rtx t1 = gen_reg_rtx (DImode);
5080 rtx t2 = gen_reg_rtx (DImode);
5081 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5086 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5087 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5088 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5089 operands[5] = gen_reg_rtx (DFmode);
5092 (define_insn "*floatunssidf2_internal"
5093 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5094 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5095 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5096 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5097 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5098 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5099 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5101 [(set_attr "length" "20")])
5104 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5105 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5106 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5107 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5108 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5109 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5110 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5111 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5112 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5113 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5114 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5115 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5116 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5119 rtx lowword, highword;
5120 if (GET_CODE (operands[4]) != MEM)
5122 highword = XEXP (operands[4], 0);
5123 lowword = plus_constant (highword, 4);
5124 if (! WORDS_BIG_ENDIAN)
5127 tmp = highword; highword = lowword; lowword = tmp;
5130 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5131 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5132 emit_move_insn (operands[5], operands[4]);
5133 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5137 (define_expand "fix_truncdfsi2"
5138 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5139 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5140 (clobber (match_dup 2))
5141 (clobber (match_dup 3))])]
5142 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5145 operands[2] = gen_reg_rtx (DImode);
5146 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5149 (define_insn "*fix_truncdfsi2_internal"
5150 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5151 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5152 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5153 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5154 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5156 [(set_attr "length" "16")])
5159 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5160 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5161 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5162 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5163 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5164 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5165 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5166 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5167 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5171 if (GET_CODE (operands[3]) != MEM)
5173 lowword = XEXP (operands[3], 0);
5174 if (WORDS_BIG_ENDIAN)
5175 lowword = plus_constant (lowword, 4);
5177 emit_insn (gen_fctiwz (operands[2], operands[1]));
5178 emit_move_insn (operands[3], operands[2]);
5179 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5183 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5184 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5185 ; because the first makes it clear that operand 0 is not live
5186 ; before the instruction.
5187 (define_insn "fctiwz"
5188 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5189 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5191 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5192 "{fcirz|fctiwz} %0,%1"
5193 [(set_attr "type" "fp")])
5195 (define_expand "floatsisf2"
5196 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5197 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5198 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5201 (define_insn "floatdidf2"
5202 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5203 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5204 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5206 [(set_attr "type" "fp")])
5208 (define_insn_and_split "floatsidf_ppc64"
5209 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5210 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5211 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5212 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5213 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5214 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5217 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5218 (set (match_dup 2) (match_dup 3))
5219 (set (match_dup 4) (match_dup 2))
5220 (set (match_dup 0) (float:DF (match_dup 4)))]
5223 (define_insn_and_split "floatunssidf_ppc64"
5224 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5225 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5226 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5227 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5228 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5229 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5232 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5233 (set (match_dup 2) (match_dup 3))
5234 (set (match_dup 4) (match_dup 2))
5235 (set (match_dup 0) (float:DF (match_dup 4)))]
5238 (define_insn "fix_truncdfdi2"
5239 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5240 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5241 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5243 [(set_attr "type" "fp")])
5245 (define_expand "floatdisf2"
5246 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5247 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5248 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_FPRS"
5251 if (!flag_unsafe_math_optimizations)
5253 rtx label = gen_label_rtx ();
5254 emit_insn (gen_floatdisf2_internal2 (operands[1], label));
5257 emit_insn (gen_floatdisf2_internal1 (operands[0], operands[1]));
5261 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5262 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5263 ;; from double rounding.
5264 (define_insn_and_split "floatdisf2_internal1"
5265 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5266 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5267 (clobber (match_scratch:DF 2 "=f"))]
5268 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5270 "&& reload_completed"
5272 (float:DF (match_dup 1)))
5274 (float_truncate:SF (match_dup 2)))]
5277 ;; Twiddles bits to avoid double rounding.
5278 ;; Bits that might be truncated when converting to DFmode are replaced
5279 ;; by a bit that won't be lost at that stage, but is below the SFmode
5280 ;; rounding position.
5281 (define_expand "floatdisf2_internal2"
5282 [(parallel [(set (match_dup 4)
5283 (compare:CC (and:DI (match_operand:DI 0 "" "")
5286 (set (match_dup 2) (and:DI (match_dup 0) (const_int 2047)))
5287 (clobber (match_scratch:CC 7 ""))])
5288 (set (match_dup 3) (ashiftrt:DI (match_dup 0) (const_int 53)))
5289 (set (match_dup 3) (plus:DI (match_dup 3) (const_int 1)))
5290 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
5291 (label_ref (match_operand:DI 1 "" ""))
5293 (set (match_dup 5) (compare:CCUNS (match_dup 3) (const_int 2)))
5294 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
5295 (label_ref (match_dup 1))
5297 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 2)))
5298 (set (match_dup 0) (ior:DI (match_dup 0) (const_int 2048)))]
5299 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_FPRS"
5302 operands[2] = gen_reg_rtx (DImode);
5303 operands[3] = gen_reg_rtx (DImode);
5304 operands[4] = gen_reg_rtx (CCmode);
5305 operands[5] = gen_reg_rtx (CCUNSmode);
5308 ;; Define the DImode operations that can be done in a small number
5309 ;; of instructions. The & constraints are to prevent the register
5310 ;; allocator from allocating registers that overlap with the inputs
5311 ;; (for example, having an input in 7,8 and an output in 6,7). We
5312 ;; also allow for the output being the same as one of the inputs.
5314 (define_insn "*adddi3_noppc64"
5315 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5316 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5317 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5318 "! TARGET_POWERPC64"
5321 if (WORDS_BIG_ENDIAN)
5322 return (GET_CODE (operands[2])) != CONST_INT
5323 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5324 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5326 return (GET_CODE (operands[2])) != CONST_INT
5327 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5328 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5330 [(set_attr "length" "8")])
5332 (define_insn "*subdi3_noppc64"
5333 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5334 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5335 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5336 "! TARGET_POWERPC64"
5339 if (WORDS_BIG_ENDIAN)
5340 return (GET_CODE (operands[1]) != CONST_INT)
5341 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5342 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5344 return (GET_CODE (operands[1]) != CONST_INT)
5345 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5346 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5348 [(set_attr "length" "8")])
5350 (define_insn "*negdi2_noppc64"
5351 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5352 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5353 "! TARGET_POWERPC64"
5356 return (WORDS_BIG_ENDIAN)
5357 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5358 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5360 [(set_attr "length" "8")])
5362 (define_expand "mulsidi3"
5363 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5364 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5365 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5366 "! TARGET_POWERPC64"
5369 if (! TARGET_POWER && ! TARGET_POWERPC)
5371 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5372 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5373 emit_insn (gen_mull_call ());
5374 if (WORDS_BIG_ENDIAN)
5375 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5378 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5379 gen_rtx_REG (SImode, 3));
5380 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5381 gen_rtx_REG (SImode, 4));
5385 else if (TARGET_POWER)
5387 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5392 (define_insn "mulsidi3_mq"
5393 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5394 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5395 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5396 (clobber (match_scratch:SI 3 "=q"))]
5398 "mul %0,%1,%2\;mfmq %L0"
5399 [(set_attr "type" "imul")
5400 (set_attr "length" "8")])
5402 (define_insn "*mulsidi3_no_mq"
5403 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5404 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5405 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5406 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5409 return (WORDS_BIG_ENDIAN)
5410 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5411 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5413 [(set_attr "type" "imul")
5414 (set_attr "length" "8")])
5417 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5418 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5419 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5420 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5423 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5424 (sign_extend:DI (match_dup 2)))
5427 (mult:SI (match_dup 1)
5431 int endian = (WORDS_BIG_ENDIAN == 0);
5432 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5433 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5436 (define_expand "umulsidi3"
5437 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5438 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5439 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5440 "TARGET_POWERPC && ! TARGET_POWERPC64"
5445 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5450 (define_insn "umulsidi3_mq"
5451 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5452 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5453 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5454 (clobber (match_scratch:SI 3 "=q"))]
5455 "TARGET_POWERPC && TARGET_POWER"
5458 return (WORDS_BIG_ENDIAN)
5459 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5460 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5462 [(set_attr "type" "imul")
5463 (set_attr "length" "8")])
5465 (define_insn "*umulsidi3_no_mq"
5466 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5467 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5468 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5469 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5472 return (WORDS_BIG_ENDIAN)
5473 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5474 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5476 [(set_attr "type" "imul")
5477 (set_attr "length" "8")])
5480 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5481 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5482 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5483 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5486 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5487 (zero_extend:DI (match_dup 2)))
5490 (mult:SI (match_dup 1)
5494 int endian = (WORDS_BIG_ENDIAN == 0);
5495 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5496 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5499 (define_expand "smulsi3_highpart"
5500 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5502 (lshiftrt:DI (mult:DI (sign_extend:DI
5503 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5505 (match_operand:SI 2 "gpc_reg_operand" "r")))
5510 if (! TARGET_POWER && ! TARGET_POWERPC)
5512 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5513 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5514 emit_insn (gen_mulh_call ());
5515 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5518 else if (TARGET_POWER)
5520 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5525 (define_insn "smulsi3_highpart_mq"
5526 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5528 (lshiftrt:DI (mult:DI (sign_extend:DI
5529 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5531 (match_operand:SI 2 "gpc_reg_operand" "r")))
5533 (clobber (match_scratch:SI 3 "=q"))]
5536 [(set_attr "type" "imul")])
5538 (define_insn "*smulsi3_highpart_no_mq"
5539 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5541 (lshiftrt:DI (mult:DI (sign_extend:DI
5542 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5544 (match_operand:SI 2 "gpc_reg_operand" "r")))
5546 "TARGET_POWERPC && ! TARGET_POWER"
5548 [(set_attr "type" "imul")])
5550 (define_expand "umulsi3_highpart"
5551 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5553 (lshiftrt:DI (mult:DI (zero_extend:DI
5554 (match_operand:SI 1 "gpc_reg_operand" ""))
5556 (match_operand:SI 2 "gpc_reg_operand" "")))
5563 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5568 (define_insn "umulsi3_highpart_mq"
5569 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5571 (lshiftrt:DI (mult:DI (zero_extend:DI
5572 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5574 (match_operand:SI 2 "gpc_reg_operand" "r")))
5576 (clobber (match_scratch:SI 3 "=q"))]
5577 "TARGET_POWERPC && TARGET_POWER"
5579 [(set_attr "type" "imul")])
5581 (define_insn "*umulsi3_highpart_no_mq"
5582 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5584 (lshiftrt:DI (mult:DI (zero_extend:DI
5585 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5587 (match_operand:SI 2 "gpc_reg_operand" "r")))
5589 "TARGET_POWERPC && ! TARGET_POWER"
5591 [(set_attr "type" "imul")])
5593 ;; If operands 0 and 2 are in the same register, we have a problem. But
5594 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5595 ;; why we have the strange constraints below.
5596 (define_insn "ashldi3_power"
5597 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5598 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5599 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5600 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5603 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5604 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5605 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5606 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5607 [(set_attr "length" "8")])
5609 (define_insn "lshrdi3_power"
5610 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5611 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5612 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5613 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5616 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5617 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5618 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5619 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5620 [(set_attr "length" "8")])
5622 ;; Shift by a variable amount is too complex to be worth open-coding. We
5623 ;; just handle shifts by constants.
5624 (define_insn "ashrdi3_power"
5625 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5626 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5627 (match_operand:SI 2 "const_int_operand" "M,i")))
5628 (clobber (match_scratch:SI 3 "=X,q"))]
5631 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5632 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5633 [(set_attr "length" "8")])
5635 (define_insn "ashrdi3_no_power"
5636 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5637 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5638 (match_operand:SI 2 "const_int_operand" "M,i")))]
5639 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5641 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5642 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5643 [(set_attr "length" "8,12")])
5645 (define_insn "*ashrdisi3_noppc64"
5646 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5647 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5648 (const_int 32)) 4))]
5649 "TARGET_32BIT && !TARGET_POWERPC64"
5652 if (REGNO (operands[0]) == REGNO (operands[1]))
5655 return \"mr %0,%1\";
5657 [(set_attr "length" "4")])
5660 ;; PowerPC64 DImode operations.
5662 (define_expand "adddi3"
5663 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5664 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5665 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5669 if (! TARGET_POWERPC64)
5671 if (non_short_cint_operand (operands[2], DImode))
5675 if (GET_CODE (operands[2]) == CONST_INT
5676 && ! add_operand (operands[2], DImode))
5678 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5679 ? operands[0] : gen_reg_rtx (DImode));
5681 HOST_WIDE_INT val = INTVAL (operands[2]);
5682 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5683 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5685 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5688 /* The ordering here is important for the prolog expander.
5689 When space is allocated from the stack, adding 'low' first may
5690 produce a temporary deallocation (which would be bad). */
5691 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5692 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5697 ;; Discourage ai/addic because of carry but provide it in an alternative
5698 ;; allowing register zero as source.
5700 (define_insn "*adddi3_internal1"
5701 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5702 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5703 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5711 (define_insn "*adddi3_internal2"
5712 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5713 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5714 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5716 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5723 [(set_attr "type" "fast_compare,compare,compare,compare")
5724 (set_attr "length" "4,4,8,8")])
5727 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5728 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5729 (match_operand:DI 2 "reg_or_short_operand" ""))
5731 (clobber (match_scratch:DI 3 ""))]
5732 "TARGET_POWERPC64 && reload_completed"
5734 (plus:DI (match_dup 1) (match_dup 2)))
5736 (compare:CC (match_dup 3)
5740 (define_insn "*adddi3_internal3"
5741 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5742 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5743 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5745 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5746 (plus:DI (match_dup 1) (match_dup 2)))]
5753 [(set_attr "type" "fast_compare,compare,compare,compare")
5754 (set_attr "length" "4,4,8,8")])
5757 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5758 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5759 (match_operand:DI 2 "reg_or_short_operand" ""))
5761 (set (match_operand:DI 0 "gpc_reg_operand" "")
5762 (plus:DI (match_dup 1) (match_dup 2)))]
5763 "TARGET_POWERPC64 && reload_completed"
5765 (plus:DI (match_dup 1) (match_dup 2)))
5767 (compare:CC (match_dup 0)
5771 ;; Split an add that we can't do in one insn into two insns, each of which
5772 ;; does one 16-bit part. This is used by combine. Note that the low-order
5773 ;; add should be last in case the result gets used in an address.
5776 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5777 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5778 (match_operand:DI 2 "non_add_cint_operand" "")))]
5780 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5781 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5784 HOST_WIDE_INT val = INTVAL (operands[2]);
5785 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5786 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5788 operands[4] = GEN_INT (low);
5789 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5790 operands[3] = GEN_INT (rest);
5791 else if (! no_new_pseudos)
5793 operands[3] = gen_reg_rtx (DImode);
5794 emit_move_insn (operands[3], operands[2]);
5795 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5802 (define_insn "one_cmpldi2"
5803 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5804 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5809 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5810 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5812 (clobber (match_scratch:DI 2 "=r,r"))]
5817 [(set_attr "type" "compare")
5818 (set_attr "length" "4,8")])
5821 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5822 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5824 (clobber (match_scratch:DI 2 ""))]
5825 "TARGET_POWERPC64 && reload_completed"
5827 (not:DI (match_dup 1)))
5829 (compare:CC (match_dup 2)
5834 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5835 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5837 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5838 (not:DI (match_dup 1)))]
5843 [(set_attr "type" "compare")
5844 (set_attr "length" "4,8")])
5847 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5848 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5850 (set (match_operand:DI 0 "gpc_reg_operand" "")
5851 (not:DI (match_dup 1)))]
5852 "TARGET_POWERPC64 && reload_completed"
5854 (not:DI (match_dup 1)))
5856 (compare:CC (match_dup 0)
5861 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5862 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
5863 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
5870 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5871 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5872 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5874 (clobber (match_scratch:DI 3 "=r,r"))]
5879 [(set_attr "type" "fast_compare")
5880 (set_attr "length" "4,8")])
5883 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5884 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5885 (match_operand:DI 2 "gpc_reg_operand" ""))
5887 (clobber (match_scratch:DI 3 ""))]
5888 "TARGET_POWERPC64 && reload_completed"
5890 (minus:DI (match_dup 1) (match_dup 2)))
5892 (compare:CC (match_dup 3)
5897 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5898 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5899 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5901 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5902 (minus:DI (match_dup 1) (match_dup 2)))]
5907 [(set_attr "type" "fast_compare")
5908 (set_attr "length" "4,8")])
5911 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5912 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5913 (match_operand:DI 2 "gpc_reg_operand" ""))
5915 (set (match_operand:DI 0 "gpc_reg_operand" "")
5916 (minus:DI (match_dup 1) (match_dup 2)))]
5917 "TARGET_POWERPC64 && reload_completed"
5919 (minus:DI (match_dup 1) (match_dup 2)))
5921 (compare:CC (match_dup 0)
5925 (define_expand "subdi3"
5926 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5927 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
5928 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
5932 if (GET_CODE (operands[2]) == CONST_INT)
5934 emit_insn (gen_adddi3 (operands[0], operands[1],
5935 negate_rtx (DImode, operands[2])));
5940 (define_insn_and_split "absdi2"
5941 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5942 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5943 (clobber (match_scratch:DI 2 "=&r,&r"))]
5946 "&& reload_completed"
5947 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5948 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5949 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5952 (define_insn_and_split "*nabsdi2"
5953 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5954 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5955 (clobber (match_scratch:DI 2 "=&r,&r"))]
5958 "&& reload_completed"
5959 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5960 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5961 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
5964 (define_expand "negdi2"
5965 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5966 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
5971 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5972 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5977 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5978 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5980 (clobber (match_scratch:DI 2 "=r,r"))]
5985 [(set_attr "type" "fast_compare")
5986 (set_attr "length" "4,8")])
5989 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5990 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5992 (clobber (match_scratch:DI 2 ""))]
5993 "TARGET_POWERPC64 && reload_completed"
5995 (neg:DI (match_dup 1)))
5997 (compare:CC (match_dup 2)
6002 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6003 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6005 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6006 (neg:DI (match_dup 1)))]
6011 [(set_attr "type" "fast_compare")
6012 (set_attr "length" "4,8")])
6015 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6016 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6018 (set (match_operand:DI 0 "gpc_reg_operand" "")
6019 (neg:DI (match_dup 1)))]
6020 "TARGET_POWERPC64 && reload_completed"
6022 (neg:DI (match_dup 1)))
6024 (compare:CC (match_dup 0)
6028 (define_insn "clzdi2"
6029 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6030 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6034 (define_expand "ctzdi2"
6036 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6037 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6039 (clobber (scratch:CC))])
6040 (set (match_dup 4) (clz:DI (match_dup 3)))
6041 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6042 (minus:DI (const_int 63) (match_dup 4)))]
6045 operands[2] = gen_reg_rtx (DImode);
6046 operands[3] = gen_reg_rtx (DImode);
6047 operands[4] = gen_reg_rtx (DImode);
6050 (define_expand "ffsdi2"
6052 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6053 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6055 (clobber (scratch:CC))])
6056 (set (match_dup 4) (clz:DI (match_dup 3)))
6057 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6058 (minus:DI (const_int 64) (match_dup 4)))]
6061 operands[2] = gen_reg_rtx (DImode);
6062 operands[3] = gen_reg_rtx (DImode);
6063 operands[4] = gen_reg_rtx (DImode);
6066 (define_insn "muldi3"
6067 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6068 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6069 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6072 [(set_attr "type" "lmul")])
6074 (define_insn "*muldi3_internal1"
6075 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6076 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6077 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6079 (clobber (match_scratch:DI 3 "=r,r"))]
6084 [(set_attr "type" "lmul_compare")
6085 (set_attr "length" "4,8")])
6088 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6089 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6090 (match_operand:DI 2 "gpc_reg_operand" ""))
6092 (clobber (match_scratch:DI 3 ""))]
6093 "TARGET_POWERPC64 && reload_completed"
6095 (mult:DI (match_dup 1) (match_dup 2)))
6097 (compare:CC (match_dup 3)
6101 (define_insn "*muldi3_internal2"
6102 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6103 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6104 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6106 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6107 (mult:DI (match_dup 1) (match_dup 2)))]
6112 [(set_attr "type" "lmul_compare")
6113 (set_attr "length" "4,8")])
6116 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6117 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6118 (match_operand:DI 2 "gpc_reg_operand" ""))
6120 (set (match_operand:DI 0 "gpc_reg_operand" "")
6121 (mult:DI (match_dup 1) (match_dup 2)))]
6122 "TARGET_POWERPC64 && reload_completed"
6124 (mult:DI (match_dup 1) (match_dup 2)))
6126 (compare:CC (match_dup 0)
6130 (define_insn "smuldi3_highpart"
6131 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6133 (lshiftrt:TI (mult:TI (sign_extend:TI
6134 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6136 (match_operand:DI 2 "gpc_reg_operand" "r")))
6140 [(set_attr "type" "lmul")])
6142 (define_insn "umuldi3_highpart"
6143 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6145 (lshiftrt:TI (mult:TI (zero_extend:TI
6146 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6148 (match_operand:DI 2 "gpc_reg_operand" "r")))
6152 [(set_attr "type" "lmul")])
6154 (define_expand "divdi3"
6155 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6156 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6157 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6161 if (GET_CODE (operands[2]) == CONST_INT
6162 && INTVAL (operands[2]) > 0
6163 && exact_log2 (INTVAL (operands[2])) >= 0)
6166 operands[2] = force_reg (DImode, operands[2]);
6169 (define_expand "moddi3"
6170 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6171 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6172 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6180 if (GET_CODE (operands[2]) != CONST_INT
6181 || INTVAL (operands[2]) <= 0
6182 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6185 temp1 = gen_reg_rtx (DImode);
6186 temp2 = gen_reg_rtx (DImode);
6188 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6189 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6190 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6195 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6196 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6197 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6199 "sradi %0,%1,%p2\;addze %0,%0"
6200 [(set_attr "length" "8")])
6203 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6204 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6205 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6207 (clobber (match_scratch:DI 3 "=r,r"))]
6210 sradi %3,%1,%p2\;addze. %3,%3
6212 [(set_attr "type" "compare")
6213 (set_attr "length" "8,12")])
6216 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6217 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6218 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6220 (clobber (match_scratch:DI 3 ""))]
6221 "TARGET_POWERPC64 && reload_completed"
6223 (div:DI (match_dup 1) (match_dup 2)))
6225 (compare:CC (match_dup 3)
6230 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6231 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6232 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6234 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6235 (div:DI (match_dup 1) (match_dup 2)))]
6238 sradi %0,%1,%p2\;addze. %0,%0
6240 [(set_attr "type" "compare")
6241 (set_attr "length" "8,12")])
6244 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6245 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6246 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6248 (set (match_operand:DI 0 "gpc_reg_operand" "")
6249 (div:DI (match_dup 1) (match_dup 2)))]
6250 "TARGET_POWERPC64 && reload_completed"
6252 (div:DI (match_dup 1) (match_dup 2)))
6254 (compare:CC (match_dup 0)
6259 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6260 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6261 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6264 [(set_attr "type" "ldiv")])
6266 (define_insn "udivdi3"
6267 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6268 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6269 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6272 [(set_attr "type" "ldiv")])
6274 (define_insn "rotldi3"
6275 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6276 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6277 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6279 "rld%I2cl %0,%1,%H2,0")
6281 (define_insn "*rotldi3_internal2"
6282 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6283 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6284 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6286 (clobber (match_scratch:DI 3 "=r,r"))]
6289 rld%I2cl. %3,%1,%H2,0
6291 [(set_attr "type" "delayed_compare")
6292 (set_attr "length" "4,8")])
6295 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6296 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6297 (match_operand:DI 2 "reg_or_cint_operand" ""))
6299 (clobber (match_scratch:DI 3 ""))]
6300 "TARGET_POWERPC64 && reload_completed"
6302 (rotate:DI (match_dup 1) (match_dup 2)))
6304 (compare:CC (match_dup 3)
6308 (define_insn "*rotldi3_internal3"
6309 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6310 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6311 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6313 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6314 (rotate:DI (match_dup 1) (match_dup 2)))]
6317 rld%I2cl. %0,%1,%H2,0
6319 [(set_attr "type" "delayed_compare")
6320 (set_attr "length" "4,8")])
6323 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6324 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6325 (match_operand:DI 2 "reg_or_cint_operand" ""))
6327 (set (match_operand:DI 0 "gpc_reg_operand" "")
6328 (rotate:DI (match_dup 1) (match_dup 2)))]
6329 "TARGET_POWERPC64 && reload_completed"
6331 (rotate:DI (match_dup 1) (match_dup 2)))
6333 (compare:CC (match_dup 0)
6337 (define_insn "*rotldi3_internal4"
6338 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6339 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6340 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6341 (match_operand:DI 3 "mask64_operand" "n")))]
6343 "rld%I2c%B3 %0,%1,%H2,%S3")
6345 (define_insn "*rotldi3_internal5"
6346 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6348 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6349 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6350 (match_operand:DI 3 "mask64_operand" "n,n"))
6352 (clobber (match_scratch:DI 4 "=r,r"))]
6355 rld%I2c%B3. %4,%1,%H2,%S3
6357 [(set_attr "type" "delayed_compare")
6358 (set_attr "length" "4,8")])
6361 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6363 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6364 (match_operand:DI 2 "reg_or_cint_operand" ""))
6365 (match_operand:DI 3 "mask64_operand" ""))
6367 (clobber (match_scratch:DI 4 ""))]
6368 "TARGET_POWERPC64 && reload_completed"
6370 (and:DI (rotate:DI (match_dup 1)
6374 (compare:CC (match_dup 4)
6378 (define_insn "*rotldi3_internal6"
6379 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6381 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6382 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6383 (match_operand:DI 3 "mask64_operand" "n,n"))
6385 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6386 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6389 rld%I2c%B3. %0,%1,%H2,%S3
6391 [(set_attr "type" "delayed_compare")
6392 (set_attr "length" "4,8")])
6395 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6397 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6398 (match_operand:DI 2 "reg_or_cint_operand" ""))
6399 (match_operand:DI 3 "mask64_operand" ""))
6401 (set (match_operand:DI 0 "gpc_reg_operand" "")
6402 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6403 "TARGET_POWERPC64 && reload_completed"
6405 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6407 (compare:CC (match_dup 0)
6411 (define_insn "*rotldi3_internal7"
6412 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6415 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6416 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6418 "rld%I2cl %0,%1,%H2,56")
6420 (define_insn "*rotldi3_internal8"
6421 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6422 (compare:CC (zero_extend:DI
6424 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6425 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6427 (clobber (match_scratch:DI 3 "=r,r"))]
6430 rld%I2cl. %3,%1,%H2,56
6432 [(set_attr "type" "delayed_compare")
6433 (set_attr "length" "4,8")])
6436 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6437 (compare:CC (zero_extend:DI
6439 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6440 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6442 (clobber (match_scratch:DI 3 ""))]
6443 "TARGET_POWERPC64 && reload_completed"
6445 (zero_extend:DI (subreg:QI
6446 (rotate:DI (match_dup 1)
6449 (compare:CC (match_dup 3)
6453 (define_insn "*rotldi3_internal9"
6454 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6455 (compare:CC (zero_extend:DI
6457 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6458 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6460 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6461 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6464 rld%I2cl. %0,%1,%H2,56
6466 [(set_attr "type" "delayed_compare")
6467 (set_attr "length" "4,8")])
6470 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6471 (compare:CC (zero_extend:DI
6473 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6474 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6476 (set (match_operand:DI 0 "gpc_reg_operand" "")
6477 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6478 "TARGET_POWERPC64 && reload_completed"
6480 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6482 (compare:CC (match_dup 0)
6486 (define_insn "*rotldi3_internal10"
6487 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6490 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6491 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6493 "rld%I2cl %0,%1,%H2,48")
6495 (define_insn "*rotldi3_internal11"
6496 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6497 (compare:CC (zero_extend:DI
6499 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6500 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6502 (clobber (match_scratch:DI 3 "=r,r"))]
6505 rld%I2cl. %3,%1,%H2,48
6507 [(set_attr "type" "delayed_compare")
6508 (set_attr "length" "4,8")])
6511 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6512 (compare:CC (zero_extend:DI
6514 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6515 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6517 (clobber (match_scratch:DI 3 ""))]
6518 "TARGET_POWERPC64 && reload_completed"
6520 (zero_extend:DI (subreg:HI
6521 (rotate:DI (match_dup 1)
6524 (compare:CC (match_dup 3)
6528 (define_insn "*rotldi3_internal12"
6529 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6530 (compare:CC (zero_extend:DI
6532 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6533 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6535 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6536 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6539 rld%I2cl. %0,%1,%H2,48
6541 [(set_attr "type" "delayed_compare")
6542 (set_attr "length" "4,8")])
6545 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6546 (compare:CC (zero_extend:DI
6548 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6549 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6551 (set (match_operand:DI 0 "gpc_reg_operand" "")
6552 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6553 "TARGET_POWERPC64 && reload_completed"
6555 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6557 (compare:CC (match_dup 0)
6561 (define_insn "*rotldi3_internal13"
6562 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6565 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6566 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6568 "rld%I2cl %0,%1,%H2,32")
6570 (define_insn "*rotldi3_internal14"
6571 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6572 (compare:CC (zero_extend:DI
6574 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6575 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6577 (clobber (match_scratch:DI 3 "=r,r"))]
6580 rld%I2cl. %3,%1,%H2,32
6582 [(set_attr "type" "delayed_compare")
6583 (set_attr "length" "4,8")])
6586 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6587 (compare:CC (zero_extend:DI
6589 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6590 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6592 (clobber (match_scratch:DI 3 ""))]
6593 "TARGET_POWERPC64 && reload_completed"
6595 (zero_extend:DI (subreg:SI
6596 (rotate:DI (match_dup 1)
6599 (compare:CC (match_dup 3)
6603 (define_insn "*rotldi3_internal15"
6604 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6605 (compare:CC (zero_extend:DI
6607 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6608 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6610 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6611 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6614 rld%I2cl. %0,%1,%H2,32
6616 [(set_attr "type" "delayed_compare")
6617 (set_attr "length" "4,8")])
6620 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6621 (compare:CC (zero_extend:DI
6623 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6624 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6626 (set (match_operand:DI 0 "gpc_reg_operand" "")
6627 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6628 "TARGET_POWERPC64 && reload_completed"
6630 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6632 (compare:CC (match_dup 0)
6636 (define_expand "ashldi3"
6637 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6638 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6639 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6640 "TARGET_POWERPC64 || TARGET_POWER"
6643 if (TARGET_POWERPC64)
6645 else if (TARGET_POWER)
6647 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6654 (define_insn "*ashldi3_internal1"
6655 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6656 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6657 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6660 [(set_attr "length" "8")])
6662 (define_insn "*ashldi3_internal2"
6663 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6664 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6665 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6667 (clobber (match_scratch:DI 3 "=r,r"))]
6672 [(set_attr "type" "delayed_compare")
6673 (set_attr "length" "4,8")])
6676 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6677 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6678 (match_operand:SI 2 "reg_or_cint_operand" ""))
6680 (clobber (match_scratch:DI 3 ""))]
6681 "TARGET_POWERPC64 && reload_completed"
6683 (ashift:DI (match_dup 1) (match_dup 2)))
6685 (compare:CC (match_dup 3)
6689 (define_insn "*ashldi3_internal3"
6690 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6691 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6692 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6694 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6695 (ashift:DI (match_dup 1) (match_dup 2)))]
6700 [(set_attr "type" "delayed_compare")
6701 (set_attr "length" "4,8")])
6704 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6705 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6706 (match_operand:SI 2 "reg_or_cint_operand" ""))
6708 (set (match_operand:DI 0 "gpc_reg_operand" "")
6709 (ashift:DI (match_dup 1) (match_dup 2)))]
6710 "TARGET_POWERPC64 && reload_completed"
6712 (ashift:DI (match_dup 1) (match_dup 2)))
6714 (compare:CC (match_dup 0)
6718 (define_insn "*ashldi3_internal4"
6719 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6720 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6721 (match_operand:SI 2 "const_int_operand" "i"))
6722 (match_operand:DI 3 "const_int_operand" "n")))]
6723 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6724 "rldic %0,%1,%H2,%W3")
6726 (define_insn "ashldi3_internal5"
6727 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6729 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6730 (match_operand:SI 2 "const_int_operand" "i,i"))
6731 (match_operand:DI 3 "const_int_operand" "n,n"))
6733 (clobber (match_scratch:DI 4 "=r,r"))]
6734 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6736 rldic. %4,%1,%H2,%W3
6738 [(set_attr "type" "delayed_compare")
6739 (set_attr "length" "4,8")])
6742 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6744 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6745 (match_operand:SI 2 "const_int_operand" ""))
6746 (match_operand:DI 3 "const_int_operand" ""))
6748 (clobber (match_scratch:DI 4 ""))]
6749 "TARGET_POWERPC64 && reload_completed
6750 && includes_rldic_lshift_p (operands[2], operands[3])"
6752 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6755 (compare:CC (match_dup 4)
6759 (define_insn "*ashldi3_internal6"
6760 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6762 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6763 (match_operand:SI 2 "const_int_operand" "i,i"))
6764 (match_operand:DI 3 "const_int_operand" "n,n"))
6766 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6767 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6768 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6770 rldic. %0,%1,%H2,%W3
6772 [(set_attr "type" "delayed_compare")
6773 (set_attr "length" "4,8")])
6776 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6778 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6779 (match_operand:SI 2 "const_int_operand" ""))
6780 (match_operand:DI 3 "const_int_operand" ""))
6782 (set (match_operand:DI 0 "gpc_reg_operand" "")
6783 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6784 "TARGET_POWERPC64 && reload_completed
6785 && includes_rldic_lshift_p (operands[2], operands[3])"
6787 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6790 (compare:CC (match_dup 0)
6794 (define_insn "*ashldi3_internal7"
6795 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6796 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6797 (match_operand:SI 2 "const_int_operand" "i"))
6798 (match_operand:DI 3 "mask64_operand" "n")))]
6799 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6800 "rldicr %0,%1,%H2,%S3")
6802 (define_insn "ashldi3_internal8"
6803 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6805 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6806 (match_operand:SI 2 "const_int_operand" "i,i"))
6807 (match_operand:DI 3 "mask64_operand" "n,n"))
6809 (clobber (match_scratch:DI 4 "=r,r"))]
6810 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6812 rldicr. %4,%1,%H2,%S3
6814 [(set_attr "type" "delayed_compare")
6815 (set_attr "length" "4,8")])
6818 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6820 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6821 (match_operand:SI 2 "const_int_operand" ""))
6822 (match_operand:DI 3 "mask64_operand" ""))
6824 (clobber (match_scratch:DI 4 ""))]
6825 "TARGET_POWERPC64 && reload_completed
6826 && includes_rldicr_lshift_p (operands[2], operands[3])"
6828 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6831 (compare:CC (match_dup 4)
6835 (define_insn "*ashldi3_internal9"
6836 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6838 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6839 (match_operand:SI 2 "const_int_operand" "i,i"))
6840 (match_operand:DI 3 "mask64_operand" "n,n"))
6842 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6843 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6844 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6846 rldicr. %0,%1,%H2,%S3
6848 [(set_attr "type" "delayed_compare")
6849 (set_attr "length" "4,8")])
6852 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6854 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6855 (match_operand:SI 2 "const_int_operand" ""))
6856 (match_operand:DI 3 "mask64_operand" ""))
6858 (set (match_operand:DI 0 "gpc_reg_operand" "")
6859 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6860 "TARGET_POWERPC64 && reload_completed
6861 && includes_rldicr_lshift_p (operands[2], operands[3])"
6863 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6866 (compare:CC (match_dup 0)
6870 (define_expand "lshrdi3"
6871 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6872 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6873 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6874 "TARGET_POWERPC64 || TARGET_POWER"
6877 if (TARGET_POWERPC64)
6879 else if (TARGET_POWER)
6881 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6888 (define_insn "*lshrdi3_internal1"
6889 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6890 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6891 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6895 (define_insn "*lshrdi3_internal2"
6896 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6897 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6898 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6900 (clobber (match_scratch:DI 3 "=r,r"))]
6905 [(set_attr "type" "delayed_compare")
6906 (set_attr "length" "4,8")])
6909 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6910 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6911 (match_operand:SI 2 "reg_or_cint_operand" ""))
6913 (clobber (match_scratch:DI 3 ""))]
6914 "TARGET_POWERPC64 && reload_completed"
6916 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6918 (compare:CC (match_dup 3)
6922 (define_insn "*lshrdi3_internal3"
6923 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6924 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6925 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6927 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6928 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6933 [(set_attr "type" "delayed_compare")
6934 (set_attr "length" "4,8")])
6937 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6938 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6939 (match_operand:SI 2 "reg_or_cint_operand" ""))
6941 (set (match_operand:DI 0 "gpc_reg_operand" "")
6942 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6943 "TARGET_POWERPC64 && reload_completed"
6945 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6947 (compare:CC (match_dup 0)
6951 (define_expand "ashrdi3"
6952 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6953 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6954 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6958 if (TARGET_POWERPC64)
6960 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6962 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
6965 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
6966 && WORDS_BIG_ENDIAN)
6968 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
6975 (define_insn "*ashrdi3_internal1"
6976 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6977 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6978 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6980 "srad%I2 %0,%1,%H2")
6982 (define_insn "*ashrdi3_internal2"
6983 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6984 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6985 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6987 (clobber (match_scratch:DI 3 "=r,r"))]
6992 [(set_attr "type" "delayed_compare")
6993 (set_attr "length" "4,8")])
6996 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6997 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6998 (match_operand:SI 2 "reg_or_cint_operand" ""))
7000 (clobber (match_scratch:DI 3 ""))]
7001 "TARGET_POWERPC64 && reload_completed"
7003 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7005 (compare:CC (match_dup 3)
7009 (define_insn "*ashrdi3_internal3"
7010 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7011 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7012 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7014 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7015 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7020 [(set_attr "type" "delayed_compare")
7021 (set_attr "length" "4,8")])
7024 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7025 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7026 (match_operand:SI 2 "reg_or_cint_operand" ""))
7028 (set (match_operand:DI 0 "gpc_reg_operand" "")
7029 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7030 "TARGET_POWERPC64 && reload_completed"
7032 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7034 (compare:CC (match_dup 0)
7038 (define_insn "anddi3"
7039 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
7040 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
7041 (match_operand:DI 2 "and64_2_operand" "?r,S,K,J,t")))
7042 (clobber (match_scratch:CC 3 "=X,X,x,x,X"))]
7046 rldic%B2 %0,%1,0,%S2
7050 [(set_attr "length" "4,4,4,4,8")])
7053 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7054 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7055 (match_operand:DI 2 "mask64_2_operand" "")))
7056 (clobber (match_scratch:CC 3 ""))]
7058 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7059 && !mask64_operand (operands[2], DImode)"
7061 (and:DI (rotate:DI (match_dup 1)
7065 (and:DI (rotate:DI (match_dup 0)
7070 build_mask64_2_operands (operands[2], &operands[4]);
7073 (define_insn "*anddi3_internal2"
7074 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7075 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7076 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7078 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7079 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7083 rldic%B2. %3,%1,0,%S2
7092 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7093 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7096 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7097 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7098 (match_operand:DI 2 "and64_operand" ""))
7100 (clobber (match_scratch:DI 3 ""))
7101 (clobber (match_scratch:CC 4 ""))]
7102 "TARGET_POWERPC64 && reload_completed"
7103 [(parallel [(set (match_dup 3)
7104 (and:DI (match_dup 1)
7106 (clobber (match_dup 4))])
7108 (compare:CC (match_dup 3)
7113 [(set (match_operand:CC 0 "cc_reg_operand" "")
7114 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7115 (match_operand:DI 2 "mask64_2_operand" ""))
7117 (clobber (match_scratch:DI 3 ""))
7118 (clobber (match_scratch:CC 4 ""))]
7119 "TARGET_POWERPC64 && reload_completed
7120 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7121 && !mask64_operand (operands[2], DImode)"
7123 (and:DI (rotate:DI (match_dup 1)
7126 (parallel [(set (match_dup 0)
7127 (compare:CC (and:DI (rotate:DI (match_dup 3)
7131 (clobber (match_dup 3))])]
7134 build_mask64_2_operands (operands[2], &operands[5]);
7137 (define_insn "*anddi3_internal3"
7138 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7139 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7140 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7142 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7143 (and:DI (match_dup 1) (match_dup 2)))
7144 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7148 rldic%B2. %0,%1,0,%S2
7157 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7158 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7161 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7162 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7163 (match_operand:DI 2 "and64_operand" ""))
7165 (set (match_operand:DI 0 "gpc_reg_operand" "")
7166 (and:DI (match_dup 1) (match_dup 2)))
7167 (clobber (match_scratch:CC 4 ""))]
7168 "TARGET_POWERPC64 && reload_completed"
7169 [(parallel [(set (match_dup 0)
7170 (and:DI (match_dup 1) (match_dup 2)))
7171 (clobber (match_dup 4))])
7173 (compare:CC (match_dup 0)
7178 [(set (match_operand:CC 3 "cc_reg_operand" "")
7179 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7180 (match_operand:DI 2 "mask64_2_operand" ""))
7182 (set (match_operand:DI 0 "gpc_reg_operand" "")
7183 (and:DI (match_dup 1) (match_dup 2)))
7184 (clobber (match_scratch:CC 4 ""))]
7185 "TARGET_POWERPC64 && reload_completed
7186 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7187 && !mask64_operand (operands[2], DImode)"
7189 (and:DI (rotate:DI (match_dup 1)
7192 (parallel [(set (match_dup 3)
7193 (compare:CC (and:DI (rotate:DI (match_dup 0)
7198 (and:DI (rotate:DI (match_dup 0)
7203 build_mask64_2_operands (operands[2], &operands[5]);
7206 (define_expand "iordi3"
7207 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7208 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7209 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7213 if (non_logical_cint_operand (operands[2], DImode))
7215 HOST_WIDE_INT value;
7216 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7217 ? operands[0] : gen_reg_rtx (DImode));
7219 if (GET_CODE (operands[2]) == CONST_INT)
7221 value = INTVAL (operands[2]);
7222 emit_insn (gen_iordi3 (tmp, operands[1],
7223 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7227 value = CONST_DOUBLE_LOW (operands[2]);
7228 emit_insn (gen_iordi3 (tmp, operands[1],
7229 immed_double_const (value
7230 & (~ (HOST_WIDE_INT) 0xffff),
7234 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7239 (define_expand "xordi3"
7240 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7241 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7242 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7246 if (non_logical_cint_operand (operands[2], DImode))
7248 HOST_WIDE_INT value;
7249 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7250 ? operands[0] : gen_reg_rtx (DImode));
7252 if (GET_CODE (operands[2]) == CONST_INT)
7254 value = INTVAL (operands[2]);
7255 emit_insn (gen_xordi3 (tmp, operands[1],
7256 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7260 value = CONST_DOUBLE_LOW (operands[2]);
7261 emit_insn (gen_xordi3 (tmp, operands[1],
7262 immed_double_const (value
7263 & (~ (HOST_WIDE_INT) 0xffff),
7267 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7272 (define_insn "*booldi3_internal1"
7273 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7274 (match_operator:DI 3 "boolean_or_operator"
7275 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7276 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7283 (define_insn "*booldi3_internal2"
7284 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7285 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7286 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7287 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7289 (clobber (match_scratch:DI 3 "=r,r"))]
7294 [(set_attr "type" "compare")
7295 (set_attr "length" "4,8")])
7298 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7299 (compare:CC (match_operator:DI 4 "boolean_operator"
7300 [(match_operand:DI 1 "gpc_reg_operand" "")
7301 (match_operand:DI 2 "gpc_reg_operand" "")])
7303 (clobber (match_scratch:DI 3 ""))]
7304 "TARGET_POWERPC64 && reload_completed"
7305 [(set (match_dup 3) (match_dup 4))
7307 (compare:CC (match_dup 3)
7311 (define_insn "*booldi3_internal3"
7312 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7313 (compare:CC (match_operator:DI 4 "boolean_operator"
7314 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7315 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7317 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7323 [(set_attr "type" "compare")
7324 (set_attr "length" "4,8")])
7327 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7328 (compare:CC (match_operator:DI 4 "boolean_operator"
7329 [(match_operand:DI 1 "gpc_reg_operand" "")
7330 (match_operand:DI 2 "gpc_reg_operand" "")])
7332 (set (match_operand:DI 0 "gpc_reg_operand" "")
7334 "TARGET_POWERPC64 && reload_completed"
7335 [(set (match_dup 0) (match_dup 4))
7337 (compare:CC (match_dup 0)
7341 ;; Split a logical operation that we can't do in one insn into two insns,
7342 ;; each of which does one 16-bit part. This is used by combine.
7345 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7346 (match_operator:DI 3 "boolean_or_operator"
7347 [(match_operand:DI 1 "gpc_reg_operand" "")
7348 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7350 [(set (match_dup 0) (match_dup 4))
7351 (set (match_dup 0) (match_dup 5))]
7356 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7358 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7359 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7361 i4 = GEN_INT (value & 0xffff);
7365 i3 = GEN_INT (INTVAL (operands[2])
7366 & (~ (HOST_WIDE_INT) 0xffff));
7367 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7369 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7371 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7375 (define_insn "*boolcdi3_internal1"
7376 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7377 (match_operator:DI 3 "boolean_operator"
7378 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7379 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7383 (define_insn "*boolcdi3_internal2"
7384 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7385 (compare:CC (match_operator:DI 4 "boolean_operator"
7386 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7387 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7389 (clobber (match_scratch:DI 3 "=r,r"))]
7394 [(set_attr "type" "compare")
7395 (set_attr "length" "4,8")])
7398 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7399 (compare:CC (match_operator:DI 4 "boolean_operator"
7400 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7401 (match_operand:DI 2 "gpc_reg_operand" "")])
7403 (clobber (match_scratch:DI 3 ""))]
7404 "TARGET_POWERPC64 && reload_completed"
7405 [(set (match_dup 3) (match_dup 4))
7407 (compare:CC (match_dup 3)
7411 (define_insn "*boolcdi3_internal3"
7412 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7413 (compare:CC (match_operator:DI 4 "boolean_operator"
7414 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7415 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7417 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7423 [(set_attr "type" "compare")
7424 (set_attr "length" "4,8")])
7427 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7428 (compare:CC (match_operator:DI 4 "boolean_operator"
7429 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7430 (match_operand:DI 2 "gpc_reg_operand" "")])
7432 (set (match_operand:DI 0 "gpc_reg_operand" "")
7434 "TARGET_POWERPC64 && reload_completed"
7435 [(set (match_dup 0) (match_dup 4))
7437 (compare:CC (match_dup 0)
7441 (define_insn "*boolccdi3_internal1"
7442 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7443 (match_operator:DI 3 "boolean_operator"
7444 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7445 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7449 (define_insn "*boolccdi3_internal2"
7450 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7451 (compare:CC (match_operator:DI 4 "boolean_operator"
7452 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7453 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7455 (clobber (match_scratch:DI 3 "=r,r"))]
7460 [(set_attr "type" "compare")
7461 (set_attr "length" "4,8")])
7464 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7465 (compare:CC (match_operator:DI 4 "boolean_operator"
7466 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7467 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7469 (clobber (match_scratch:DI 3 ""))]
7470 "TARGET_POWERPC64 && reload_completed"
7471 [(set (match_dup 3) (match_dup 4))
7473 (compare:CC (match_dup 3)
7477 (define_insn "*boolccdi3_internal3"
7478 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7479 (compare:CC (match_operator:DI 4 "boolean_operator"
7480 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7481 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7483 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7489 [(set_attr "type" "compare")
7490 (set_attr "length" "4,8")])
7493 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7494 (compare:CC (match_operator:DI 4 "boolean_operator"
7495 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7496 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7498 (set (match_operand:DI 0 "gpc_reg_operand" "")
7500 "TARGET_POWERPC64 && reload_completed"
7501 [(set (match_dup 0) (match_dup 4))
7503 (compare:CC (match_dup 0)
7507 ;; Now define ways of moving data around.
7509 ;; Elf specific ways of loading addresses for non-PIC code.
7510 ;; The output of this could be r0, but we make a very strong
7511 ;; preference for a base register because it will usually
7513 (define_insn "elf_high"
7514 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7515 (high:SI (match_operand 1 "" "")))]
7516 "TARGET_ELF && ! TARGET_64BIT"
7517 "{liu|lis} %0,%1@ha")
7519 (define_insn "elf_low"
7520 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7521 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7522 (match_operand 2 "" "")))]
7523 "TARGET_ELF && ! TARGET_64BIT"
7525 {cal|la} %0,%2@l(%1)
7526 {ai|addic} %0,%1,%K2")
7528 ;; Mach-O PIC trickery.
7529 (define_insn "macho_high"
7530 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7531 (high:SI (match_operand 1 "" "")))]
7532 "TARGET_MACHO && ! TARGET_64BIT"
7533 "{liu|lis} %0,ha16(%1)")
7535 (define_insn "macho_low"
7536 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7537 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7538 (match_operand 2 "" "")))]
7539 "TARGET_MACHO && ! TARGET_64BIT"
7541 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
7542 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
7544 ;; Set up a register with a value from the GOT table
7546 (define_expand "movsi_got"
7547 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7548 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7549 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7550 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7553 if (GET_CODE (operands[1]) == CONST)
7555 rtx offset = const0_rtx;
7556 HOST_WIDE_INT value;
7558 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7559 value = INTVAL (offset);
7562 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7563 emit_insn (gen_movsi_got (tmp, operands[1]));
7564 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7569 operands[2] = rs6000_got_register (operands[1]);
7572 (define_insn "*movsi_got_internal"
7573 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7574 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7575 (match_operand:SI 2 "gpc_reg_operand" "b")]
7577 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7578 "{l|lwz} %0,%a1@got(%2)"
7579 [(set_attr "type" "load")])
7581 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7582 ;; didn't get allocated to a hard register.
7584 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7585 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7586 (match_operand:SI 2 "memory_operand" "")]
7588 "DEFAULT_ABI == ABI_V4
7590 && (reload_in_progress || reload_completed)"
7591 [(set (match_dup 0) (match_dup 2))
7592 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7596 ;; For SI, we special-case integers that can't be loaded in one insn. We
7597 ;; do the load 16-bits at a time. We could do this by loading from memory,
7598 ;; and this is even supposed to be faster, but it is simpler not to get
7599 ;; integers in the TOC.
7600 (define_expand "movsi"
7601 [(set (match_operand:SI 0 "general_operand" "")
7602 (match_operand:SI 1 "any_operand" ""))]
7604 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7606 (define_insn "movsi_low"
7607 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7608 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7609 (match_operand 2 "" ""))))]
7610 "TARGET_MACHO && ! TARGET_64BIT"
7611 "{l|lwz} %0,lo16(%2)(%1)"
7612 [(set_attr "type" "load")
7613 (set_attr "length" "4")])
7615 (define_insn "movsi_low_st"
7616 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7617 (match_operand 2 "" "")))
7618 (match_operand:SI 0 "gpc_reg_operand" "r"))]
7619 "TARGET_MACHO && ! TARGET_64BIT"
7620 "{st|stw} %0,lo16(%2)(%1)"
7621 [(set_attr "type" "store")
7622 (set_attr "length" "4")])
7624 (define_insn "movdf_low"
7625 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
7626 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7627 (match_operand 2 "" ""))))]
7628 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7631 switch (which_alternative)
7634 return \"lfd %0,lo16(%2)(%1)\";
7638 operands2[0] = operands[0];
7639 operands2[1] = operands[1];
7640 operands2[2] = operands[2];
7641 if (TARGET_POWERPC64 && TARGET_32BIT)
7642 /* Note, old assemblers didn't support relocation here. */
7643 return \"ld %0,lo16(%2)(%1)\";
7646 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
7647 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
7649 if (MACHO_DYNAMIC_NO_PIC_P)
7650 output_asm_insn (\"{liu|lis} %L0,ha16(%2+4)\", operands);
7652 /* We cannot rely on ha16(low half)==ha16(high half), alas,
7653 although in practice it almost always is. */
7654 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
7656 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
7663 [(set_attr "type" "load")
7664 (set_attr "length" "4,12")])
7666 (define_insn "movdf_low_st"
7667 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7668 (match_operand 2 "" "")))
7669 (match_operand:DF 0 "gpc_reg_operand" "f"))]
7670 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7671 "stfd %0,lo16(%2)(%1)"
7672 [(set_attr "type" "store")
7673 (set_attr "length" "4")])
7675 (define_insn "movsf_low"
7676 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
7677 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7678 (match_operand 2 "" ""))))]
7679 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7682 {l|lwz} %0,lo16(%2)(%1)"
7683 [(set_attr "type" "load")
7684 (set_attr "length" "4")])
7686 (define_insn "movsf_low_st"
7687 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7688 (match_operand 2 "" "")))
7689 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
7690 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7692 stfs %0,lo16(%2)(%1)
7693 {st|stw} %0,lo16(%2)(%1)"
7694 [(set_attr "type" "store")
7695 (set_attr "length" "4")])
7697 (define_insn "*movsi_internal1"
7698 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7699 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7700 "gpc_reg_operand (operands[0], SImode)
7701 || gpc_reg_operand (operands[1], SImode)"
7705 {l%U1%X1|lwz%U1%X1} %0,%1
7706 {st%U0%X0|stw%U0%X0} %1,%0
7716 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7717 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7719 ;; Split a load of a large constant into the appropriate two-insn
7723 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7724 (match_operand:SI 1 "const_int_operand" ""))]
7725 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7726 && (INTVAL (operands[1]) & 0xffff) != 0"
7730 (ior:SI (match_dup 0)
7733 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7735 if (tem == operands[0])
7741 (define_insn "*movsi_internal2"
7742 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7743 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "0,r,r")
7745 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7748 {cmpi|cmpwi} %2,%0,0
7751 [(set_attr "type" "cmp,compare,cmp")
7752 (set_attr "length" "4,4,8")])
7755 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7756 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7758 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7759 "TARGET_32BIT && reload_completed"
7760 [(set (match_dup 0) (match_dup 1))
7762 (compare:CC (match_dup 0)
7766 (define_expand "movhi"
7767 [(set (match_operand:HI 0 "general_operand" "")
7768 (match_operand:HI 1 "any_operand" ""))]
7770 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7772 (define_insn "*movhi_internal"
7773 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7774 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7775 "gpc_reg_operand (operands[0], HImode)
7776 || gpc_reg_operand (operands[1], HImode)"
7786 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7788 (define_expand "movqi"
7789 [(set (match_operand:QI 0 "general_operand" "")
7790 (match_operand:QI 1 "any_operand" ""))]
7792 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7794 (define_insn "*movqi_internal"
7795 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7796 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7797 "gpc_reg_operand (operands[0], QImode)
7798 || gpc_reg_operand (operands[1], QImode)"
7808 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7810 ;; Here is how to move condition codes around. When we store CC data in
7811 ;; an integer register or memory, we store just the high-order 4 bits.
7812 ;; This lets us not shift in the most common case of CR0.
7813 (define_expand "movcc"
7814 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7815 (match_operand:CC 1 "nonimmediate_operand" ""))]
7819 (define_insn "*movcc_internal1"
7820 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7821 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7822 "register_operand (operands[0], CCmode)
7823 || register_operand (operands[1], CCmode)"
7827 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7829 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7834 {l%U1%X1|lwz%U1%X1} %0,%1
7835 {st%U0%U1|stw%U0%U1} %1,%0"
7837 (cond [(eq_attr "alternative" "0")
7838 (const_string "cr_logical")
7839 (eq_attr "alternative" "1,2")
7840 (const_string "mtcr")
7841 (eq_attr "alternative" "5,7")
7842 (const_string "integer")
7843 (eq_attr "alternative" "6")
7844 (const_string "mfjmpr")
7845 (eq_attr "alternative" "8")
7846 (const_string "mtjmpr")
7847 (eq_attr "alternative" "9")
7848 (const_string "load")
7849 (eq_attr "alternative" "10")
7850 (const_string "store")
7851 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7852 (const_string "mfcrf")
7854 (const_string "mfcr")))
7855 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7857 ;; For floating-point, we normally deal with the floating-point registers
7858 ;; unless -msoft-float is used. The sole exception is that parameter passing
7859 ;; can produce floating-point values in fixed-point registers. Unless the
7860 ;; value is a simple constant or already in memory, we deal with this by
7861 ;; allocating memory and copying the value explicitly via that memory location.
7862 (define_expand "movsf"
7863 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7864 (match_operand:SF 1 "any_operand" ""))]
7866 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7869 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7870 (match_operand:SF 1 "const_double_operand" ""))]
7872 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7873 || (GET_CODE (operands[0]) == SUBREG
7874 && GET_CODE (SUBREG_REG (operands[0])) == REG
7875 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7876 [(set (match_dup 2) (match_dup 3))]
7882 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7883 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7885 if (! TARGET_POWERPC64)
7886 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7888 operands[2] = gen_lowpart (SImode, operands[0]);
7890 operands[3] = gen_int_mode (l, SImode);
7893 (define_insn "*movsf_hardfloat"
7894 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7895 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7896 "(gpc_reg_operand (operands[0], SFmode)
7897 || gpc_reg_operand (operands[1], SFmode))
7898 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7901 {l%U1%X1|lwz%U1%X1} %0,%1
7902 {st%U0%X0|stw%U0%X0} %1,%0
7912 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7913 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7915 (define_insn "*movsf_softfloat"
7916 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7917 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7918 "(gpc_reg_operand (operands[0], SFmode)
7919 || gpc_reg_operand (operands[1], SFmode))
7920 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7926 {l%U1%X1|lwz%U1%X1} %0,%1
7927 {st%U0%X0|stw%U0%X0} %1,%0
7934 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
7935 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7938 (define_expand "movdf"
7939 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7940 (match_operand:DF 1 "any_operand" ""))]
7942 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7945 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7946 (match_operand:DF 1 "const_int_operand" ""))]
7947 "! TARGET_POWERPC64 && reload_completed
7948 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7949 || (GET_CODE (operands[0]) == SUBREG
7950 && GET_CODE (SUBREG_REG (operands[0])) == REG
7951 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7952 [(set (match_dup 2) (match_dup 4))
7953 (set (match_dup 3) (match_dup 1))]
7956 int endian = (WORDS_BIG_ENDIAN == 0);
7957 HOST_WIDE_INT value = INTVAL (operands[1]);
7959 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7960 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7961 #if HOST_BITS_PER_WIDE_INT == 32
7962 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7964 operands[4] = GEN_INT (value >> 32);
7965 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7970 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7971 (match_operand:DF 1 "const_double_operand" ""))]
7972 "! TARGET_POWERPC64 && reload_completed
7973 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7974 || (GET_CODE (operands[0]) == SUBREG
7975 && GET_CODE (SUBREG_REG (operands[0])) == REG
7976 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7977 [(set (match_dup 2) (match_dup 4))
7978 (set (match_dup 3) (match_dup 5))]
7981 int endian = (WORDS_BIG_ENDIAN == 0);
7985 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7986 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7988 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7989 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7990 operands[4] = gen_int_mode (l[endian], SImode);
7991 operands[5] = gen_int_mode (l[1 - endian], SImode);
7995 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7996 (match_operand:DF 1 "easy_fp_constant" ""))]
7997 "TARGET_POWERPC64 && reload_completed
7998 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7999 || (GET_CODE (operands[0]) == SUBREG
8000 && GET_CODE (SUBREG_REG (operands[0])) == REG
8001 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8002 [(set (match_dup 2) (match_dup 3))]
8005 int endian = (WORDS_BIG_ENDIAN == 0);
8008 #if HOST_BITS_PER_WIDE_INT >= 64
8012 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8013 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8015 operands[2] = gen_lowpart (DImode, operands[0]);
8016 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8017 #if HOST_BITS_PER_WIDE_INT >= 64
8018 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8019 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8021 operands[3] = gen_int_mode (val, DImode);
8023 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8027 ;; Don't have reload use general registers to load a constant. First,
8028 ;; it might not work if the output operand is the equivalent of
8029 ;; a non-offsettable memref, but also it is less efficient than loading
8030 ;; the constant into an FP register, since it will probably be used there.
8031 ;; The "??" is a kludge until we can figure out a more reasonable way
8032 ;; of handling these non-offsettable values.
8033 (define_insn "*movdf_hardfloat32"
8034 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8035 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8036 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8037 && (gpc_reg_operand (operands[0], DFmode)
8038 || gpc_reg_operand (operands[1], DFmode))"
8041 switch (which_alternative)
8046 /* We normally copy the low-numbered register first. However, if
8047 the first register operand 0 is the same as the second register
8048 of operand 1, we must copy in the opposite order. */
8049 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8050 return \"mr %L0,%L1\;mr %0,%1\";
8052 return \"mr %0,%1\;mr %L0,%L1\";
8054 if (offsettable_memref_p (operands[1])
8055 || (GET_CODE (operands[1]) == MEM
8056 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8057 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8058 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8060 /* If the low-address word is used in the address, we must load
8061 it last. Otherwise, load it first. Note that we cannot have
8062 auto-increment in that case since the address register is
8063 known to be dead. */
8064 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8066 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8068 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8074 addreg = find_addr_reg (XEXP (operands[1], 0));
8075 if (refers_to_regno_p (REGNO (operands[0]),
8076 REGNO (operands[0]) + 1,
8079 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8080 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8081 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8082 return \"{lx|lwzx} %0,%1\";
8086 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8087 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8088 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8089 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8094 if (offsettable_memref_p (operands[0])
8095 || (GET_CODE (operands[0]) == MEM
8096 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8097 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8098 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8099 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8104 addreg = find_addr_reg (XEXP (operands[0], 0));
8105 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8106 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8107 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8108 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8112 return \"fmr %0,%1\";
8114 return \"lfd%U1%X1 %0,%1\";
8116 return \"stfd%U0%X0 %1,%0\";
8123 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*")
8124 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8126 (define_insn "*movdf_softfloat32"
8127 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8128 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8129 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8130 && (gpc_reg_operand (operands[0], DFmode)
8131 || gpc_reg_operand (operands[1], DFmode))"
8134 switch (which_alternative)
8139 /* We normally copy the low-numbered register first. However, if
8140 the first register operand 0 is the same as the second register of
8141 operand 1, we must copy in the opposite order. */
8142 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8143 return \"mr %L0,%L1\;mr %0,%1\";
8145 return \"mr %0,%1\;mr %L0,%L1\";
8147 /* If the low-address word is used in the address, we must load
8148 it last. Otherwise, load it first. Note that we cannot have
8149 auto-increment in that case since the address register is
8150 known to be dead. */
8151 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8153 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8155 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8157 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8164 [(set_attr "type" "*,load,store,*,*,*")
8165 (set_attr "length" "8,8,8,8,12,16")])
8167 ; ld/std require word-aligned displacements -> 'Y' constraint.
8168 ; List Y->r and r->Y before r->r for reload.
8169 (define_insn "*movdf_hardfloat64"
8170 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
8171 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8172 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8173 && (gpc_reg_operand (operands[0], DFmode)
8174 || gpc_reg_operand (operands[1], DFmode))"
8188 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
8189 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8191 (define_insn "*movdf_softfloat64"
8192 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8193 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8194 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8195 && (gpc_reg_operand (operands[0], DFmode)
8196 || gpc_reg_operand (operands[1], DFmode))"
8207 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
8208 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8210 (define_expand "movtf"
8211 [(set (match_operand:TF 0 "general_operand" "")
8212 (match_operand:TF 1 "any_operand" ""))]
8213 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8214 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8215 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8217 ; It's important to list the o->f and f->o moves before f->f because
8218 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8219 ; which doesn't make progress.
8220 (define_insn_and_split "*movtf_internal"
8221 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,rm,r")
8222 (match_operand:TF 1 "input_operand" "f,o,f,r,mGHF"))]
8223 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8224 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8225 && (gpc_reg_operand (operands[0], TFmode)
8226 || gpc_reg_operand (operands[1], TFmode))"
8228 "&& reload_completed"
8230 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8231 [(set_attr "length" "8,8,8,20,20")])
8233 (define_expand "extenddftf2"
8234 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8235 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8236 (use (match_dup 2))])]
8237 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8238 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8240 operands[2] = CONST0_RTX (DFmode);
8243 (define_insn_and_split "*extenddftf2_internal"
8244 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8245 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8246 (use (match_operand:DF 2 "input_operand" "rf,m,f,n"))]
8247 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8248 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8250 "&& reload_completed"
8253 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8254 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8255 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8257 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8262 (define_expand "extendsftf2"
8263 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8264 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8265 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8266 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8268 rtx tmp = gen_reg_rtx (DFmode);
8269 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8270 emit_insn (gen_extenddftf2 (operands[0], tmp));
8274 (define_insn "trunctfdf2"
8275 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8276 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8277 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8278 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8280 [(set_attr "type" "fp")
8281 (set_attr "length" "4")])
8283 (define_insn_and_split "trunctfsf2"
8284 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8285 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8286 (clobber (match_scratch:DF 2 "=f"))]
8287 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8288 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8290 "&& reload_completed"
8292 (float_truncate:DF (match_dup 1)))
8294 (float_truncate:SF (match_dup 2)))]
8297 (define_expand "floatsitf2"
8298 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8299 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8300 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8301 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8303 rtx tmp = gen_reg_rtx (DFmode);
8304 expand_float (tmp, operands[1], false);
8305 emit_insn (gen_extenddftf2 (operands[0], tmp));
8309 ; fadd, but rounding towards zero.
8310 ; This is probably not the optimal code sequence.
8311 (define_insn "fix_trunc_helper"
8312 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8313 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8314 UNSPEC_FIX_TRUNC_TF))
8315 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8316 "TARGET_HARD_FLOAT && TARGET_FPRS"
8317 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8318 [(set_attr "type" "fp")
8319 (set_attr "length" "20")])
8321 (define_expand "fix_trunctfsi2"
8322 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8323 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8324 (clobber (match_dup 2))
8325 (clobber (match_dup 3))
8326 (clobber (match_dup 4))
8327 (clobber (match_dup 5))])]
8328 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8329 && (TARGET_POWER2 || TARGET_POWERPC)
8330 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8332 operands[2] = gen_reg_rtx (DFmode);
8333 operands[3] = gen_reg_rtx (DFmode);
8334 operands[4] = gen_reg_rtx (DImode);
8335 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8338 (define_insn_and_split "*fix_trunctfsi2_internal"
8339 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8340 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8341 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8342 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8343 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8344 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8345 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8346 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8348 "&& reload_completed"
8352 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8354 if (GET_CODE (operands[5]) != MEM)
8356 lowword = XEXP (operands[5], 0);
8357 if (WORDS_BIG_ENDIAN)
8358 lowword = plus_constant (lowword, 4);
8360 emit_insn (gen_fctiwz (operands[4], operands[2]));
8361 emit_move_insn (operands[5], operands[4]);
8362 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
8366 (define_insn "negtf2"
8367 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8368 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8369 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8370 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8373 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8374 return \"fneg %L0,%L1\;fneg %0,%1\";
8376 return \"fneg %0,%1\;fneg %L0,%L1\";
8378 [(set_attr "type" "fp")
8379 (set_attr "length" "8")])
8381 (define_expand "abstf2"
8382 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8383 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8384 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8385 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8388 rtx label = gen_label_rtx ();
8389 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8394 (define_expand "abstf2_internal"
8395 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8396 (match_operand:TF 1 "gpc_reg_operand" "f"))
8397 (set (match_dup 3) (match_dup 5))
8398 (set (match_dup 5) (abs:DF (match_dup 5)))
8399 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8400 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8401 (label_ref (match_operand 2 "" ""))
8403 (set (match_dup 6) (neg:DF (match_dup 6)))]
8404 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8405 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8408 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8409 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8410 operands[3] = gen_reg_rtx (DFmode);
8411 operands[4] = gen_reg_rtx (CCFPmode);
8412 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8413 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8416 ;; Next come the multi-word integer load and store and the load and store
8418 (define_expand "movdi"
8419 [(set (match_operand:DI 0 "general_operand" "")
8420 (match_operand:DI 1 "any_operand" ""))]
8422 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8424 (define_insn "*movdi_internal32"
8425 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8426 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8428 && (gpc_reg_operand (operands[0], DImode)
8429 || gpc_reg_operand (operands[1], DImode))"
8432 switch (which_alternative)
8441 return \"fmr %0,%1\";
8443 return \"lfd%U1%X1 %0,%1\";
8445 return \"stfd%U0%X0 %1,%0\";
8454 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")])
8457 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8458 (match_operand:DI 1 "const_int_operand" ""))]
8459 "! TARGET_POWERPC64 && reload_completed"
8460 [(set (match_dup 2) (match_dup 4))
8461 (set (match_dup 3) (match_dup 1))]
8464 HOST_WIDE_INT value = INTVAL (operands[1]);
8465 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8467 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8469 #if HOST_BITS_PER_WIDE_INT == 32
8470 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8472 operands[4] = GEN_INT (value >> 32);
8473 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8478 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8479 (match_operand:DI 1 "input_operand" ""))]
8480 "reload_completed && !TARGET_POWERPC64
8481 && gpr_or_gpr_p (operands[0], operands[1])"
8483 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8486 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8487 (match_operand:TI 1 "const_double_operand" ""))]
8489 [(set (match_dup 2) (match_dup 4))
8490 (set (match_dup 3) (match_dup 5))]
8493 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8495 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8497 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8499 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8500 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8502 else if (GET_CODE (operands[1]) == CONST_INT)
8504 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8505 operands[5] = operands[1];
8511 (define_insn "*movdi_internal64"
8512 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,?f,f,m,r,*h,*h")
8513 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8515 && (gpc_reg_operand (operands[0], DImode)
8516 || gpc_reg_operand (operands[1], DImode))"
8531 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8532 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8534 ;; immediate value valid for a single instruction hiding in a const_double
8536 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8537 (match_operand:DI 1 "const_double_operand" "F"))]
8538 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8539 && GET_CODE (operands[1]) == CONST_DOUBLE
8540 && num_insns_constant (operands[1], DImode) == 1"
8543 return ((unsigned HOST_WIDE_INT)
8544 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8545 ? \"li %0,%1\" : \"lis %0,%v1\";
8548 ;; Generate all one-bits and clear left or right.
8549 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8551 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8552 (match_operand:DI 1 "mask64_operand" ""))]
8553 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8554 [(set (match_dup 0) (const_int -1))
8556 (and:DI (rotate:DI (match_dup 0)
8561 ;; Split a load of a large constant into the appropriate five-instruction
8562 ;; sequence. Handle anything in a constant number of insns.
8563 ;; When non-easy constants can go in the TOC, this should use
8564 ;; easy_fp_constant predicate.
8566 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8567 (match_operand:DI 1 "const_int_operand" ""))]
8568 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8569 [(set (match_dup 0) (match_dup 2))
8570 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8572 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8574 if (tem == operands[0])
8581 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8582 (match_operand:DI 1 "const_double_operand" ""))]
8583 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8584 [(set (match_dup 0) (match_dup 2))
8585 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8587 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8589 if (tem == operands[0])
8595 (define_insn "*movdi_internal2"
8596 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8597 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "0,r,r")
8599 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8605 [(set_attr "type" "cmp,compare,cmp")
8606 (set_attr "length" "4,4,8")])
8609 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8610 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8612 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8613 "TARGET_POWERPC64 && reload_completed"
8614 [(set (match_dup 0) (match_dup 1))
8616 (compare:CC (match_dup 0)
8620 ;; TImode is similar, except that we usually want to compute the address into
8621 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8622 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8623 (define_expand "movti"
8624 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8625 (match_operand:TI 1 "general_operand" ""))
8626 (clobber (scratch:SI))])]
8628 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8630 ;; We say that MQ is clobbered in the last alternative because the first
8631 ;; alternative would never get used otherwise since it would need a reload
8632 ;; while the 2nd alternative would not. We put memory cases first so they
8633 ;; are preferred. Otherwise, we'd try to reload the output instead of
8634 ;; giving the SCRATCH mq.
8636 (define_insn "*movti_power"
8637 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8638 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
8639 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
8640 "TARGET_POWER && ! TARGET_POWERPC64
8641 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8644 switch (which_alternative)
8651 return \"{stsi|stswi} %1,%P0,16\";
8656 /* If the address is not used in the output, we can use lsi. Otherwise,
8657 fall through to generating four loads. */
8659 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8660 return \"{lsi|lswi} %0,%P1,16\";
8661 /* ... fall through ... */
8666 [(set_attr "type" "store,store,*,load,load")])
8668 (define_insn "*movti_string"
8669 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8670 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))]
8671 "! TARGET_POWER && ! TARGET_POWERPC64
8672 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8675 switch (which_alternative)
8681 return \"{stsi|stswi} %1,%P0,16\";
8686 /* If the address is not used in the output, we can use lsi. Otherwise,
8687 fall through to generating four loads. */
8689 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8690 return \"{lsi|lswi} %0,%P1,16\";
8691 /* ... fall through ... */
8696 [(set_attr "type" "store,store,*,load,load")])
8698 (define_insn "*movti_ppc64"
8699 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,m,r")
8700 (match_operand:TI 1 "input_operand" "r,r,o"))]
8701 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8702 || gpc_reg_operand (operands[1], TImode))"
8707 [(set_attr "type" "*,load,store")])
8710 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8711 (match_operand:TI 1 "input_operand" ""))]
8713 && gpr_or_gpr_p (operands[0], operands[1])"
8715 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8717 (define_expand "load_multiple"
8718 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8719 (match_operand:SI 1 "" ""))
8720 (use (match_operand:SI 2 "" ""))])]
8721 "TARGET_STRING && !TARGET_POWERPC64"
8729 /* Support only loading a constant number of fixed-point registers from
8730 memory and only bother with this if more than two; the machine
8731 doesn't support more than eight. */
8732 if (GET_CODE (operands[2]) != CONST_INT
8733 || INTVAL (operands[2]) <= 2
8734 || INTVAL (operands[2]) > 8
8735 || GET_CODE (operands[1]) != MEM
8736 || GET_CODE (operands[0]) != REG
8737 || REGNO (operands[0]) >= 32)
8740 count = INTVAL (operands[2]);
8741 regno = REGNO (operands[0]);
8743 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8744 op1 = replace_equiv_address (operands[1],
8745 force_reg (SImode, XEXP (operands[1], 0)));
8747 for (i = 0; i < count; i++)
8748 XVECEXP (operands[3], 0, i)
8749 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8750 adjust_address_nv (op1, SImode, i * 4));
8753 (define_insn "*ldmsi8"
8754 [(match_parallel 0 "load_multiple_operation"
8755 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8756 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8757 (set (match_operand:SI 3 "gpc_reg_operand" "")
8758 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8759 (set (match_operand:SI 4 "gpc_reg_operand" "")
8760 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8761 (set (match_operand:SI 5 "gpc_reg_operand" "")
8762 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8763 (set (match_operand:SI 6 "gpc_reg_operand" "")
8764 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8765 (set (match_operand:SI 7 "gpc_reg_operand" "")
8766 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8767 (set (match_operand:SI 8 "gpc_reg_operand" "")
8768 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8769 (set (match_operand:SI 9 "gpc_reg_operand" "")
8770 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8771 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8773 { return rs6000_output_load_multiple (operands); }"
8774 [(set_attr "type" "load")
8775 (set_attr "length" "32")])
8777 (define_insn "*ldmsi7"
8778 [(match_parallel 0 "load_multiple_operation"
8779 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8780 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8781 (set (match_operand:SI 3 "gpc_reg_operand" "")
8782 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8783 (set (match_operand:SI 4 "gpc_reg_operand" "")
8784 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8785 (set (match_operand:SI 5 "gpc_reg_operand" "")
8786 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8787 (set (match_operand:SI 6 "gpc_reg_operand" "")
8788 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8789 (set (match_operand:SI 7 "gpc_reg_operand" "")
8790 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8791 (set (match_operand:SI 8 "gpc_reg_operand" "")
8792 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8793 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8795 { return rs6000_output_load_multiple (operands); }"
8796 [(set_attr "type" "load")
8797 (set_attr "length" "32")])
8799 (define_insn "*ldmsi6"
8800 [(match_parallel 0 "load_multiple_operation"
8801 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8802 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8803 (set (match_operand:SI 3 "gpc_reg_operand" "")
8804 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8805 (set (match_operand:SI 4 "gpc_reg_operand" "")
8806 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8807 (set (match_operand:SI 5 "gpc_reg_operand" "")
8808 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8809 (set (match_operand:SI 6 "gpc_reg_operand" "")
8810 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8811 (set (match_operand:SI 7 "gpc_reg_operand" "")
8812 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8813 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8815 { return rs6000_output_load_multiple (operands); }"
8816 [(set_attr "type" "load")
8817 (set_attr "length" "32")])
8819 (define_insn "*ldmsi5"
8820 [(match_parallel 0 "load_multiple_operation"
8821 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8822 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8823 (set (match_operand:SI 3 "gpc_reg_operand" "")
8824 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8825 (set (match_operand:SI 4 "gpc_reg_operand" "")
8826 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8827 (set (match_operand:SI 5 "gpc_reg_operand" "")
8828 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8829 (set (match_operand:SI 6 "gpc_reg_operand" "")
8830 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8831 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8833 { return rs6000_output_load_multiple (operands); }"
8834 [(set_attr "type" "load")
8835 (set_attr "length" "32")])
8837 (define_insn "*ldmsi4"
8838 [(match_parallel 0 "load_multiple_operation"
8839 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8840 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8841 (set (match_operand:SI 3 "gpc_reg_operand" "")
8842 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8843 (set (match_operand:SI 4 "gpc_reg_operand" "")
8844 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8845 (set (match_operand:SI 5 "gpc_reg_operand" "")
8846 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8847 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8849 { return rs6000_output_load_multiple (operands); }"
8850 [(set_attr "type" "load")
8851 (set_attr "length" "32")])
8853 (define_insn "*ldmsi3"
8854 [(match_parallel 0 "load_multiple_operation"
8855 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8856 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8857 (set (match_operand:SI 3 "gpc_reg_operand" "")
8858 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8859 (set (match_operand:SI 4 "gpc_reg_operand" "")
8860 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8861 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8863 { return rs6000_output_load_multiple (operands); }"
8864 [(set_attr "type" "load")
8865 (set_attr "length" "32")])
8867 (define_expand "store_multiple"
8868 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8869 (match_operand:SI 1 "" ""))
8870 (clobber (scratch:SI))
8871 (use (match_operand:SI 2 "" ""))])]
8872 "TARGET_STRING && !TARGET_POWERPC64"
8881 /* Support only storing a constant number of fixed-point registers to
8882 memory and only bother with this if more than two; the machine
8883 doesn't support more than eight. */
8884 if (GET_CODE (operands[2]) != CONST_INT
8885 || INTVAL (operands[2]) <= 2
8886 || INTVAL (operands[2]) > 8
8887 || GET_CODE (operands[0]) != MEM
8888 || GET_CODE (operands[1]) != REG
8889 || REGNO (operands[1]) >= 32)
8892 count = INTVAL (operands[2]);
8893 regno = REGNO (operands[1]);
8895 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8896 to = force_reg (SImode, XEXP (operands[0], 0));
8897 op0 = replace_equiv_address (operands[0], to);
8899 XVECEXP (operands[3], 0, 0)
8900 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8901 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8902 gen_rtx_SCRATCH (SImode));
8904 for (i = 1; i < count; i++)
8905 XVECEXP (operands[3], 0, i + 1)
8906 = gen_rtx_SET (VOIDmode,
8907 adjust_address_nv (op0, SImode, i * 4),
8908 gen_rtx_REG (SImode, regno + i));
8911 (define_insn "*store_multiple_power"
8912 [(match_parallel 0 "store_multiple_operation"
8913 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8914 (match_operand:SI 2 "gpc_reg_operand" "r"))
8915 (clobber (match_scratch:SI 3 "=q"))])]
8916 "TARGET_STRING && TARGET_POWER"
8917 "{stsi|stswi} %2,%P1,%O0"
8918 [(set_attr "type" "store")])
8920 (define_insn "*stmsi8"
8921 [(match_parallel 0 "store_multiple_operation"
8922 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8923 (match_operand:SI 2 "gpc_reg_operand" "r"))
8924 (clobber (match_scratch:SI 3 "X"))
8925 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8926 (match_operand:SI 4 "gpc_reg_operand" "r"))
8927 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8928 (match_operand:SI 5 "gpc_reg_operand" "r"))
8929 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8930 (match_operand:SI 6 "gpc_reg_operand" "r"))
8931 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8932 (match_operand:SI 7 "gpc_reg_operand" "r"))
8933 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8934 (match_operand:SI 8 "gpc_reg_operand" "r"))
8935 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8936 (match_operand:SI 9 "gpc_reg_operand" "r"))
8937 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8938 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8939 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8940 "{stsi|stswi} %2,%1,%O0"
8941 [(set_attr "type" "store")])
8943 (define_insn "*stmsi7"
8944 [(match_parallel 0 "store_multiple_operation"
8945 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8946 (match_operand:SI 2 "gpc_reg_operand" "r"))
8947 (clobber (match_scratch:SI 3 "X"))
8948 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8949 (match_operand:SI 4 "gpc_reg_operand" "r"))
8950 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8951 (match_operand:SI 5 "gpc_reg_operand" "r"))
8952 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8953 (match_operand:SI 6 "gpc_reg_operand" "r"))
8954 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8955 (match_operand:SI 7 "gpc_reg_operand" "r"))
8956 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8957 (match_operand:SI 8 "gpc_reg_operand" "r"))
8958 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8959 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8960 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
8961 "{stsi|stswi} %2,%1,%O0"
8962 [(set_attr "type" "store")])
8964 (define_insn "*stmsi6"
8965 [(match_parallel 0 "store_multiple_operation"
8966 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8967 (match_operand:SI 2 "gpc_reg_operand" "r"))
8968 (clobber (match_scratch:SI 3 "X"))
8969 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8970 (match_operand:SI 4 "gpc_reg_operand" "r"))
8971 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8972 (match_operand:SI 5 "gpc_reg_operand" "r"))
8973 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8974 (match_operand:SI 6 "gpc_reg_operand" "r"))
8975 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8976 (match_operand:SI 7 "gpc_reg_operand" "r"))
8977 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8978 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
8979 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
8980 "{stsi|stswi} %2,%1,%O0"
8981 [(set_attr "type" "store")])
8983 (define_insn "*stmsi5"
8984 [(match_parallel 0 "store_multiple_operation"
8985 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8986 (match_operand:SI 2 "gpc_reg_operand" "r"))
8987 (clobber (match_scratch:SI 3 "X"))
8988 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8989 (match_operand:SI 4 "gpc_reg_operand" "r"))
8990 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8991 (match_operand:SI 5 "gpc_reg_operand" "r"))
8992 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8993 (match_operand:SI 6 "gpc_reg_operand" "r"))
8994 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8995 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
8996 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
8997 "{stsi|stswi} %2,%1,%O0"
8998 [(set_attr "type" "store")])
9000 (define_insn "*stmsi4"
9001 [(match_parallel 0 "store_multiple_operation"
9002 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9003 (match_operand:SI 2 "gpc_reg_operand" "r"))
9004 (clobber (match_scratch:SI 3 "X"))
9005 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9006 (match_operand:SI 4 "gpc_reg_operand" "r"))
9007 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9008 (match_operand:SI 5 "gpc_reg_operand" "r"))
9009 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9010 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9011 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9012 "{stsi|stswi} %2,%1,%O0"
9013 [(set_attr "type" "store")])
9015 (define_insn "*stmsi3"
9016 [(match_parallel 0 "store_multiple_operation"
9017 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9018 (match_operand:SI 2 "gpc_reg_operand" "r"))
9019 (clobber (match_scratch:SI 3 "X"))
9020 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9021 (match_operand:SI 4 "gpc_reg_operand" "r"))
9022 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9023 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9024 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9025 "{stsi|stswi} %2,%1,%O0"
9026 [(set_attr "type" "store")])
9028 ;; String/block move insn.
9029 ;; Argument 0 is the destination
9030 ;; Argument 1 is the source
9031 ;; Argument 2 is the length
9032 ;; Argument 3 is the alignment
9034 (define_expand "movstrsi"
9035 [(parallel [(set (match_operand:BLK 0 "" "")
9036 (match_operand:BLK 1 "" ""))
9037 (use (match_operand:SI 2 "" ""))
9038 (use (match_operand:SI 3 "" ""))])]
9042 if (expand_block_move (operands))
9048 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9049 ;; register allocator doesn't have a clue about allocating 8 word registers.
9050 ;; rD/rS = r5 is preferred, efficient form.
9051 (define_expand "movstrsi_8reg"
9052 [(parallel [(set (match_operand 0 "" "")
9053 (match_operand 1 "" ""))
9054 (use (match_operand 2 "" ""))
9055 (use (match_operand 3 "" ""))
9056 (clobber (reg:SI 5))
9057 (clobber (reg:SI 6))
9058 (clobber (reg:SI 7))
9059 (clobber (reg:SI 8))
9060 (clobber (reg:SI 9))
9061 (clobber (reg:SI 10))
9062 (clobber (reg:SI 11))
9063 (clobber (reg:SI 12))
9064 (clobber (match_scratch:SI 4 ""))])]
9069 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9070 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9071 (use (match_operand:SI 2 "immediate_operand" "i"))
9072 (use (match_operand:SI 3 "immediate_operand" "i"))
9073 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9074 (clobber (reg:SI 6))
9075 (clobber (reg:SI 7))
9076 (clobber (reg:SI 8))
9077 (clobber (reg:SI 9))
9078 (clobber (reg:SI 10))
9079 (clobber (reg:SI 11))
9080 (clobber (reg:SI 12))
9081 (clobber (match_scratch:SI 5 "=q"))]
9082 "TARGET_STRING && TARGET_POWER
9083 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9084 || INTVAL (operands[2]) == 0)
9085 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9086 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9087 && REGNO (operands[4]) == 5"
9088 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9089 [(set_attr "type" "load")
9090 (set_attr "length" "8")])
9093 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9094 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9095 (use (match_operand:SI 2 "immediate_operand" "i"))
9096 (use (match_operand:SI 3 "immediate_operand" "i"))
9097 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9098 (clobber (reg:SI 6))
9099 (clobber (reg:SI 7))
9100 (clobber (reg:SI 8))
9101 (clobber (reg:SI 9))
9102 (clobber (reg:SI 10))
9103 (clobber (reg:SI 11))
9104 (clobber (reg:SI 12))
9105 (clobber (match_scratch:SI 5 "X"))]
9106 "TARGET_STRING && ! TARGET_POWER
9107 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9108 || INTVAL (operands[2]) == 0)
9109 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9110 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9111 && REGNO (operands[4]) == 5"
9112 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9113 [(set_attr "type" "load")
9114 (set_attr "length" "8")])
9117 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9118 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9119 (use (match_operand:SI 2 "immediate_operand" "i"))
9120 (use (match_operand:SI 3 "immediate_operand" "i"))
9121 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9122 (clobber (reg:SI 6))
9123 (clobber (reg:SI 7))
9124 (clobber (reg:SI 8))
9125 (clobber (reg:SI 9))
9126 (clobber (reg:SI 10))
9127 (clobber (reg:SI 11))
9128 (clobber (reg:SI 12))
9129 (clobber (match_scratch:SI 5 "X"))]
9130 "TARGET_STRING && TARGET_POWERPC64
9131 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9132 || INTVAL (operands[2]) == 0)
9133 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9134 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9135 && REGNO (operands[4]) == 5"
9136 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9137 [(set_attr "type" "load")
9138 (set_attr "length" "8")])
9140 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9141 ;; register allocator doesn't have a clue about allocating 6 word registers.
9142 ;; rD/rS = r5 is preferred, efficient form.
9143 (define_expand "movstrsi_6reg"
9144 [(parallel [(set (match_operand 0 "" "")
9145 (match_operand 1 "" ""))
9146 (use (match_operand 2 "" ""))
9147 (use (match_operand 3 "" ""))
9148 (clobber (reg:SI 5))
9149 (clobber (reg:SI 6))
9150 (clobber (reg:SI 7))
9151 (clobber (reg:SI 8))
9152 (clobber (reg:SI 9))
9153 (clobber (reg:SI 10))
9154 (clobber (match_scratch:SI 4 ""))])]
9159 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9160 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9161 (use (match_operand:SI 2 "immediate_operand" "i"))
9162 (use (match_operand:SI 3 "immediate_operand" "i"))
9163 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9164 (clobber (reg:SI 6))
9165 (clobber (reg:SI 7))
9166 (clobber (reg:SI 8))
9167 (clobber (reg:SI 9))
9168 (clobber (reg:SI 10))
9169 (clobber (match_scratch:SI 5 "=q"))]
9170 "TARGET_STRING && TARGET_POWER
9171 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9172 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9173 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9174 && REGNO (operands[4]) == 5"
9175 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9176 [(set_attr "type" "load")
9177 (set_attr "length" "8")])
9180 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9181 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9182 (use (match_operand:SI 2 "immediate_operand" "i"))
9183 (use (match_operand:SI 3 "immediate_operand" "i"))
9184 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9185 (clobber (reg:SI 6))
9186 (clobber (reg:SI 7))
9187 (clobber (reg:SI 8))
9188 (clobber (reg:SI 9))
9189 (clobber (reg:SI 10))
9190 (clobber (match_scratch:SI 5 "X"))]
9191 "TARGET_STRING && ! TARGET_POWER
9192 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9193 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9194 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9195 && REGNO (operands[4]) == 5"
9196 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9197 [(set_attr "type" "load")
9198 (set_attr "length" "8")])
9201 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9202 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9203 (use (match_operand:SI 2 "immediate_operand" "i"))
9204 (use (match_operand:SI 3 "immediate_operand" "i"))
9205 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9206 (clobber (reg:SI 6))
9207 (clobber (reg:SI 7))
9208 (clobber (reg:SI 8))
9209 (clobber (reg:SI 9))
9210 (clobber (reg:SI 10))
9211 (clobber (match_scratch:SI 5 "X"))]
9212 "TARGET_STRING && TARGET_POWERPC64
9213 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9214 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9215 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9216 && REGNO (operands[4]) == 5"
9217 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9218 [(set_attr "type" "load")
9219 (set_attr "length" "8")])
9221 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9222 ;; problems with TImode.
9223 ;; rD/rS = r5 is preferred, efficient form.
9224 (define_expand "movstrsi_4reg"
9225 [(parallel [(set (match_operand 0 "" "")
9226 (match_operand 1 "" ""))
9227 (use (match_operand 2 "" ""))
9228 (use (match_operand 3 "" ""))
9229 (clobber (reg:SI 5))
9230 (clobber (reg:SI 6))
9231 (clobber (reg:SI 7))
9232 (clobber (reg:SI 8))
9233 (clobber (match_scratch:SI 4 ""))])]
9238 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9239 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9240 (use (match_operand:SI 2 "immediate_operand" "i"))
9241 (use (match_operand:SI 3 "immediate_operand" "i"))
9242 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9243 (clobber (reg:SI 6))
9244 (clobber (reg:SI 7))
9245 (clobber (reg:SI 8))
9246 (clobber (match_scratch:SI 5 "=q"))]
9247 "TARGET_STRING && TARGET_POWER
9248 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9249 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9250 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9251 && REGNO (operands[4]) == 5"
9252 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9253 [(set_attr "type" "load")
9254 (set_attr "length" "8")])
9257 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9258 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9259 (use (match_operand:SI 2 "immediate_operand" "i"))
9260 (use (match_operand:SI 3 "immediate_operand" "i"))
9261 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9262 (clobber (reg:SI 6))
9263 (clobber (reg:SI 7))
9264 (clobber (reg:SI 8))
9265 (clobber (match_scratch:SI 5 "X"))]
9266 "TARGET_STRING && ! TARGET_POWER
9267 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9268 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9269 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9270 && REGNO (operands[4]) == 5"
9271 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9272 [(set_attr "type" "load")
9273 (set_attr "length" "8")])
9276 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9277 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9278 (use (match_operand:SI 2 "immediate_operand" "i"))
9279 (use (match_operand:SI 3 "immediate_operand" "i"))
9280 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9281 (clobber (reg:SI 6))
9282 (clobber (reg:SI 7))
9283 (clobber (reg:SI 8))
9284 (clobber (match_scratch:SI 5 "X"))]
9285 "TARGET_STRING && TARGET_POWERPC64
9286 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9287 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9288 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9289 && REGNO (operands[4]) == 5"
9290 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9291 [(set_attr "type" "load")
9292 (set_attr "length" "8")])
9294 ;; Move up to 8 bytes at a time.
9295 (define_expand "movstrsi_2reg"
9296 [(parallel [(set (match_operand 0 "" "")
9297 (match_operand 1 "" ""))
9298 (use (match_operand 2 "" ""))
9299 (use (match_operand 3 "" ""))
9300 (clobber (match_scratch:DI 4 ""))
9301 (clobber (match_scratch:SI 5 ""))])]
9302 "TARGET_STRING && ! TARGET_POWERPC64"
9306 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9307 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9308 (use (match_operand:SI 2 "immediate_operand" "i"))
9309 (use (match_operand:SI 3 "immediate_operand" "i"))
9310 (clobber (match_scratch:DI 4 "=&r"))
9311 (clobber (match_scratch:SI 5 "=q"))]
9312 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9313 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9314 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9315 [(set_attr "type" "load")
9316 (set_attr "length" "8")])
9319 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9320 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9321 (use (match_operand:SI 2 "immediate_operand" "i"))
9322 (use (match_operand:SI 3 "immediate_operand" "i"))
9323 (clobber (match_scratch:DI 4 "=&r"))
9324 (clobber (match_scratch:SI 5 "X"))]
9325 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9326 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9327 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9328 [(set_attr "type" "load")
9329 (set_attr "length" "8")])
9331 ;; Move up to 4 bytes at a time.
9332 (define_expand "movstrsi_1reg"
9333 [(parallel [(set (match_operand 0 "" "")
9334 (match_operand 1 "" ""))
9335 (use (match_operand 2 "" ""))
9336 (use (match_operand 3 "" ""))
9337 (clobber (match_scratch:SI 4 ""))
9338 (clobber (match_scratch:SI 5 ""))])]
9343 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9344 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9345 (use (match_operand:SI 2 "immediate_operand" "i"))
9346 (use (match_operand:SI 3 "immediate_operand" "i"))
9347 (clobber (match_scratch:SI 4 "=&r"))
9348 (clobber (match_scratch:SI 5 "=q"))]
9349 "TARGET_STRING && TARGET_POWER
9350 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9351 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9352 [(set_attr "type" "load")
9353 (set_attr "length" "8")])
9356 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9357 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9358 (use (match_operand:SI 2 "immediate_operand" "i"))
9359 (use (match_operand:SI 3 "immediate_operand" "i"))
9360 (clobber (match_scratch:SI 4 "=&r"))
9361 (clobber (match_scratch:SI 5 "X"))]
9362 "TARGET_STRING && ! TARGET_POWER
9363 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9364 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9365 [(set_attr "type" "load")
9366 (set_attr "length" "8")])
9369 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9370 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9371 (use (match_operand:SI 2 "immediate_operand" "i"))
9372 (use (match_operand:SI 3 "immediate_operand" "i"))
9373 (clobber (match_scratch:SI 4 "=&r"))
9374 (clobber (match_scratch:SI 5 "X"))]
9375 "TARGET_STRING && TARGET_POWERPC64
9376 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9377 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9378 [(set_attr "type" "load")
9379 (set_attr "length" "8")])
9382 ;; Define insns that do load or store with update. Some of these we can
9383 ;; get by using pre-decrement or pre-increment, but the hardware can also
9384 ;; do cases where the increment is not the size of the object.
9386 ;; In all these cases, we use operands 0 and 1 for the register being
9387 ;; incremented because those are the operands that local-alloc will
9388 ;; tie and these are the pair most likely to be tieable (and the ones
9389 ;; that will benefit the most).
9391 (define_insn "*movdi_update1"
9392 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9393 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9394 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9395 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9396 (plus:DI (match_dup 1) (match_dup 2)))]
9397 "TARGET_POWERPC64 && TARGET_UPDATE"
9401 [(set_attr "type" "load_ux,load_u")])
9403 (define_insn "movdi_update"
9404 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9405 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
9406 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9407 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9408 (plus:DI (match_dup 1) (match_dup 2)))]
9409 "TARGET_POWERPC64 && TARGET_UPDATE"
9413 [(set_attr "type" "store_ux,store_u")])
9415 (define_insn "*movsi_update1"
9416 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9417 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9418 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9419 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9420 (plus:SI (match_dup 1) (match_dup 2)))]
9423 {lux|lwzux} %3,%0,%2
9424 {lu|lwzu} %3,%2(%0)"
9425 [(set_attr "type" "load_ux,load_u")])
9427 (define_insn "*movsi_update2"
9428 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9430 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9431 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9432 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9433 (plus:DI (match_dup 1) (match_dup 2)))]
9436 [(set_attr "type" "load_ext_ux")])
9438 (define_insn "movsi_update"
9439 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9440 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9441 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9442 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9443 (plus:SI (match_dup 1) (match_dup 2)))]
9446 {stux|stwux} %3,%0,%2
9447 {stu|stwu} %3,%2(%0)"
9448 [(set_attr "type" "store_ux,store_u")])
9450 (define_insn "*movhi_update1"
9451 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9452 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9453 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9454 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9455 (plus:SI (match_dup 1) (match_dup 2)))]
9460 [(set_attr "type" "load_ux,load_u")])
9462 (define_insn "*movhi_update2"
9463 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9465 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9466 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9467 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9468 (plus:SI (match_dup 1) (match_dup 2)))]
9473 [(set_attr "type" "load_ux,load_u")])
9475 (define_insn "*movhi_update3"
9476 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9478 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9479 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9480 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9481 (plus:SI (match_dup 1) (match_dup 2)))]
9486 [(set_attr "type" "load_ext_ux,load_ext_u")])
9488 (define_insn "*movhi_update4"
9489 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9490 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9491 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9492 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9493 (plus:SI (match_dup 1) (match_dup 2)))]
9498 [(set_attr "type" "store_ux,store_u")])
9500 (define_insn "*movqi_update1"
9501 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9502 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9503 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9504 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9505 (plus:SI (match_dup 1) (match_dup 2)))]
9510 [(set_attr "type" "load_ux,load_u")])
9512 (define_insn "*movqi_update2"
9513 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9515 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9516 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9517 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9518 (plus:SI (match_dup 1) (match_dup 2)))]
9523 [(set_attr "type" "load_ux,load_u")])
9525 (define_insn "*movqi_update3"
9526 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9527 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9528 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9529 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9530 (plus:SI (match_dup 1) (match_dup 2)))]
9535 [(set_attr "type" "store_ux,store_u")])
9537 (define_insn "*movsf_update1"
9538 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9539 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9540 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9541 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9542 (plus:SI (match_dup 1) (match_dup 2)))]
9543 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9547 [(set_attr "type" "fpload_ux,fpload_u")])
9549 (define_insn "*movsf_update2"
9550 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9551 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9552 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9553 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9554 (plus:SI (match_dup 1) (match_dup 2)))]
9555 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9559 [(set_attr "type" "fpstore_ux,fpstore_u")])
9561 (define_insn "*movsf_update3"
9562 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9563 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9564 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9565 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9566 (plus:SI (match_dup 1) (match_dup 2)))]
9567 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9569 {lux|lwzux} %3,%0,%2
9570 {lu|lwzu} %3,%2(%0)"
9571 [(set_attr "type" "load_ux,load_u")])
9573 (define_insn "*movsf_update4"
9574 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9575 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9576 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9577 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9578 (plus:SI (match_dup 1) (match_dup 2)))]
9579 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9581 {stux|stwux} %3,%0,%2
9582 {stu|stwu} %3,%2(%0)"
9583 [(set_attr "type" "store_ux,store_u")])
9585 (define_insn "*movdf_update1"
9586 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9587 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9588 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9589 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9590 (plus:SI (match_dup 1) (match_dup 2)))]
9591 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9595 [(set_attr "type" "fpload_ux,fpload_u")])
9597 (define_insn "*movdf_update2"
9598 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9599 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9600 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9601 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9602 (plus:SI (match_dup 1) (match_dup 2)))]
9603 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9607 [(set_attr "type" "fpstore_ux,fpstore_u")])
9609 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9612 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
9613 (match_operand:DF 1 "memory_operand" ""))
9614 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
9615 (match_operand:DF 3 "memory_operand" ""))]
9617 && TARGET_HARD_FLOAT && TARGET_FPRS
9618 && registers_ok_for_quad_peep (operands[0], operands[2])
9619 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
9620 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
9624 [(set (match_operand:DF 0 "memory_operand" "")
9625 (match_operand:DF 1 "gpc_reg_operand" "f"))
9626 (set (match_operand:DF 2 "memory_operand" "")
9627 (match_operand:DF 3 "gpc_reg_operand" "f"))]
9629 && TARGET_HARD_FLOAT && TARGET_FPRS
9630 && registers_ok_for_quad_peep (operands[1], operands[3])
9631 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
9632 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
9637 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9638 (define_insn "tls_gd_32"
9639 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9640 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9641 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9643 "HAVE_AS_TLS && !TARGET_64BIT"
9644 "addi %0,%1,%2@got@tlsgd")
9646 (define_insn "tls_gd_64"
9647 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9648 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9649 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9651 "HAVE_AS_TLS && TARGET_64BIT"
9652 "addi %0,%1,%2@got@tlsgd")
9654 (define_insn "tls_ld_32"
9655 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9656 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9658 "HAVE_AS_TLS && !TARGET_64BIT"
9659 "addi %0,%1,%&@got@tlsld")
9661 (define_insn "tls_ld_64"
9662 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9663 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9665 "HAVE_AS_TLS && TARGET_64BIT"
9666 "addi %0,%1,%&@got@tlsld")
9668 (define_insn "tls_dtprel_32"
9669 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9670 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9671 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9673 "HAVE_AS_TLS && !TARGET_64BIT"
9674 "addi %0,%1,%2@dtprel")
9676 (define_insn "tls_dtprel_64"
9677 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9678 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9679 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9681 "HAVE_AS_TLS && TARGET_64BIT"
9682 "addi %0,%1,%2@dtprel")
9684 (define_insn "tls_dtprel_ha_32"
9685 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9686 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9687 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9688 UNSPEC_TLSDTPRELHA))]
9689 "HAVE_AS_TLS && !TARGET_64BIT"
9690 "addis %0,%1,%2@dtprel@ha")
9692 (define_insn "tls_dtprel_ha_64"
9693 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9694 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9695 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9696 UNSPEC_TLSDTPRELHA))]
9697 "HAVE_AS_TLS && TARGET_64BIT"
9698 "addis %0,%1,%2@dtprel@ha")
9700 (define_insn "tls_dtprel_lo_32"
9701 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9702 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9703 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9704 UNSPEC_TLSDTPRELLO))]
9705 "HAVE_AS_TLS && !TARGET_64BIT"
9706 "addi %0,%1,%2@dtprel@l")
9708 (define_insn "tls_dtprel_lo_64"
9709 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9710 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9711 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9712 UNSPEC_TLSDTPRELLO))]
9713 "HAVE_AS_TLS && TARGET_64BIT"
9714 "addi %0,%1,%2@dtprel@l")
9716 (define_insn "tls_got_dtprel_32"
9717 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9718 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9719 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9720 UNSPEC_TLSGOTDTPREL))]
9721 "HAVE_AS_TLS && !TARGET_64BIT"
9722 "lwz %0,%2@got@dtprel(%1)")
9724 (define_insn "tls_got_dtprel_64"
9725 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9726 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9727 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9728 UNSPEC_TLSGOTDTPREL))]
9729 "HAVE_AS_TLS && TARGET_64BIT"
9730 "ld %0,%2@got@dtprel(%1)")
9732 (define_insn "tls_tprel_32"
9733 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9734 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9735 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9737 "HAVE_AS_TLS && !TARGET_64BIT"
9738 "addi %0,%1,%2@tprel")
9740 (define_insn "tls_tprel_64"
9741 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9742 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9743 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9745 "HAVE_AS_TLS && TARGET_64BIT"
9746 "addi %0,%1,%2@tprel")
9748 (define_insn "tls_tprel_ha_32"
9749 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9750 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9751 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9752 UNSPEC_TLSTPRELHA))]
9753 "HAVE_AS_TLS && !TARGET_64BIT"
9754 "addis %0,%1,%2@tprel@ha")
9756 (define_insn "tls_tprel_ha_64"
9757 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9758 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9759 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9760 UNSPEC_TLSTPRELHA))]
9761 "HAVE_AS_TLS && TARGET_64BIT"
9762 "addis %0,%1,%2@tprel@ha")
9764 (define_insn "tls_tprel_lo_32"
9765 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9766 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9767 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9768 UNSPEC_TLSTPRELLO))]
9769 "HAVE_AS_TLS && !TARGET_64BIT"
9770 "addi %0,%1,%2@tprel@l")
9772 (define_insn "tls_tprel_lo_64"
9773 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9774 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9775 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9776 UNSPEC_TLSTPRELLO))]
9777 "HAVE_AS_TLS && TARGET_64BIT"
9778 "addi %0,%1,%2@tprel@l")
9780 ;; "b" output constraint here and on tls_tls input to support linker tls
9781 ;; optimization. The linker may edit the instructions emitted by a
9782 ;; tls_got_tprel/tls_tls pair to addis,addi.
9783 (define_insn "tls_got_tprel_32"
9784 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9785 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9786 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9787 UNSPEC_TLSGOTTPREL))]
9788 "HAVE_AS_TLS && !TARGET_64BIT"
9789 "lwz %0,%2@got@tprel(%1)")
9791 (define_insn "tls_got_tprel_64"
9792 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9793 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9794 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9795 UNSPEC_TLSGOTTPREL))]
9796 "HAVE_AS_TLS && TARGET_64BIT"
9797 "ld %0,%2@got@tprel(%1)")
9799 (define_insn "tls_tls_32"
9800 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9801 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9802 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9804 "HAVE_AS_TLS && !TARGET_64BIT"
9807 (define_insn "tls_tls_64"
9808 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9809 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9810 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9812 "HAVE_AS_TLS && TARGET_64BIT"
9815 ;; Next come insns related to the calling sequence.
9817 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9818 ;; We move the back-chain and decrement the stack pointer.
9820 (define_expand "allocate_stack"
9821 [(set (match_operand 0 "gpc_reg_operand" "=r")
9822 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9824 (minus (reg 1) (match_dup 1)))]
9827 { rtx chain = gen_reg_rtx (Pmode);
9828 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9831 emit_move_insn (chain, stack_bot);
9833 /* Check stack bounds if necessary. */
9834 if (current_function_limit_stack)
9837 available = expand_binop (Pmode, sub_optab,
9838 stack_pointer_rtx, stack_limit_rtx,
9839 NULL_RTX, 1, OPTAB_WIDEN);
9840 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9843 if (GET_CODE (operands[1]) != CONST_INT
9844 || INTVAL (operands[1]) < -32767
9845 || INTVAL (operands[1]) > 32768)
9847 neg_op0 = gen_reg_rtx (Pmode);
9849 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9851 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9854 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9857 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
9858 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9862 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9863 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9864 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9867 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9871 ;; These patterns say how to save and restore the stack pointer. We need not
9872 ;; save the stack pointer at function level since we are careful to
9873 ;; preserve the backchain. At block level, we have to restore the backchain
9874 ;; when we restore the stack pointer.
9876 ;; For nonlocal gotos, we must save both the stack pointer and its
9877 ;; backchain and restore both. Note that in the nonlocal case, the
9878 ;; save area is a memory location.
9880 (define_expand "save_stack_function"
9881 [(match_operand 0 "any_operand" "")
9882 (match_operand 1 "any_operand" "")]
9886 (define_expand "restore_stack_function"
9887 [(match_operand 0 "any_operand" "")
9888 (match_operand 1 "any_operand" "")]
9892 (define_expand "restore_stack_block"
9893 [(use (match_operand 0 "register_operand" ""))
9894 (set (match_dup 2) (match_dup 3))
9895 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9896 (set (match_dup 3) (match_dup 2))]
9900 operands[2] = gen_reg_rtx (Pmode);
9901 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9904 (define_expand "save_stack_nonlocal"
9905 [(match_operand 0 "memory_operand" "")
9906 (match_operand 1 "register_operand" "")]
9910 rtx temp = gen_reg_rtx (Pmode);
9911 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9913 /* Copy the backchain to the first word, sp to the second. */
9914 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9915 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
9916 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
9921 (define_expand "restore_stack_nonlocal"
9922 [(match_operand 0 "register_operand" "")
9923 (match_operand 1 "memory_operand" "")]
9927 rtx temp = gen_reg_rtx (Pmode);
9928 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9930 /* Restore the backchain from the first word, sp from the second. */
9931 emit_move_insn (temp,
9932 adjust_address_nv (operands[1], Pmode, 0));
9933 emit_move_insn (operands[0],
9934 adjust_address_nv (operands[1], Pmode, units_per_word));
9935 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9939 ;; TOC register handling.
9941 ;; Code to initialize the TOC register...
9943 (define_insn "load_toc_aix_si"
9944 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9945 (unspec:SI [(const_int 0)] UNSPEC_TOC))
9947 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9951 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9952 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9953 operands[2] = gen_rtx_REG (Pmode, 2);
9954 return \"{l|lwz} %0,%1(%2)\";
9956 [(set_attr "type" "load")])
9958 (define_insn "load_toc_aix_di"
9959 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9960 (unspec:DI [(const_int 0)] UNSPEC_TOC))
9962 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9966 #ifdef TARGET_RELOCATABLE
9967 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9968 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9970 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9973 strcat (buf, \"@toc\");
9974 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9975 operands[2] = gen_rtx_REG (Pmode, 2);
9976 return \"ld %0,%1(%2)\";
9978 [(set_attr "type" "load")])
9980 (define_insn "load_toc_v4_pic_si"
9981 [(set (match_operand:SI 0 "register_operand" "=l")
9982 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
9983 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9984 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9985 [(set_attr "type" "branch")
9986 (set_attr "length" "4")])
9988 (define_insn "load_toc_v4_PIC_1"
9989 [(set (match_operand:SI 0 "register_operand" "=l")
9990 (match_operand:SI 1 "immediate_operand" "s"))
9991 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
9992 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9993 "bcl 20,31,%1\\n%1:"
9994 [(set_attr "type" "branch")
9995 (set_attr "length" "4")])
9997 (define_insn "load_toc_v4_PIC_1b"
9998 [(set (match_operand:SI 0 "register_operand" "=l")
9999 (match_operand:SI 1 "immediate_operand" "s"))
10000 (use (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")]
10002 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10003 "bcl 20,31,%1+4\\n%1:\\n\\t.long %2-%1"
10004 [(set_attr "type" "branch")
10005 (set_attr "length" "8")])
10007 (define_insn "load_toc_v4_PIC_2"
10008 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10009 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10010 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10011 (match_operand:SI 3 "immediate_operand" "s")))))]
10012 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10013 "{l|lwz} %0,%2-%3(%1)"
10014 [(set_attr "type" "load")])
10016 (define_insn "load_macho_picbase"
10017 [(set (match_operand:SI 0 "register_operand" "=l")
10018 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
10020 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
10021 "bcl 20,31,%1\\n%1:"
10022 [(set_attr "type" "branch")
10023 (set_attr "length" "4")])
10025 (define_insn "macho_correct_pic"
10026 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10027 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10028 (unspec:SI [(match_operand:SI 2 "immediate_operand" "s")
10029 (match_operand:SI 3 "immediate_operand" "s")]
10030 UNSPEC_MPIC_CORRECT)))]
10031 "DEFAULT_ABI == ABI_DARWIN"
10032 "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)"
10033 [(set_attr "length" "8")])
10035 ;; If the TOC is shared over a translation unit, as happens with all
10036 ;; the kinds of PIC that we support, we need to restore the TOC
10037 ;; pointer only when jumping over units of translation.
10038 ;; On Darwin, we need to reload the picbase.
10040 (define_expand "builtin_setjmp_receiver"
10041 [(use (label_ref (match_operand 0 "" "")))]
10042 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10043 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10044 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10048 if (DEFAULT_ABI == ABI_DARWIN)
10050 const char *picbase = machopic_function_base_name ();
10051 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10052 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10056 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10057 CODE_LABEL_NUMBER (operands[0]));
10058 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10060 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10061 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10065 rs6000_emit_load_toc_table (FALSE);
10069 ;; A function pointer under AIX is a pointer to a data area whose first word
10070 ;; contains the actual address of the function, whose second word contains a
10071 ;; pointer to its TOC, and whose third word contains a value to place in the
10072 ;; static chain register (r11). Note that if we load the static chain, our
10073 ;; "trampoline" need not have any executable code.
10075 (define_expand "call_indirect_aix32"
10076 [(set (match_dup 2)
10077 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10078 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10081 (mem:SI (plus:SI (match_dup 0)
10084 (mem:SI (plus:SI (match_dup 0)
10086 (parallel [(call (mem:SI (match_dup 2))
10087 (match_operand 1 "" ""))
10091 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10092 (clobber (scratch:SI))])]
10095 { operands[2] = gen_reg_rtx (SImode); }")
10097 (define_expand "call_indirect_aix64"
10098 [(set (match_dup 2)
10099 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10100 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10103 (mem:DI (plus:DI (match_dup 0)
10106 (mem:DI (plus:DI (match_dup 0)
10108 (parallel [(call (mem:SI (match_dup 2))
10109 (match_operand 1 "" ""))
10113 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10114 (clobber (scratch:SI))])]
10117 { operands[2] = gen_reg_rtx (DImode); }")
10119 (define_expand "call_value_indirect_aix32"
10120 [(set (match_dup 3)
10121 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10122 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10125 (mem:SI (plus:SI (match_dup 1)
10128 (mem:SI (plus:SI (match_dup 1)
10130 (parallel [(set (match_operand 0 "" "")
10131 (call (mem:SI (match_dup 3))
10132 (match_operand 2 "" "")))
10136 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10137 (clobber (scratch:SI))])]
10140 { operands[3] = gen_reg_rtx (SImode); }")
10142 (define_expand "call_value_indirect_aix64"
10143 [(set (match_dup 3)
10144 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10145 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10148 (mem:DI (plus:DI (match_dup 1)
10151 (mem:DI (plus:DI (match_dup 1)
10153 (parallel [(set (match_operand 0 "" "")
10154 (call (mem:SI (match_dup 3))
10155 (match_operand 2 "" "")))
10159 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10160 (clobber (scratch:SI))])]
10163 { operands[3] = gen_reg_rtx (DImode); }")
10165 ;; Now the definitions for the call and call_value insns
10166 (define_expand "call"
10167 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10168 (match_operand 1 "" ""))
10169 (use (match_operand 2 "" ""))
10170 (clobber (scratch:SI))])]
10175 if (MACHOPIC_INDIRECT)
10176 operands[0] = machopic_indirect_call_target (operands[0]);
10179 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10182 operands[0] = XEXP (operands[0], 0);
10184 if (GET_CODE (operands[0]) != SYMBOL_REF
10185 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10186 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10188 if (INTVAL (operands[2]) & CALL_LONG)
10189 operands[0] = rs6000_longcall_ref (operands[0]);
10191 if (DEFAULT_ABI == ABI_V4
10192 || DEFAULT_ABI == ABI_DARWIN)
10193 operands[0] = force_reg (Pmode, operands[0]);
10195 else if (DEFAULT_ABI == ABI_AIX)
10197 /* AIX function pointers are really pointers to a three word
10199 emit_call_insn (TARGET_32BIT
10200 ? gen_call_indirect_aix32 (force_reg (SImode,
10203 : gen_call_indirect_aix64 (force_reg (DImode,
10213 (define_expand "call_value"
10214 [(parallel [(set (match_operand 0 "" "")
10215 (call (mem:SI (match_operand 1 "address_operand" ""))
10216 (match_operand 2 "" "")))
10217 (use (match_operand 3 "" ""))
10218 (clobber (scratch:SI))])]
10223 if (MACHOPIC_INDIRECT)
10224 operands[1] = machopic_indirect_call_target (operands[1]);
10227 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10230 operands[1] = XEXP (operands[1], 0);
10232 if (GET_CODE (operands[1]) != SYMBOL_REF
10233 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10234 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10236 if (INTVAL (operands[3]) & CALL_LONG)
10237 operands[1] = rs6000_longcall_ref (operands[1]);
10239 if (DEFAULT_ABI == ABI_V4
10240 || DEFAULT_ABI == ABI_DARWIN)
10241 operands[1] = force_reg (Pmode, operands[1]);
10243 else if (DEFAULT_ABI == ABI_AIX)
10245 /* AIX function pointers are really pointers to a three word
10247 emit_call_insn (TARGET_32BIT
10248 ? gen_call_value_indirect_aix32 (operands[0],
10252 : gen_call_value_indirect_aix64 (operands[0],
10263 ;; Call to function in current module. No TOC pointer reload needed.
10264 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10265 ;; either the function was not prototyped, or it was prototyped as a
10266 ;; variable argument function. It is > 0 if FP registers were passed
10267 ;; and < 0 if they were not.
10269 (define_insn "*call_local32"
10270 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10271 (match_operand 1 "" "g,g"))
10272 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10273 (clobber (match_scratch:SI 3 "=l,l"))]
10274 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10277 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10278 output_asm_insn (\"crxor 6,6,6\", operands);
10280 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10281 output_asm_insn (\"creqv 6,6,6\", operands);
10283 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10285 [(set_attr "type" "branch")
10286 (set_attr "length" "4,8")])
10288 (define_insn "*call_local64"
10289 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10290 (match_operand 1 "" "g,g"))
10291 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10292 (clobber (match_scratch:SI 3 "=l,l"))]
10293 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10296 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10297 output_asm_insn (\"crxor 6,6,6\", operands);
10299 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10300 output_asm_insn (\"creqv 6,6,6\", operands);
10302 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10304 [(set_attr "type" "branch")
10305 (set_attr "length" "4,8")])
10307 (define_insn "*call_value_local32"
10308 [(set (match_operand 0 "" "")
10309 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10310 (match_operand 2 "" "g,g")))
10311 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10312 (clobber (match_scratch:SI 4 "=l,l"))]
10313 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10316 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10317 output_asm_insn (\"crxor 6,6,6\", operands);
10319 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10320 output_asm_insn (\"creqv 6,6,6\", operands);
10322 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10324 [(set_attr "type" "branch")
10325 (set_attr "length" "4,8")])
10328 (define_insn "*call_value_local64"
10329 [(set (match_operand 0 "" "")
10330 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10331 (match_operand 2 "" "g,g")))
10332 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10333 (clobber (match_scratch:SI 4 "=l,l"))]
10334 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10337 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10338 output_asm_insn (\"crxor 6,6,6\", operands);
10340 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10341 output_asm_insn (\"creqv 6,6,6\", operands);
10343 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10345 [(set_attr "type" "branch")
10346 (set_attr "length" "4,8")])
10348 ;; Call to function which may be in another module. Restore the TOC
10349 ;; pointer (r2) after the call unless this is System V.
10350 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10351 ;; either the function was not prototyped, or it was prototyped as a
10352 ;; variable argument function. It is > 0 if FP registers were passed
10353 ;; and < 0 if they were not.
10355 (define_insn "*call_indirect_nonlocal_aix32"
10356 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10357 (match_operand 1 "" "g"))
10361 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10362 (clobber (match_scratch:SI 2 "=l"))]
10363 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10364 "b%T0l\;{l|lwz} 2,20(1)"
10365 [(set_attr "type" "jmpreg")
10366 (set_attr "length" "8")])
10368 (define_insn "*call_nonlocal_aix32"
10369 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10370 (match_operand 1 "" "g"))
10371 (use (match_operand:SI 2 "immediate_operand" "O"))
10372 (clobber (match_scratch:SI 3 "=l"))]
10374 && DEFAULT_ABI == ABI_AIX
10375 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10377 [(set_attr "type" "branch")
10378 (set_attr "length" "8")])
10380 (define_insn "*call_indirect_nonlocal_aix64"
10381 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10382 (match_operand 1 "" "g"))
10386 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10387 (clobber (match_scratch:SI 2 "=l"))]
10388 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10389 "b%T0l\;ld 2,40(1)"
10390 [(set_attr "type" "jmpreg")
10391 (set_attr "length" "8")])
10393 (define_insn "*call_nonlocal_aix64"
10394 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10395 (match_operand 1 "" "g"))
10396 (use (match_operand:SI 2 "immediate_operand" "O"))
10397 (clobber (match_scratch:SI 3 "=l"))]
10399 && DEFAULT_ABI == ABI_AIX
10400 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10402 [(set_attr "type" "branch")
10403 (set_attr "length" "8")])
10405 (define_insn "*call_value_indirect_nonlocal_aix32"
10406 [(set (match_operand 0 "" "")
10407 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10408 (match_operand 2 "" "g")))
10412 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10413 (clobber (match_scratch:SI 3 "=l"))]
10414 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10415 "b%T1l\;{l|lwz} 2,20(1)"
10416 [(set_attr "type" "jmpreg")
10417 (set_attr "length" "8")])
10419 (define_insn "*call_value_nonlocal_aix32"
10420 [(set (match_operand 0 "" "")
10421 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10422 (match_operand 2 "" "g")))
10423 (use (match_operand:SI 3 "immediate_operand" "O"))
10424 (clobber (match_scratch:SI 4 "=l"))]
10426 && DEFAULT_ABI == ABI_AIX
10427 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10429 [(set_attr "type" "branch")
10430 (set_attr "length" "8")])
10432 (define_insn "*call_value_indirect_nonlocal_aix64"
10433 [(set (match_operand 0 "" "")
10434 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10435 (match_operand 2 "" "g")))
10439 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10440 (clobber (match_scratch:SI 3 "=l"))]
10441 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10442 "b%T1l\;ld 2,40(1)"
10443 [(set_attr "type" "jmpreg")
10444 (set_attr "length" "8")])
10446 (define_insn "*call_value_nonlocal_aix64"
10447 [(set (match_operand 0 "" "")
10448 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10449 (match_operand 2 "" "g")))
10450 (use (match_operand:SI 3 "immediate_operand" "O"))
10451 (clobber (match_scratch:SI 4 "=l"))]
10453 && DEFAULT_ABI == ABI_AIX
10454 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10456 [(set_attr "type" "branch")
10457 (set_attr "length" "8")])
10459 ;; A function pointer under System V is just a normal pointer
10460 ;; operands[0] is the function pointer
10461 ;; operands[1] is the stack size to clean up
10462 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10463 ;; which indicates how to set cr1
10465 (define_insn "*call_indirect_nonlocal_sysv"
10466 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10467 (match_operand 1 "" "g,g"))
10468 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10469 (clobber (match_scratch:SI 3 "=l,l"))]
10470 "DEFAULT_ABI == ABI_V4
10471 || DEFAULT_ABI == ABI_DARWIN"
10473 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10474 output_asm_insn ("crxor 6,6,6", operands);
10476 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10477 output_asm_insn ("creqv 6,6,6", operands);
10481 [(set_attr "type" "jmpreg,jmpreg")
10482 (set_attr "length" "4,8")])
10484 (define_insn "*call_nonlocal_sysv"
10485 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10486 (match_operand 1 "" "g,g"))
10487 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10488 (clobber (match_scratch:SI 3 "=l,l"))]
10489 "(DEFAULT_ABI == ABI_DARWIN
10490 || (DEFAULT_ABI == ABI_V4
10491 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10493 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10494 output_asm_insn ("crxor 6,6,6", operands);
10496 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10497 output_asm_insn ("creqv 6,6,6", operands);
10500 return output_call(insn, operands, 0, 2);
10502 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10505 [(set_attr "type" "branch,branch")
10506 (set_attr "length" "4,8")])
10508 (define_insn "*call_value_indirect_nonlocal_sysv"
10509 [(set (match_operand 0 "" "")
10510 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10511 (match_operand 2 "" "g,g")))
10512 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10513 (clobber (match_scratch:SI 4 "=l,l"))]
10514 "DEFAULT_ABI == ABI_V4
10515 || DEFAULT_ABI == ABI_DARWIN"
10517 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10518 output_asm_insn ("crxor 6,6,6", operands);
10520 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10521 output_asm_insn ("creqv 6,6,6", operands);
10525 [(set_attr "type" "jmpreg,jmpreg")
10526 (set_attr "length" "4,8")])
10528 (define_insn "*call_value_nonlocal_sysv"
10529 [(set (match_operand 0 "" "")
10530 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10531 (match_operand 2 "" "g,g")))
10532 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10533 (clobber (match_scratch:SI 4 "=l,l"))]
10534 "(DEFAULT_ABI == ABI_DARWIN
10535 || (DEFAULT_ABI == ABI_V4
10536 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10538 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10539 output_asm_insn ("crxor 6,6,6", operands);
10541 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10542 output_asm_insn ("creqv 6,6,6", operands);
10545 return output_call(insn, operands, 1, 3);
10547 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10550 [(set_attr "type" "branch,branch")
10551 (set_attr "length" "4,8")])
10553 ;; Call subroutine returning any type.
10554 (define_expand "untyped_call"
10555 [(parallel [(call (match_operand 0 "" "")
10557 (match_operand 1 "" "")
10558 (match_operand 2 "" "")])]
10564 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10566 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10568 rtx set = XVECEXP (operands[2], 0, i);
10569 emit_move_insn (SET_DEST (set), SET_SRC (set));
10572 /* The optimizer does not know that the call sets the function value
10573 registers we stored in the result block. We avoid problems by
10574 claiming that all hard registers are used and clobbered at this
10576 emit_insn (gen_blockage ());
10581 ;; sibling call patterns
10582 (define_expand "sibcall"
10583 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10584 (match_operand 1 "" ""))
10585 (use (match_operand 2 "" ""))
10586 (use (match_operand 3 "" ""))
10592 if (MACHOPIC_INDIRECT)
10593 operands[0] = machopic_indirect_call_target (operands[0]);
10596 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10599 operands[0] = XEXP (operands[0], 0);
10600 operands[3] = gen_reg_rtx (SImode);
10604 ;; this and similar patterns must be marked as using LR, otherwise
10605 ;; dataflow will try to delete the store into it. This is true
10606 ;; even when the actual reg to jump to is in CTR, when LR was
10607 ;; saved and restored around the PIC-setting BCL.
10608 (define_insn "*sibcall_local32"
10609 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10610 (match_operand 1 "" "g,g"))
10611 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10612 (use (match_operand:SI 3 "register_operand" "l,l"))
10614 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10617 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10618 output_asm_insn (\"crxor 6,6,6\", operands);
10620 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10621 output_asm_insn (\"creqv 6,6,6\", operands);
10623 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10625 [(set_attr "type" "branch")
10626 (set_attr "length" "4,8")])
10628 (define_insn "*sibcall_local64"
10629 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10630 (match_operand 1 "" "g,g"))
10631 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10632 (use (match_operand:SI 3 "register_operand" "l,l"))
10634 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10637 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10638 output_asm_insn (\"crxor 6,6,6\", operands);
10640 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10641 output_asm_insn (\"creqv 6,6,6\", operands);
10643 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10645 [(set_attr "type" "branch")
10646 (set_attr "length" "4,8")])
10648 (define_insn "*sibcall_value_local32"
10649 [(set (match_operand 0 "" "")
10650 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10651 (match_operand 2 "" "g,g")))
10652 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10653 (use (match_operand:SI 4 "register_operand" "l,l"))
10655 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10658 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10659 output_asm_insn (\"crxor 6,6,6\", operands);
10661 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10662 output_asm_insn (\"creqv 6,6,6\", operands);
10664 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10666 [(set_attr "type" "branch")
10667 (set_attr "length" "4,8")])
10670 (define_insn "*sibcall_value_local64"
10671 [(set (match_operand 0 "" "")
10672 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10673 (match_operand 2 "" "g,g")))
10674 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10675 (use (match_operand:SI 4 "register_operand" "l,l"))
10677 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10680 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10681 output_asm_insn (\"crxor 6,6,6\", operands);
10683 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10684 output_asm_insn (\"creqv 6,6,6\", operands);
10686 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10688 [(set_attr "type" "branch")
10689 (set_attr "length" "4,8")])
10691 (define_insn "*sibcall_nonlocal_aix32"
10692 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10693 (match_operand 1 "" "g"))
10694 (use (match_operand:SI 2 "immediate_operand" "O"))
10695 (use (match_operand:SI 3 "register_operand" "l"))
10698 && DEFAULT_ABI == ABI_AIX
10699 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10701 [(set_attr "type" "branch")
10702 (set_attr "length" "4")])
10704 (define_insn "*sibcall_nonlocal_aix64"
10705 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10706 (match_operand 1 "" "g"))
10707 (use (match_operand:SI 2 "immediate_operand" "O"))
10708 (use (match_operand:SI 3 "register_operand" "l"))
10711 && DEFAULT_ABI == ABI_AIX
10712 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10714 [(set_attr "type" "branch")
10715 (set_attr "length" "4")])
10717 (define_insn "*sibcall_value_nonlocal_aix32"
10718 [(set (match_operand 0 "" "")
10719 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10720 (match_operand 2 "" "g")))
10721 (use (match_operand:SI 3 "immediate_operand" "O"))
10722 (use (match_operand:SI 4 "register_operand" "l"))
10725 && DEFAULT_ABI == ABI_AIX
10726 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10728 [(set_attr "type" "branch")
10729 (set_attr "length" "4")])
10731 (define_insn "*sibcall_value_nonlocal_aix64"
10732 [(set (match_operand 0 "" "")
10733 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10734 (match_operand 2 "" "g")))
10735 (use (match_operand:SI 3 "immediate_operand" "O"))
10736 (use (match_operand:SI 4 "register_operand" "l"))
10739 && DEFAULT_ABI == ABI_AIX
10740 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10742 [(set_attr "type" "branch")
10743 (set_attr "length" "4")])
10745 (define_insn "*sibcall_nonlocal_sysv"
10746 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10747 (match_operand 1 "" ""))
10748 (use (match_operand 2 "immediate_operand" "O,n"))
10749 (use (match_operand:SI 3 "register_operand" "l,l"))
10751 "(DEFAULT_ABI == ABI_DARWIN
10752 || DEFAULT_ABI == ABI_V4)
10753 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10756 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10757 output_asm_insn (\"crxor 6,6,6\", operands);
10759 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10760 output_asm_insn (\"creqv 6,6,6\", operands);
10762 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
10764 [(set_attr "type" "branch,branch")
10765 (set_attr "length" "4,8")])
10767 (define_expand "sibcall_value"
10768 [(parallel [(set (match_operand 0 "register_operand" "")
10769 (call (mem:SI (match_operand 1 "address_operand" ""))
10770 (match_operand 2 "" "")))
10771 (use (match_operand 3 "" ""))
10772 (use (match_operand 4 "" ""))
10778 if (MACHOPIC_INDIRECT)
10779 operands[1] = machopic_indirect_call_target (operands[1]);
10782 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10785 operands[1] = XEXP (operands[1], 0);
10786 operands[4] = gen_reg_rtx (SImode);
10790 (define_insn "*sibcall_value_nonlocal_sysv"
10791 [(set (match_operand 0 "" "")
10792 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10793 (match_operand 2 "" "")))
10794 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10795 (use (match_operand:SI 4 "register_operand" "l,l"))
10797 "(DEFAULT_ABI == ABI_DARWIN
10798 || DEFAULT_ABI == ABI_V4)
10799 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10802 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10803 output_asm_insn (\"crxor 6,6,6\", operands);
10805 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10806 output_asm_insn (\"creqv 6,6,6\", operands);
10808 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
10810 [(set_attr "type" "branch,branch")
10811 (set_attr "length" "4,8")])
10813 (define_expand "sibcall_epilogue"
10814 [(use (const_int 0))]
10815 "TARGET_SCHED_PROLOG"
10818 rs6000_emit_epilogue (TRUE);
10822 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10823 ;; all of memory. This blocks insns from being moved across this point.
10825 (define_insn "blockage"
10826 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10830 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10831 ;; signed & unsigned, and one type of branch.
10833 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10834 ;; insns, and branches. We store the operands of compares until we see
10836 (define_expand "cmpsi"
10838 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10839 (match_operand:SI 1 "reg_or_short_operand" "")))]
10843 /* Take care of the possibility that operands[1] might be negative but
10844 this might be a logical operation. That insn doesn't exist. */
10845 if (GET_CODE (operands[1]) == CONST_INT
10846 && INTVAL (operands[1]) < 0)
10847 operands[1] = force_reg (SImode, operands[1]);
10849 rs6000_compare_op0 = operands[0];
10850 rs6000_compare_op1 = operands[1];
10851 rs6000_compare_fp_p = 0;
10855 (define_expand "cmpdi"
10857 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10858 (match_operand:DI 1 "reg_or_short_operand" "")))]
10862 /* Take care of the possibility that operands[1] might be negative but
10863 this might be a logical operation. That insn doesn't exist. */
10864 if (GET_CODE (operands[1]) == CONST_INT
10865 && INTVAL (operands[1]) < 0)
10866 operands[1] = force_reg (DImode, operands[1]);
10868 rs6000_compare_op0 = operands[0];
10869 rs6000_compare_op1 = operands[1];
10870 rs6000_compare_fp_p = 0;
10874 (define_expand "cmpsf"
10875 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10876 (match_operand:SF 1 "gpc_reg_operand" "")))]
10877 "TARGET_HARD_FLOAT"
10880 rs6000_compare_op0 = operands[0];
10881 rs6000_compare_op1 = operands[1];
10882 rs6000_compare_fp_p = 1;
10886 (define_expand "cmpdf"
10887 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10888 (match_operand:DF 1 "gpc_reg_operand" "")))]
10889 "TARGET_HARD_FLOAT && TARGET_FPRS"
10892 rs6000_compare_op0 = operands[0];
10893 rs6000_compare_op1 = operands[1];
10894 rs6000_compare_fp_p = 1;
10898 (define_expand "cmptf"
10899 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
10900 (match_operand:TF 1 "gpc_reg_operand" "")))]
10901 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
10902 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10905 rs6000_compare_op0 = operands[0];
10906 rs6000_compare_op1 = operands[1];
10907 rs6000_compare_fp_p = 1;
10911 (define_expand "beq"
10912 [(use (match_operand 0 "" ""))]
10914 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10916 (define_expand "bne"
10917 [(use (match_operand 0 "" ""))]
10919 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10921 (define_expand "bge"
10922 [(use (match_operand 0 "" ""))]
10924 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10926 (define_expand "bgt"
10927 [(use (match_operand 0 "" ""))]
10929 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10931 (define_expand "ble"
10932 [(use (match_operand 0 "" ""))]
10934 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10936 (define_expand "blt"
10937 [(use (match_operand 0 "" ""))]
10939 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10941 (define_expand "bgeu"
10942 [(use (match_operand 0 "" ""))]
10944 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10946 (define_expand "bgtu"
10947 [(use (match_operand 0 "" ""))]
10949 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10951 (define_expand "bleu"
10952 [(use (match_operand 0 "" ""))]
10954 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10956 (define_expand "bltu"
10957 [(use (match_operand 0 "" ""))]
10959 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10961 (define_expand "bunordered"
10962 [(use (match_operand 0 "" ""))]
10964 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10966 (define_expand "bordered"
10967 [(use (match_operand 0 "" ""))]
10969 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10971 (define_expand "buneq"
10972 [(use (match_operand 0 "" ""))]
10974 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10976 (define_expand "bunge"
10977 [(use (match_operand 0 "" ""))]
10979 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10981 (define_expand "bungt"
10982 [(use (match_operand 0 "" ""))]
10984 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10986 (define_expand "bunle"
10987 [(use (match_operand 0 "" ""))]
10989 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10991 (define_expand "bunlt"
10992 [(use (match_operand 0 "" ""))]
10994 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10996 (define_expand "bltgt"
10997 [(use (match_operand 0 "" ""))]
10999 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11001 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11002 ;; For SEQ, likewise, except that comparisons with zero should be done
11003 ;; with an scc insns. However, due to the order that combine see the
11004 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11005 ;; the cases we don't want to handle.
11006 (define_expand "seq"
11007 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11009 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11011 (define_expand "sne"
11012 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11016 if (! rs6000_compare_fp_p)
11019 rs6000_emit_sCOND (NE, operands[0]);
11023 ;; A >= 0 is best done the portable way for A an integer.
11024 (define_expand "sge"
11025 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11029 if (! rs6000_compare_fp_p
11030 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11033 rs6000_emit_sCOND (GE, operands[0]);
11037 ;; A > 0 is best done using the portable sequence, so fail in that case.
11038 (define_expand "sgt"
11039 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11043 if (! rs6000_compare_fp_p
11044 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11047 rs6000_emit_sCOND (GT, operands[0]);
11051 ;; A <= 0 is best done the portable way for A an integer.
11052 (define_expand "sle"
11053 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11057 if (! rs6000_compare_fp_p
11058 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11061 rs6000_emit_sCOND (LE, operands[0]);
11065 ;; A < 0 is best done in the portable way for A an integer.
11066 (define_expand "slt"
11067 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11071 if (! rs6000_compare_fp_p
11072 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11075 rs6000_emit_sCOND (LT, operands[0]);
11079 (define_expand "sgeu"
11080 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11082 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11084 (define_expand "sgtu"
11085 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11087 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11089 (define_expand "sleu"
11090 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11092 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11094 (define_expand "sltu"
11095 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11097 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11099 (define_expand "sunordered"
11100 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11102 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11104 (define_expand "sordered"
11105 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11107 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11109 (define_expand "suneq"
11110 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11112 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11114 (define_expand "sunge"
11115 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11117 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11119 (define_expand "sungt"
11120 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11122 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11124 (define_expand "sunle"
11125 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11127 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11129 (define_expand "sunlt"
11130 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11132 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11134 (define_expand "sltgt"
11135 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11137 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11140 ;; Here are the actual compare insns.
11141 (define_insn "*cmpsi_internal1"
11142 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11143 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11144 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11146 "{cmp%I2|cmpw%I2} %0,%1,%2"
11147 [(set_attr "type" "cmp")])
11149 (define_insn "*cmpdi_internal1"
11150 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11151 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11152 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11155 [(set_attr "type" "cmp")])
11157 ;; If we are comparing a register for equality with a large constant,
11158 ;; we can do this with an XOR followed by a compare. But we need a scratch
11159 ;; register for the result of the XOR.
11162 [(set (match_operand:CC 0 "cc_reg_operand" "")
11163 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11164 (match_operand:SI 2 "non_short_cint_operand" "")))
11165 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11166 "find_single_use (operands[0], insn, 0)
11167 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11168 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11169 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11170 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11173 /* Get the constant we are comparing against, C, and see what it looks like
11174 sign-extended to 16 bits. Then see what constant could be XOR'ed
11175 with C to get the sign-extended value. */
11177 HOST_WIDE_INT c = INTVAL (operands[2]);
11178 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11179 HOST_WIDE_INT xorv = c ^ sextc;
11181 operands[4] = GEN_INT (xorv);
11182 operands[5] = GEN_INT (sextc);
11185 (define_insn "*cmpsi_internal2"
11186 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11187 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11188 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11190 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11191 [(set_attr "type" "cmp")])
11193 (define_insn "*cmpdi_internal2"
11194 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11195 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11196 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11198 "cmpld%I2 %0,%1,%b2"
11199 [(set_attr "type" "cmp")])
11201 ;; The following two insns don't exist as single insns, but if we provide
11202 ;; them, we can swap an add and compare, which will enable us to overlap more
11203 ;; of the required delay between a compare and branch. We generate code for
11204 ;; them by splitting.
11207 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11208 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11209 (match_operand:SI 2 "short_cint_operand" "i")))
11210 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11211 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11214 [(set_attr "length" "8")])
11217 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11218 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11219 (match_operand:SI 2 "u_short_cint_operand" "i")))
11220 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11221 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11224 [(set_attr "length" "8")])
11227 [(set (match_operand:CC 3 "cc_reg_operand" "")
11228 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11229 (match_operand:SI 2 "short_cint_operand" "")))
11230 (set (match_operand:SI 0 "gpc_reg_operand" "")
11231 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11233 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11234 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11237 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11238 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11239 (match_operand:SI 2 "u_short_cint_operand" "")))
11240 (set (match_operand:SI 0 "gpc_reg_operand" "")
11241 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11243 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11244 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11246 (define_insn "*cmpsf_internal1"
11247 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11248 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11249 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11250 "TARGET_HARD_FLOAT && TARGET_FPRS"
11252 [(set_attr "type" "fpcompare")])
11254 (define_insn "*cmpdf_internal1"
11255 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11256 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11257 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11258 "TARGET_HARD_FLOAT && TARGET_FPRS"
11260 [(set_attr "type" "fpcompare")])
11262 ;; Only need to compare second words if first words equal
11263 (define_insn "*cmptf_internal1"
11264 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11265 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11266 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11267 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
11268 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11269 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11270 [(set_attr "type" "fpcompare")
11271 (set_attr "length" "12")])
11273 ;; Now we have the scc insns. We can do some combinations because of the
11274 ;; way the machine works.
11276 ;; Note that this is probably faster if we can put an insn between the
11277 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11278 ;; cases the insns below which don't use an intermediate CR field will
11279 ;; be used instead.
11281 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11282 (match_operator:SI 1 "scc_comparison_operator"
11283 [(match_operand 2 "cc_reg_operand" "y")
11286 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11287 [(set (attr "type")
11288 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11289 (const_string "mfcrf")
11291 (const_string "mfcr")))
11292 (set_attr "length" "12")])
11294 ;; Same as above, but get the GT bit.
11295 (define_insn "move_from_CR_gt_bit"
11296 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11297 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11299 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,1"
11300 [(set_attr "type" "mfcr")
11301 (set_attr "length" "12")])
11303 ;; Same as above, but get the OV/ORDERED bit.
11304 (define_insn "move_from_CR_ov_bit"
11305 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11306 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11308 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11309 [(set_attr "type" "mfcr")
11310 (set_attr "length" "12")])
11313 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11314 (match_operator:DI 1 "scc_comparison_operator"
11315 [(match_operand 2 "cc_reg_operand" "y")
11318 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11319 [(set (attr "type")
11320 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11321 (const_string "mfcrf")
11323 (const_string "mfcr")))
11324 (set_attr "length" "12")])
11327 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11328 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11329 [(match_operand 2 "cc_reg_operand" "y,y")
11332 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11333 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11336 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11338 [(set_attr "type" "delayed_compare")
11339 (set_attr "length" "12,16")])
11342 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11343 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11344 [(match_operand 2 "cc_reg_operand" "")
11347 (set (match_operand:SI 3 "gpc_reg_operand" "")
11348 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11349 "TARGET_32BIT && reload_completed"
11350 [(set (match_dup 3)
11351 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11353 (compare:CC (match_dup 3)
11358 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11359 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11360 [(match_operand 2 "cc_reg_operand" "y")
11362 (match_operand:SI 3 "const_int_operand" "n")))]
11366 int is_bit = ccr_bit (operands[1], 1);
11367 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11370 if (is_bit >= put_bit)
11371 count = is_bit - put_bit;
11373 count = 32 - (put_bit - is_bit);
11375 operands[4] = GEN_INT (count);
11376 operands[5] = GEN_INT (put_bit);
11378 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11380 [(set (attr "type")
11381 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11382 (const_string "mfcrf")
11384 (const_string "mfcr")))
11385 (set_attr "length" "12")])
11388 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11390 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11391 [(match_operand 2 "cc_reg_operand" "y,y")
11393 (match_operand:SI 3 "const_int_operand" "n,n"))
11395 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11396 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11401 int is_bit = ccr_bit (operands[1], 1);
11402 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11405 /* Force split for non-cc0 compare. */
11406 if (which_alternative == 1)
11409 if (is_bit >= put_bit)
11410 count = is_bit - put_bit;
11412 count = 32 - (put_bit - is_bit);
11414 operands[5] = GEN_INT (count);
11415 operands[6] = GEN_INT (put_bit);
11417 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11419 [(set_attr "type" "delayed_compare")
11420 (set_attr "length" "12,16")])
11423 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11425 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11426 [(match_operand 2 "cc_reg_operand" "")
11428 (match_operand:SI 3 "const_int_operand" ""))
11430 (set (match_operand:SI 4 "gpc_reg_operand" "")
11431 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11434 [(set (match_dup 4)
11435 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11438 (compare:CC (match_dup 4)
11442 ;; There is a 3 cycle delay between consecutive mfcr instructions
11443 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11446 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11447 (match_operator:SI 1 "scc_comparison_operator"
11448 [(match_operand 2 "cc_reg_operand" "y")
11450 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11451 (match_operator:SI 4 "scc_comparison_operator"
11452 [(match_operand 5 "cc_reg_operand" "y")
11454 "REGNO (operands[2]) != REGNO (operands[5])"
11455 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11456 [(set_attr "type" "mfcr")
11457 (set_attr "length" "20")])
11460 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11461 (match_operator:DI 1 "scc_comparison_operator"
11462 [(match_operand 2 "cc_reg_operand" "y")
11464 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11465 (match_operator:DI 4 "scc_comparison_operator"
11466 [(match_operand 5 "cc_reg_operand" "y")
11468 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11469 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11470 [(set_attr "type" "mfcr")
11471 (set_attr "length" "20")])
11473 ;; There are some scc insns that can be done directly, without a compare.
11474 ;; These are faster because they don't involve the communications between
11475 ;; the FXU and branch units. In fact, we will be replacing all of the
11476 ;; integer scc insns here or in the portable methods in emit_store_flag.
11478 ;; Also support (neg (scc ..)) since that construct is used to replace
11479 ;; branches, (plus (scc ..) ..) since that construct is common and
11480 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11481 ;; cases where it is no more expensive than (neg (scc ..)).
11483 ;; Have reload force a constant into a register for the simple insns that
11484 ;; otherwise won't accept constants. We do this because it is faster than
11485 ;; the cmp/mfcr sequence we would otherwise generate.
11488 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11489 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11490 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11491 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11494 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11495 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11496 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11497 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11498 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11499 [(set_attr "length" "12,8,12,12,12")])
11502 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11503 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11504 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11505 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11508 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11509 subfic %3,%1,0\;adde %0,%3,%1
11510 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11511 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11512 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11513 [(set_attr "length" "12,8,12,12,12")])
11516 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11518 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11519 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11521 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11522 (eq:SI (match_dup 1) (match_dup 2)))
11523 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11526 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11527 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11528 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11529 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11530 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11536 [(set_attr "type" "compare")
11537 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11540 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11542 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11543 (match_operand:SI 2 "reg_or_cint_operand" ""))
11545 (set (match_operand:SI 0 "gpc_reg_operand" "")
11546 (eq:SI (match_dup 1) (match_dup 2)))
11547 (clobber (match_scratch:SI 3 ""))]
11548 "TARGET_32BIT && reload_completed"
11549 [(parallel [(set (match_dup 0)
11550 (eq:SI (match_dup 1) (match_dup 2)))
11551 (clobber (match_dup 3))])
11553 (compare:CC (match_dup 0)
11558 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11560 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11561 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11563 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11564 (eq:DI (match_dup 1) (match_dup 2)))
11565 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11568 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11569 subfic %3,%1,0\;adde. %0,%3,%1
11570 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11571 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11572 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11578 [(set_attr "type" "compare")
11579 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11582 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11584 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11585 (match_operand:DI 2 "reg_or_cint_operand" ""))
11587 (set (match_operand:DI 0 "gpc_reg_operand" "")
11588 (eq:DI (match_dup 1) (match_dup 2)))
11589 (clobber (match_scratch:DI 3 ""))]
11590 "TARGET_64BIT && reload_completed"
11591 [(parallel [(set (match_dup 0)
11592 (eq:DI (match_dup 1) (match_dup 2)))
11593 (clobber (match_dup 3))])
11595 (compare:CC (match_dup 0)
11599 ;; We have insns of the form shown by the first define_insn below. If
11600 ;; there is something inside the comparison operation, we must split it.
11602 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11603 (plus:SI (match_operator 1 "comparison_operator"
11604 [(match_operand:SI 2 "" "")
11605 (match_operand:SI 3
11606 "reg_or_cint_operand" "")])
11607 (match_operand:SI 4 "gpc_reg_operand" "")))
11608 (clobber (match_operand:SI 5 "register_operand" ""))]
11609 "! gpc_reg_operand (operands[2], SImode)"
11610 [(set (match_dup 5) (match_dup 2))
11611 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11615 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11616 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11617 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11618 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11621 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11622 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11623 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11624 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11625 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11626 [(set_attr "length" "12,8,12,12,12")])
11629 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11632 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11633 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11634 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11636 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11639 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11640 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11641 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11642 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11643 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11649 [(set_attr "type" "compare")
11650 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11653 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11656 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11657 (match_operand:SI 2 "reg_or_cint_operand" ""))
11658 (match_operand:SI 3 "gpc_reg_operand" ""))
11660 (clobber (match_scratch:SI 4 ""))]
11661 "TARGET_32BIT && reload_completed"
11662 [(set (match_dup 4)
11663 (plus:SI (eq:SI (match_dup 1)
11667 (compare:CC (match_dup 4)
11672 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11675 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11676 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11677 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11679 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11680 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11683 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11684 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11685 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11686 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11687 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11693 [(set_attr "type" "compare")
11694 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11697 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11700 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11701 (match_operand:SI 2 "reg_or_cint_operand" ""))
11702 (match_operand:SI 3 "gpc_reg_operand" ""))
11704 (set (match_operand:SI 0 "gpc_reg_operand" "")
11705 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11706 "TARGET_32BIT && reload_completed"
11707 [(set (match_dup 0)
11708 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11710 (compare:CC (match_dup 0)
11715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11716 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11717 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11720 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11721 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11722 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11723 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11724 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11725 [(set_attr "length" "12,8,12,12,12")])
11727 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11728 ;; since it nabs/sr is just as fast.
11729 (define_insn "*ne0"
11730 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11731 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11733 (clobber (match_scratch:SI 2 "=&r"))]
11734 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11735 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11736 [(set_attr "length" "8")])
11739 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11740 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11742 (clobber (match_scratch:DI 2 "=&r"))]
11744 "addic %2,%1,-1\;subfe %0,%2,%1"
11745 [(set_attr "length" "8")])
11747 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11749 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11750 (plus:SI (lshiftrt:SI
11751 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11753 (match_operand:SI 2 "gpc_reg_operand" "r")))
11754 (clobber (match_scratch:SI 3 "=&r"))]
11756 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11757 [(set_attr "length" "8")])
11760 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11761 (plus:DI (lshiftrt:DI
11762 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11764 (match_operand:DI 2 "gpc_reg_operand" "r")))
11765 (clobber (match_scratch:DI 3 "=&r"))]
11767 "addic %3,%1,-1\;addze %0,%2"
11768 [(set_attr "length" "8")])
11771 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11773 (plus:SI (lshiftrt:SI
11774 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11776 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11778 (clobber (match_scratch:SI 3 "=&r,&r"))
11779 (clobber (match_scratch:SI 4 "=X,&r"))]
11782 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11784 [(set_attr "type" "compare")
11785 (set_attr "length" "8,12")])
11788 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11790 (plus:SI (lshiftrt:SI
11791 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11793 (match_operand:SI 2 "gpc_reg_operand" ""))
11795 (clobber (match_scratch:SI 3 ""))
11796 (clobber (match_scratch:SI 4 ""))]
11797 "TARGET_32BIT && reload_completed"
11798 [(parallel [(set (match_dup 3)
11799 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11802 (clobber (match_dup 4))])
11804 (compare:CC (match_dup 3)
11809 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11811 (plus:DI (lshiftrt:DI
11812 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11814 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11816 (clobber (match_scratch:DI 3 "=&r,&r"))]
11819 addic %3,%1,-1\;addze. %3,%2
11821 [(set_attr "type" "compare")
11822 (set_attr "length" "8,12")])
11825 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11827 (plus:DI (lshiftrt:DI
11828 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11830 (match_operand:DI 2 "gpc_reg_operand" ""))
11832 (clobber (match_scratch:DI 3 ""))]
11833 "TARGET_64BIT && reload_completed"
11834 [(set (match_dup 3)
11835 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11839 (compare:CC (match_dup 3)
11844 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11846 (plus:SI (lshiftrt:SI
11847 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11849 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11851 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11852 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11854 (clobber (match_scratch:SI 3 "=&r,&r"))]
11857 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11859 [(set_attr "type" "compare")
11860 (set_attr "length" "8,12")])
11863 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11865 (plus:SI (lshiftrt:SI
11866 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11868 (match_operand:SI 2 "gpc_reg_operand" ""))
11870 (set (match_operand:SI 0 "gpc_reg_operand" "")
11871 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11873 (clobber (match_scratch:SI 3 ""))]
11874 "TARGET_32BIT && reload_completed"
11875 [(parallel [(set (match_dup 0)
11876 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11878 (clobber (match_dup 3))])
11880 (compare:CC (match_dup 0)
11885 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11887 (plus:DI (lshiftrt:DI
11888 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11890 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11892 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11893 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11895 (clobber (match_scratch:DI 3 "=&r,&r"))]
11898 addic %3,%1,-1\;addze. %0,%2
11900 [(set_attr "type" "compare")
11901 (set_attr "length" "8,12")])
11904 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11906 (plus:DI (lshiftrt:DI
11907 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11909 (match_operand:DI 2 "gpc_reg_operand" ""))
11911 (set (match_operand:DI 0 "gpc_reg_operand" "")
11912 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11914 (clobber (match_scratch:DI 3 ""))]
11915 "TARGET_64BIT && reload_completed"
11916 [(parallel [(set (match_dup 0)
11917 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11919 (clobber (match_dup 3))])
11921 (compare:CC (match_dup 0)
11926 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11927 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11928 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11929 (clobber (match_scratch:SI 3 "=r,X"))]
11932 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11933 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11934 [(set_attr "length" "12")])
11937 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11939 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11940 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11942 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11943 (le:SI (match_dup 1) (match_dup 2)))
11944 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11947 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11948 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11951 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11952 (set_attr "length" "12,12,16,16")])
11955 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11957 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11958 (match_operand:SI 2 "reg_or_short_operand" ""))
11960 (set (match_operand:SI 0 "gpc_reg_operand" "")
11961 (le:SI (match_dup 1) (match_dup 2)))
11962 (clobber (match_scratch:SI 3 ""))]
11963 "TARGET_POWER && reload_completed"
11964 [(parallel [(set (match_dup 0)
11965 (le:SI (match_dup 1) (match_dup 2)))
11966 (clobber (match_dup 3))])
11968 (compare:CC (match_dup 0)
11973 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11974 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11975 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11976 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11979 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11980 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11981 [(set_attr "length" "12")])
11984 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11986 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11987 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11988 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11990 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11993 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11994 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11997 [(set_attr "type" "compare")
11998 (set_attr "length" "12,12,16,16")])
12001 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12003 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12004 (match_operand:SI 2 "reg_or_short_operand" ""))
12005 (match_operand:SI 3 "gpc_reg_operand" ""))
12007 (clobber (match_scratch:SI 4 ""))]
12008 "TARGET_POWER && reload_completed"
12009 [(set (match_dup 4)
12010 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12013 (compare:CC (match_dup 4)
12018 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12020 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12021 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12022 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12024 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12025 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12028 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12029 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12032 [(set_attr "type" "compare")
12033 (set_attr "length" "12,12,16,16")])
12036 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12038 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12039 (match_operand:SI 2 "reg_or_short_operand" ""))
12040 (match_operand:SI 3 "gpc_reg_operand" ""))
12042 (set (match_operand:SI 0 "gpc_reg_operand" "")
12043 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12044 "TARGET_POWER && reload_completed"
12045 [(set (match_dup 0)
12046 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12048 (compare:CC (match_dup 0)
12053 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12054 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12055 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12058 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12059 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12060 [(set_attr "length" "12")])
12063 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12064 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12065 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12067 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12068 [(set_attr "length" "12")])
12071 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12072 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12073 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12075 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12076 [(set_attr "length" "12")])
12079 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12081 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12082 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12084 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12085 (leu:DI (match_dup 1) (match_dup 2)))]
12088 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12090 [(set_attr "type" "compare")
12091 (set_attr "length" "12,16")])
12094 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12096 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12097 (match_operand:DI 2 "reg_or_short_operand" ""))
12099 (set (match_operand:DI 0 "gpc_reg_operand" "")
12100 (leu:DI (match_dup 1) (match_dup 2)))]
12101 "TARGET_64BIT && reload_completed"
12102 [(set (match_dup 0)
12103 (leu:DI (match_dup 1) (match_dup 2)))
12105 (compare:CC (match_dup 0)
12110 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12112 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12113 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12115 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12116 (leu:SI (match_dup 1) (match_dup 2)))]
12119 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12121 [(set_attr "type" "compare")
12122 (set_attr "length" "12,16")])
12125 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12127 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12128 (match_operand:SI 2 "reg_or_short_operand" ""))
12130 (set (match_operand:SI 0 "gpc_reg_operand" "")
12131 (leu:SI (match_dup 1) (match_dup 2)))]
12132 "TARGET_32BIT && reload_completed"
12133 [(set (match_dup 0)
12134 (leu:SI (match_dup 1) (match_dup 2)))
12136 (compare:CC (match_dup 0)
12141 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12142 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12143 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12144 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12146 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12147 [(set_attr "length" "8")])
12150 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12152 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12153 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12154 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12156 (clobber (match_scratch:SI 4 "=&r,&r"))]
12159 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12161 [(set_attr "type" "compare")
12162 (set_attr "length" "8,12")])
12165 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12167 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12168 (match_operand:SI 2 "reg_or_short_operand" ""))
12169 (match_operand:SI 3 "gpc_reg_operand" ""))
12171 (clobber (match_scratch:SI 4 ""))]
12172 "TARGET_32BIT && reload_completed"
12173 [(set (match_dup 4)
12174 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12177 (compare:CC (match_dup 4)
12182 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12184 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12185 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12186 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12188 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12189 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12192 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12194 [(set_attr "type" "compare")
12195 (set_attr "length" "8,12")])
12198 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12200 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12201 (match_operand:SI 2 "reg_or_short_operand" ""))
12202 (match_operand:SI 3 "gpc_reg_operand" ""))
12204 (set (match_operand:SI 0 "gpc_reg_operand" "")
12205 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12206 "TARGET_32BIT && reload_completed"
12207 [(set (match_dup 0)
12208 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12210 (compare:CC (match_dup 0)
12215 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12216 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12217 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12219 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12220 [(set_attr "length" "12")])
12223 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12225 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12226 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12227 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12229 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12230 [(set_attr "length" "12")])
12233 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12236 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12237 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12238 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12240 (clobber (match_scratch:SI 4 "=&r,&r"))]
12243 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12245 [(set_attr "type" "compare")
12246 (set_attr "length" "12,16")])
12249 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12252 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12253 (match_operand:SI 2 "reg_or_short_operand" "")))
12254 (match_operand:SI 3 "gpc_reg_operand" ""))
12256 (clobber (match_scratch:SI 4 ""))]
12257 "TARGET_32BIT && reload_completed"
12258 [(set (match_dup 4)
12259 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12262 (compare:CC (match_dup 4)
12267 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12270 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12271 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12272 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12274 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12275 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12278 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12280 [(set_attr "type" "compare")
12281 (set_attr "length" "12,16")])
12284 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12287 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12288 (match_operand:SI 2 "reg_or_short_operand" "")))
12289 (match_operand:SI 3 "gpc_reg_operand" ""))
12291 (set (match_operand:SI 0 "gpc_reg_operand" "")
12292 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12293 "TARGET_32BIT && reload_completed"
12294 [(set (match_dup 0)
12295 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12298 (compare:CC (match_dup 0)
12303 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12304 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12305 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12307 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12308 [(set_attr "length" "12")])
12311 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12313 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12314 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12316 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12317 (lt:SI (match_dup 1) (match_dup 2)))]
12320 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12322 [(set_attr "type" "delayed_compare")
12323 (set_attr "length" "12,16")])
12326 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12328 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12329 (match_operand:SI 2 "reg_or_short_operand" ""))
12331 (set (match_operand:SI 0 "gpc_reg_operand" "")
12332 (lt:SI (match_dup 1) (match_dup 2)))]
12333 "TARGET_POWER && reload_completed"
12334 [(set (match_dup 0)
12335 (lt:SI (match_dup 1) (match_dup 2)))
12337 (compare:CC (match_dup 0)
12342 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12343 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12344 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12345 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12347 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12348 [(set_attr "length" "12")])
12351 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12353 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12354 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12355 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12357 (clobber (match_scratch:SI 4 "=&r,&r"))]
12360 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12362 [(set_attr "type" "compare")
12363 (set_attr "length" "12,16")])
12366 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12368 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12369 (match_operand:SI 2 "reg_or_short_operand" ""))
12370 (match_operand:SI 3 "gpc_reg_operand" ""))
12372 (clobber (match_scratch:SI 4 ""))]
12373 "TARGET_POWER && reload_completed"
12374 [(set (match_dup 4)
12375 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12378 (compare:CC (match_dup 4)
12383 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12385 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12386 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12387 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12389 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12390 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12393 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12395 [(set_attr "type" "compare")
12396 (set_attr "length" "12,16")])
12399 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12401 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12402 (match_operand:SI 2 "reg_or_short_operand" ""))
12403 (match_operand:SI 3 "gpc_reg_operand" ""))
12405 (set (match_operand:SI 0 "gpc_reg_operand" "")
12406 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12407 "TARGET_POWER && reload_completed"
12408 [(set (match_dup 0)
12409 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12411 (compare:CC (match_dup 0)
12416 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12417 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12418 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12420 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12421 [(set_attr "length" "12")])
12424 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12425 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12426 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12429 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
12430 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12431 [(set_attr "length" "12")])
12434 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12436 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12437 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12439 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12440 (ltu:SI (match_dup 1) (match_dup 2)))]
12443 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12444 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12447 [(set_attr "type" "compare")
12448 (set_attr "length" "12,12,16,16")])
12451 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12453 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12454 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12456 (set (match_operand:SI 0 "gpc_reg_operand" "")
12457 (ltu:SI (match_dup 1) (match_dup 2)))]
12458 "TARGET_32BIT && reload_completed"
12459 [(set (match_dup 0)
12460 (ltu:SI (match_dup 1) (match_dup 2)))
12462 (compare:CC (match_dup 0)
12467 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12468 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12469 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12470 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12473 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
12474 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12475 [(set_attr "length" "12")])
12478 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12480 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12481 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12482 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12484 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12487 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12488 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12491 [(set_attr "type" "compare")
12492 (set_attr "length" "12,12,16,16")])
12495 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12497 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12498 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12499 (match_operand:SI 3 "gpc_reg_operand" ""))
12501 (clobber (match_scratch:SI 4 ""))]
12502 "TARGET_32BIT && reload_completed"
12503 [(set (match_dup 4)
12504 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12507 (compare:CC (match_dup 4)
12512 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12514 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12515 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12516 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12518 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12519 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12522 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12523 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12526 [(set_attr "type" "compare")
12527 (set_attr "length" "12,12,16,16")])
12530 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12532 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12533 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12534 (match_operand:SI 3 "gpc_reg_operand" ""))
12536 (set (match_operand:SI 0 "gpc_reg_operand" "")
12537 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12538 "TARGET_32BIT && reload_completed"
12539 [(set (match_dup 0)
12540 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12542 (compare:CC (match_dup 0)
12547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12548 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12549 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12552 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12553 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12554 [(set_attr "length" "8")])
12557 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12558 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12559 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12560 (clobber (match_scratch:SI 3 "=r"))]
12562 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12563 [(set_attr "length" "12")])
12566 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12568 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12569 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12571 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12572 (ge:SI (match_dup 1) (match_dup 2)))
12573 (clobber (match_scratch:SI 3 "=r,r"))]
12576 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12578 [(set_attr "type" "compare")
12579 (set_attr "length" "12,16")])
12582 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12584 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12585 (match_operand:SI 2 "reg_or_short_operand" ""))
12587 (set (match_operand:SI 0 "gpc_reg_operand" "")
12588 (ge:SI (match_dup 1) (match_dup 2)))
12589 (clobber (match_scratch:SI 3 ""))]
12590 "TARGET_POWER && reload_completed"
12591 [(parallel [(set (match_dup 0)
12592 (ge:SI (match_dup 1) (match_dup 2)))
12593 (clobber (match_dup 3))])
12595 (compare:CC (match_dup 0)
12600 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12601 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12602 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12603 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12605 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12606 [(set_attr "length" "12")])
12609 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12611 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12612 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12613 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12615 (clobber (match_scratch:SI 4 "=&r,&r"))]
12618 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12620 [(set_attr "type" "compare")
12621 (set_attr "length" "12,16")])
12624 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12626 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12627 (match_operand:SI 2 "reg_or_short_operand" ""))
12628 (match_operand:SI 3 "gpc_reg_operand" ""))
12630 (clobber (match_scratch:SI 4 ""))]
12631 "TARGET_POWER && reload_completed"
12632 [(set (match_dup 4)
12633 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12636 (compare:CC (match_dup 4)
12641 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12643 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12644 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12645 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12647 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12648 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12651 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12653 [(set_attr "type" "compare")
12654 (set_attr "length" "12,16")])
12657 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12659 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12660 (match_operand:SI 2 "reg_or_short_operand" ""))
12661 (match_operand:SI 3 "gpc_reg_operand" ""))
12663 (set (match_operand:SI 0 "gpc_reg_operand" "")
12664 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12665 "TARGET_POWER && reload_completed"
12666 [(set (match_dup 0)
12667 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12669 (compare:CC (match_dup 0)
12674 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12675 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12676 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12678 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12679 [(set_attr "length" "12")])
12682 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12683 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12684 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12687 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12688 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12689 [(set_attr "length" "12")])
12692 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12693 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12694 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12697 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12698 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12699 [(set_attr "length" "12")])
12702 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12704 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12705 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12707 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12708 (geu:SI (match_dup 1) (match_dup 2)))]
12711 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12712 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12715 [(set_attr "type" "compare")
12716 (set_attr "length" "12,12,16,16")])
12719 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12721 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12722 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12724 (set (match_operand:SI 0 "gpc_reg_operand" "")
12725 (geu:SI (match_dup 1) (match_dup 2)))]
12726 "TARGET_32BIT && reload_completed"
12727 [(set (match_dup 0)
12728 (geu:SI (match_dup 1) (match_dup 2)))
12730 (compare:CC (match_dup 0)
12735 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12737 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12738 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12740 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12741 (geu:DI (match_dup 1) (match_dup 2)))]
12744 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12745 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12748 [(set_attr "type" "compare")
12749 (set_attr "length" "12,12,16,16")])
12752 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12754 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12755 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12757 (set (match_operand:DI 0 "gpc_reg_operand" "")
12758 (geu:DI (match_dup 1) (match_dup 2)))]
12759 "TARGET_64BIT && reload_completed"
12760 [(set (match_dup 0)
12761 (geu:DI (match_dup 1) (match_dup 2)))
12763 (compare:CC (match_dup 0)
12768 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12769 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12770 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12771 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12774 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12775 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12776 [(set_attr "length" "8")])
12779 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12781 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12782 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12783 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12785 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12788 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12789 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12792 [(set_attr "type" "compare")
12793 (set_attr "length" "8,8,12,12")])
12796 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12798 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12799 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12800 (match_operand:SI 3 "gpc_reg_operand" ""))
12802 (clobber (match_scratch:SI 4 ""))]
12803 "TARGET_32BIT && reload_completed"
12804 [(set (match_dup 4)
12805 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12808 (compare:CC (match_dup 4)
12813 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12815 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12816 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12817 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12819 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12820 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12823 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12824 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12827 [(set_attr "type" "compare")
12828 (set_attr "length" "8,8,12,12")])
12831 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12833 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12834 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12835 (match_operand:SI 3 "gpc_reg_operand" ""))
12837 (set (match_operand:SI 0 "gpc_reg_operand" "")
12838 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12839 "TARGET_32BIT && reload_completed"
12840 [(set (match_dup 0)
12841 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12843 (compare:CC (match_dup 0)
12848 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12849 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12850 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12853 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12854 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12855 [(set_attr "length" "12")])
12858 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12860 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12861 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12862 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12865 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12866 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12867 [(set_attr "length" "12")])
12870 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12873 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12874 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12875 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12877 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12880 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12881 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12884 [(set_attr "type" "compare")
12885 (set_attr "length" "12,12,16,16")])
12888 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12891 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12892 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12893 (match_operand:SI 3 "gpc_reg_operand" ""))
12895 (clobber (match_scratch:SI 4 ""))]
12896 "TARGET_32BIT && reload_completed"
12897 [(set (match_dup 4)
12898 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12901 (compare:CC (match_dup 4)
12906 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12909 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12910 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12911 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12913 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12914 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12917 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12918 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12921 [(set_attr "type" "compare")
12922 (set_attr "length" "12,12,16,16")])
12925 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12928 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12929 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12930 (match_operand:SI 3 "gpc_reg_operand" ""))
12932 (set (match_operand:SI 0 "gpc_reg_operand" "")
12933 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12934 "TARGET_32BIT && reload_completed"
12935 [(set (match_dup 0)
12936 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12938 (compare:CC (match_dup 0)
12943 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12944 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12947 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12948 [(set_attr "length" "12")])
12951 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12952 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12955 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12956 [(set_attr "length" "12")])
12959 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12961 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12964 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12965 (gt:SI (match_dup 1) (const_int 0)))]
12968 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12970 [(set_attr "type" "delayed_compare")
12971 (set_attr "length" "12,16")])
12974 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12976 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12979 (set (match_operand:SI 0 "gpc_reg_operand" "")
12980 (gt:SI (match_dup 1) (const_int 0)))]
12981 "TARGET_32BIT && reload_completed"
12982 [(set (match_dup 0)
12983 (gt:SI (match_dup 1) (const_int 0)))
12985 (compare:CC (match_dup 0)
12990 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12992 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12995 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12996 (gt:DI (match_dup 1) (const_int 0)))]
12999 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
13001 [(set_attr "type" "delayed_compare")
13002 (set_attr "length" "12,16")])
13005 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13007 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13010 (set (match_operand:DI 0 "gpc_reg_operand" "")
13011 (gt:DI (match_dup 1) (const_int 0)))]
13012 "TARGET_64BIT && reload_completed"
13013 [(set (match_dup 0)
13014 (gt:DI (match_dup 1) (const_int 0)))
13016 (compare:CC (match_dup 0)
13021 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13022 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13023 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13025 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13026 [(set_attr "length" "12")])
13029 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13031 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13032 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13034 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13035 (gt:SI (match_dup 1) (match_dup 2)))]
13038 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13040 [(set_attr "type" "delayed_compare")
13041 (set_attr "length" "12,16")])
13044 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13046 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13047 (match_operand:SI 2 "reg_or_short_operand" ""))
13049 (set (match_operand:SI 0 "gpc_reg_operand" "")
13050 (gt:SI (match_dup 1) (match_dup 2)))]
13051 "TARGET_POWER && reload_completed"
13052 [(set (match_dup 0)
13053 (gt:SI (match_dup 1) (match_dup 2)))
13055 (compare:CC (match_dup 0)
13060 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13061 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13063 (match_operand:SI 2 "gpc_reg_operand" "r")))]
13065 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13066 [(set_attr "length" "12")])
13069 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13070 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13072 (match_operand:DI 2 "gpc_reg_operand" "r")))]
13074 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13075 [(set_attr "length" "12")])
13078 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13080 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13082 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13084 (clobber (match_scratch:SI 3 "=&r,&r"))]
13087 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13089 [(set_attr "type" "compare")
13090 (set_attr "length" "12,16")])
13093 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13095 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13097 (match_operand:SI 2 "gpc_reg_operand" ""))
13099 (clobber (match_scratch:SI 3 ""))]
13100 "TARGET_32BIT && reload_completed"
13101 [(set (match_dup 3)
13102 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13105 (compare:CC (match_dup 3)
13110 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13112 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13114 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13116 (clobber (match_scratch:DI 3 "=&r,&r"))]
13119 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13121 [(set_attr "type" "compare")
13122 (set_attr "length" "12,16")])
13125 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13127 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13129 (match_operand:DI 2 "gpc_reg_operand" ""))
13131 (clobber (match_scratch:DI 3 ""))]
13132 "TARGET_64BIT && reload_completed"
13133 [(set (match_dup 3)
13134 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13137 (compare:CC (match_dup 3)
13142 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13144 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13146 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13148 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13149 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13152 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13154 [(set_attr "type" "compare")
13155 (set_attr "length" "12,16")])
13158 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13160 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13162 (match_operand:SI 2 "gpc_reg_operand" ""))
13164 (set (match_operand:SI 0 "gpc_reg_operand" "")
13165 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13166 "TARGET_32BIT && reload_completed"
13167 [(set (match_dup 0)
13168 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13170 (compare:CC (match_dup 0)
13175 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13177 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13179 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13181 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13182 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13185 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13187 [(set_attr "type" "compare")
13188 (set_attr "length" "12,16")])
13191 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13193 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13195 (match_operand:DI 2 "gpc_reg_operand" ""))
13197 (set (match_operand:DI 0 "gpc_reg_operand" "")
13198 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13199 "TARGET_64BIT && reload_completed"
13200 [(set (match_dup 0)
13201 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13203 (compare:CC (match_dup 0)
13208 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13209 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13210 (match_operand:SI 2 "reg_or_short_operand" "r"))
13211 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13213 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13214 [(set_attr "length" "12")])
13217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13219 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13220 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13221 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13223 (clobber (match_scratch:SI 4 "=&r,&r"))]
13226 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13228 [(set_attr "type" "compare")
13229 (set_attr "length" "12,16")])
13232 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13234 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13235 (match_operand:SI 2 "reg_or_short_operand" ""))
13236 (match_operand:SI 3 "gpc_reg_operand" ""))
13238 (clobber (match_scratch:SI 4 ""))]
13239 "TARGET_POWER && reload_completed"
13240 [(set (match_dup 4)
13241 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13243 (compare:CC (match_dup 4)
13248 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13250 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13251 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13252 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13254 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13255 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13258 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13260 [(set_attr "type" "compare")
13261 (set_attr "length" "12,16")])
13264 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13266 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13267 (match_operand:SI 2 "reg_or_short_operand" ""))
13268 (match_operand:SI 3 "gpc_reg_operand" ""))
13270 (set (match_operand:SI 0 "gpc_reg_operand" "")
13271 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13272 "TARGET_POWER && reload_completed"
13273 [(set (match_dup 0)
13274 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13276 (compare:CC (match_dup 0)
13281 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13282 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13285 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13286 [(set_attr "length" "12")])
13289 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13290 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13293 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13294 [(set_attr "length" "12")])
13297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13298 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13299 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13301 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13302 [(set_attr "length" "12")])
13305 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13306 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13307 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13309 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
13310 [(set_attr "length" "12")])
13313 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13314 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13315 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13317 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
13318 [(set_attr "length" "12")])
13321 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13323 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13324 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13326 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13327 (gtu:SI (match_dup 1) (match_dup 2)))]
13330 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13332 [(set_attr "type" "compare")
13333 (set_attr "length" "12,16")])
13336 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13338 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13339 (match_operand:SI 2 "reg_or_short_operand" ""))
13341 (set (match_operand:SI 0 "gpc_reg_operand" "")
13342 (gtu:SI (match_dup 1) (match_dup 2)))]
13343 "TARGET_32BIT && reload_completed"
13344 [(set (match_dup 0)
13345 (gtu:SI (match_dup 1) (match_dup 2)))
13347 (compare:CC (match_dup 0)
13352 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13354 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13355 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13357 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13358 (gtu:DI (match_dup 1) (match_dup 2)))]
13361 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13363 [(set_attr "type" "compare")
13364 (set_attr "length" "12,16")])
13367 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13369 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13370 (match_operand:DI 2 "reg_or_short_operand" ""))
13372 (set (match_operand:DI 0 "gpc_reg_operand" "")
13373 (gtu:DI (match_dup 1) (match_dup 2)))]
13374 "TARGET_64BIT && reload_completed"
13375 [(set (match_dup 0)
13376 (gtu:DI (match_dup 1) (match_dup 2)))
13378 (compare:CC (match_dup 0)
13383 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13384 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13385 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
13386 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
13389 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
13390 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
13391 [(set_attr "length" "8,12")])
13394 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13395 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13396 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
13397 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))]
13400 addic %0,%1,%k2\;addze %0,%3
13401 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf%I3c %0,%0,%3"
13402 [(set_attr "length" "8,12")])
13405 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13407 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13408 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13409 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13411 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13414 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13415 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
13418 [(set_attr "type" "compare")
13419 (set_attr "length" "8,12,12,16")])
13422 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13424 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13425 (match_operand:SI 2 "reg_or_short_operand" ""))
13426 (match_operand:SI 3 "gpc_reg_operand" ""))
13428 (clobber (match_scratch:SI 4 ""))]
13429 "TARGET_32BIT && reload_completed"
13430 [(set (match_dup 4)
13431 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13434 (compare:CC (match_dup 4)
13439 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13441 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13442 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13443 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13445 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13448 addic %4,%1,%k2\;addze. %4,%3
13449 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
13452 [(set_attr "type" "compare")
13453 (set_attr "length" "8,12,12,16")])
13456 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13458 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13459 (match_operand:DI 2 "reg_or_short_operand" ""))
13460 (match_operand:DI 3 "gpc_reg_operand" ""))
13462 (clobber (match_scratch:DI 4 ""))]
13463 "TARGET_64BIT && reload_completed"
13464 [(set (match_dup 4)
13465 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13468 (compare:CC (match_dup 4)
13473 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13475 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13476 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13477 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13479 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13480 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13483 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13484 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
13487 [(set_attr "type" "compare")
13488 (set_attr "length" "8,12,12,16")])
13491 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13493 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13494 (match_operand:SI 2 "reg_or_short_operand" ""))
13495 (match_operand:SI 3 "gpc_reg_operand" ""))
13497 (set (match_operand:SI 0 "gpc_reg_operand" "")
13498 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13499 "TARGET_32BIT && reload_completed"
13500 [(set (match_dup 0)
13501 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13503 (compare:CC (match_dup 0)
13508 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13510 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13511 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13512 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13514 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13515 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13518 addic %0,%1,%k2\;addze. %0,%3
13519 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subfc. %0,%0,%3
13522 [(set_attr "type" "compare")
13523 (set_attr "length" "8,12,12,16")])
13526 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13528 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13529 (match_operand:DI 2 "reg_or_short_operand" ""))
13530 (match_operand:DI 3 "gpc_reg_operand" ""))
13532 (set (match_operand:DI 0 "gpc_reg_operand" "")
13533 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13534 "TARGET_64BIT && reload_completed"
13535 [(set (match_dup 0)
13536 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13538 (compare:CC (match_dup 0)
13543 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13544 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13545 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13547 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13548 [(set_attr "length" "8")])
13551 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13552 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13553 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13555 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13556 [(set_attr "length" "8")])
13558 ;; Define both directions of branch and return. If we need a reload
13559 ;; register, we'd rather use CR0 since it is much easier to copy a
13560 ;; register CC value to there.
13564 (if_then_else (match_operator 1 "branch_comparison_operator"
13566 "cc_reg_operand" "y")
13568 (label_ref (match_operand 0 "" ""))
13573 return output_cbranch (operands[1], \"%l0\", 0, insn);
13575 [(set_attr "type" "branch")])
13579 (if_then_else (match_operator 0 "branch_comparison_operator"
13581 "cc_reg_operand" "y")
13588 return output_cbranch (operands[0], NULL, 0, insn);
13590 [(set_attr "type" "branch")
13591 (set_attr "length" "4")])
13595 (if_then_else (match_operator 1 "branch_comparison_operator"
13597 "cc_reg_operand" "y")
13600 (label_ref (match_operand 0 "" ""))))]
13604 return output_cbranch (operands[1], \"%l0\", 1, insn);
13606 [(set_attr "type" "branch")])
13610 (if_then_else (match_operator 0 "branch_comparison_operator"
13612 "cc_reg_operand" "y")
13619 return output_cbranch (operands[0], NULL, 1, insn);
13621 [(set_attr "type" "branch")
13622 (set_attr "length" "4")])
13624 ;; Logic on condition register values.
13626 ; This pattern matches things like
13627 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13628 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13630 ; which are generated by the branch logic.
13631 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13633 (define_insn "*cceq_ior_compare"
13634 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13635 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13636 [(match_operator:SI 2
13637 "branch_positive_comparison_operator"
13639 "cc_reg_operand" "y,y")
13641 (match_operator:SI 4
13642 "branch_positive_comparison_operator"
13644 "cc_reg_operand" "0,y")
13647 "!(TARGET_E500 && TARGET_HARD_FLOAT && !TARGET_FPRS)"
13648 "cr%q1 %E0,%j2,%j4"
13649 [(set_attr "type" "cr_logical,delayed_cr")])
13651 ; Why is the constant -1 here, but 1 in the previous pattern?
13652 ; Because ~1 has all but the low bit set.
13654 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13655 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13656 [(not:SI (match_operator:SI 2
13657 "branch_positive_comparison_operator"
13659 "cc_reg_operand" "y,y")
13661 (match_operator:SI 4
13662 "branch_positive_comparison_operator"
13664 "cc_reg_operand" "0,y")
13668 "cr%q1 %E0,%j2,%j4"
13669 [(set_attr "type" "cr_logical,delayed_cr")])
13671 (define_insn "*cceq_rev_compare"
13672 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13673 (compare:CCEQ (match_operator:SI 1
13674 "branch_positive_comparison_operator"
13676 "cc_reg_operand" "0,y")
13680 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13681 [(set_attr "type" "cr_logical,delayed_cr")])
13683 ;; If we are comparing the result of two comparisons, this can be done
13684 ;; using creqv or crxor.
13686 (define_insn_and_split ""
13687 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13688 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13689 [(match_operand 2 "cc_reg_operand" "y")
13691 (match_operator 3 "branch_comparison_operator"
13692 [(match_operand 4 "cc_reg_operand" "y")
13697 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13701 int positive_1, positive_2;
13703 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13704 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13707 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13708 GET_CODE (operands[1])),
13710 operands[2], const0_rtx);
13711 else if (GET_MODE (operands[1]) != SImode)
13712 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13713 operands[2], const0_rtx);
13716 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13717 GET_CODE (operands[3])),
13719 operands[4], const0_rtx);
13720 else if (GET_MODE (operands[3]) != SImode)
13721 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13722 operands[4], const0_rtx);
13724 if (positive_1 == positive_2)
13726 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13727 operands[5] = constm1_rtx;
13731 operands[5] = const1_rtx;
13735 ;; Unconditional branch and return.
13737 (define_insn "jump"
13739 (label_ref (match_operand 0 "" "")))]
13742 [(set_attr "type" "branch")])
13744 (define_insn "return"
13748 [(set_attr "type" "jmpreg")])
13750 (define_expand "indirect_jump"
13751 [(set (pc) (match_operand 0 "register_operand" ""))]
13756 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13758 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13762 (define_insn "indirect_jumpsi"
13763 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13768 [(set_attr "type" "jmpreg")])
13770 (define_insn "indirect_jumpdi"
13771 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13776 [(set_attr "type" "jmpreg")])
13778 ;; Table jump for switch statements:
13779 (define_expand "tablejump"
13780 [(use (match_operand 0 "" ""))
13781 (use (label_ref (match_operand 1 "" "")))]
13786 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13788 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13792 (define_expand "tablejumpsi"
13793 [(set (match_dup 3)
13794 (plus:SI (match_operand:SI 0 "" "")
13796 (parallel [(set (pc) (match_dup 3))
13797 (use (label_ref (match_operand 1 "" "")))])]
13800 { operands[0] = force_reg (SImode, operands[0]);
13801 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13802 operands[3] = gen_reg_rtx (SImode);
13805 (define_expand "tablejumpdi"
13806 [(set (match_dup 4)
13807 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13809 (plus:DI (match_dup 4)
13811 (parallel [(set (pc) (match_dup 3))
13812 (use (label_ref (match_operand 1 "" "")))])]
13815 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13816 operands[3] = gen_reg_rtx (DImode);
13817 operands[4] = gen_reg_rtx (DImode);
13822 (match_operand:SI 0 "register_operand" "c,*l"))
13823 (use (label_ref (match_operand 1 "" "")))]
13828 [(set_attr "type" "jmpreg")])
13832 (match_operand:DI 0 "register_operand" "c,*l"))
13833 (use (label_ref (match_operand 1 "" "")))]
13838 [(set_attr "type" "jmpreg")])
13843 "{cror 0,0,0|nop}")
13845 ;; Define the subtract-one-and-jump insns, starting with the template
13846 ;; so loop.c knows what to generate.
13848 (define_expand "doloop_end"
13849 [(use (match_operand 0 "" "")) ; loop pseudo
13850 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13851 (use (match_operand 2 "" "")) ; max iterations
13852 (use (match_operand 3 "" "")) ; loop level
13853 (use (match_operand 4 "" ""))] ; label
13857 /* Only use this on innermost loops. */
13858 if (INTVAL (operands[3]) > 1)
13862 if (GET_MODE (operands[0]) != DImode)
13864 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13868 if (GET_MODE (operands[0]) != SImode)
13870 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13875 (define_expand "ctrsi"
13876 [(parallel [(set (pc)
13877 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
13879 (label_ref (match_operand 1 "" ""))
13882 (plus:SI (match_dup 0)
13884 (clobber (match_scratch:CC 2 ""))
13885 (clobber (match_scratch:SI 3 ""))])]
13889 (define_expand "ctrdi"
13890 [(parallel [(set (pc)
13891 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
13893 (label_ref (match_operand 1 "" ""))
13896 (plus:DI (match_dup 0)
13898 (clobber (match_scratch:CC 2 ""))
13899 (clobber (match_scratch:DI 3 ""))])]
13903 ;; We need to be able to do this for any operand, including MEM, or we
13904 ;; will cause reload to blow up since we don't allow output reloads on
13906 ;; For the length attribute to be calculated correctly, the
13907 ;; label MUST be operand 0.
13909 (define_insn "*ctrsi_internal1"
13911 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
13913 (label_ref (match_operand 0 "" ""))
13915 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13916 (plus:SI (match_dup 1)
13918 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13919 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
13923 if (which_alternative != 0)
13925 else if (get_attr_length (insn) == 4)
13926 return \"{bdn|bdnz} %l0\";
13928 return \"bdz $+8\;b %l0\";
13930 [(set_attr "type" "branch")
13931 (set_attr "length" "*,12,16,16")])
13933 (define_insn "*ctrsi_internal2"
13935 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
13938 (label_ref (match_operand 0 "" ""))))
13939 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13940 (plus:SI (match_dup 1)
13942 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13943 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
13947 if (which_alternative != 0)
13949 else if (get_attr_length (insn) == 4)
13950 return \"bdz %l0\";
13952 return \"{bdn|bdnz} $+8\;b %l0\";
13954 [(set_attr "type" "branch")
13955 (set_attr "length" "*,12,16,16")])
13957 (define_insn "*ctrdi_internal1"
13959 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
13961 (label_ref (match_operand 0 "" ""))
13963 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13964 (plus:DI (match_dup 1)
13966 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13967 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
13971 if (which_alternative != 0)
13973 else if (get_attr_length (insn) == 4)
13974 return \"{bdn|bdnz} %l0\";
13976 return \"bdz $+8\;b %l0\";
13978 [(set_attr "type" "branch")
13979 (set_attr "length" "*,12,16,16")])
13981 (define_insn "*ctrdi_internal2"
13983 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
13986 (label_ref (match_operand 0 "" ""))))
13987 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13988 (plus:DI (match_dup 1)
13990 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13991 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
13995 if (which_alternative != 0)
13997 else if (get_attr_length (insn) == 4)
13998 return \"bdz %l0\";
14000 return \"{bdn|bdnz} $+8\;b %l0\";
14002 [(set_attr "type" "branch")
14003 (set_attr "length" "*,12,16,16")])
14005 ;; Similar, but we can use GE since we have a REG_NONNEG.
14007 (define_insn "*ctrsi_internal3"
14009 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14011 (label_ref (match_operand 0 "" ""))
14013 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14014 (plus:SI (match_dup 1)
14016 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14017 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14018 "TARGET_32BIT && find_reg_note (insn, REG_NONNEG, 0)"
14021 if (which_alternative != 0)
14023 else if (get_attr_length (insn) == 4)
14024 return \"{bdn|bdnz} %l0\";
14026 return \"bdz $+8\;b %l0\";
14028 [(set_attr "type" "branch")
14029 (set_attr "length" "*,12,16,16")])
14031 (define_insn "*ctrsi_internal4"
14033 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14036 (label_ref (match_operand 0 "" ""))))
14037 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14038 (plus:SI (match_dup 1)
14040 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14041 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14042 "TARGET_32BIT && find_reg_note (insn, REG_NONNEG, 0)"
14045 if (which_alternative != 0)
14047 else if (get_attr_length (insn) == 4)
14048 return \"bdz %l0\";
14050 return \"{bdn|bdnz} $+8\;b %l0\";
14052 [(set_attr "type" "branch")
14053 (set_attr "length" "*,12,16,16")])
14055 (define_insn "*ctrdi_internal3"
14057 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14059 (label_ref (match_operand 0 "" ""))
14061 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14062 (plus:DI (match_dup 1)
14064 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14065 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14066 "TARGET_64BIT && find_reg_note (insn, REG_NONNEG, 0)"
14069 if (which_alternative != 0)
14071 else if (get_attr_length (insn) == 4)
14072 return \"{bdn|bdnz} %l0\";
14074 return \"bdz $+8\;b %l0\";
14076 [(set_attr "type" "branch")
14077 (set_attr "length" "*,12,16,16")])
14079 (define_insn "*ctrdi_internal4"
14081 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14084 (label_ref (match_operand 0 "" ""))))
14085 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14086 (plus:DI (match_dup 1)
14088 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14089 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14090 "TARGET_64BIT && find_reg_note (insn, REG_NONNEG, 0)"
14093 if (which_alternative != 0)
14095 else if (get_attr_length (insn) == 4)
14096 return \"bdz %l0\";
14098 return \"{bdn|bdnz} $+8\;b %l0\";
14100 [(set_attr "type" "branch")
14101 (set_attr "length" "*,12,16,16")])
14103 ;; Similar but use EQ
14105 (define_insn "*ctrsi_internal5"
14107 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14109 (label_ref (match_operand 0 "" ""))
14111 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14112 (plus:SI (match_dup 1)
14114 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14115 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14119 if (which_alternative != 0)
14121 else if (get_attr_length (insn) == 4)
14122 return \"bdz %l0\";
14124 return \"{bdn|bdnz} $+8\;b %l0\";
14126 [(set_attr "type" "branch")
14127 (set_attr "length" "*,12,16,16")])
14129 (define_insn "*ctrsi_internal6"
14131 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14134 (label_ref (match_operand 0 "" ""))))
14135 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14136 (plus:SI (match_dup 1)
14138 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14139 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14143 if (which_alternative != 0)
14145 else if (get_attr_length (insn) == 4)
14146 return \"{bdn|bdnz} %l0\";
14148 return \"bdz $+8\;b %l0\";
14150 [(set_attr "type" "branch")
14151 (set_attr "length" "*,12,16,16")])
14153 (define_insn "*ctrdi_internal5"
14155 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14157 (label_ref (match_operand 0 "" ""))
14159 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14160 (plus:DI (match_dup 1)
14162 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14163 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14167 if (which_alternative != 0)
14169 else if (get_attr_length (insn) == 4)
14170 return \"bdz %l0\";
14172 return \"{bdn|bdnz} $+8\;b %l0\";
14174 [(set_attr "type" "branch")
14175 (set_attr "length" "*,12,16,16")])
14177 (define_insn "*ctrdi_internal6"
14179 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14182 (label_ref (match_operand 0 "" ""))))
14183 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14184 (plus:DI (match_dup 1)
14186 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14187 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14191 if (which_alternative != 0)
14193 else if (get_attr_length (insn) == 4)
14194 return \"{bdn|bdnz} %l0\";
14196 return \"bdz $+8\;b %l0\";
14198 [(set_attr "type" "branch")
14199 (set_attr "length" "*,12,16,16")])
14201 ;; Now the splitters if we could not allocate the CTR register
14205 (if_then_else (match_operator 2 "comparison_operator"
14206 [(match_operand:SI 1 "gpc_reg_operand" "")
14208 (match_operand 5 "" "")
14209 (match_operand 6 "" "")))
14210 (set (match_operand:SI 0 "gpc_reg_operand" "")
14211 (plus:SI (match_dup 1)
14213 (clobber (match_scratch:CC 3 ""))
14214 (clobber (match_scratch:SI 4 ""))]
14215 "TARGET_32BIT && reload_completed"
14216 [(parallel [(set (match_dup 3)
14217 (compare:CC (plus:SI (match_dup 1)
14221 (plus:SI (match_dup 1)
14223 (set (pc) (if_then_else (match_dup 7)
14227 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14228 operands[3], const0_rtx); }")
14232 (if_then_else (match_operator 2 "comparison_operator"
14233 [(match_operand:SI 1 "gpc_reg_operand" "")
14235 (match_operand 5 "" "")
14236 (match_operand 6 "" "")))
14237 (set (match_operand:SI 0 "nonimmediate_operand" "")
14238 (plus:SI (match_dup 1) (const_int -1)))
14239 (clobber (match_scratch:CC 3 ""))
14240 (clobber (match_scratch:SI 4 ""))]
14241 "TARGET_32BIT && reload_completed
14242 && ! gpc_reg_operand (operands[0], SImode)"
14243 [(parallel [(set (match_dup 3)
14244 (compare:CC (plus:SI (match_dup 1)
14248 (plus:SI (match_dup 1)
14252 (set (pc) (if_then_else (match_dup 7)
14256 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14257 operands[3], const0_rtx); }")
14260 (if_then_else (match_operator 2 "comparison_operator"
14261 [(match_operand:DI 1 "gpc_reg_operand" "")
14263 (match_operand 5 "" "")
14264 (match_operand 6 "" "")))
14265 (set (match_operand:DI 0 "gpc_reg_operand" "")
14266 (plus:DI (match_dup 1)
14268 (clobber (match_scratch:CC 3 ""))
14269 (clobber (match_scratch:DI 4 ""))]
14270 "TARGET_64BIT && reload_completed"
14271 [(parallel [(set (match_dup 3)
14272 (compare:CC (plus:DI (match_dup 1)
14276 (plus:DI (match_dup 1)
14278 (set (pc) (if_then_else (match_dup 7)
14282 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14283 operands[3], const0_rtx); }")
14287 (if_then_else (match_operator 2 "comparison_operator"
14288 [(match_operand:DI 1 "gpc_reg_operand" "")
14290 (match_operand 5 "" "")
14291 (match_operand 6 "" "")))
14292 (set (match_operand:DI 0 "nonimmediate_operand" "")
14293 (plus:DI (match_dup 1) (const_int -1)))
14294 (clobber (match_scratch:CC 3 ""))
14295 (clobber (match_scratch:DI 4 ""))]
14296 "TARGET_64BIT && reload_completed
14297 && ! gpc_reg_operand (operands[0], DImode)"
14298 [(parallel [(set (match_dup 3)
14299 (compare:CC (plus:DI (match_dup 1)
14303 (plus:DI (match_dup 1)
14307 (set (pc) (if_then_else (match_dup 7)
14311 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14312 operands[3], const0_rtx); }")
14314 (define_insn "trap"
14315 [(trap_if (const_int 1) (const_int 0))]
14319 (define_expand "conditional_trap"
14320 [(trap_if (match_operator 0 "trap_comparison_operator"
14321 [(match_dup 2) (match_dup 3)])
14322 (match_operand 1 "const_int_operand" ""))]
14324 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14325 operands[2] = rs6000_compare_op0;
14326 operands[3] = rs6000_compare_op1;")
14329 [(trap_if (match_operator 0 "trap_comparison_operator"
14330 [(match_operand:SI 1 "register_operand" "r")
14331 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14334 "{t|tw}%V0%I2 %1,%2")
14337 [(trap_if (match_operator 0 "trap_comparison_operator"
14338 [(match_operand:DI 1 "register_operand" "r")
14339 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14344 ;; Insns related to generating the function prologue and epilogue.
14346 (define_expand "prologue"
14347 [(use (const_int 0))]
14348 "TARGET_SCHED_PROLOG"
14351 rs6000_emit_prologue ();
14355 (define_insn "*movesi_from_cr_one"
14356 [(match_parallel 0 "mfcr_operation"
14357 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14358 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14359 (match_operand 3 "immediate_operand" "n")]
14360 UNSPEC_MOVESI_FROM_CR))])]
14366 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14368 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14369 operands[4] = GEN_INT (mask);
14370 output_asm_insn (\"mfcr %1,%4\", operands);
14374 [(set_attr "type" "mfcrf")])
14376 (define_insn "movesi_from_cr"
14377 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14378 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14379 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14380 UNSPEC_MOVESI_FROM_CR))]
14383 [(set_attr "type" "mfcr")])
14385 (define_insn "*stmw"
14386 [(match_parallel 0 "stmw_operation"
14387 [(set (match_operand:SI 1 "memory_operand" "=m")
14388 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14390 "{stm|stmw} %2,%1")
14392 (define_insn "*save_fpregs_si"
14393 [(match_parallel 0 "any_operand"
14394 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14395 (use (match_operand:SI 2 "call_operand" "s"))
14396 (set (match_operand:DF 3 "memory_operand" "=m")
14397 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14400 [(set_attr "type" "branch")
14401 (set_attr "length" "4")])
14403 (define_insn "*save_fpregs_di"
14404 [(match_parallel 0 "any_operand"
14405 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14406 (use (match_operand:DI 2 "call_operand" "s"))
14407 (set (match_operand:DF 3 "memory_operand" "=m")
14408 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14411 [(set_attr "type" "branch")
14412 (set_attr "length" "4")])
14414 ; These are to explain that changes to the stack pointer should
14415 ; not be moved over stores to stack memory.
14416 (define_insn "stack_tie"
14417 [(set (match_operand:BLK 0 "memory_operand" "+m")
14418 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14421 [(set_attr "length" "0")])
14424 (define_expand "epilogue"
14425 [(use (const_int 0))]
14426 "TARGET_SCHED_PROLOG"
14429 rs6000_emit_epilogue (FALSE);
14433 ; On some processors, doing the mtcrf one CC register at a time is
14434 ; faster (like on the 604e). On others, doing them all at once is
14435 ; faster; for instance, on the 601 and 750.
14437 (define_expand "movsi_to_cr_one"
14438 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14439 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14440 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14442 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14444 (define_insn "*movsi_to_cr"
14445 [(match_parallel 0 "mtcrf_operation"
14446 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14447 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14448 (match_operand 3 "immediate_operand" "n")]
14449 UNSPEC_MOVESI_TO_CR))])]
14455 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14456 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14457 operands[4] = GEN_INT (mask);
14458 return \"mtcrf %4,%2\";
14460 [(set_attr "type" "mtcr")])
14462 (define_insn "*mtcrfsi"
14463 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14464 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14465 (match_operand 2 "immediate_operand" "n")]
14466 UNSPEC_MOVESI_TO_CR))]
14467 "GET_CODE (operands[0]) == REG
14468 && CR_REGNO_P (REGNO (operands[0]))
14469 && GET_CODE (operands[2]) == CONST_INT
14470 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14472 [(set_attr "type" "mtcr")])
14474 ; The load-multiple instructions have similar properties.
14475 ; Note that "load_multiple" is a name known to the machine-independent
14476 ; code that actually corresponds to the powerpc load-string.
14478 (define_insn "*lmw"
14479 [(match_parallel 0 "lmw_operation"
14480 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14481 (match_operand:SI 2 "memory_operand" "m"))])]
14485 (define_insn "*return_internal_si"
14487 (use (match_operand:SI 0 "register_operand" "lc"))]
14490 [(set_attr "type" "jmpreg")])
14492 (define_insn "*return_internal_di"
14494 (use (match_operand:DI 0 "register_operand" "lc"))]
14497 [(set_attr "type" "jmpreg")])
14499 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14500 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
14502 (define_insn "*return_and_restore_fpregs_si"
14503 [(match_parallel 0 "any_operand"
14505 (use (match_operand:SI 1 "register_operand" "l"))
14506 (use (match_operand:SI 2 "call_operand" "s"))
14507 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14508 (match_operand:DF 4 "memory_operand" "m"))])]
14512 (define_insn "*return_and_restore_fpregs_di"
14513 [(match_parallel 0 "any_operand"
14515 (use (match_operand:DI 1 "register_operand" "l"))
14516 (use (match_operand:DI 2 "call_operand" "s"))
14517 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14518 (match_operand:DF 4 "memory_operand" "m"))])]
14522 ; This is used in compiling the unwind routines.
14523 (define_expand "eh_return"
14524 [(use (match_operand 0 "general_operand" ""))]
14529 emit_insn (gen_eh_set_lr_si (operands[0]));
14531 emit_insn (gen_eh_set_lr_di (operands[0]));
14535 ; We can't expand this before we know where the link register is stored.
14536 (define_insn "eh_set_lr_si"
14537 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")]
14539 (clobber (match_scratch:SI 1 "=&b"))]
14543 (define_insn "eh_set_lr_di"
14544 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
14546 (clobber (match_scratch:DI 1 "=&b"))]
14551 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14552 (clobber (match_scratch 1 ""))]
14557 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14561 (define_insn "prefetch"
14562 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14563 (match_operand:SI 1 "const_int_operand" "n")
14564 (match_operand:SI 2 "const_int_operand" "n"))]
14568 if (GET_CODE (operands[0]) == REG)
14569 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14570 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14572 [(set_attr "type" "load")])
14574 (include "altivec.md")