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 ;; combine patterns for rlwimi
3040 (define_insn "*insvsi_internal5"
3041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3042 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3043 (match_operand:SI 1 "mask_operand" "i"))
3044 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3045 (match_operand:SI 2 "const_int_operand" "i"))
3046 (match_operand:SI 5 "mask_operand" "i"))))]
3047 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3050 int me = extract_ME(operands[5]);
3051 int mb = extract_MB(operands[5]);
3052 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3053 operands[2] = GEN_INT(mb);
3054 operands[1] = GEN_INT(me);
3055 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3057 [(set_attr "type" "insert_word")])
3059 (define_insn "*insvsi_internal6"
3060 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3061 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3062 (match_operand:SI 2 "const_int_operand" "i"))
3063 (match_operand:SI 5 "mask_operand" "i"))
3064 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3065 (match_operand:SI 1 "mask_operand" "i"))))]
3066 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3069 int me = extract_ME(operands[5]);
3070 int mb = extract_MB(operands[5]);
3071 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3072 operands[2] = GEN_INT(mb);
3073 operands[1] = GEN_INT(me);
3074 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3076 [(set_attr "type" "insert_word")])
3078 (define_insn "insvdi"
3079 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3080 (match_operand:SI 1 "const_int_operand" "i")
3081 (match_operand:SI 2 "const_int_operand" "i"))
3082 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3086 int start = INTVAL (operands[2]) & 63;
3087 int size = INTVAL (operands[1]) & 63;
3089 operands[1] = GEN_INT (64 - start - size);
3090 return \"rldimi %0,%3,%H1,%H2\";
3093 (define_expand "extzv"
3094 [(set (match_operand 0 "gpc_reg_operand" "")
3095 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3096 (match_operand:SI 2 "const_int_operand" "")
3097 (match_operand:SI 3 "const_int_operand" "")))]
3101 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3102 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3103 compiler if the address of the structure is taken later. */
3104 if (GET_CODE (operands[0]) == SUBREG
3105 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3108 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3109 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3111 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3115 (define_insn "extzvsi"
3116 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3117 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3118 (match_operand:SI 2 "const_int_operand" "i")
3119 (match_operand:SI 3 "const_int_operand" "i")))]
3123 int start = INTVAL (operands[3]) & 31;
3124 int size = INTVAL (operands[2]) & 31;
3126 if (start + size >= 32)
3127 operands[3] = const0_rtx;
3129 operands[3] = GEN_INT (start + size);
3130 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3133 (define_insn "*extzvsi_internal1"
3134 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3135 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3136 (match_operand:SI 2 "const_int_operand" "i,i")
3137 (match_operand:SI 3 "const_int_operand" "i,i"))
3139 (clobber (match_scratch:SI 4 "=r,r"))]
3143 int start = INTVAL (operands[3]) & 31;
3144 int size = INTVAL (operands[2]) & 31;
3146 /* Force split for non-cc0 compare. */
3147 if (which_alternative == 1)
3150 /* If the bit-field being tested fits in the upper or lower half of a
3151 word, it is possible to use andiu. or andil. to test it. This is
3152 useful because the condition register set-use delay is smaller for
3153 andi[ul]. than for rlinm. This doesn't work when the starting bit
3154 position is 0 because the LT and GT bits may be set wrong. */
3156 if ((start > 0 && start + size <= 16) || start >= 16)
3158 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3159 - (1 << (16 - (start & 15) - size))));
3161 return \"{andiu.|andis.} %4,%1,%3\";
3163 return \"{andil.|andi.} %4,%1,%3\";
3166 if (start + size >= 32)
3167 operands[3] = const0_rtx;
3169 operands[3] = GEN_INT (start + size);
3170 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3172 [(set_attr "type" "compare")
3173 (set_attr "length" "4,8")])
3176 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3177 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3178 (match_operand:SI 2 "const_int_operand" "")
3179 (match_operand:SI 3 "const_int_operand" ""))
3181 (clobber (match_scratch:SI 4 ""))]
3184 (zero_extract:SI (match_dup 1) (match_dup 2)
3187 (compare:CC (match_dup 4)
3191 (define_insn "*extzvsi_internal2"
3192 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3193 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3194 (match_operand:SI 2 "const_int_operand" "i,i")
3195 (match_operand:SI 3 "const_int_operand" "i,i"))
3197 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3198 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3202 int start = INTVAL (operands[3]) & 31;
3203 int size = INTVAL (operands[2]) & 31;
3205 /* Force split for non-cc0 compare. */
3206 if (which_alternative == 1)
3209 /* Since we are using the output value, we can't ignore any need for
3210 a shift. The bit-field must end at the LSB. */
3211 if (start >= 16 && start + size == 32)
3213 operands[3] = GEN_INT ((1 << size) - 1);
3214 return \"{andil.|andi.} %0,%1,%3\";
3217 if (start + size >= 32)
3218 operands[3] = const0_rtx;
3220 operands[3] = GEN_INT (start + size);
3221 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3223 [(set_attr "type" "compare")
3224 (set_attr "length" "4,8")])
3227 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3228 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3229 (match_operand:SI 2 "const_int_operand" "")
3230 (match_operand:SI 3 "const_int_operand" ""))
3232 (set (match_operand:SI 0 "gpc_reg_operand" "")
3233 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3236 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3238 (compare:CC (match_dup 0)
3242 (define_insn "extzvdi"
3243 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3244 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3245 (match_operand:SI 2 "const_int_operand" "i")
3246 (match_operand:SI 3 "const_int_operand" "i")))]
3250 int start = INTVAL (operands[3]) & 63;
3251 int size = INTVAL (operands[2]) & 63;
3253 if (start + size >= 64)
3254 operands[3] = const0_rtx;
3256 operands[3] = GEN_INT (start + size);
3257 operands[2] = GEN_INT (64 - size);
3258 return \"rldicl %0,%1,%3,%2\";
3261 (define_insn "*extzvdi_internal1"
3262 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3263 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3264 (match_operand:SI 2 "const_int_operand" "i")
3265 (match_operand:SI 3 "const_int_operand" "i"))
3267 (clobber (match_scratch:DI 4 "=r"))]
3271 int start = INTVAL (operands[3]) & 63;
3272 int size = INTVAL (operands[2]) & 63;
3274 if (start + size >= 64)
3275 operands[3] = const0_rtx;
3277 operands[3] = GEN_INT (start + size);
3278 operands[2] = GEN_INT (64 - size);
3279 return \"rldicl. %4,%1,%3,%2\";
3282 (define_insn "*extzvdi_internal2"
3283 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3284 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3285 (match_operand:SI 2 "const_int_operand" "i")
3286 (match_operand:SI 3 "const_int_operand" "i"))
3288 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3289 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3293 int start = INTVAL (operands[3]) & 63;
3294 int size = INTVAL (operands[2]) & 63;
3296 if (start + size >= 64)
3297 operands[3] = const0_rtx;
3299 operands[3] = GEN_INT (start + size);
3300 operands[2] = GEN_INT (64 - size);
3301 return \"rldicl. %0,%1,%3,%2\";
3304 (define_insn "rotlsi3"
3305 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3306 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3307 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3309 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3311 (define_insn "*rotlsi3_internal2"
3312 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3313 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3314 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3316 (clobber (match_scratch:SI 3 "=r,r"))]
3319 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3321 [(set_attr "type" "delayed_compare")
3322 (set_attr "length" "4,8")])
3325 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3326 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3327 (match_operand:SI 2 "reg_or_cint_operand" ""))
3329 (clobber (match_scratch:SI 3 ""))]
3332 (rotate:SI (match_dup 1) (match_dup 2)))
3334 (compare:CC (match_dup 3)
3338 (define_insn "*rotlsi3_internal3"
3339 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3340 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3341 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3343 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3344 (rotate:SI (match_dup 1) (match_dup 2)))]
3347 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3349 [(set_attr "type" "delayed_compare")
3350 (set_attr "length" "4,8")])
3353 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3354 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3355 (match_operand:SI 2 "reg_or_cint_operand" ""))
3357 (set (match_operand:SI 0 "gpc_reg_operand" "")
3358 (rotate:SI (match_dup 1) (match_dup 2)))]
3361 (rotate:SI (match_dup 1) (match_dup 2)))
3363 (compare:CC (match_dup 0)
3367 (define_insn "*rotlsi3_internal4"
3368 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3369 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3370 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3371 (match_operand:SI 3 "mask_operand" "n")))]
3373 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3375 (define_insn "*rotlsi3_internal5"
3376 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3378 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3379 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3380 (match_operand:SI 3 "mask_operand" "n,n"))
3382 (clobber (match_scratch:SI 4 "=r,r"))]
3385 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3387 [(set_attr "type" "delayed_compare")
3388 (set_attr "length" "4,8")])
3391 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3393 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3394 (match_operand:SI 2 "reg_or_cint_operand" ""))
3395 (match_operand:SI 3 "mask_operand" ""))
3397 (clobber (match_scratch:SI 4 ""))]
3400 (and:SI (rotate:SI (match_dup 1)
3404 (compare:CC (match_dup 4)
3408 (define_insn "*rotlsi3_internal6"
3409 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3411 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3412 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3413 (match_operand:SI 3 "mask_operand" "n,n"))
3415 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3416 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3419 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3421 [(set_attr "type" "delayed_compare")
3422 (set_attr "length" "4,8")])
3425 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3427 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3428 (match_operand:SI 2 "reg_or_cint_operand" ""))
3429 (match_operand:SI 3 "mask_operand" ""))
3431 (set (match_operand:SI 0 "gpc_reg_operand" "")
3432 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3435 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3437 (compare:CC (match_dup 0)
3441 (define_insn "*rotlsi3_internal7"
3442 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3445 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3446 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3448 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3450 (define_insn "*rotlsi3_internal8"
3451 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3452 (compare:CC (zero_extend:SI
3454 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3455 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3457 (clobber (match_scratch:SI 3 "=r,r"))]
3460 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3462 [(set_attr "type" "delayed_compare")
3463 (set_attr "length" "4,8")])
3466 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3467 (compare:CC (zero_extend:SI
3469 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3470 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3472 (clobber (match_scratch:SI 3 ""))]
3475 (zero_extend:SI (subreg:QI
3476 (rotate:SI (match_dup 1)
3479 (compare:CC (match_dup 3)
3483 (define_insn "*rotlsi3_internal9"
3484 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3485 (compare:CC (zero_extend:SI
3487 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3488 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3490 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3491 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3494 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3496 [(set_attr "type" "delayed_compare")
3497 (set_attr "length" "4,8")])
3500 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3501 (compare:CC (zero_extend:SI
3503 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3504 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3506 (set (match_operand:SI 0 "gpc_reg_operand" "")
3507 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3510 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3512 (compare:CC (match_dup 0)
3516 (define_insn "*rotlsi3_internal10"
3517 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3520 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3521 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3523 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3525 (define_insn "*rotlsi3_internal11"
3526 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3527 (compare:CC (zero_extend:SI
3529 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3530 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3532 (clobber (match_scratch:SI 3 "=r,r"))]
3535 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3537 [(set_attr "type" "delayed_compare")
3538 (set_attr "length" "4,8")])
3541 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3542 (compare:CC (zero_extend:SI
3544 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3545 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3547 (clobber (match_scratch:SI 3 ""))]
3550 (zero_extend:SI (subreg:HI
3551 (rotate:SI (match_dup 1)
3554 (compare:CC (match_dup 3)
3558 (define_insn "*rotlsi3_internal12"
3559 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3560 (compare:CC (zero_extend:SI
3562 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3563 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3565 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3566 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3569 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3571 [(set_attr "type" "delayed_compare")
3572 (set_attr "length" "4,8")])
3575 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3576 (compare:CC (zero_extend:SI
3578 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3579 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3581 (set (match_operand:SI 0 "gpc_reg_operand" "")
3582 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3585 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3587 (compare:CC (match_dup 0)
3591 ;; Note that we use "sle." instead of "sl." so that we can set
3592 ;; SHIFT_COUNT_TRUNCATED.
3594 (define_expand "ashlsi3"
3595 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3596 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3597 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3602 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3604 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3608 (define_insn "ashlsi3_power"
3609 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3610 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3611 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3612 (clobber (match_scratch:SI 3 "=q,X"))]
3616 {sli|slwi} %0,%1,%h2")
3618 (define_insn "ashlsi3_no_power"
3619 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3620 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3621 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3623 "{sl|slw}%I2 %0,%1,%h2")
3626 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3627 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3628 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3630 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3631 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3635 {sli.|slwi.} %3,%1,%h2
3638 [(set_attr "type" "delayed_compare")
3639 (set_attr "length" "4,4,8,8")])
3642 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3643 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3644 (match_operand:SI 2 "reg_or_cint_operand" ""))
3646 (clobber (match_scratch:SI 3 ""))
3647 (clobber (match_scratch:SI 4 ""))]
3648 "TARGET_POWER && reload_completed"
3649 [(parallel [(set (match_dup 3)
3650 (ashift:SI (match_dup 1) (match_dup 2)))
3651 (clobber (match_dup 4))])
3653 (compare:CC (match_dup 3)
3658 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3659 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3660 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3662 (clobber (match_scratch:SI 3 "=r,r"))]
3663 "! TARGET_POWER && TARGET_32BIT"
3665 {sl|slw}%I2. %3,%1,%h2
3667 [(set_attr "type" "delayed_compare")
3668 (set_attr "length" "4,8")])
3671 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3672 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3673 (match_operand:SI 2 "reg_or_cint_operand" ""))
3675 (clobber (match_scratch:SI 3 ""))]
3676 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3678 (ashift:SI (match_dup 1) (match_dup 2)))
3680 (compare:CC (match_dup 3)
3685 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3686 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3687 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3689 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3690 (ashift:SI (match_dup 1) (match_dup 2)))
3691 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3695 {sli.|slwi.} %0,%1,%h2
3698 [(set_attr "type" "delayed_compare")
3699 (set_attr "length" "4,4,8,8")])
3702 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3703 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3704 (match_operand:SI 2 "reg_or_cint_operand" ""))
3706 (set (match_operand:SI 0 "gpc_reg_operand" "")
3707 (ashift:SI (match_dup 1) (match_dup 2)))
3708 (clobber (match_scratch:SI 4 ""))]
3709 "TARGET_POWER && reload_completed"
3710 [(parallel [(set (match_dup 0)
3711 (ashift:SI (match_dup 1) (match_dup 2)))
3712 (clobber (match_dup 4))])
3714 (compare:CC (match_dup 0)
3719 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3720 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3721 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3723 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3724 (ashift:SI (match_dup 1) (match_dup 2)))]
3725 "! TARGET_POWER && TARGET_32BIT"
3727 {sl|slw}%I2. %0,%1,%h2
3729 [(set_attr "type" "delayed_compare")
3730 (set_attr "length" "4,8")])
3733 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3734 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3735 (match_operand:SI 2 "reg_or_cint_operand" ""))
3737 (set (match_operand:SI 0 "gpc_reg_operand" "")
3738 (ashift:SI (match_dup 1) (match_dup 2)))]
3739 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3741 (ashift:SI (match_dup 1) (match_dup 2)))
3743 (compare:CC (match_dup 0)
3748 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3749 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3750 (match_operand:SI 2 "const_int_operand" "i"))
3751 (match_operand:SI 3 "mask_operand" "n")))]
3752 "includes_lshift_p (operands[2], operands[3])"
3753 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3756 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3758 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3759 (match_operand:SI 2 "const_int_operand" "i,i"))
3760 (match_operand:SI 3 "mask_operand" "n,n"))
3762 (clobber (match_scratch:SI 4 "=r,r"))]
3763 "includes_lshift_p (operands[2], operands[3])"
3765 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3767 [(set_attr "type" "delayed_compare")
3768 (set_attr "length" "4,8")])
3771 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3773 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3774 (match_operand:SI 2 "const_int_operand" ""))
3775 (match_operand:SI 3 "mask_operand" ""))
3777 (clobber (match_scratch:SI 4 ""))]
3778 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3780 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3783 (compare:CC (match_dup 4)
3788 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3790 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3791 (match_operand:SI 2 "const_int_operand" "i,i"))
3792 (match_operand:SI 3 "mask_operand" "n,n"))
3794 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3795 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3796 "includes_lshift_p (operands[2], operands[3])"
3798 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3800 [(set_attr "type" "delayed_compare")
3801 (set_attr "length" "4,8")])
3804 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3806 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3807 (match_operand:SI 2 "const_int_operand" ""))
3808 (match_operand:SI 3 "mask_operand" ""))
3810 (set (match_operand:SI 0 "gpc_reg_operand" "")
3811 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3812 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3814 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3816 (compare:CC (match_dup 0)
3820 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3822 (define_expand "lshrsi3"
3823 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3824 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3825 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3830 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3832 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3836 (define_insn "lshrsi3_power"
3837 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3838 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3839 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3840 (clobber (match_scratch:SI 3 "=q,X,X"))]
3845 {s%A2i|s%A2wi} %0,%1,%h2")
3847 (define_insn "lshrsi3_no_power"
3848 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3849 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3850 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3854 {sr|srw}%I2 %0,%1,%h2")
3857 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3858 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3859 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3861 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3862 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3867 {s%A2i.|s%A2wi.} %3,%1,%h2
3871 [(set_attr "type" "delayed_compare")
3872 (set_attr "length" "4,4,4,8,8,8")])
3875 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3876 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3877 (match_operand:SI 2 "reg_or_cint_operand" ""))
3879 (clobber (match_scratch:SI 3 ""))
3880 (clobber (match_scratch:SI 4 ""))]
3881 "TARGET_POWER && reload_completed"
3882 [(parallel [(set (match_dup 3)
3883 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3884 (clobber (match_dup 4))])
3886 (compare:CC (match_dup 3)
3891 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3892 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3893 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3895 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3896 "! TARGET_POWER && TARGET_32BIT"
3899 {sr|srw}%I2. %3,%1,%h2
3902 [(set_attr "type" "delayed_compare")
3903 (set_attr "length" "4,4,8,8")])
3906 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3907 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3908 (match_operand:SI 2 "reg_or_cint_operand" ""))
3910 (clobber (match_scratch:SI 3 ""))]
3911 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3913 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3915 (compare:CC (match_dup 3)
3920 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3921 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3922 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3924 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3925 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3926 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3931 {s%A2i.|s%A2wi.} %0,%1,%h2
3935 [(set_attr "type" "delayed_compare")
3936 (set_attr "length" "4,4,4,8,8,8")])
3939 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3940 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3941 (match_operand:SI 2 "reg_or_cint_operand" ""))
3943 (set (match_operand:SI 0 "gpc_reg_operand" "")
3944 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3945 (clobber (match_scratch:SI 4 ""))]
3946 "TARGET_POWER && reload_completed"
3947 [(parallel [(set (match_dup 0)
3948 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3949 (clobber (match_dup 4))])
3951 (compare:CC (match_dup 0)
3956 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3957 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3958 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3960 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3961 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3962 "! TARGET_POWER && TARGET_32BIT"
3965 {sr|srw}%I2. %0,%1,%h2
3968 [(set_attr "type" "delayed_compare")
3969 (set_attr "length" "4,4,8,8")])
3972 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3973 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3974 (match_operand:SI 2 "reg_or_cint_operand" ""))
3976 (set (match_operand:SI 0 "gpc_reg_operand" "")
3977 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3978 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3980 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3982 (compare:CC (match_dup 0)
3987 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3988 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3989 (match_operand:SI 2 "const_int_operand" "i"))
3990 (match_operand:SI 3 "mask_operand" "n")))]
3991 "includes_rshift_p (operands[2], operands[3])"
3992 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3997 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3998 (match_operand:SI 2 "const_int_operand" "i,i"))
3999 (match_operand:SI 3 "mask_operand" "n,n"))
4001 (clobber (match_scratch:SI 4 "=r,r"))]
4002 "includes_rshift_p (operands[2], operands[3])"
4004 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4006 [(set_attr "type" "delayed_compare")
4007 (set_attr "length" "4,8")])
4010 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4012 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4013 (match_operand:SI 2 "const_int_operand" ""))
4014 (match_operand:SI 3 "mask_operand" ""))
4016 (clobber (match_scratch:SI 4 ""))]
4017 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4019 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4022 (compare:CC (match_dup 4)
4027 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4029 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4030 (match_operand:SI 2 "const_int_operand" "i,i"))
4031 (match_operand:SI 3 "mask_operand" "n,n"))
4033 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4034 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4035 "includes_rshift_p (operands[2], operands[3])"
4037 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4039 [(set_attr "type" "delayed_compare")
4040 (set_attr "length" "4,8")])
4043 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4045 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4046 (match_operand:SI 2 "const_int_operand" ""))
4047 (match_operand:SI 3 "mask_operand" ""))
4049 (set (match_operand:SI 0 "gpc_reg_operand" "")
4050 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4051 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4053 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4055 (compare:CC (match_dup 0)
4060 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4063 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4064 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4065 "includes_rshift_p (operands[2], GEN_INT (255))"
4066 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4069 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4073 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4074 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4076 (clobber (match_scratch:SI 3 "=r,r"))]
4077 "includes_rshift_p (operands[2], GEN_INT (255))"
4079 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4081 [(set_attr "type" "delayed_compare")
4082 (set_attr "length" "4,8")])
4085 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4089 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4090 (match_operand:SI 2 "const_int_operand" "")) 0))
4092 (clobber (match_scratch:SI 3 ""))]
4093 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4095 (zero_extend:SI (subreg:QI
4096 (lshiftrt:SI (match_dup 1)
4099 (compare:CC (match_dup 3)
4104 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4108 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4109 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4111 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4112 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4113 "includes_rshift_p (operands[2], GEN_INT (255))"
4115 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4117 [(set_attr "type" "delayed_compare")
4118 (set_attr "length" "4,8")])
4121 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4125 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4126 (match_operand:SI 2 "const_int_operand" "")) 0))
4128 (set (match_operand:SI 0 "gpc_reg_operand" "")
4129 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4130 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4132 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4134 (compare:CC (match_dup 0)
4139 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4142 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4143 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4144 "includes_rshift_p (operands[2], GEN_INT (65535))"
4145 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4148 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4152 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4153 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4155 (clobber (match_scratch:SI 3 "=r,r"))]
4156 "includes_rshift_p (operands[2], GEN_INT (65535))"
4158 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4160 [(set_attr "type" "delayed_compare")
4161 (set_attr "length" "4,8")])
4164 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4168 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4169 (match_operand:SI 2 "const_int_operand" "")) 0))
4171 (clobber (match_scratch:SI 3 ""))]
4172 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4174 (zero_extend:SI (subreg:HI
4175 (lshiftrt:SI (match_dup 1)
4178 (compare:CC (match_dup 3)
4183 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4187 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4188 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4190 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4191 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4192 "includes_rshift_p (operands[2], GEN_INT (65535))"
4194 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4196 [(set_attr "type" "delayed_compare")
4197 (set_attr "length" "4,8")])
4200 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4204 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4205 (match_operand:SI 2 "const_int_operand" "")) 0))
4207 (set (match_operand:SI 0 "gpc_reg_operand" "")
4208 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4209 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4211 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4213 (compare:CC (match_dup 0)
4218 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4220 (match_operand:SI 1 "gpc_reg_operand" "r"))
4221 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4227 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4229 (match_operand:SI 1 "gpc_reg_operand" "r"))
4230 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4236 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4238 (match_operand:SI 1 "gpc_reg_operand" "r"))
4239 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4245 (define_expand "ashrsi3"
4246 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4247 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4248 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4253 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4255 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4259 (define_insn "ashrsi3_power"
4260 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4261 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4262 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4263 (clobber (match_scratch:SI 3 "=q,X"))]
4267 {srai|srawi} %0,%1,%h2")
4269 (define_insn "ashrsi3_no_power"
4270 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4271 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4272 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4274 "{sra|sraw}%I2 %0,%1,%h2")
4277 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4278 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4279 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4281 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4282 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4286 {srai.|srawi.} %3,%1,%h2
4289 [(set_attr "type" "delayed_compare")
4290 (set_attr "length" "4,4,8,8")])
4293 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4294 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4295 (match_operand:SI 2 "reg_or_cint_operand" ""))
4297 (clobber (match_scratch:SI 3 ""))
4298 (clobber (match_scratch:SI 4 ""))]
4299 "TARGET_POWER && reload_completed"
4300 [(parallel [(set (match_dup 3)
4301 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4302 (clobber (match_dup 4))])
4304 (compare:CC (match_dup 3)
4309 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4310 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4311 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4313 (clobber (match_scratch:SI 3 "=r,r"))]
4316 {sra|sraw}%I2. %3,%1,%h2
4318 [(set_attr "type" "delayed_compare")
4319 (set_attr "length" "4,8")])
4322 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4323 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4324 (match_operand:SI 2 "reg_or_cint_operand" ""))
4326 (clobber (match_scratch:SI 3 ""))]
4327 "! TARGET_POWER && reload_completed"
4329 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4331 (compare:CC (match_dup 3)
4336 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4337 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4338 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4340 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4341 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4342 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4346 {srai.|srawi.} %0,%1,%h2
4349 [(set_attr "type" "delayed_compare")
4350 (set_attr "length" "4,4,8,8")])
4353 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4354 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4355 (match_operand:SI 2 "reg_or_cint_operand" ""))
4357 (set (match_operand:SI 0 "gpc_reg_operand" "")
4358 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4359 (clobber (match_scratch:SI 4 ""))]
4360 "TARGET_POWER && reload_completed"
4361 [(parallel [(set (match_dup 0)
4362 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4363 (clobber (match_dup 4))])
4365 (compare:CC (match_dup 0)
4370 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4371 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4372 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4374 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4375 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4378 {sra|sraw}%I2. %0,%1,%h2
4380 [(set_attr "type" "delayed_compare")
4381 (set_attr "length" "4,8")])
4384 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4385 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4386 (match_operand:SI 2 "reg_or_cint_operand" ""))
4388 (set (match_operand:SI 0 "gpc_reg_operand" "")
4389 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4390 "! TARGET_POWER && reload_completed"
4392 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4394 (compare:CC (match_dup 0)
4398 ;; Floating-point insns, excluding normal data motion.
4400 ;; PowerPC has a full set of single-precision floating point instructions.
4402 ;; For the POWER architecture, we pretend that we have both SFmode and
4403 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4404 ;; The only conversions we will do will be when storing to memory. In that
4405 ;; case, we will use the "frsp" instruction before storing.
4407 ;; Note that when we store into a single-precision memory location, we need to
4408 ;; use the frsp insn first. If the register being stored isn't dead, we
4409 ;; need a scratch register for the frsp. But this is difficult when the store
4410 ;; is done by reload. It is not incorrect to do the frsp on the register in
4411 ;; this case, we just lose precision that we would have otherwise gotten but
4412 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4414 (define_insn "extendsfdf2"
4415 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4416 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4417 "TARGET_HARD_FLOAT && TARGET_FPRS"
4420 if (REGNO (operands[0]) == REGNO (operands[1]))
4423 return \"fmr %0,%1\";
4425 [(set_attr "type" "fp")])
4427 (define_insn "truncdfsf2"
4428 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4429 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4430 "TARGET_HARD_FLOAT && TARGET_FPRS"
4432 [(set_attr "type" "fp")])
4434 (define_insn "aux_truncdfsf2"
4435 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4436 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4437 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4439 [(set_attr "type" "fp")])
4441 (define_expand "negsf2"
4442 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4443 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4447 (define_insn "*negsf2"
4448 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4449 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4450 "TARGET_HARD_FLOAT && TARGET_FPRS"
4452 [(set_attr "type" "fp")])
4454 (define_expand "abssf2"
4455 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4456 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4460 (define_insn "*abssf2"
4461 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4462 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4463 "TARGET_HARD_FLOAT && TARGET_FPRS"
4465 [(set_attr "type" "fp")])
4468 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4469 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4470 "TARGET_HARD_FLOAT && TARGET_FPRS"
4472 [(set_attr "type" "fp")])
4474 (define_expand "addsf3"
4475 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4476 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4477 (match_operand:SF 2 "gpc_reg_operand" "")))]
4482 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4483 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4484 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4485 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4487 [(set_attr "type" "fp")])
4490 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4491 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4492 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4493 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4494 "{fa|fadd} %0,%1,%2"
4495 [(set_attr "type" "fp")])
4497 (define_expand "subsf3"
4498 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4499 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4500 (match_operand:SF 2 "gpc_reg_operand" "")))]
4505 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4506 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4507 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4508 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4510 [(set_attr "type" "fp")])
4513 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4514 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4515 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4516 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4517 "{fs|fsub} %0,%1,%2"
4518 [(set_attr "type" "fp")])
4520 (define_expand "mulsf3"
4521 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4522 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4523 (match_operand:SF 2 "gpc_reg_operand" "")))]
4528 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4529 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4530 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4531 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4533 [(set_attr "type" "fp")])
4536 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4537 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4538 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4539 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4540 "{fm|fmul} %0,%1,%2"
4541 [(set_attr "type" "dmul")])
4543 (define_expand "divsf3"
4544 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4545 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4546 (match_operand:SF 2 "gpc_reg_operand" "")))]
4551 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4552 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4553 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4554 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4556 [(set_attr "type" "sdiv")])
4559 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4560 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4561 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4562 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4563 "{fd|fdiv} %0,%1,%2"
4564 [(set_attr "type" "ddiv")])
4567 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4568 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4569 (match_operand:SF 2 "gpc_reg_operand" "f"))
4570 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4571 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4572 "fmadds %0,%1,%2,%3"
4573 [(set_attr "type" "fp")])
4576 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4577 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4578 (match_operand:SF 2 "gpc_reg_operand" "f"))
4579 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4580 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4581 "{fma|fmadd} %0,%1,%2,%3"
4582 [(set_attr "type" "dmul")])
4585 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4586 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4587 (match_operand:SF 2 "gpc_reg_operand" "f"))
4588 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4589 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4590 "fmsubs %0,%1,%2,%3"
4591 [(set_attr "type" "fp")])
4594 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4595 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4596 (match_operand:SF 2 "gpc_reg_operand" "f"))
4597 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4598 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4599 "{fms|fmsub} %0,%1,%2,%3"
4600 [(set_attr "type" "dmul")])
4603 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4604 (neg:SF (plus: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 "fnmadds %0,%1,%2,%3"
4610 [(set_attr "type" "fp")])
4613 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4614 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4615 (match_operand:SF 2 "gpc_reg_operand" "f"))
4616 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4617 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4618 && ! HONOR_SIGNED_ZEROS (SFmode)"
4619 "fnmadds %0,%1,%2,%3"
4620 [(set_attr "type" "fp")])
4623 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4624 (neg:SF (plus: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 "{fnma|fnmadd} %0,%1,%2,%3"
4629 [(set_attr "type" "dmul")])
4632 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4633 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4634 (match_operand:SF 2 "gpc_reg_operand" "f"))
4635 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4636 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4637 && ! HONOR_SIGNED_ZEROS (SFmode)"
4638 "{fnma|fnmadd} %0,%1,%2,%3"
4639 [(set_attr "type" "dmul")])
4642 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4643 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4644 (match_operand:SF 2 "gpc_reg_operand" "f"))
4645 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4646 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4647 && HONOR_SIGNED_ZEROS (SFmode)"
4648 "fnmsubs %0,%1,%2,%3"
4649 [(set_attr "type" "fp")])
4652 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4653 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4654 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4655 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4656 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4657 && ! HONOR_SIGNED_ZEROS (SFmode)"
4658 "fnmsubs %0,%1,%2,%3"
4659 [(set_attr "type" "fp")])
4662 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4663 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4664 (match_operand:SF 2 "gpc_reg_operand" "f"))
4665 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4666 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4667 "{fnms|fnmsub} %0,%1,%2,%3"
4668 [(set_attr "type" "dmul")])
4671 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4672 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4673 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4674 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4675 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4676 && ! HONOR_SIGNED_ZEROS (SFmode)"
4677 "{fnms|fnmsub} %0,%1,%2,%3"
4678 [(set_attr "type" "fp")])
4680 (define_expand "sqrtsf2"
4681 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4682 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4683 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4687 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4688 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4689 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4691 [(set_attr "type" "ssqrt")])
4694 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4695 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4696 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4698 [(set_attr "type" "dsqrt")])
4700 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4701 ;; fsel instruction and some auxiliary computations. Then we just have a
4702 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4704 (define_expand "maxsf3"
4705 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4706 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4707 (match_operand:SF 2 "gpc_reg_operand" ""))
4710 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4711 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4713 (define_expand "minsf3"
4714 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4715 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4716 (match_operand:SF 2 "gpc_reg_operand" ""))
4719 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4720 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4723 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4724 (match_operator:SF 3 "min_max_operator"
4725 [(match_operand:SF 1 "gpc_reg_operand" "")
4726 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4727 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4730 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4731 operands[1], operands[2]);
4735 (define_expand "movsicc"
4736 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4737 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4738 (match_operand:SI 2 "gpc_reg_operand" "")
4739 (match_operand:SI 3 "gpc_reg_operand" "")))]
4743 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4749 ;; We use the BASE_REGS for the isel input operands because, if rA is
4750 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4751 ;; because we may switch the operands and rB may end up being rA.
4753 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4754 ;; leave out the mode in operand 4 and use one pattern, but reload can
4755 ;; change the mode underneath our feet and then gets confused trying
4756 ;; to reload the value.
4757 (define_insn "isel_signed"
4758 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4760 (match_operator 1 "comparison_operator"
4761 [(match_operand:CC 4 "cc_reg_operand" "y")
4763 (match_operand:SI 2 "gpc_reg_operand" "b")
4764 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4767 { return output_isel (operands); }"
4768 [(set_attr "length" "4")])
4770 (define_insn "isel_unsigned"
4771 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4773 (match_operator 1 "comparison_operator"
4774 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4776 (match_operand:SI 2 "gpc_reg_operand" "b")
4777 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4780 { return output_isel (operands); }"
4781 [(set_attr "length" "4")])
4783 (define_expand "movsfcc"
4784 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4785 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4786 (match_operand:SF 2 "gpc_reg_operand" "")
4787 (match_operand:SF 3 "gpc_reg_operand" "")))]
4788 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4791 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4797 (define_insn "*fselsfsf4"
4798 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4799 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4800 (match_operand:SF 4 "zero_fp_constant" "F"))
4801 (match_operand:SF 2 "gpc_reg_operand" "f")
4802 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4803 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4805 [(set_attr "type" "fp")])
4807 (define_insn "*fseldfsf4"
4808 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4809 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4810 (match_operand:DF 4 "zero_fp_constant" "F"))
4811 (match_operand:SF 2 "gpc_reg_operand" "f")
4812 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4813 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4815 [(set_attr "type" "fp")])
4817 (define_insn "negdf2"
4818 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4819 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4820 "TARGET_HARD_FLOAT && TARGET_FPRS"
4822 [(set_attr "type" "fp")])
4824 (define_insn "absdf2"
4825 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4826 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4827 "TARGET_HARD_FLOAT && TARGET_FPRS"
4829 [(set_attr "type" "fp")])
4832 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4833 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4834 "TARGET_HARD_FLOAT && TARGET_FPRS"
4836 [(set_attr "type" "fp")])
4838 (define_insn "adddf3"
4839 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4840 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4841 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4842 "TARGET_HARD_FLOAT && TARGET_FPRS"
4843 "{fa|fadd} %0,%1,%2"
4844 [(set_attr "type" "fp")])
4846 (define_insn "subdf3"
4847 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4848 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4849 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4850 "TARGET_HARD_FLOAT && TARGET_FPRS"
4851 "{fs|fsub} %0,%1,%2"
4852 [(set_attr "type" "fp")])
4854 (define_insn "muldf3"
4855 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4856 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4857 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4858 "TARGET_HARD_FLOAT && TARGET_FPRS"
4859 "{fm|fmul} %0,%1,%2"
4860 [(set_attr "type" "dmul")])
4862 (define_insn "divdf3"
4863 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4864 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4865 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4866 "TARGET_HARD_FLOAT && TARGET_FPRS"
4867 "{fd|fdiv} %0,%1,%2"
4868 [(set_attr "type" "ddiv")])
4871 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4872 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4873 (match_operand:DF 2 "gpc_reg_operand" "f"))
4874 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4875 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4876 "{fma|fmadd} %0,%1,%2,%3"
4877 [(set_attr "type" "dmul")])
4880 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4881 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4882 (match_operand:DF 2 "gpc_reg_operand" "f"))
4883 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4884 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4885 "{fms|fmsub} %0,%1,%2,%3"
4886 [(set_attr "type" "dmul")])
4889 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4890 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4891 (match_operand:DF 2 "gpc_reg_operand" "f"))
4892 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4893 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4894 && HONOR_SIGNED_ZEROS (DFmode)"
4895 "{fnma|fnmadd} %0,%1,%2,%3"
4896 [(set_attr "type" "dmul")])
4899 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4900 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
4901 (match_operand:DF 2 "gpc_reg_operand" "f"))
4902 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4903 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4904 && ! HONOR_SIGNED_ZEROS (DFmode)"
4905 "{fnma|fnmadd} %0,%1,%2,%3"
4906 [(set_attr "type" "dmul")])
4909 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4910 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4911 (match_operand:DF 2 "gpc_reg_operand" "f"))
4912 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4913 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4914 && HONOR_SIGNED_ZEROS (DFmode)"
4915 "{fnms|fnmsub} %0,%1,%2,%3"
4916 [(set_attr "type" "dmul")])
4919 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4920 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
4921 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4922 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
4923 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4924 && ! HONOR_SIGNED_ZEROS (DFmode)"
4925 "{fnms|fnmsub} %0,%1,%2,%3"
4926 [(set_attr "type" "dmul")])
4928 (define_insn "sqrtdf2"
4929 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4930 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4931 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4933 [(set_attr "type" "dsqrt")])
4935 ;; The conditional move instructions allow us to perform max and min
4936 ;; operations even when
4938 (define_expand "maxdf3"
4939 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4940 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4941 (match_operand:DF 2 "gpc_reg_operand" ""))
4944 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4945 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4947 (define_expand "mindf3"
4948 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4949 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4950 (match_operand:DF 2 "gpc_reg_operand" ""))
4953 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4954 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4957 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4958 (match_operator:DF 3 "min_max_operator"
4959 [(match_operand:DF 1 "gpc_reg_operand" "")
4960 (match_operand:DF 2 "gpc_reg_operand" "")]))]
4961 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4964 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4965 operands[1], operands[2]);
4969 (define_expand "movdfcc"
4970 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4971 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4972 (match_operand:DF 2 "gpc_reg_operand" "")
4973 (match_operand:DF 3 "gpc_reg_operand" "")))]
4974 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4977 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4983 (define_insn "*fseldfdf4"
4984 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4985 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4986 (match_operand:DF 4 "zero_fp_constant" "F"))
4987 (match_operand:DF 2 "gpc_reg_operand" "f")
4988 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4989 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4991 [(set_attr "type" "fp")])
4993 (define_insn "*fselsfdf4"
4994 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4995 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4996 (match_operand:SF 4 "zero_fp_constant" "F"))
4997 (match_operand:DF 2 "gpc_reg_operand" "f")
4998 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5001 [(set_attr "type" "fp")])
5003 ;; Conversions to and from floating-point.
5005 (define_expand "fixuns_truncsfsi2"
5006 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5007 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5008 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5011 (define_expand "fix_truncsfsi2"
5012 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5013 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5014 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5017 ; For each of these conversions, there is a define_expand, a define_insn
5018 ; with a '#' template, and a define_split (with C code). The idea is
5019 ; to allow constant folding with the template of the define_insn,
5020 ; then to have the insns split later (between sched1 and final).
5022 (define_expand "floatsidf2"
5023 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5024 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5027 (clobber (match_dup 4))
5028 (clobber (match_dup 5))
5029 (clobber (match_dup 6))])]
5030 "TARGET_HARD_FLOAT && TARGET_FPRS"
5033 if (TARGET_POWERPC64)
5035 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5036 rtx t1 = gen_reg_rtx (DImode);
5037 rtx t2 = gen_reg_rtx (DImode);
5038 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5042 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5043 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5044 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5045 operands[5] = gen_reg_rtx (DFmode);
5046 operands[6] = gen_reg_rtx (SImode);
5049 (define_insn "*floatsidf2_internal"
5050 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5051 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5052 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5053 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5054 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5055 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5056 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5057 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5059 [(set_attr "length" "24")])
5062 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5063 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5064 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5065 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5066 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5067 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5068 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5069 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5070 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5071 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5072 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5073 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5074 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5075 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5076 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5079 rtx lowword, highword;
5080 if (GET_CODE (operands[4]) != MEM)
5082 highword = XEXP (operands[4], 0);
5083 lowword = plus_constant (highword, 4);
5084 if (! WORDS_BIG_ENDIAN)
5087 tmp = highword; highword = lowword; lowword = tmp;
5090 emit_insn (gen_xorsi3 (operands[6], operands[1],
5091 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5092 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5093 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5094 emit_move_insn (operands[5], operands[4]);
5095 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5099 (define_expand "floatunssisf2"
5100 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5101 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5102 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5105 (define_expand "floatunssidf2"
5106 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5107 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5110 (clobber (match_dup 4))
5111 (clobber (match_dup 5))])]
5112 "TARGET_HARD_FLOAT && TARGET_FPRS"
5115 if (TARGET_POWERPC64)
5117 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5118 rtx t1 = gen_reg_rtx (DImode);
5119 rtx t2 = gen_reg_rtx (DImode);
5120 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5125 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5126 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5127 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5128 operands[5] = gen_reg_rtx (DFmode);
5131 (define_insn "*floatunssidf2_internal"
5132 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5133 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5134 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5135 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5136 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5137 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5138 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5140 [(set_attr "length" "20")])
5143 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5144 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5145 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5146 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5147 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5148 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5149 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5150 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5151 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5152 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5153 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5154 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5155 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5158 rtx lowword, highword;
5159 if (GET_CODE (operands[4]) != MEM)
5161 highword = XEXP (operands[4], 0);
5162 lowword = plus_constant (highword, 4);
5163 if (! WORDS_BIG_ENDIAN)
5166 tmp = highword; highword = lowword; lowword = tmp;
5169 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5170 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5171 emit_move_insn (operands[5], operands[4]);
5172 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5176 (define_expand "fix_truncdfsi2"
5177 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5178 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5179 (clobber (match_dup 2))
5180 (clobber (match_dup 3))])]
5181 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5184 operands[2] = gen_reg_rtx (DImode);
5185 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5188 (define_insn "*fix_truncdfsi2_internal"
5189 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5190 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5191 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5192 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5193 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5195 [(set_attr "length" "16")])
5198 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5199 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5200 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5201 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5202 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5203 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5204 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5205 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5206 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5210 if (GET_CODE (operands[3]) != MEM)
5212 lowword = XEXP (operands[3], 0);
5213 if (WORDS_BIG_ENDIAN)
5214 lowword = plus_constant (lowword, 4);
5216 emit_insn (gen_fctiwz (operands[2], operands[1]));
5217 emit_move_insn (operands[3], operands[2]);
5218 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5222 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5223 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5224 ; because the first makes it clear that operand 0 is not live
5225 ; before the instruction.
5226 (define_insn "fctiwz"
5227 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5228 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5230 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5231 "{fcirz|fctiwz} %0,%1"
5232 [(set_attr "type" "fp")])
5234 (define_expand "floatsisf2"
5235 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5236 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5237 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5240 (define_insn "floatdidf2"
5241 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5242 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5243 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5245 [(set_attr "type" "fp")])
5247 (define_insn_and_split "floatsidf_ppc64"
5248 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5249 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5250 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5251 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5252 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5253 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5256 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5257 (set (match_dup 2) (match_dup 3))
5258 (set (match_dup 4) (match_dup 2))
5259 (set (match_dup 0) (float:DF (match_dup 4)))]
5262 (define_insn_and_split "floatunssidf_ppc64"
5263 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5264 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5265 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5266 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5267 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5268 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5271 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5272 (set (match_dup 2) (match_dup 3))
5273 (set (match_dup 4) (match_dup 2))
5274 (set (match_dup 0) (float:DF (match_dup 4)))]
5277 (define_insn "fix_truncdfdi2"
5278 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5279 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5280 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5282 [(set_attr "type" "fp")])
5284 (define_expand "floatdisf2"
5285 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5286 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5287 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_FPRS"
5290 if (!flag_unsafe_math_optimizations)
5292 rtx label = gen_label_rtx ();
5293 emit_insn (gen_floatdisf2_internal2 (operands[1], label));
5296 emit_insn (gen_floatdisf2_internal1 (operands[0], operands[1]));
5300 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5301 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5302 ;; from double rounding.
5303 (define_insn_and_split "floatdisf2_internal1"
5304 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5305 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5306 (clobber (match_scratch:DF 2 "=f"))]
5307 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5309 "&& reload_completed"
5311 (float:DF (match_dup 1)))
5313 (float_truncate:SF (match_dup 2)))]
5316 ;; Twiddles bits to avoid double rounding.
5317 ;; Bits that might be truncated when converting to DFmode are replaced
5318 ;; by a bit that won't be lost at that stage, but is below the SFmode
5319 ;; rounding position.
5320 (define_expand "floatdisf2_internal2"
5321 [(parallel [(set (match_dup 4)
5322 (compare:CC (and:DI (match_operand:DI 0 "" "")
5325 (set (match_dup 2) (and:DI (match_dup 0) (const_int 2047)))
5326 (clobber (match_scratch:CC 7 ""))])
5327 (set (match_dup 3) (ashiftrt:DI (match_dup 0) (const_int 53)))
5328 (set (match_dup 3) (plus:DI (match_dup 3) (const_int 1)))
5329 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
5330 (label_ref (match_operand:DI 1 "" ""))
5332 (set (match_dup 5) (compare:CCUNS (match_dup 3) (const_int 2)))
5333 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
5334 (label_ref (match_dup 1))
5336 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 2)))
5337 (set (match_dup 0) (ior:DI (match_dup 0) (const_int 2048)))]
5338 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_FPRS"
5341 operands[2] = gen_reg_rtx (DImode);
5342 operands[3] = gen_reg_rtx (DImode);
5343 operands[4] = gen_reg_rtx (CCmode);
5344 operands[5] = gen_reg_rtx (CCUNSmode);
5347 ;; Define the DImode operations that can be done in a small number
5348 ;; of instructions. The & constraints are to prevent the register
5349 ;; allocator from allocating registers that overlap with the inputs
5350 ;; (for example, having an input in 7,8 and an output in 6,7). We
5351 ;; also allow for the output being the same as one of the inputs.
5353 (define_insn "*adddi3_noppc64"
5354 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5355 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5356 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5357 "! TARGET_POWERPC64"
5360 if (WORDS_BIG_ENDIAN)
5361 return (GET_CODE (operands[2])) != CONST_INT
5362 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5363 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5365 return (GET_CODE (operands[2])) != CONST_INT
5366 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5367 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5369 [(set_attr "length" "8")])
5371 (define_insn "*subdi3_noppc64"
5372 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5373 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5374 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5375 "! TARGET_POWERPC64"
5378 if (WORDS_BIG_ENDIAN)
5379 return (GET_CODE (operands[1]) != CONST_INT)
5380 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5381 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5383 return (GET_CODE (operands[1]) != CONST_INT)
5384 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5385 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5387 [(set_attr "length" "8")])
5389 (define_insn "*negdi2_noppc64"
5390 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5391 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5392 "! TARGET_POWERPC64"
5395 return (WORDS_BIG_ENDIAN)
5396 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5397 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5399 [(set_attr "length" "8")])
5401 (define_expand "mulsidi3"
5402 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5403 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5404 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5405 "! TARGET_POWERPC64"
5408 if (! TARGET_POWER && ! TARGET_POWERPC)
5410 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5411 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5412 emit_insn (gen_mull_call ());
5413 if (WORDS_BIG_ENDIAN)
5414 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5417 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5418 gen_rtx_REG (SImode, 3));
5419 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5420 gen_rtx_REG (SImode, 4));
5424 else if (TARGET_POWER)
5426 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5431 (define_insn "mulsidi3_mq"
5432 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5433 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5434 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5435 (clobber (match_scratch:SI 3 "=q"))]
5437 "mul %0,%1,%2\;mfmq %L0"
5438 [(set_attr "type" "imul")
5439 (set_attr "length" "8")])
5441 (define_insn "*mulsidi3_no_mq"
5442 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5443 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5444 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5445 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5448 return (WORDS_BIG_ENDIAN)
5449 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5450 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5452 [(set_attr "type" "imul")
5453 (set_attr "length" "8")])
5456 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5457 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5458 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5459 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5462 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5463 (sign_extend:DI (match_dup 2)))
5466 (mult:SI (match_dup 1)
5470 int endian = (WORDS_BIG_ENDIAN == 0);
5471 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5472 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5475 (define_expand "umulsidi3"
5476 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5477 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5478 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5479 "TARGET_POWERPC && ! TARGET_POWERPC64"
5484 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5489 (define_insn "umulsidi3_mq"
5490 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5491 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5492 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5493 (clobber (match_scratch:SI 3 "=q"))]
5494 "TARGET_POWERPC && TARGET_POWER"
5497 return (WORDS_BIG_ENDIAN)
5498 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5499 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5501 [(set_attr "type" "imul")
5502 (set_attr "length" "8")])
5504 (define_insn "*umulsidi3_no_mq"
5505 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5506 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5507 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5508 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5511 return (WORDS_BIG_ENDIAN)
5512 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5513 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5515 [(set_attr "type" "imul")
5516 (set_attr "length" "8")])
5519 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5520 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5521 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5522 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5525 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5526 (zero_extend:DI (match_dup 2)))
5529 (mult:SI (match_dup 1)
5533 int endian = (WORDS_BIG_ENDIAN == 0);
5534 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5535 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5538 (define_expand "smulsi3_highpart"
5539 [(set (match_operand:SI 0 "gpc_reg_operand" "")
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")))
5549 if (! TARGET_POWER && ! TARGET_POWERPC)
5551 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5552 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5553 emit_insn (gen_mulh_call ());
5554 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5557 else if (TARGET_POWER)
5559 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5564 (define_insn "smulsi3_highpart_mq"
5565 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5567 (lshiftrt:DI (mult:DI (sign_extend:DI
5568 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5570 (match_operand:SI 2 "gpc_reg_operand" "r")))
5572 (clobber (match_scratch:SI 3 "=q"))]
5575 [(set_attr "type" "imul")])
5577 (define_insn "*smulsi3_highpart_no_mq"
5578 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5580 (lshiftrt:DI (mult:DI (sign_extend:DI
5581 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5583 (match_operand:SI 2 "gpc_reg_operand" "r")))
5585 "TARGET_POWERPC && ! TARGET_POWER"
5587 [(set_attr "type" "imul")])
5589 (define_expand "umulsi3_highpart"
5590 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5592 (lshiftrt:DI (mult:DI (zero_extend:DI
5593 (match_operand:SI 1 "gpc_reg_operand" ""))
5595 (match_operand:SI 2 "gpc_reg_operand" "")))
5602 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5607 (define_insn "umulsi3_highpart_mq"
5608 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5610 (lshiftrt:DI (mult:DI (zero_extend:DI
5611 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5613 (match_operand:SI 2 "gpc_reg_operand" "r")))
5615 (clobber (match_scratch:SI 3 "=q"))]
5616 "TARGET_POWERPC && TARGET_POWER"
5618 [(set_attr "type" "imul")])
5620 (define_insn "*umulsi3_highpart_no_mq"
5621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5623 (lshiftrt:DI (mult:DI (zero_extend:DI
5624 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5626 (match_operand:SI 2 "gpc_reg_operand" "r")))
5628 "TARGET_POWERPC && ! TARGET_POWER"
5630 [(set_attr "type" "imul")])
5632 ;; If operands 0 and 2 are in the same register, we have a problem. But
5633 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5634 ;; why we have the strange constraints below.
5635 (define_insn "ashldi3_power"
5636 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5637 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5638 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5639 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5642 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5643 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5644 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5645 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5646 [(set_attr "length" "8")])
5648 (define_insn "lshrdi3_power"
5649 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5650 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5651 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5652 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5655 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5656 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5657 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5658 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5659 [(set_attr "length" "8")])
5661 ;; Shift by a variable amount is too complex to be worth open-coding. We
5662 ;; just handle shifts by constants.
5663 (define_insn "ashrdi3_power"
5664 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5665 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5666 (match_operand:SI 2 "const_int_operand" "M,i")))
5667 (clobber (match_scratch:SI 3 "=X,q"))]
5670 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5671 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5672 [(set_attr "length" "8")])
5674 (define_insn "ashrdi3_no_power"
5675 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5676 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5677 (match_operand:SI 2 "const_int_operand" "M,i")))]
5678 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5680 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5681 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5682 [(set_attr "length" "8,12")])
5684 (define_insn "*ashrdisi3_noppc64"
5685 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5686 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5687 (const_int 32)) 4))]
5688 "TARGET_32BIT && !TARGET_POWERPC64"
5691 if (REGNO (operands[0]) == REGNO (operands[1]))
5694 return \"mr %0,%1\";
5696 [(set_attr "length" "4")])
5699 ;; PowerPC64 DImode operations.
5701 (define_expand "adddi3"
5702 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5703 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5704 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5708 if (! TARGET_POWERPC64)
5710 if (non_short_cint_operand (operands[2], DImode))
5714 if (GET_CODE (operands[2]) == CONST_INT
5715 && ! add_operand (operands[2], DImode))
5717 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5718 ? operands[0] : gen_reg_rtx (DImode));
5720 HOST_WIDE_INT val = INTVAL (operands[2]);
5721 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5722 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5724 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5727 /* The ordering here is important for the prolog expander.
5728 When space is allocated from the stack, adding 'low' first may
5729 produce a temporary deallocation (which would be bad). */
5730 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5731 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5736 ;; Discourage ai/addic because of carry but provide it in an alternative
5737 ;; allowing register zero as source.
5739 (define_insn "*adddi3_internal1"
5740 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5741 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5742 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5750 (define_insn "*adddi3_internal2"
5751 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5752 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5753 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5755 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5762 [(set_attr "type" "fast_compare,compare,compare,compare")
5763 (set_attr "length" "4,4,8,8")])
5766 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5767 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5768 (match_operand:DI 2 "reg_or_short_operand" ""))
5770 (clobber (match_scratch:DI 3 ""))]
5771 "TARGET_POWERPC64 && reload_completed"
5773 (plus:DI (match_dup 1) (match_dup 2)))
5775 (compare:CC (match_dup 3)
5779 (define_insn "*adddi3_internal3"
5780 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5781 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5782 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5784 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5785 (plus:DI (match_dup 1) (match_dup 2)))]
5792 [(set_attr "type" "fast_compare,compare,compare,compare")
5793 (set_attr "length" "4,4,8,8")])
5796 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5797 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5798 (match_operand:DI 2 "reg_or_short_operand" ""))
5800 (set (match_operand:DI 0 "gpc_reg_operand" "")
5801 (plus:DI (match_dup 1) (match_dup 2)))]
5802 "TARGET_POWERPC64 && reload_completed"
5804 (plus:DI (match_dup 1) (match_dup 2)))
5806 (compare:CC (match_dup 0)
5810 ;; Split an add that we can't do in one insn into two insns, each of which
5811 ;; does one 16-bit part. This is used by combine. Note that the low-order
5812 ;; add should be last in case the result gets used in an address.
5815 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5816 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5817 (match_operand:DI 2 "non_add_cint_operand" "")))]
5819 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5820 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5823 HOST_WIDE_INT val = INTVAL (operands[2]);
5824 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5825 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5827 operands[4] = GEN_INT (low);
5828 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5829 operands[3] = GEN_INT (rest);
5830 else if (! no_new_pseudos)
5832 operands[3] = gen_reg_rtx (DImode);
5833 emit_move_insn (operands[3], operands[2]);
5834 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5841 (define_insn "one_cmpldi2"
5842 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5843 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5849 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5851 (clobber (match_scratch:DI 2 "=r,r"))]
5856 [(set_attr "type" "compare")
5857 (set_attr "length" "4,8")])
5860 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5861 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5863 (clobber (match_scratch:DI 2 ""))]
5864 "TARGET_POWERPC64 && reload_completed"
5866 (not:DI (match_dup 1)))
5868 (compare:CC (match_dup 2)
5873 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5874 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5876 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5877 (not:DI (match_dup 1)))]
5882 [(set_attr "type" "compare")
5883 (set_attr "length" "4,8")])
5886 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5887 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5889 (set (match_operand:DI 0 "gpc_reg_operand" "")
5890 (not:DI (match_dup 1)))]
5891 "TARGET_POWERPC64 && reload_completed"
5893 (not:DI (match_dup 1)))
5895 (compare:CC (match_dup 0)
5900 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5901 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
5902 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
5909 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5910 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5911 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5913 (clobber (match_scratch:DI 3 "=r,r"))]
5918 [(set_attr "type" "fast_compare")
5919 (set_attr "length" "4,8")])
5922 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5923 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5924 (match_operand:DI 2 "gpc_reg_operand" ""))
5926 (clobber (match_scratch:DI 3 ""))]
5927 "TARGET_POWERPC64 && reload_completed"
5929 (minus:DI (match_dup 1) (match_dup 2)))
5931 (compare:CC (match_dup 3)
5936 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5937 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5938 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5940 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5941 (minus:DI (match_dup 1) (match_dup 2)))]
5946 [(set_attr "type" "fast_compare")
5947 (set_attr "length" "4,8")])
5950 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5951 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5952 (match_operand:DI 2 "gpc_reg_operand" ""))
5954 (set (match_operand:DI 0 "gpc_reg_operand" "")
5955 (minus:DI (match_dup 1) (match_dup 2)))]
5956 "TARGET_POWERPC64 && reload_completed"
5958 (minus:DI (match_dup 1) (match_dup 2)))
5960 (compare:CC (match_dup 0)
5964 (define_expand "subdi3"
5965 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5966 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
5967 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
5971 if (GET_CODE (operands[2]) == CONST_INT)
5973 emit_insn (gen_adddi3 (operands[0], operands[1],
5974 negate_rtx (DImode, operands[2])));
5979 (define_insn_and_split "absdi2"
5980 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5981 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5982 (clobber (match_scratch:DI 2 "=&r,&r"))]
5985 "&& reload_completed"
5986 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5987 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5988 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5991 (define_insn_and_split "*nabsdi2"
5992 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5993 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5994 (clobber (match_scratch:DI 2 "=&r,&r"))]
5997 "&& reload_completed"
5998 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5999 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6000 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6003 (define_expand "negdi2"
6004 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6005 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
6010 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6011 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6016 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6017 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6019 (clobber (match_scratch:DI 2 "=r,r"))]
6024 [(set_attr "type" "fast_compare")
6025 (set_attr "length" "4,8")])
6028 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6029 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6031 (clobber (match_scratch:DI 2 ""))]
6032 "TARGET_POWERPC64 && reload_completed"
6034 (neg:DI (match_dup 1)))
6036 (compare:CC (match_dup 2)
6041 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6042 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6044 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6045 (neg:DI (match_dup 1)))]
6050 [(set_attr "type" "fast_compare")
6051 (set_attr "length" "4,8")])
6054 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6055 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6057 (set (match_operand:DI 0 "gpc_reg_operand" "")
6058 (neg:DI (match_dup 1)))]
6059 "TARGET_POWERPC64 && reload_completed"
6061 (neg:DI (match_dup 1)))
6063 (compare:CC (match_dup 0)
6067 (define_insn "clzdi2"
6068 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6069 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6073 (define_expand "ctzdi2"
6075 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6076 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6078 (clobber (scratch:CC))])
6079 (set (match_dup 4) (clz:DI (match_dup 3)))
6080 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6081 (minus:DI (const_int 63) (match_dup 4)))]
6084 operands[2] = gen_reg_rtx (DImode);
6085 operands[3] = gen_reg_rtx (DImode);
6086 operands[4] = gen_reg_rtx (DImode);
6089 (define_expand "ffsdi2"
6091 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6092 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6094 (clobber (scratch:CC))])
6095 (set (match_dup 4) (clz:DI (match_dup 3)))
6096 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6097 (minus:DI (const_int 64) (match_dup 4)))]
6100 operands[2] = gen_reg_rtx (DImode);
6101 operands[3] = gen_reg_rtx (DImode);
6102 operands[4] = gen_reg_rtx (DImode);
6105 (define_insn "muldi3"
6106 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6107 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6108 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6111 [(set_attr "type" "lmul")])
6113 (define_insn "*muldi3_internal1"
6114 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6115 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6116 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6118 (clobber (match_scratch:DI 3 "=r,r"))]
6123 [(set_attr "type" "lmul_compare")
6124 (set_attr "length" "4,8")])
6127 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6128 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6129 (match_operand:DI 2 "gpc_reg_operand" ""))
6131 (clobber (match_scratch:DI 3 ""))]
6132 "TARGET_POWERPC64 && reload_completed"
6134 (mult:DI (match_dup 1) (match_dup 2)))
6136 (compare:CC (match_dup 3)
6140 (define_insn "*muldi3_internal2"
6141 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6142 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6143 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6145 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6146 (mult:DI (match_dup 1) (match_dup 2)))]
6151 [(set_attr "type" "lmul_compare")
6152 (set_attr "length" "4,8")])
6155 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6156 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6157 (match_operand:DI 2 "gpc_reg_operand" ""))
6159 (set (match_operand:DI 0 "gpc_reg_operand" "")
6160 (mult:DI (match_dup 1) (match_dup 2)))]
6161 "TARGET_POWERPC64 && reload_completed"
6163 (mult:DI (match_dup 1) (match_dup 2)))
6165 (compare:CC (match_dup 0)
6169 (define_insn "smuldi3_highpart"
6170 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6172 (lshiftrt:TI (mult:TI (sign_extend:TI
6173 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6175 (match_operand:DI 2 "gpc_reg_operand" "r")))
6179 [(set_attr "type" "lmul")])
6181 (define_insn "umuldi3_highpart"
6182 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6184 (lshiftrt:TI (mult:TI (zero_extend:TI
6185 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6187 (match_operand:DI 2 "gpc_reg_operand" "r")))
6191 [(set_attr "type" "lmul")])
6193 (define_expand "divdi3"
6194 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6195 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6196 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6200 if (GET_CODE (operands[2]) == CONST_INT
6201 && INTVAL (operands[2]) > 0
6202 && exact_log2 (INTVAL (operands[2])) >= 0)
6205 operands[2] = force_reg (DImode, operands[2]);
6208 (define_expand "moddi3"
6209 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6210 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6211 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6219 if (GET_CODE (operands[2]) != CONST_INT
6220 || INTVAL (operands[2]) <= 0
6221 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6224 temp1 = gen_reg_rtx (DImode);
6225 temp2 = gen_reg_rtx (DImode);
6227 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6228 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6229 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6234 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6235 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6236 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6238 "sradi %0,%1,%p2\;addze %0,%0"
6239 [(set_attr "length" "8")])
6242 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6243 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6244 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6246 (clobber (match_scratch:DI 3 "=r,r"))]
6249 sradi %3,%1,%p2\;addze. %3,%3
6251 [(set_attr "type" "compare")
6252 (set_attr "length" "8,12")])
6255 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6256 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6257 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6259 (clobber (match_scratch:DI 3 ""))]
6260 "TARGET_POWERPC64 && reload_completed"
6262 (div:DI (match_dup 1) (match_dup 2)))
6264 (compare:CC (match_dup 3)
6269 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6270 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6271 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6273 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6274 (div:DI (match_dup 1) (match_dup 2)))]
6277 sradi %0,%1,%p2\;addze. %0,%0
6279 [(set_attr "type" "compare")
6280 (set_attr "length" "8,12")])
6283 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6284 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6285 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6287 (set (match_operand:DI 0 "gpc_reg_operand" "")
6288 (div:DI (match_dup 1) (match_dup 2)))]
6289 "TARGET_POWERPC64 && reload_completed"
6291 (div:DI (match_dup 1) (match_dup 2)))
6293 (compare:CC (match_dup 0)
6298 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6299 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6300 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6303 [(set_attr "type" "ldiv")])
6305 (define_insn "udivdi3"
6306 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6307 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6308 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6311 [(set_attr "type" "ldiv")])
6313 (define_insn "rotldi3"
6314 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6315 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6316 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6318 "rld%I2cl %0,%1,%H2,0")
6320 (define_insn "*rotldi3_internal2"
6321 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6322 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6323 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6325 (clobber (match_scratch:DI 3 "=r,r"))]
6328 rld%I2cl. %3,%1,%H2,0
6330 [(set_attr "type" "delayed_compare")
6331 (set_attr "length" "4,8")])
6334 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6335 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6336 (match_operand:DI 2 "reg_or_cint_operand" ""))
6338 (clobber (match_scratch:DI 3 ""))]
6339 "TARGET_POWERPC64 && reload_completed"
6341 (rotate:DI (match_dup 1) (match_dup 2)))
6343 (compare:CC (match_dup 3)
6347 (define_insn "*rotldi3_internal3"
6348 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6349 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6350 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6352 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6353 (rotate:DI (match_dup 1) (match_dup 2)))]
6356 rld%I2cl. %0,%1,%H2,0
6358 [(set_attr "type" "delayed_compare")
6359 (set_attr "length" "4,8")])
6362 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6363 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6364 (match_operand:DI 2 "reg_or_cint_operand" ""))
6366 (set (match_operand:DI 0 "gpc_reg_operand" "")
6367 (rotate:DI (match_dup 1) (match_dup 2)))]
6368 "TARGET_POWERPC64 && reload_completed"
6370 (rotate:DI (match_dup 1) (match_dup 2)))
6372 (compare:CC (match_dup 0)
6376 (define_insn "*rotldi3_internal4"
6377 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6378 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6379 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6380 (match_operand:DI 3 "mask64_operand" "n")))]
6382 "rld%I2c%B3 %0,%1,%H2,%S3")
6384 (define_insn "*rotldi3_internal5"
6385 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6387 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6388 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6389 (match_operand:DI 3 "mask64_operand" "n,n"))
6391 (clobber (match_scratch:DI 4 "=r,r"))]
6394 rld%I2c%B3. %4,%1,%H2,%S3
6396 [(set_attr "type" "delayed_compare")
6397 (set_attr "length" "4,8")])
6400 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6402 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6403 (match_operand:DI 2 "reg_or_cint_operand" ""))
6404 (match_operand:DI 3 "mask64_operand" ""))
6406 (clobber (match_scratch:DI 4 ""))]
6407 "TARGET_POWERPC64 && reload_completed"
6409 (and:DI (rotate:DI (match_dup 1)
6413 (compare:CC (match_dup 4)
6417 (define_insn "*rotldi3_internal6"
6418 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6420 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6421 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6422 (match_operand:DI 3 "mask64_operand" "n,n"))
6424 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6425 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6428 rld%I2c%B3. %0,%1,%H2,%S3
6430 [(set_attr "type" "delayed_compare")
6431 (set_attr "length" "4,8")])
6434 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6436 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6437 (match_operand:DI 2 "reg_or_cint_operand" ""))
6438 (match_operand:DI 3 "mask64_operand" ""))
6440 (set (match_operand:DI 0 "gpc_reg_operand" "")
6441 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6442 "TARGET_POWERPC64 && reload_completed"
6444 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6446 (compare:CC (match_dup 0)
6450 (define_insn "*rotldi3_internal7"
6451 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6454 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6455 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6457 "rld%I2cl %0,%1,%H2,56")
6459 (define_insn "*rotldi3_internal8"
6460 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6461 (compare:CC (zero_extend:DI
6463 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6464 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6466 (clobber (match_scratch:DI 3 "=r,r"))]
6469 rld%I2cl. %3,%1,%H2,56
6471 [(set_attr "type" "delayed_compare")
6472 (set_attr "length" "4,8")])
6475 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6476 (compare:CC (zero_extend:DI
6478 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6479 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6481 (clobber (match_scratch:DI 3 ""))]
6482 "TARGET_POWERPC64 && reload_completed"
6484 (zero_extend:DI (subreg:QI
6485 (rotate:DI (match_dup 1)
6488 (compare:CC (match_dup 3)
6492 (define_insn "*rotldi3_internal9"
6493 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6494 (compare:CC (zero_extend:DI
6496 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6497 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6499 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6500 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6503 rld%I2cl. %0,%1,%H2,56
6505 [(set_attr "type" "delayed_compare")
6506 (set_attr "length" "4,8")])
6509 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6510 (compare:CC (zero_extend:DI
6512 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6513 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6515 (set (match_operand:DI 0 "gpc_reg_operand" "")
6516 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6517 "TARGET_POWERPC64 && reload_completed"
6519 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6521 (compare:CC (match_dup 0)
6525 (define_insn "*rotldi3_internal10"
6526 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6529 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6530 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6532 "rld%I2cl %0,%1,%H2,48")
6534 (define_insn "*rotldi3_internal11"
6535 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6536 (compare:CC (zero_extend:DI
6538 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6539 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6541 (clobber (match_scratch:DI 3 "=r,r"))]
6544 rld%I2cl. %3,%1,%H2,48
6546 [(set_attr "type" "delayed_compare")
6547 (set_attr "length" "4,8")])
6550 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6551 (compare:CC (zero_extend:DI
6553 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6554 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6556 (clobber (match_scratch:DI 3 ""))]
6557 "TARGET_POWERPC64 && reload_completed"
6559 (zero_extend:DI (subreg:HI
6560 (rotate:DI (match_dup 1)
6563 (compare:CC (match_dup 3)
6567 (define_insn "*rotldi3_internal12"
6568 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6569 (compare:CC (zero_extend:DI
6571 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6572 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6574 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6575 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6578 rld%I2cl. %0,%1,%H2,48
6580 [(set_attr "type" "delayed_compare")
6581 (set_attr "length" "4,8")])
6584 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6585 (compare:CC (zero_extend:DI
6587 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6588 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6590 (set (match_operand:DI 0 "gpc_reg_operand" "")
6591 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6592 "TARGET_POWERPC64 && reload_completed"
6594 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6596 (compare:CC (match_dup 0)
6600 (define_insn "*rotldi3_internal13"
6601 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6604 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6605 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6607 "rld%I2cl %0,%1,%H2,32")
6609 (define_insn "*rotldi3_internal14"
6610 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6611 (compare:CC (zero_extend:DI
6613 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6614 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6616 (clobber (match_scratch:DI 3 "=r,r"))]
6619 rld%I2cl. %3,%1,%H2,32
6621 [(set_attr "type" "delayed_compare")
6622 (set_attr "length" "4,8")])
6625 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6626 (compare:CC (zero_extend:DI
6628 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6629 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6631 (clobber (match_scratch:DI 3 ""))]
6632 "TARGET_POWERPC64 && reload_completed"
6634 (zero_extend:DI (subreg:SI
6635 (rotate:DI (match_dup 1)
6638 (compare:CC (match_dup 3)
6642 (define_insn "*rotldi3_internal15"
6643 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6644 (compare:CC (zero_extend:DI
6646 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6647 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6649 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6650 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6653 rld%I2cl. %0,%1,%H2,32
6655 [(set_attr "type" "delayed_compare")
6656 (set_attr "length" "4,8")])
6659 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6660 (compare:CC (zero_extend:DI
6662 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6663 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6665 (set (match_operand:DI 0 "gpc_reg_operand" "")
6666 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6667 "TARGET_POWERPC64 && reload_completed"
6669 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6671 (compare:CC (match_dup 0)
6675 (define_expand "ashldi3"
6676 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6677 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6678 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6679 "TARGET_POWERPC64 || TARGET_POWER"
6682 if (TARGET_POWERPC64)
6684 else if (TARGET_POWER)
6686 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6693 (define_insn "*ashldi3_internal1"
6694 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6695 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6696 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6699 [(set_attr "length" "8")])
6701 (define_insn "*ashldi3_internal2"
6702 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6703 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6704 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6706 (clobber (match_scratch:DI 3 "=r,r"))]
6711 [(set_attr "type" "delayed_compare")
6712 (set_attr "length" "4,8")])
6715 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6716 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6717 (match_operand:SI 2 "reg_or_cint_operand" ""))
6719 (clobber (match_scratch:DI 3 ""))]
6720 "TARGET_POWERPC64 && reload_completed"
6722 (ashift:DI (match_dup 1) (match_dup 2)))
6724 (compare:CC (match_dup 3)
6728 (define_insn "*ashldi3_internal3"
6729 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6730 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6731 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6733 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6734 (ashift:DI (match_dup 1) (match_dup 2)))]
6739 [(set_attr "type" "delayed_compare")
6740 (set_attr "length" "4,8")])
6743 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6744 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6745 (match_operand:SI 2 "reg_or_cint_operand" ""))
6747 (set (match_operand:DI 0 "gpc_reg_operand" "")
6748 (ashift:DI (match_dup 1) (match_dup 2)))]
6749 "TARGET_POWERPC64 && reload_completed"
6751 (ashift:DI (match_dup 1) (match_dup 2)))
6753 (compare:CC (match_dup 0)
6757 (define_insn "*ashldi3_internal4"
6758 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6759 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6760 (match_operand:SI 2 "const_int_operand" "i"))
6761 (match_operand:DI 3 "const_int_operand" "n")))]
6762 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6763 "rldic %0,%1,%H2,%W3")
6765 (define_insn "ashldi3_internal5"
6766 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6768 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6769 (match_operand:SI 2 "const_int_operand" "i,i"))
6770 (match_operand:DI 3 "const_int_operand" "n,n"))
6772 (clobber (match_scratch:DI 4 "=r,r"))]
6773 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6775 rldic. %4,%1,%H2,%W3
6777 [(set_attr "type" "delayed_compare")
6778 (set_attr "length" "4,8")])
6781 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6783 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6784 (match_operand:SI 2 "const_int_operand" ""))
6785 (match_operand:DI 3 "const_int_operand" ""))
6787 (clobber (match_scratch:DI 4 ""))]
6788 "TARGET_POWERPC64 && reload_completed
6789 && includes_rldic_lshift_p (operands[2], operands[3])"
6791 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6794 (compare:CC (match_dup 4)
6798 (define_insn "*ashldi3_internal6"
6799 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6801 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6802 (match_operand:SI 2 "const_int_operand" "i,i"))
6803 (match_operand:DI 3 "const_int_operand" "n,n"))
6805 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6806 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6807 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6809 rldic. %0,%1,%H2,%W3
6811 [(set_attr "type" "delayed_compare")
6812 (set_attr "length" "4,8")])
6815 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6817 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6818 (match_operand:SI 2 "const_int_operand" ""))
6819 (match_operand:DI 3 "const_int_operand" ""))
6821 (set (match_operand:DI 0 "gpc_reg_operand" "")
6822 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6823 "TARGET_POWERPC64 && reload_completed
6824 && includes_rldic_lshift_p (operands[2], operands[3])"
6826 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6829 (compare:CC (match_dup 0)
6833 (define_insn "*ashldi3_internal7"
6834 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6835 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6836 (match_operand:SI 2 "const_int_operand" "i"))
6837 (match_operand:DI 3 "mask64_operand" "n")))]
6838 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6839 "rldicr %0,%1,%H2,%S3")
6841 (define_insn "ashldi3_internal8"
6842 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6844 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6845 (match_operand:SI 2 "const_int_operand" "i,i"))
6846 (match_operand:DI 3 "mask64_operand" "n,n"))
6848 (clobber (match_scratch:DI 4 "=r,r"))]
6849 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6851 rldicr. %4,%1,%H2,%S3
6853 [(set_attr "type" "delayed_compare")
6854 (set_attr "length" "4,8")])
6857 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6859 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6860 (match_operand:SI 2 "const_int_operand" ""))
6861 (match_operand:DI 3 "mask64_operand" ""))
6863 (clobber (match_scratch:DI 4 ""))]
6864 "TARGET_POWERPC64 && reload_completed
6865 && includes_rldicr_lshift_p (operands[2], operands[3])"
6867 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6870 (compare:CC (match_dup 4)
6874 (define_insn "*ashldi3_internal9"
6875 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6877 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6878 (match_operand:SI 2 "const_int_operand" "i,i"))
6879 (match_operand:DI 3 "mask64_operand" "n,n"))
6881 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6882 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6883 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6885 rldicr. %0,%1,%H2,%S3
6887 [(set_attr "type" "delayed_compare")
6888 (set_attr "length" "4,8")])
6891 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6893 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6894 (match_operand:SI 2 "const_int_operand" ""))
6895 (match_operand:DI 3 "mask64_operand" ""))
6897 (set (match_operand:DI 0 "gpc_reg_operand" "")
6898 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6899 "TARGET_POWERPC64 && reload_completed
6900 && includes_rldicr_lshift_p (operands[2], operands[3])"
6902 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6905 (compare:CC (match_dup 0)
6909 (define_expand "lshrdi3"
6910 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6911 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6912 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6913 "TARGET_POWERPC64 || TARGET_POWER"
6916 if (TARGET_POWERPC64)
6918 else if (TARGET_POWER)
6920 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6927 (define_insn "*lshrdi3_internal1"
6928 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6929 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6930 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6934 (define_insn "*lshrdi3_internal2"
6935 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6936 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6937 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6939 (clobber (match_scratch:DI 3 "=r,r"))]
6944 [(set_attr "type" "delayed_compare")
6945 (set_attr "length" "4,8")])
6948 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6949 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6950 (match_operand:SI 2 "reg_or_cint_operand" ""))
6952 (clobber (match_scratch:DI 3 ""))]
6953 "TARGET_POWERPC64 && reload_completed"
6955 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6957 (compare:CC (match_dup 3)
6961 (define_insn "*lshrdi3_internal3"
6962 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6963 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6964 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6966 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6967 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6972 [(set_attr "type" "delayed_compare")
6973 (set_attr "length" "4,8")])
6976 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6977 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6978 (match_operand:SI 2 "reg_or_cint_operand" ""))
6980 (set (match_operand:DI 0 "gpc_reg_operand" "")
6981 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6982 "TARGET_POWERPC64 && reload_completed"
6984 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6986 (compare:CC (match_dup 0)
6990 (define_expand "ashrdi3"
6991 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6992 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6993 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6997 if (TARGET_POWERPC64)
6999 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7001 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7004 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7005 && WORDS_BIG_ENDIAN)
7007 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7014 (define_insn "*ashrdi3_internal1"
7015 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7016 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7017 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7019 "srad%I2 %0,%1,%H2")
7021 (define_insn "*ashrdi3_internal2"
7022 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7023 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7024 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7026 (clobber (match_scratch:DI 3 "=r,r"))]
7031 [(set_attr "type" "delayed_compare")
7032 (set_attr "length" "4,8")])
7035 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7036 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7037 (match_operand:SI 2 "reg_or_cint_operand" ""))
7039 (clobber (match_scratch:DI 3 ""))]
7040 "TARGET_POWERPC64 && reload_completed"
7042 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7044 (compare:CC (match_dup 3)
7048 (define_insn "*ashrdi3_internal3"
7049 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7050 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7051 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7053 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7054 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7059 [(set_attr "type" "delayed_compare")
7060 (set_attr "length" "4,8")])
7063 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7064 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7065 (match_operand:SI 2 "reg_or_cint_operand" ""))
7067 (set (match_operand:DI 0 "gpc_reg_operand" "")
7068 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7069 "TARGET_POWERPC64 && reload_completed"
7071 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7073 (compare:CC (match_dup 0)
7077 (define_insn "anddi3"
7078 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
7079 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
7080 (match_operand:DI 2 "and64_2_operand" "?r,S,K,J,t")))
7081 (clobber (match_scratch:CC 3 "=X,X,x,x,X"))]
7085 rldic%B2 %0,%1,0,%S2
7089 [(set_attr "length" "4,4,4,4,8")])
7092 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7093 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7094 (match_operand:DI 2 "mask64_2_operand" "")))
7095 (clobber (match_scratch:CC 3 ""))]
7097 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7098 && !mask64_operand (operands[2], DImode)"
7100 (and:DI (rotate:DI (match_dup 1)
7104 (and:DI (rotate:DI (match_dup 0)
7109 build_mask64_2_operands (operands[2], &operands[4]);
7112 (define_insn "*anddi3_internal2"
7113 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7114 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7115 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7117 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7118 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7122 rldic%B2. %3,%1,0,%S2
7131 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7132 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7135 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7136 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7137 (match_operand:DI 2 "and64_operand" ""))
7139 (clobber (match_scratch:DI 3 ""))
7140 (clobber (match_scratch:CC 4 ""))]
7141 "TARGET_POWERPC64 && reload_completed"
7142 [(parallel [(set (match_dup 3)
7143 (and:DI (match_dup 1)
7145 (clobber (match_dup 4))])
7147 (compare:CC (match_dup 3)
7152 [(set (match_operand:CC 0 "cc_reg_operand" "")
7153 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7154 (match_operand:DI 2 "mask64_2_operand" ""))
7156 (clobber (match_scratch:DI 3 ""))
7157 (clobber (match_scratch:CC 4 ""))]
7158 "TARGET_POWERPC64 && reload_completed
7159 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7160 && !mask64_operand (operands[2], DImode)"
7162 (and:DI (rotate:DI (match_dup 1)
7165 (parallel [(set (match_dup 0)
7166 (compare:CC (and:DI (rotate:DI (match_dup 3)
7170 (clobber (match_dup 3))])]
7173 build_mask64_2_operands (operands[2], &operands[5]);
7176 (define_insn "*anddi3_internal3"
7177 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7178 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7179 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7181 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7182 (and:DI (match_dup 1) (match_dup 2)))
7183 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7187 rldic%B2. %0,%1,0,%S2
7196 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7197 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7200 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7201 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7202 (match_operand:DI 2 "and64_operand" ""))
7204 (set (match_operand:DI 0 "gpc_reg_operand" "")
7205 (and:DI (match_dup 1) (match_dup 2)))
7206 (clobber (match_scratch:CC 4 ""))]
7207 "TARGET_POWERPC64 && reload_completed"
7208 [(parallel [(set (match_dup 0)
7209 (and:DI (match_dup 1) (match_dup 2)))
7210 (clobber (match_dup 4))])
7212 (compare:CC (match_dup 0)
7217 [(set (match_operand:CC 3 "cc_reg_operand" "")
7218 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7219 (match_operand:DI 2 "mask64_2_operand" ""))
7221 (set (match_operand:DI 0 "gpc_reg_operand" "")
7222 (and:DI (match_dup 1) (match_dup 2)))
7223 (clobber (match_scratch:CC 4 ""))]
7224 "TARGET_POWERPC64 && reload_completed
7225 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7226 && !mask64_operand (operands[2], DImode)"
7228 (and:DI (rotate:DI (match_dup 1)
7231 (parallel [(set (match_dup 3)
7232 (compare:CC (and:DI (rotate:DI (match_dup 0)
7237 (and:DI (rotate:DI (match_dup 0)
7242 build_mask64_2_operands (operands[2], &operands[5]);
7245 (define_expand "iordi3"
7246 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7247 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7248 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7252 if (non_logical_cint_operand (operands[2], DImode))
7254 HOST_WIDE_INT value;
7255 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7256 ? operands[0] : gen_reg_rtx (DImode));
7258 if (GET_CODE (operands[2]) == CONST_INT)
7260 value = INTVAL (operands[2]);
7261 emit_insn (gen_iordi3 (tmp, operands[1],
7262 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7266 value = CONST_DOUBLE_LOW (operands[2]);
7267 emit_insn (gen_iordi3 (tmp, operands[1],
7268 immed_double_const (value
7269 & (~ (HOST_WIDE_INT) 0xffff),
7273 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7278 (define_expand "xordi3"
7279 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7280 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7281 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7285 if (non_logical_cint_operand (operands[2], DImode))
7287 HOST_WIDE_INT value;
7288 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7289 ? operands[0] : gen_reg_rtx (DImode));
7291 if (GET_CODE (operands[2]) == CONST_INT)
7293 value = INTVAL (operands[2]);
7294 emit_insn (gen_xordi3 (tmp, operands[1],
7295 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7299 value = CONST_DOUBLE_LOW (operands[2]);
7300 emit_insn (gen_xordi3 (tmp, operands[1],
7301 immed_double_const (value
7302 & (~ (HOST_WIDE_INT) 0xffff),
7306 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7311 (define_insn "*booldi3_internal1"
7312 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7313 (match_operator:DI 3 "boolean_or_operator"
7314 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7315 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7322 (define_insn "*booldi3_internal2"
7323 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7324 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7325 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7326 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7328 (clobber (match_scratch:DI 3 "=r,r"))]
7333 [(set_attr "type" "compare")
7334 (set_attr "length" "4,8")])
7337 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7338 (compare:CC (match_operator:DI 4 "boolean_operator"
7339 [(match_operand:DI 1 "gpc_reg_operand" "")
7340 (match_operand:DI 2 "gpc_reg_operand" "")])
7342 (clobber (match_scratch:DI 3 ""))]
7343 "TARGET_POWERPC64 && reload_completed"
7344 [(set (match_dup 3) (match_dup 4))
7346 (compare:CC (match_dup 3)
7350 (define_insn "*booldi3_internal3"
7351 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7352 (compare:CC (match_operator:DI 4 "boolean_operator"
7353 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7354 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7356 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7362 [(set_attr "type" "compare")
7363 (set_attr "length" "4,8")])
7366 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7367 (compare:CC (match_operator:DI 4 "boolean_operator"
7368 [(match_operand:DI 1 "gpc_reg_operand" "")
7369 (match_operand:DI 2 "gpc_reg_operand" "")])
7371 (set (match_operand:DI 0 "gpc_reg_operand" "")
7373 "TARGET_POWERPC64 && reload_completed"
7374 [(set (match_dup 0) (match_dup 4))
7376 (compare:CC (match_dup 0)
7380 ;; Split a logical operation that we can't do in one insn into two insns,
7381 ;; each of which does one 16-bit part. This is used by combine.
7384 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7385 (match_operator:DI 3 "boolean_or_operator"
7386 [(match_operand:DI 1 "gpc_reg_operand" "")
7387 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7389 [(set (match_dup 0) (match_dup 4))
7390 (set (match_dup 0) (match_dup 5))]
7395 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7397 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7398 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7400 i4 = GEN_INT (value & 0xffff);
7404 i3 = GEN_INT (INTVAL (operands[2])
7405 & (~ (HOST_WIDE_INT) 0xffff));
7406 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7408 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7410 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7414 (define_insn "*boolcdi3_internal1"
7415 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7416 (match_operator:DI 3 "boolean_operator"
7417 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7418 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7422 (define_insn "*boolcdi3_internal2"
7423 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7424 (compare:CC (match_operator:DI 4 "boolean_operator"
7425 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7426 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7428 (clobber (match_scratch:DI 3 "=r,r"))]
7433 [(set_attr "type" "compare")
7434 (set_attr "length" "4,8")])
7437 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7438 (compare:CC (match_operator:DI 4 "boolean_operator"
7439 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7440 (match_operand:DI 2 "gpc_reg_operand" "")])
7442 (clobber (match_scratch:DI 3 ""))]
7443 "TARGET_POWERPC64 && reload_completed"
7444 [(set (match_dup 3) (match_dup 4))
7446 (compare:CC (match_dup 3)
7450 (define_insn "*boolcdi3_internal3"
7451 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7452 (compare:CC (match_operator:DI 4 "boolean_operator"
7453 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7454 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7456 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7462 [(set_attr "type" "compare")
7463 (set_attr "length" "4,8")])
7466 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7467 (compare:CC (match_operator:DI 4 "boolean_operator"
7468 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7469 (match_operand:DI 2 "gpc_reg_operand" "")])
7471 (set (match_operand:DI 0 "gpc_reg_operand" "")
7473 "TARGET_POWERPC64 && reload_completed"
7474 [(set (match_dup 0) (match_dup 4))
7476 (compare:CC (match_dup 0)
7480 (define_insn "*boolccdi3_internal1"
7481 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7482 (match_operator:DI 3 "boolean_operator"
7483 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7484 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7488 (define_insn "*boolccdi3_internal2"
7489 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7490 (compare:CC (match_operator:DI 4 "boolean_operator"
7491 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7492 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7494 (clobber (match_scratch:DI 3 "=r,r"))]
7499 [(set_attr "type" "compare")
7500 (set_attr "length" "4,8")])
7503 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7504 (compare:CC (match_operator:DI 4 "boolean_operator"
7505 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7506 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7508 (clobber (match_scratch:DI 3 ""))]
7509 "TARGET_POWERPC64 && reload_completed"
7510 [(set (match_dup 3) (match_dup 4))
7512 (compare:CC (match_dup 3)
7516 (define_insn "*boolccdi3_internal3"
7517 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7518 (compare:CC (match_operator:DI 4 "boolean_operator"
7519 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7520 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7522 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7528 [(set_attr "type" "compare")
7529 (set_attr "length" "4,8")])
7532 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7533 (compare:CC (match_operator:DI 4 "boolean_operator"
7534 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7535 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7537 (set (match_operand:DI 0 "gpc_reg_operand" "")
7539 "TARGET_POWERPC64 && reload_completed"
7540 [(set (match_dup 0) (match_dup 4))
7542 (compare:CC (match_dup 0)
7546 ;; Now define ways of moving data around.
7548 ;; Elf specific ways of loading addresses for non-PIC code.
7549 ;; The output of this could be r0, but we make a very strong
7550 ;; preference for a base register because it will usually
7552 (define_insn "elf_high"
7553 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7554 (high:SI (match_operand 1 "" "")))]
7555 "TARGET_ELF && ! TARGET_64BIT"
7556 "{liu|lis} %0,%1@ha")
7558 (define_insn "elf_low"
7559 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7560 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7561 (match_operand 2 "" "")))]
7562 "TARGET_ELF && ! TARGET_64BIT"
7564 {cal|la} %0,%2@l(%1)
7565 {ai|addic} %0,%1,%K2")
7567 ;; Mach-O PIC trickery.
7568 (define_insn "macho_high"
7569 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7570 (high:SI (match_operand 1 "" "")))]
7571 "TARGET_MACHO && ! TARGET_64BIT"
7572 "{liu|lis} %0,ha16(%1)")
7574 (define_insn "macho_low"
7575 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7576 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7577 (match_operand 2 "" "")))]
7578 "TARGET_MACHO && ! TARGET_64BIT"
7580 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
7581 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
7583 ;; Set up a register with a value from the GOT table
7585 (define_expand "movsi_got"
7586 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7587 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7588 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7589 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7592 if (GET_CODE (operands[1]) == CONST)
7594 rtx offset = const0_rtx;
7595 HOST_WIDE_INT value;
7597 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7598 value = INTVAL (offset);
7601 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7602 emit_insn (gen_movsi_got (tmp, operands[1]));
7603 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7608 operands[2] = rs6000_got_register (operands[1]);
7611 (define_insn "*movsi_got_internal"
7612 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7613 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7614 (match_operand:SI 2 "gpc_reg_operand" "b")]
7616 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7617 "{l|lwz} %0,%a1@got(%2)"
7618 [(set_attr "type" "load")])
7620 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7621 ;; didn't get allocated to a hard register.
7623 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7624 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7625 (match_operand:SI 2 "memory_operand" "")]
7627 "DEFAULT_ABI == ABI_V4
7629 && (reload_in_progress || reload_completed)"
7630 [(set (match_dup 0) (match_dup 2))
7631 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7635 ;; For SI, we special-case integers that can't be loaded in one insn. We
7636 ;; do the load 16-bits at a time. We could do this by loading from memory,
7637 ;; and this is even supposed to be faster, but it is simpler not to get
7638 ;; integers in the TOC.
7639 (define_expand "movsi"
7640 [(set (match_operand:SI 0 "general_operand" "")
7641 (match_operand:SI 1 "any_operand" ""))]
7643 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7645 (define_insn "movsi_low"
7646 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7647 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7648 (match_operand 2 "" ""))))]
7649 "TARGET_MACHO && ! TARGET_64BIT"
7650 "{l|lwz} %0,lo16(%2)(%1)"
7651 [(set_attr "type" "load")
7652 (set_attr "length" "4")])
7654 (define_insn "movsi_low_st"
7655 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7656 (match_operand 2 "" "")))
7657 (match_operand:SI 0 "gpc_reg_operand" "r"))]
7658 "TARGET_MACHO && ! TARGET_64BIT"
7659 "{st|stw} %0,lo16(%2)(%1)"
7660 [(set_attr "type" "store")
7661 (set_attr "length" "4")])
7663 (define_insn "movdf_low"
7664 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
7665 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7666 (match_operand 2 "" ""))))]
7667 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7670 switch (which_alternative)
7673 return \"lfd %0,lo16(%2)(%1)\";
7677 operands2[0] = operands[0];
7678 operands2[1] = operands[1];
7679 operands2[2] = operands[2];
7680 if (TARGET_POWERPC64 && TARGET_32BIT)
7681 /* Note, old assemblers didn't support relocation here. */
7682 return \"ld %0,lo16(%2)(%1)\";
7685 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
7686 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
7688 if (MACHO_DYNAMIC_NO_PIC_P)
7689 output_asm_insn (\"{liu|lis} %L0,ha16(%2+4)\", operands);
7691 /* We cannot rely on ha16(low half)==ha16(high half), alas,
7692 although in practice it almost always is. */
7693 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
7695 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
7702 [(set_attr "type" "load")
7703 (set_attr "length" "4,12")])
7705 (define_insn "movdf_low_st"
7706 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7707 (match_operand 2 "" "")))
7708 (match_operand:DF 0 "gpc_reg_operand" "f"))]
7709 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7710 "stfd %0,lo16(%2)(%1)"
7711 [(set_attr "type" "store")
7712 (set_attr "length" "4")])
7714 (define_insn "movsf_low"
7715 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
7716 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7717 (match_operand 2 "" ""))))]
7718 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7721 {l|lwz} %0,lo16(%2)(%1)"
7722 [(set_attr "type" "load")
7723 (set_attr "length" "4")])
7725 (define_insn "movsf_low_st"
7726 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7727 (match_operand 2 "" "")))
7728 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
7729 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7731 stfs %0,lo16(%2)(%1)
7732 {st|stw} %0,lo16(%2)(%1)"
7733 [(set_attr "type" "store")
7734 (set_attr "length" "4")])
7736 (define_insn "*movsi_internal1"
7737 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7738 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7739 "gpc_reg_operand (operands[0], SImode)
7740 || gpc_reg_operand (operands[1], SImode)"
7744 {l%U1%X1|lwz%U1%X1} %0,%1
7745 {st%U0%X0|stw%U0%X0} %1,%0
7755 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7756 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7758 ;; Split a load of a large constant into the appropriate two-insn
7762 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7763 (match_operand:SI 1 "const_int_operand" ""))]
7764 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7765 && (INTVAL (operands[1]) & 0xffff) != 0"
7769 (ior:SI (match_dup 0)
7772 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7774 if (tem == operands[0])
7780 (define_insn "*movsi_internal2"
7781 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7782 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "0,r,r")
7784 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7787 {cmpi|cmpwi} %2,%0,0
7790 [(set_attr "type" "cmp,compare,cmp")
7791 (set_attr "length" "4,4,8")])
7794 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7795 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7797 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7798 "TARGET_32BIT && reload_completed"
7799 [(set (match_dup 0) (match_dup 1))
7801 (compare:CC (match_dup 0)
7805 (define_expand "movhi"
7806 [(set (match_operand:HI 0 "general_operand" "")
7807 (match_operand:HI 1 "any_operand" ""))]
7809 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7811 (define_insn "*movhi_internal"
7812 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7813 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7814 "gpc_reg_operand (operands[0], HImode)
7815 || gpc_reg_operand (operands[1], HImode)"
7825 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7827 (define_expand "movqi"
7828 [(set (match_operand:QI 0 "general_operand" "")
7829 (match_operand:QI 1 "any_operand" ""))]
7831 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7833 (define_insn "*movqi_internal"
7834 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7835 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7836 "gpc_reg_operand (operands[0], QImode)
7837 || gpc_reg_operand (operands[1], QImode)"
7847 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7849 ;; Here is how to move condition codes around. When we store CC data in
7850 ;; an integer register or memory, we store just the high-order 4 bits.
7851 ;; This lets us not shift in the most common case of CR0.
7852 (define_expand "movcc"
7853 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7854 (match_operand:CC 1 "nonimmediate_operand" ""))]
7858 (define_insn "*movcc_internal1"
7859 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7860 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7861 "register_operand (operands[0], CCmode)
7862 || register_operand (operands[1], CCmode)"
7866 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7868 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7873 {l%U1%X1|lwz%U1%X1} %0,%1
7874 {st%U0%U1|stw%U0%U1} %1,%0"
7876 (cond [(eq_attr "alternative" "0")
7877 (const_string "cr_logical")
7878 (eq_attr "alternative" "1,2")
7879 (const_string "mtcr")
7880 (eq_attr "alternative" "5,7")
7881 (const_string "integer")
7882 (eq_attr "alternative" "6")
7883 (const_string "mfjmpr")
7884 (eq_attr "alternative" "8")
7885 (const_string "mtjmpr")
7886 (eq_attr "alternative" "9")
7887 (const_string "load")
7888 (eq_attr "alternative" "10")
7889 (const_string "store")
7890 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7891 (const_string "mfcrf")
7893 (const_string "mfcr")))
7894 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7896 ;; For floating-point, we normally deal with the floating-point registers
7897 ;; unless -msoft-float is used. The sole exception is that parameter passing
7898 ;; can produce floating-point values in fixed-point registers. Unless the
7899 ;; value is a simple constant or already in memory, we deal with this by
7900 ;; allocating memory and copying the value explicitly via that memory location.
7901 (define_expand "movsf"
7902 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7903 (match_operand:SF 1 "any_operand" ""))]
7905 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7908 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7909 (match_operand:SF 1 "const_double_operand" ""))]
7911 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7912 || (GET_CODE (operands[0]) == SUBREG
7913 && GET_CODE (SUBREG_REG (operands[0])) == REG
7914 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7915 [(set (match_dup 2) (match_dup 3))]
7921 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7922 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7924 if (! TARGET_POWERPC64)
7925 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7927 operands[2] = gen_lowpart (SImode, operands[0]);
7929 operands[3] = gen_int_mode (l, SImode);
7932 (define_insn "*movsf_hardfloat"
7933 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7934 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7935 "(gpc_reg_operand (operands[0], SFmode)
7936 || gpc_reg_operand (operands[1], SFmode))
7937 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7940 {l%U1%X1|lwz%U1%X1} %0,%1
7941 {st%U0%X0|stw%U0%X0} %1,%0
7951 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7952 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7954 (define_insn "*movsf_softfloat"
7955 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7956 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7957 "(gpc_reg_operand (operands[0], SFmode)
7958 || gpc_reg_operand (operands[1], SFmode))
7959 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7965 {l%U1%X1|lwz%U1%X1} %0,%1
7966 {st%U0%X0|stw%U0%X0} %1,%0
7973 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
7974 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7977 (define_expand "movdf"
7978 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7979 (match_operand:DF 1 "any_operand" ""))]
7981 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7984 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7985 (match_operand:DF 1 "const_int_operand" ""))]
7986 "! TARGET_POWERPC64 && reload_completed
7987 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7988 || (GET_CODE (operands[0]) == SUBREG
7989 && GET_CODE (SUBREG_REG (operands[0])) == REG
7990 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7991 [(set (match_dup 2) (match_dup 4))
7992 (set (match_dup 3) (match_dup 1))]
7995 int endian = (WORDS_BIG_ENDIAN == 0);
7996 HOST_WIDE_INT value = INTVAL (operands[1]);
7998 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7999 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8000 #if HOST_BITS_PER_WIDE_INT == 32
8001 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8003 operands[4] = GEN_INT (value >> 32);
8004 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8009 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8010 (match_operand:DF 1 "const_double_operand" ""))]
8011 "! TARGET_POWERPC64 && reload_completed
8012 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8013 || (GET_CODE (operands[0]) == SUBREG
8014 && GET_CODE (SUBREG_REG (operands[0])) == REG
8015 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8016 [(set (match_dup 2) (match_dup 4))
8017 (set (match_dup 3) (match_dup 5))]
8020 int endian = (WORDS_BIG_ENDIAN == 0);
8024 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8025 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8027 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8028 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8029 operands[4] = gen_int_mode (l[endian], SImode);
8030 operands[5] = gen_int_mode (l[1 - endian], SImode);
8034 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8035 (match_operand:DF 1 "easy_fp_constant" ""))]
8036 "TARGET_POWERPC64 && reload_completed
8037 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8038 || (GET_CODE (operands[0]) == SUBREG
8039 && GET_CODE (SUBREG_REG (operands[0])) == REG
8040 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8041 [(set (match_dup 2) (match_dup 3))]
8044 int endian = (WORDS_BIG_ENDIAN == 0);
8047 #if HOST_BITS_PER_WIDE_INT >= 64
8051 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8052 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8054 operands[2] = gen_lowpart (DImode, operands[0]);
8055 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8056 #if HOST_BITS_PER_WIDE_INT >= 64
8057 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8058 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8060 operands[3] = gen_int_mode (val, DImode);
8062 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8066 ;; Don't have reload use general registers to load a constant. First,
8067 ;; it might not work if the output operand is the equivalent of
8068 ;; a non-offsettable memref, but also it is less efficient than loading
8069 ;; the constant into an FP register, since it will probably be used there.
8070 ;; The "??" is a kludge until we can figure out a more reasonable way
8071 ;; of handling these non-offsettable values.
8072 (define_insn "*movdf_hardfloat32"
8073 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8074 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8075 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8076 && (gpc_reg_operand (operands[0], DFmode)
8077 || gpc_reg_operand (operands[1], DFmode))"
8080 switch (which_alternative)
8085 /* We normally copy the low-numbered register first. However, if
8086 the first register operand 0 is the same as the second register
8087 of operand 1, we must copy in the opposite order. */
8088 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8089 return \"mr %L0,%L1\;mr %0,%1\";
8091 return \"mr %0,%1\;mr %L0,%L1\";
8093 if (offsettable_memref_p (operands[1])
8094 || (GET_CODE (operands[1]) == MEM
8095 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8096 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8097 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8099 /* If the low-address word is used in the address, we must load
8100 it last. Otherwise, load it first. Note that we cannot have
8101 auto-increment in that case since the address register is
8102 known to be dead. */
8103 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8105 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8107 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8113 addreg = find_addr_reg (XEXP (operands[1], 0));
8114 if (refers_to_regno_p (REGNO (operands[0]),
8115 REGNO (operands[0]) + 1,
8118 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8119 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8120 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8121 return \"{lx|lwzx} %0,%1\";
8125 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8126 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8127 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8128 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8133 if (offsettable_memref_p (operands[0])
8134 || (GET_CODE (operands[0]) == MEM
8135 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8136 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8137 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8138 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8143 addreg = find_addr_reg (XEXP (operands[0], 0));
8144 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8145 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8146 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8147 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8151 return \"fmr %0,%1\";
8153 return \"lfd%U1%X1 %0,%1\";
8155 return \"stfd%U0%X0 %1,%0\";
8162 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*")
8163 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8165 (define_insn "*movdf_softfloat32"
8166 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8167 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8168 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8169 && (gpc_reg_operand (operands[0], DFmode)
8170 || gpc_reg_operand (operands[1], DFmode))"
8173 switch (which_alternative)
8178 /* We normally copy the low-numbered register first. However, if
8179 the first register operand 0 is the same as the second register of
8180 operand 1, we must copy in the opposite order. */
8181 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8182 return \"mr %L0,%L1\;mr %0,%1\";
8184 return \"mr %0,%1\;mr %L0,%L1\";
8186 /* If the low-address word is used in the address, we must load
8187 it last. Otherwise, load it first. Note that we cannot have
8188 auto-increment in that case since the address register is
8189 known to be dead. */
8190 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8192 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8194 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8196 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8203 [(set_attr "type" "*,load,store,*,*,*")
8204 (set_attr "length" "8,8,8,8,12,16")])
8206 ; ld/std require word-aligned displacements -> 'Y' constraint.
8207 ; List Y->r and r->Y before r->r for reload.
8208 (define_insn "*movdf_hardfloat64"
8209 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
8210 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8211 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8212 && (gpc_reg_operand (operands[0], DFmode)
8213 || gpc_reg_operand (operands[1], DFmode))"
8227 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
8228 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8230 (define_insn "*movdf_softfloat64"
8231 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8232 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8233 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8234 && (gpc_reg_operand (operands[0], DFmode)
8235 || gpc_reg_operand (operands[1], DFmode))"
8246 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
8247 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8249 (define_expand "movtf"
8250 [(set (match_operand:TF 0 "general_operand" "")
8251 (match_operand:TF 1 "any_operand" ""))]
8252 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8253 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8254 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8256 ; It's important to list the o->f and f->o moves before f->f because
8257 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8258 ; which doesn't make progress.
8259 (define_insn_and_split "*movtf_internal"
8260 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,rm,r")
8261 (match_operand:TF 1 "input_operand" "f,o,f,r,mGHF"))]
8262 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8263 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8264 && (gpc_reg_operand (operands[0], TFmode)
8265 || gpc_reg_operand (operands[1], TFmode))"
8267 "&& reload_completed"
8269 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8270 [(set_attr "length" "8,8,8,20,20")])
8272 (define_expand "extenddftf2"
8273 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8274 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8275 (use (match_dup 2))])]
8276 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8277 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8279 operands[2] = CONST0_RTX (DFmode);
8282 (define_insn_and_split "*extenddftf2_internal"
8283 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8284 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8285 (use (match_operand:DF 2 "input_operand" "rf,m,f,n"))]
8286 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8287 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8289 "&& reload_completed"
8292 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8293 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8294 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8296 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8301 (define_expand "extendsftf2"
8302 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8303 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8304 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8305 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8307 rtx tmp = gen_reg_rtx (DFmode);
8308 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8309 emit_insn (gen_extenddftf2 (operands[0], tmp));
8313 (define_insn "trunctfdf2"
8314 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8315 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8316 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8317 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8319 [(set_attr "type" "fp")
8320 (set_attr "length" "4")])
8322 (define_insn_and_split "trunctfsf2"
8323 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8324 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8325 (clobber (match_scratch:DF 2 "=f"))]
8326 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8327 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8329 "&& reload_completed"
8331 (float_truncate:DF (match_dup 1)))
8333 (float_truncate:SF (match_dup 2)))]
8336 (define_expand "floatsitf2"
8337 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8338 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
8339 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8340 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8342 rtx tmp = gen_reg_rtx (DFmode);
8343 expand_float (tmp, operands[1], false);
8344 emit_insn (gen_extenddftf2 (operands[0], tmp));
8348 ; fadd, but rounding towards zero.
8349 ; This is probably not the optimal code sequence.
8350 (define_insn "fix_trunc_helper"
8351 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8352 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8353 UNSPEC_FIX_TRUNC_TF))
8354 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8355 "TARGET_HARD_FLOAT && TARGET_FPRS"
8356 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8357 [(set_attr "type" "fp")
8358 (set_attr "length" "20")])
8360 (define_expand "fix_trunctfsi2"
8361 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8362 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8363 (clobber (match_dup 2))
8364 (clobber (match_dup 3))
8365 (clobber (match_dup 4))
8366 (clobber (match_dup 5))])]
8367 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8368 && (TARGET_POWER2 || TARGET_POWERPC)
8369 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8371 operands[2] = gen_reg_rtx (DFmode);
8372 operands[3] = gen_reg_rtx (DFmode);
8373 operands[4] = gen_reg_rtx (DImode);
8374 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8377 (define_insn_and_split "*fix_trunctfsi2_internal"
8378 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8379 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8380 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8381 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8382 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8383 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8384 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8385 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8387 "&& reload_completed"
8391 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8393 if (GET_CODE (operands[5]) != MEM)
8395 lowword = XEXP (operands[5], 0);
8396 if (WORDS_BIG_ENDIAN)
8397 lowword = plus_constant (lowword, 4);
8399 emit_insn (gen_fctiwz (operands[4], operands[2]));
8400 emit_move_insn (operands[5], operands[4]);
8401 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
8405 (define_insn "negtf2"
8406 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8407 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8408 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8409 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8412 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8413 return \"fneg %L0,%L1\;fneg %0,%1\";
8415 return \"fneg %0,%1\;fneg %L0,%L1\";
8417 [(set_attr "type" "fp")
8418 (set_attr "length" "8")])
8420 (define_expand "abstf2"
8421 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8422 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8423 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8424 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8427 rtx label = gen_label_rtx ();
8428 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8433 (define_expand "abstf2_internal"
8434 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8435 (match_operand:TF 1 "gpc_reg_operand" "f"))
8436 (set (match_dup 3) (match_dup 5))
8437 (set (match_dup 5) (abs:DF (match_dup 5)))
8438 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8439 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8440 (label_ref (match_operand 2 "" ""))
8442 (set (match_dup 6) (neg:DF (match_dup 6)))]
8443 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8444 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8447 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8448 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8449 operands[3] = gen_reg_rtx (DFmode);
8450 operands[4] = gen_reg_rtx (CCFPmode);
8451 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8452 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8455 ;; Next come the multi-word integer load and store and the load and store
8457 (define_expand "movdi"
8458 [(set (match_operand:DI 0 "general_operand" "")
8459 (match_operand:DI 1 "any_operand" ""))]
8461 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8463 (define_insn "*movdi_internal32"
8464 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8465 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8467 && (gpc_reg_operand (operands[0], DImode)
8468 || gpc_reg_operand (operands[1], DImode))"
8471 switch (which_alternative)
8480 return \"fmr %0,%1\";
8482 return \"lfd%U1%X1 %0,%1\";
8484 return \"stfd%U0%X0 %1,%0\";
8493 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")])
8496 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8497 (match_operand:DI 1 "const_int_operand" ""))]
8498 "! TARGET_POWERPC64 && reload_completed"
8499 [(set (match_dup 2) (match_dup 4))
8500 (set (match_dup 3) (match_dup 1))]
8503 HOST_WIDE_INT value = INTVAL (operands[1]);
8504 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8506 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8508 #if HOST_BITS_PER_WIDE_INT == 32
8509 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8511 operands[4] = GEN_INT (value >> 32);
8512 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8517 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8518 (match_operand:DI 1 "input_operand" ""))]
8519 "reload_completed && !TARGET_POWERPC64
8520 && gpr_or_gpr_p (operands[0], operands[1])"
8522 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8525 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8526 (match_operand:TI 1 "const_double_operand" ""))]
8528 [(set (match_dup 2) (match_dup 4))
8529 (set (match_dup 3) (match_dup 5))]
8532 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8534 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8536 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8538 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8539 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8541 else if (GET_CODE (operands[1]) == CONST_INT)
8543 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8544 operands[5] = operands[1];
8550 (define_insn "*movdi_internal64"
8551 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,?f,f,m,r,*h,*h")
8552 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8554 && (gpc_reg_operand (operands[0], DImode)
8555 || gpc_reg_operand (operands[1], DImode))"
8570 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8571 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8573 ;; immediate value valid for a single instruction hiding in a const_double
8575 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8576 (match_operand:DI 1 "const_double_operand" "F"))]
8577 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8578 && GET_CODE (operands[1]) == CONST_DOUBLE
8579 && num_insns_constant (operands[1], DImode) == 1"
8582 return ((unsigned HOST_WIDE_INT)
8583 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8584 ? \"li %0,%1\" : \"lis %0,%v1\";
8587 ;; Generate all one-bits and clear left or right.
8588 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8590 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8591 (match_operand:DI 1 "mask64_operand" ""))]
8592 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8593 [(set (match_dup 0) (const_int -1))
8595 (and:DI (rotate:DI (match_dup 0)
8600 ;; Split a load of a large constant into the appropriate five-instruction
8601 ;; sequence. Handle anything in a constant number of insns.
8602 ;; When non-easy constants can go in the TOC, this should use
8603 ;; easy_fp_constant predicate.
8605 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8606 (match_operand:DI 1 "const_int_operand" ""))]
8607 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8608 [(set (match_dup 0) (match_dup 2))
8609 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8611 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8613 if (tem == operands[0])
8620 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8621 (match_operand:DI 1 "const_double_operand" ""))]
8622 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8623 [(set (match_dup 0) (match_dup 2))
8624 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8626 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8628 if (tem == operands[0])
8634 (define_insn "*movdi_internal2"
8635 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8636 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "0,r,r")
8638 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8644 [(set_attr "type" "cmp,compare,cmp")
8645 (set_attr "length" "4,4,8")])
8648 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8649 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8651 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8652 "TARGET_POWERPC64 && reload_completed"
8653 [(set (match_dup 0) (match_dup 1))
8655 (compare:CC (match_dup 0)
8659 ;; TImode is similar, except that we usually want to compute the address into
8660 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8661 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8662 (define_expand "movti"
8663 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8664 (match_operand:TI 1 "general_operand" ""))
8665 (clobber (scratch:SI))])]
8667 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8669 ;; We say that MQ is clobbered in the last alternative because the first
8670 ;; alternative would never get used otherwise since it would need a reload
8671 ;; while the 2nd alternative would not. We put memory cases first so they
8672 ;; are preferred. Otherwise, we'd try to reload the output instead of
8673 ;; giving the SCRATCH mq.
8675 (define_insn "*movti_power"
8676 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8677 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
8678 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
8679 "TARGET_POWER && ! TARGET_POWERPC64
8680 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8683 switch (which_alternative)
8690 return \"{stsi|stswi} %1,%P0,16\";
8695 /* If the address is not used in the output, we can use lsi. Otherwise,
8696 fall through to generating four loads. */
8698 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8699 return \"{lsi|lswi} %0,%P1,16\";
8700 /* ... fall through ... */
8705 [(set_attr "type" "store,store,*,load,load")])
8707 (define_insn "*movti_string"
8708 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8709 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))]
8710 "! TARGET_POWER && ! TARGET_POWERPC64
8711 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8714 switch (which_alternative)
8720 return \"{stsi|stswi} %1,%P0,16\";
8725 /* If the address is not used in the output, we can use lsi. Otherwise,
8726 fall through to generating four loads. */
8728 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8729 return \"{lsi|lswi} %0,%P1,16\";
8730 /* ... fall through ... */
8735 [(set_attr "type" "store,store,*,load,load")])
8737 (define_insn "*movti_ppc64"
8738 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,m,r")
8739 (match_operand:TI 1 "input_operand" "r,r,o"))]
8740 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8741 || gpc_reg_operand (operands[1], TImode))"
8746 [(set_attr "type" "*,load,store")])
8749 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8750 (match_operand:TI 1 "input_operand" ""))]
8752 && gpr_or_gpr_p (operands[0], operands[1])"
8754 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8756 (define_expand "load_multiple"
8757 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8758 (match_operand:SI 1 "" ""))
8759 (use (match_operand:SI 2 "" ""))])]
8760 "TARGET_STRING && !TARGET_POWERPC64"
8768 /* Support only loading a constant number of fixed-point registers from
8769 memory and only bother with this if more than two; the machine
8770 doesn't support more than eight. */
8771 if (GET_CODE (operands[2]) != CONST_INT
8772 || INTVAL (operands[2]) <= 2
8773 || INTVAL (operands[2]) > 8
8774 || GET_CODE (operands[1]) != MEM
8775 || GET_CODE (operands[0]) != REG
8776 || REGNO (operands[0]) >= 32)
8779 count = INTVAL (operands[2]);
8780 regno = REGNO (operands[0]);
8782 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8783 op1 = replace_equiv_address (operands[1],
8784 force_reg (SImode, XEXP (operands[1], 0)));
8786 for (i = 0; i < count; i++)
8787 XVECEXP (operands[3], 0, i)
8788 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8789 adjust_address_nv (op1, SImode, i * 4));
8792 (define_insn "*ldmsi8"
8793 [(match_parallel 0 "load_multiple_operation"
8794 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8795 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8796 (set (match_operand:SI 3 "gpc_reg_operand" "")
8797 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8798 (set (match_operand:SI 4 "gpc_reg_operand" "")
8799 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8800 (set (match_operand:SI 5 "gpc_reg_operand" "")
8801 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8802 (set (match_operand:SI 6 "gpc_reg_operand" "")
8803 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8804 (set (match_operand:SI 7 "gpc_reg_operand" "")
8805 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8806 (set (match_operand:SI 8 "gpc_reg_operand" "")
8807 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8808 (set (match_operand:SI 9 "gpc_reg_operand" "")
8809 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8810 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8812 { return rs6000_output_load_multiple (operands); }"
8813 [(set_attr "type" "load")
8814 (set_attr "length" "32")])
8816 (define_insn "*ldmsi7"
8817 [(match_parallel 0 "load_multiple_operation"
8818 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8819 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8820 (set (match_operand:SI 3 "gpc_reg_operand" "")
8821 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8822 (set (match_operand:SI 4 "gpc_reg_operand" "")
8823 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8824 (set (match_operand:SI 5 "gpc_reg_operand" "")
8825 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8826 (set (match_operand:SI 6 "gpc_reg_operand" "")
8827 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8828 (set (match_operand:SI 7 "gpc_reg_operand" "")
8829 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8830 (set (match_operand:SI 8 "gpc_reg_operand" "")
8831 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8832 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8834 { return rs6000_output_load_multiple (operands); }"
8835 [(set_attr "type" "load")
8836 (set_attr "length" "32")])
8838 (define_insn "*ldmsi6"
8839 [(match_parallel 0 "load_multiple_operation"
8840 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8841 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8842 (set (match_operand:SI 3 "gpc_reg_operand" "")
8843 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8844 (set (match_operand:SI 4 "gpc_reg_operand" "")
8845 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8846 (set (match_operand:SI 5 "gpc_reg_operand" "")
8847 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8848 (set (match_operand:SI 6 "gpc_reg_operand" "")
8849 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8850 (set (match_operand:SI 7 "gpc_reg_operand" "")
8851 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8852 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8854 { return rs6000_output_load_multiple (operands); }"
8855 [(set_attr "type" "load")
8856 (set_attr "length" "32")])
8858 (define_insn "*ldmsi5"
8859 [(match_parallel 0 "load_multiple_operation"
8860 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8861 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8862 (set (match_operand:SI 3 "gpc_reg_operand" "")
8863 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8864 (set (match_operand:SI 4 "gpc_reg_operand" "")
8865 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8866 (set (match_operand:SI 5 "gpc_reg_operand" "")
8867 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8868 (set (match_operand:SI 6 "gpc_reg_operand" "")
8869 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8870 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8872 { return rs6000_output_load_multiple (operands); }"
8873 [(set_attr "type" "load")
8874 (set_attr "length" "32")])
8876 (define_insn "*ldmsi4"
8877 [(match_parallel 0 "load_multiple_operation"
8878 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8879 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8880 (set (match_operand:SI 3 "gpc_reg_operand" "")
8881 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8882 (set (match_operand:SI 4 "gpc_reg_operand" "")
8883 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8884 (set (match_operand:SI 5 "gpc_reg_operand" "")
8885 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8886 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8888 { return rs6000_output_load_multiple (operands); }"
8889 [(set_attr "type" "load")
8890 (set_attr "length" "32")])
8892 (define_insn "*ldmsi3"
8893 [(match_parallel 0 "load_multiple_operation"
8894 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8895 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8896 (set (match_operand:SI 3 "gpc_reg_operand" "")
8897 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8898 (set (match_operand:SI 4 "gpc_reg_operand" "")
8899 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8900 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8902 { return rs6000_output_load_multiple (operands); }"
8903 [(set_attr "type" "load")
8904 (set_attr "length" "32")])
8906 (define_expand "store_multiple"
8907 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8908 (match_operand:SI 1 "" ""))
8909 (clobber (scratch:SI))
8910 (use (match_operand:SI 2 "" ""))])]
8911 "TARGET_STRING && !TARGET_POWERPC64"
8920 /* Support only storing a constant number of fixed-point registers to
8921 memory and only bother with this if more than two; the machine
8922 doesn't support more than eight. */
8923 if (GET_CODE (operands[2]) != CONST_INT
8924 || INTVAL (operands[2]) <= 2
8925 || INTVAL (operands[2]) > 8
8926 || GET_CODE (operands[0]) != MEM
8927 || GET_CODE (operands[1]) != REG
8928 || REGNO (operands[1]) >= 32)
8931 count = INTVAL (operands[2]);
8932 regno = REGNO (operands[1]);
8934 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8935 to = force_reg (SImode, XEXP (operands[0], 0));
8936 op0 = replace_equiv_address (operands[0], to);
8938 XVECEXP (operands[3], 0, 0)
8939 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8940 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8941 gen_rtx_SCRATCH (SImode));
8943 for (i = 1; i < count; i++)
8944 XVECEXP (operands[3], 0, i + 1)
8945 = gen_rtx_SET (VOIDmode,
8946 adjust_address_nv (op0, SImode, i * 4),
8947 gen_rtx_REG (SImode, regno + i));
8950 (define_insn "*store_multiple_power"
8951 [(match_parallel 0 "store_multiple_operation"
8952 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8953 (match_operand:SI 2 "gpc_reg_operand" "r"))
8954 (clobber (match_scratch:SI 3 "=q"))])]
8955 "TARGET_STRING && TARGET_POWER"
8956 "{stsi|stswi} %2,%P1,%O0"
8957 [(set_attr "type" "store")])
8959 (define_insn "*stmsi8"
8960 [(match_parallel 0 "store_multiple_operation"
8961 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8962 (match_operand:SI 2 "gpc_reg_operand" "r"))
8963 (clobber (match_scratch:SI 3 "X"))
8964 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8965 (match_operand:SI 4 "gpc_reg_operand" "r"))
8966 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8967 (match_operand:SI 5 "gpc_reg_operand" "r"))
8968 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8969 (match_operand:SI 6 "gpc_reg_operand" "r"))
8970 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8971 (match_operand:SI 7 "gpc_reg_operand" "r"))
8972 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8973 (match_operand:SI 8 "gpc_reg_operand" "r"))
8974 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8975 (match_operand:SI 9 "gpc_reg_operand" "r"))
8976 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8977 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8978 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8979 "{stsi|stswi} %2,%1,%O0"
8980 [(set_attr "type" "store")])
8982 (define_insn "*stmsi7"
8983 [(match_parallel 0 "store_multiple_operation"
8984 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8985 (match_operand:SI 2 "gpc_reg_operand" "r"))
8986 (clobber (match_scratch:SI 3 "X"))
8987 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8988 (match_operand:SI 4 "gpc_reg_operand" "r"))
8989 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8990 (match_operand:SI 5 "gpc_reg_operand" "r"))
8991 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8992 (match_operand:SI 6 "gpc_reg_operand" "r"))
8993 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8994 (match_operand:SI 7 "gpc_reg_operand" "r"))
8995 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8996 (match_operand:SI 8 "gpc_reg_operand" "r"))
8997 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8998 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8999 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9000 "{stsi|stswi} %2,%1,%O0"
9001 [(set_attr "type" "store")])
9003 (define_insn "*stmsi6"
9004 [(match_parallel 0 "store_multiple_operation"
9005 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9006 (match_operand:SI 2 "gpc_reg_operand" "r"))
9007 (clobber (match_scratch:SI 3 "X"))
9008 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9009 (match_operand:SI 4 "gpc_reg_operand" "r"))
9010 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9011 (match_operand:SI 5 "gpc_reg_operand" "r"))
9012 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9013 (match_operand:SI 6 "gpc_reg_operand" "r"))
9014 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9015 (match_operand:SI 7 "gpc_reg_operand" "r"))
9016 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9017 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9018 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9019 "{stsi|stswi} %2,%1,%O0"
9020 [(set_attr "type" "store")])
9022 (define_insn "*stmsi5"
9023 [(match_parallel 0 "store_multiple_operation"
9024 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9025 (match_operand:SI 2 "gpc_reg_operand" "r"))
9026 (clobber (match_scratch:SI 3 "X"))
9027 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9028 (match_operand:SI 4 "gpc_reg_operand" "r"))
9029 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9030 (match_operand:SI 5 "gpc_reg_operand" "r"))
9031 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9032 (match_operand:SI 6 "gpc_reg_operand" "r"))
9033 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9034 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9035 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9036 "{stsi|stswi} %2,%1,%O0"
9037 [(set_attr "type" "store")])
9039 (define_insn "*stmsi4"
9040 [(match_parallel 0 "store_multiple_operation"
9041 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9042 (match_operand:SI 2 "gpc_reg_operand" "r"))
9043 (clobber (match_scratch:SI 3 "X"))
9044 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9045 (match_operand:SI 4 "gpc_reg_operand" "r"))
9046 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9047 (match_operand:SI 5 "gpc_reg_operand" "r"))
9048 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9049 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9050 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9051 "{stsi|stswi} %2,%1,%O0"
9052 [(set_attr "type" "store")])
9054 (define_insn "*stmsi3"
9055 [(match_parallel 0 "store_multiple_operation"
9056 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9057 (match_operand:SI 2 "gpc_reg_operand" "r"))
9058 (clobber (match_scratch:SI 3 "X"))
9059 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9060 (match_operand:SI 4 "gpc_reg_operand" "r"))
9061 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9062 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9063 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9064 "{stsi|stswi} %2,%1,%O0"
9065 [(set_attr "type" "store")])
9067 ;; String/block move insn.
9068 ;; Argument 0 is the destination
9069 ;; Argument 1 is the source
9070 ;; Argument 2 is the length
9071 ;; Argument 3 is the alignment
9073 (define_expand "movstrsi"
9074 [(parallel [(set (match_operand:BLK 0 "" "")
9075 (match_operand:BLK 1 "" ""))
9076 (use (match_operand:SI 2 "" ""))
9077 (use (match_operand:SI 3 "" ""))])]
9081 if (expand_block_move (operands))
9087 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9088 ;; register allocator doesn't have a clue about allocating 8 word registers.
9089 ;; rD/rS = r5 is preferred, efficient form.
9090 (define_expand "movstrsi_8reg"
9091 [(parallel [(set (match_operand 0 "" "")
9092 (match_operand 1 "" ""))
9093 (use (match_operand 2 "" ""))
9094 (use (match_operand 3 "" ""))
9095 (clobber (reg:SI 5))
9096 (clobber (reg:SI 6))
9097 (clobber (reg:SI 7))
9098 (clobber (reg:SI 8))
9099 (clobber (reg:SI 9))
9100 (clobber (reg:SI 10))
9101 (clobber (reg:SI 11))
9102 (clobber (reg:SI 12))
9103 (clobber (match_scratch:SI 4 ""))])]
9108 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9109 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9110 (use (match_operand:SI 2 "immediate_operand" "i"))
9111 (use (match_operand:SI 3 "immediate_operand" "i"))
9112 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9113 (clobber (reg:SI 6))
9114 (clobber (reg:SI 7))
9115 (clobber (reg:SI 8))
9116 (clobber (reg:SI 9))
9117 (clobber (reg:SI 10))
9118 (clobber (reg:SI 11))
9119 (clobber (reg:SI 12))
9120 (clobber (match_scratch:SI 5 "=q"))]
9121 "TARGET_STRING && TARGET_POWER
9122 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9123 || INTVAL (operands[2]) == 0)
9124 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9125 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9126 && REGNO (operands[4]) == 5"
9127 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9128 [(set_attr "type" "load")
9129 (set_attr "length" "8")])
9132 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9133 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9134 (use (match_operand:SI 2 "immediate_operand" "i"))
9135 (use (match_operand:SI 3 "immediate_operand" "i"))
9136 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9137 (clobber (reg:SI 6))
9138 (clobber (reg:SI 7))
9139 (clobber (reg:SI 8))
9140 (clobber (reg:SI 9))
9141 (clobber (reg:SI 10))
9142 (clobber (reg:SI 11))
9143 (clobber (reg:SI 12))
9144 (clobber (match_scratch:SI 5 "X"))]
9145 "TARGET_STRING && ! TARGET_POWER
9146 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9147 || INTVAL (operands[2]) == 0)
9148 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9149 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9150 && REGNO (operands[4]) == 5"
9151 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9152 [(set_attr "type" "load")
9153 (set_attr "length" "8")])
9156 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9157 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9158 (use (match_operand:SI 2 "immediate_operand" "i"))
9159 (use (match_operand:SI 3 "immediate_operand" "i"))
9160 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9161 (clobber (reg:SI 6))
9162 (clobber (reg:SI 7))
9163 (clobber (reg:SI 8))
9164 (clobber (reg:SI 9))
9165 (clobber (reg:SI 10))
9166 (clobber (reg:SI 11))
9167 (clobber (reg:SI 12))
9168 (clobber (match_scratch:SI 5 "X"))]
9169 "TARGET_STRING && TARGET_POWERPC64
9170 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9171 || INTVAL (operands[2]) == 0)
9172 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9173 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
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")])
9179 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9180 ;; register allocator doesn't have a clue about allocating 6 word registers.
9181 ;; rD/rS = r5 is preferred, efficient form.
9182 (define_expand "movstrsi_6reg"
9183 [(parallel [(set (match_operand 0 "" "")
9184 (match_operand 1 "" ""))
9185 (use (match_operand 2 "" ""))
9186 (use (match_operand 3 "" ""))
9187 (clobber (reg:SI 5))
9188 (clobber (reg:SI 6))
9189 (clobber (reg:SI 7))
9190 (clobber (reg:SI 8))
9191 (clobber (reg:SI 9))
9192 (clobber (reg:SI 10))
9193 (clobber (match_scratch:SI 4 ""))])]
9198 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9199 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9200 (use (match_operand:SI 2 "immediate_operand" "i"))
9201 (use (match_operand:SI 3 "immediate_operand" "i"))
9202 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9203 (clobber (reg:SI 6))
9204 (clobber (reg:SI 7))
9205 (clobber (reg:SI 8))
9206 (clobber (reg:SI 9))
9207 (clobber (reg:SI 10))
9208 (clobber (match_scratch:SI 5 "=q"))]
9209 "TARGET_STRING && TARGET_POWER
9210 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9211 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9212 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9213 && REGNO (operands[4]) == 5"
9214 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9215 [(set_attr "type" "load")
9216 (set_attr "length" "8")])
9219 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9220 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9221 (use (match_operand:SI 2 "immediate_operand" "i"))
9222 (use (match_operand:SI 3 "immediate_operand" "i"))
9223 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9224 (clobber (reg:SI 6))
9225 (clobber (reg:SI 7))
9226 (clobber (reg:SI 8))
9227 (clobber (reg:SI 9))
9228 (clobber (reg:SI 10))
9229 (clobber (match_scratch:SI 5 "X"))]
9230 "TARGET_STRING && ! TARGET_POWER
9231 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9232 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9233 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9234 && REGNO (operands[4]) == 5"
9235 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9236 [(set_attr "type" "load")
9237 (set_attr "length" "8")])
9240 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9241 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9242 (use (match_operand:SI 2 "immediate_operand" "i"))
9243 (use (match_operand:SI 3 "immediate_operand" "i"))
9244 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9245 (clobber (reg:SI 6))
9246 (clobber (reg:SI 7))
9247 (clobber (reg:SI 8))
9248 (clobber (reg:SI 9))
9249 (clobber (reg:SI 10))
9250 (clobber (match_scratch:SI 5 "X"))]
9251 "TARGET_STRING && TARGET_POWERPC64
9252 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9253 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9254 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9255 && REGNO (operands[4]) == 5"
9256 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9257 [(set_attr "type" "load")
9258 (set_attr "length" "8")])
9260 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9261 ;; problems with TImode.
9262 ;; rD/rS = r5 is preferred, efficient form.
9263 (define_expand "movstrsi_4reg"
9264 [(parallel [(set (match_operand 0 "" "")
9265 (match_operand 1 "" ""))
9266 (use (match_operand 2 "" ""))
9267 (use (match_operand 3 "" ""))
9268 (clobber (reg:SI 5))
9269 (clobber (reg:SI 6))
9270 (clobber (reg:SI 7))
9271 (clobber (reg:SI 8))
9272 (clobber (match_scratch:SI 4 ""))])]
9277 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9278 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9279 (use (match_operand:SI 2 "immediate_operand" "i"))
9280 (use (match_operand:SI 3 "immediate_operand" "i"))
9281 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9282 (clobber (reg:SI 6))
9283 (clobber (reg:SI 7))
9284 (clobber (reg:SI 8))
9285 (clobber (match_scratch:SI 5 "=q"))]
9286 "TARGET_STRING && TARGET_POWER
9287 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9288 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9289 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9290 && REGNO (operands[4]) == 5"
9291 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9292 [(set_attr "type" "load")
9293 (set_attr "length" "8")])
9296 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9297 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9298 (use (match_operand:SI 2 "immediate_operand" "i"))
9299 (use (match_operand:SI 3 "immediate_operand" "i"))
9300 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9301 (clobber (reg:SI 6))
9302 (clobber (reg:SI 7))
9303 (clobber (reg:SI 8))
9304 (clobber (match_scratch:SI 5 "X"))]
9305 "TARGET_STRING && ! TARGET_POWER
9306 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9307 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9308 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9309 && REGNO (operands[4]) == 5"
9310 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9311 [(set_attr "type" "load")
9312 (set_attr "length" "8")])
9315 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9316 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9317 (use (match_operand:SI 2 "immediate_operand" "i"))
9318 (use (match_operand:SI 3 "immediate_operand" "i"))
9319 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9320 (clobber (reg:SI 6))
9321 (clobber (reg:SI 7))
9322 (clobber (reg:SI 8))
9323 (clobber (match_scratch:SI 5 "X"))]
9324 "TARGET_STRING && TARGET_POWERPC64
9325 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9326 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9327 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9328 && REGNO (operands[4]) == 5"
9329 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9330 [(set_attr "type" "load")
9331 (set_attr "length" "8")])
9333 ;; Move up to 8 bytes at a time.
9334 (define_expand "movstrsi_2reg"
9335 [(parallel [(set (match_operand 0 "" "")
9336 (match_operand 1 "" ""))
9337 (use (match_operand 2 "" ""))
9338 (use (match_operand 3 "" ""))
9339 (clobber (match_scratch:DI 4 ""))
9340 (clobber (match_scratch:SI 5 ""))])]
9341 "TARGET_STRING && ! TARGET_POWERPC64"
9345 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9346 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9347 (use (match_operand:SI 2 "immediate_operand" "i"))
9348 (use (match_operand:SI 3 "immediate_operand" "i"))
9349 (clobber (match_scratch:DI 4 "=&r"))
9350 (clobber (match_scratch:SI 5 "=q"))]
9351 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9352 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9353 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9354 [(set_attr "type" "load")
9355 (set_attr "length" "8")])
9358 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9359 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9360 (use (match_operand:SI 2 "immediate_operand" "i"))
9361 (use (match_operand:SI 3 "immediate_operand" "i"))
9362 (clobber (match_scratch:DI 4 "=&r"))
9363 (clobber (match_scratch:SI 5 "X"))]
9364 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9365 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9366 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9367 [(set_attr "type" "load")
9368 (set_attr "length" "8")])
9370 ;; Move up to 4 bytes at a time.
9371 (define_expand "movstrsi_1reg"
9372 [(parallel [(set (match_operand 0 "" "")
9373 (match_operand 1 "" ""))
9374 (use (match_operand 2 "" ""))
9375 (use (match_operand 3 "" ""))
9376 (clobber (match_scratch:SI 4 ""))
9377 (clobber (match_scratch:SI 5 ""))])]
9382 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9383 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9384 (use (match_operand:SI 2 "immediate_operand" "i"))
9385 (use (match_operand:SI 3 "immediate_operand" "i"))
9386 (clobber (match_scratch:SI 4 "=&r"))
9387 (clobber (match_scratch:SI 5 "=q"))]
9388 "TARGET_STRING && TARGET_POWER
9389 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9390 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9391 [(set_attr "type" "load")
9392 (set_attr "length" "8")])
9395 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9396 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9397 (use (match_operand:SI 2 "immediate_operand" "i"))
9398 (use (match_operand:SI 3 "immediate_operand" "i"))
9399 (clobber (match_scratch:SI 4 "=&r"))
9400 (clobber (match_scratch:SI 5 "X"))]
9401 "TARGET_STRING && ! TARGET_POWER
9402 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9403 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9404 [(set_attr "type" "load")
9405 (set_attr "length" "8")])
9408 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9409 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9410 (use (match_operand:SI 2 "immediate_operand" "i"))
9411 (use (match_operand:SI 3 "immediate_operand" "i"))
9412 (clobber (match_scratch:SI 4 "=&r"))
9413 (clobber (match_scratch:SI 5 "X"))]
9414 "TARGET_STRING && TARGET_POWERPC64
9415 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9416 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9417 [(set_attr "type" "load")
9418 (set_attr "length" "8")])
9421 ;; Define insns that do load or store with update. Some of these we can
9422 ;; get by using pre-decrement or pre-increment, but the hardware can also
9423 ;; do cases where the increment is not the size of the object.
9425 ;; In all these cases, we use operands 0 and 1 for the register being
9426 ;; incremented because those are the operands that local-alloc will
9427 ;; tie and these are the pair most likely to be tieable (and the ones
9428 ;; that will benefit the most).
9430 (define_insn "*movdi_update1"
9431 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9432 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9433 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9434 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9435 (plus:DI (match_dup 1) (match_dup 2)))]
9436 "TARGET_POWERPC64 && TARGET_UPDATE"
9440 [(set_attr "type" "load_ux,load_u")])
9442 (define_insn "movdi_update"
9443 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9444 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
9445 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9446 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9447 (plus:DI (match_dup 1) (match_dup 2)))]
9448 "TARGET_POWERPC64 && TARGET_UPDATE"
9452 [(set_attr "type" "store_ux,store_u")])
9454 (define_insn "*movsi_update1"
9455 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9456 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9457 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9458 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9459 (plus:SI (match_dup 1) (match_dup 2)))]
9462 {lux|lwzux} %3,%0,%2
9463 {lu|lwzu} %3,%2(%0)"
9464 [(set_attr "type" "load_ux,load_u")])
9466 (define_insn "*movsi_update2"
9467 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9469 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9470 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9471 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9472 (plus:DI (match_dup 1) (match_dup 2)))]
9475 [(set_attr "type" "load_ext_ux")])
9477 (define_insn "movsi_update"
9478 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9479 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9480 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9481 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9482 (plus:SI (match_dup 1) (match_dup 2)))]
9485 {stux|stwux} %3,%0,%2
9486 {stu|stwu} %3,%2(%0)"
9487 [(set_attr "type" "store_ux,store_u")])
9489 (define_insn "*movhi_update1"
9490 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9491 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9492 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9493 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9494 (plus:SI (match_dup 1) (match_dup 2)))]
9499 [(set_attr "type" "load_ux,load_u")])
9501 (define_insn "*movhi_update2"
9502 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9504 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9505 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9506 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9507 (plus:SI (match_dup 1) (match_dup 2)))]
9512 [(set_attr "type" "load_ux,load_u")])
9514 (define_insn "*movhi_update3"
9515 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9517 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9518 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9519 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9520 (plus:SI (match_dup 1) (match_dup 2)))]
9525 [(set_attr "type" "load_ext_ux,load_ext_u")])
9527 (define_insn "*movhi_update4"
9528 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9529 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9530 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9531 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9532 (plus:SI (match_dup 1) (match_dup 2)))]
9537 [(set_attr "type" "store_ux,store_u")])
9539 (define_insn "*movqi_update1"
9540 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9541 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9542 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9543 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9544 (plus:SI (match_dup 1) (match_dup 2)))]
9549 [(set_attr "type" "load_ux,load_u")])
9551 (define_insn "*movqi_update2"
9552 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9554 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9555 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9556 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9557 (plus:SI (match_dup 1) (match_dup 2)))]
9562 [(set_attr "type" "load_ux,load_u")])
9564 (define_insn "*movqi_update3"
9565 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9566 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9567 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9568 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9569 (plus:SI (match_dup 1) (match_dup 2)))]
9574 [(set_attr "type" "store_ux,store_u")])
9576 (define_insn "*movsf_update1"
9577 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9578 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9579 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9580 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9581 (plus:SI (match_dup 1) (match_dup 2)))]
9582 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9586 [(set_attr "type" "fpload_ux,fpload_u")])
9588 (define_insn "*movsf_update2"
9589 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9590 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9591 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9592 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9593 (plus:SI (match_dup 1) (match_dup 2)))]
9594 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9598 [(set_attr "type" "fpstore_ux,fpstore_u")])
9600 (define_insn "*movsf_update3"
9601 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9602 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9603 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9604 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9605 (plus:SI (match_dup 1) (match_dup 2)))]
9606 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9608 {lux|lwzux} %3,%0,%2
9609 {lu|lwzu} %3,%2(%0)"
9610 [(set_attr "type" "load_ux,load_u")])
9612 (define_insn "*movsf_update4"
9613 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9614 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9615 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9616 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9617 (plus:SI (match_dup 1) (match_dup 2)))]
9618 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9620 {stux|stwux} %3,%0,%2
9621 {stu|stwu} %3,%2(%0)"
9622 [(set_attr "type" "store_ux,store_u")])
9624 (define_insn "*movdf_update1"
9625 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9626 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9627 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9628 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9629 (plus:SI (match_dup 1) (match_dup 2)))]
9630 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9634 [(set_attr "type" "fpload_ux,fpload_u")])
9636 (define_insn "*movdf_update2"
9637 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9638 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9639 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9640 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9641 (plus:SI (match_dup 1) (match_dup 2)))]
9642 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9646 [(set_attr "type" "fpstore_ux,fpstore_u")])
9648 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9650 (define_insn "*lfq_power2"
9651 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9652 (match_operand:TF 1 "memory_operand" ""))]
9654 && TARGET_HARD_FLOAT && TARGET_FPRS"
9658 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9659 (match_operand:DF 1 "memory_operand" ""))
9660 (set (match_operand:DF 2 "gpc_reg_operand" "")
9661 (match_operand:DF 3 "memory_operand" ""))]
9663 && TARGET_HARD_FLOAT && TARGET_FPRS
9664 && registers_ok_for_quad_peep (operands[0], operands[2])
9665 && mems_ok_for_quad_peep (operands[1], operands[3])"
9668 "operands[1] = widen_memory_access (operands[1], TFmode, 0);
9669 operands[0] = gen_rtx_REG (TFmode, REGNO (operands[0]));")
9671 (define_insn "*stfq_power2"
9672 [(set (match_operand:TF 0 "memory_operand" "")
9673 (match_operand:TF 1 "gpc_reg_operand" "f"))]
9675 && TARGET_HARD_FLOAT && TARGET_FPRS"
9680 [(set (match_operand:DF 0 "memory_operand" "")
9681 (match_operand:DF 1 "gpc_reg_operand" ""))
9682 (set (match_operand:DF 2 "memory_operand" "")
9683 (match_operand:DF 3 "gpc_reg_operand" ""))]
9685 && TARGET_HARD_FLOAT && TARGET_FPRS
9686 && registers_ok_for_quad_peep (operands[1], operands[3])
9687 && mems_ok_for_quad_peep (operands[0], operands[2])"
9690 "operands[0] = widen_memory_access (operands[0], TFmode, 0);
9691 operands[1] = gen_rtx_REG (TFmode, REGNO (operands[1]));")
9695 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9696 (define_insn "tls_gd_32"
9697 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9698 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9699 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9701 "HAVE_AS_TLS && !TARGET_64BIT"
9702 "addi %0,%1,%2@got@tlsgd")
9704 (define_insn "tls_gd_64"
9705 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9706 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9707 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9709 "HAVE_AS_TLS && TARGET_64BIT"
9710 "addi %0,%1,%2@got@tlsgd")
9712 (define_insn "tls_ld_32"
9713 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9714 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9716 "HAVE_AS_TLS && !TARGET_64BIT"
9717 "addi %0,%1,%&@got@tlsld")
9719 (define_insn "tls_ld_64"
9720 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9721 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9723 "HAVE_AS_TLS && TARGET_64BIT"
9724 "addi %0,%1,%&@got@tlsld")
9726 (define_insn "tls_dtprel_32"
9727 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9728 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9729 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9731 "HAVE_AS_TLS && !TARGET_64BIT"
9732 "addi %0,%1,%2@dtprel")
9734 (define_insn "tls_dtprel_64"
9735 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9736 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9737 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9739 "HAVE_AS_TLS && TARGET_64BIT"
9740 "addi %0,%1,%2@dtprel")
9742 (define_insn "tls_dtprel_ha_32"
9743 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9744 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9745 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9746 UNSPEC_TLSDTPRELHA))]
9747 "HAVE_AS_TLS && !TARGET_64BIT"
9748 "addis %0,%1,%2@dtprel@ha")
9750 (define_insn "tls_dtprel_ha_64"
9751 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9752 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9753 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9754 UNSPEC_TLSDTPRELHA))]
9755 "HAVE_AS_TLS && TARGET_64BIT"
9756 "addis %0,%1,%2@dtprel@ha")
9758 (define_insn "tls_dtprel_lo_32"
9759 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9760 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9761 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9762 UNSPEC_TLSDTPRELLO))]
9763 "HAVE_AS_TLS && !TARGET_64BIT"
9764 "addi %0,%1,%2@dtprel@l")
9766 (define_insn "tls_dtprel_lo_64"
9767 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9768 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9769 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9770 UNSPEC_TLSDTPRELLO))]
9771 "HAVE_AS_TLS && TARGET_64BIT"
9772 "addi %0,%1,%2@dtprel@l")
9774 (define_insn "tls_got_dtprel_32"
9775 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9776 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9777 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9778 UNSPEC_TLSGOTDTPREL))]
9779 "HAVE_AS_TLS && !TARGET_64BIT"
9780 "lwz %0,%2@got@dtprel(%1)")
9782 (define_insn "tls_got_dtprel_64"
9783 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9784 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9785 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9786 UNSPEC_TLSGOTDTPREL))]
9787 "HAVE_AS_TLS && TARGET_64BIT"
9788 "ld %0,%2@got@dtprel(%1)")
9790 (define_insn "tls_tprel_32"
9791 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9792 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9793 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9795 "HAVE_AS_TLS && !TARGET_64BIT"
9796 "addi %0,%1,%2@tprel")
9798 (define_insn "tls_tprel_64"
9799 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9800 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9801 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9803 "HAVE_AS_TLS && TARGET_64BIT"
9804 "addi %0,%1,%2@tprel")
9806 (define_insn "tls_tprel_ha_32"
9807 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9808 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9809 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9810 UNSPEC_TLSTPRELHA))]
9811 "HAVE_AS_TLS && !TARGET_64BIT"
9812 "addis %0,%1,%2@tprel@ha")
9814 (define_insn "tls_tprel_ha_64"
9815 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9816 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9817 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9818 UNSPEC_TLSTPRELHA))]
9819 "HAVE_AS_TLS && TARGET_64BIT"
9820 "addis %0,%1,%2@tprel@ha")
9822 (define_insn "tls_tprel_lo_32"
9823 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9824 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9825 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9826 UNSPEC_TLSTPRELLO))]
9827 "HAVE_AS_TLS && !TARGET_64BIT"
9828 "addi %0,%1,%2@tprel@l")
9830 (define_insn "tls_tprel_lo_64"
9831 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9832 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9833 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9834 UNSPEC_TLSTPRELLO))]
9835 "HAVE_AS_TLS && TARGET_64BIT"
9836 "addi %0,%1,%2@tprel@l")
9838 ;; "b" output constraint here and on tls_tls input to support linker tls
9839 ;; optimization. The linker may edit the instructions emitted by a
9840 ;; tls_got_tprel/tls_tls pair to addis,addi.
9841 (define_insn "tls_got_tprel_32"
9842 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9843 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9844 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9845 UNSPEC_TLSGOTTPREL))]
9846 "HAVE_AS_TLS && !TARGET_64BIT"
9847 "lwz %0,%2@got@tprel(%1)")
9849 (define_insn "tls_got_tprel_64"
9850 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9851 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9852 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9853 UNSPEC_TLSGOTTPREL))]
9854 "HAVE_AS_TLS && TARGET_64BIT"
9855 "ld %0,%2@got@tprel(%1)")
9857 (define_insn "tls_tls_32"
9858 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9859 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9860 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9862 "HAVE_AS_TLS && !TARGET_64BIT"
9865 (define_insn "tls_tls_64"
9866 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9867 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9868 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9870 "HAVE_AS_TLS && TARGET_64BIT"
9873 ;; Next come insns related to the calling sequence.
9875 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9876 ;; We move the back-chain and decrement the stack pointer.
9878 (define_expand "allocate_stack"
9879 [(set (match_operand 0 "gpc_reg_operand" "=r")
9880 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9882 (minus (reg 1) (match_dup 1)))]
9885 { rtx chain = gen_reg_rtx (Pmode);
9886 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9889 emit_move_insn (chain, stack_bot);
9891 /* Check stack bounds if necessary. */
9892 if (current_function_limit_stack)
9895 available = expand_binop (Pmode, sub_optab,
9896 stack_pointer_rtx, stack_limit_rtx,
9897 NULL_RTX, 1, OPTAB_WIDEN);
9898 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9901 if (GET_CODE (operands[1]) != CONST_INT
9902 || INTVAL (operands[1]) < -32767
9903 || INTVAL (operands[1]) > 32768)
9905 neg_op0 = gen_reg_rtx (Pmode);
9907 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9909 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9912 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9915 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
9916 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9920 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9921 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9922 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9925 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9929 ;; These patterns say how to save and restore the stack pointer. We need not
9930 ;; save the stack pointer at function level since we are careful to
9931 ;; preserve the backchain. At block level, we have to restore the backchain
9932 ;; when we restore the stack pointer.
9934 ;; For nonlocal gotos, we must save both the stack pointer and its
9935 ;; backchain and restore both. Note that in the nonlocal case, the
9936 ;; save area is a memory location.
9938 (define_expand "save_stack_function"
9939 [(match_operand 0 "any_operand" "")
9940 (match_operand 1 "any_operand" "")]
9944 (define_expand "restore_stack_function"
9945 [(match_operand 0 "any_operand" "")
9946 (match_operand 1 "any_operand" "")]
9950 (define_expand "restore_stack_block"
9951 [(use (match_operand 0 "register_operand" ""))
9952 (set (match_dup 2) (match_dup 3))
9953 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9954 (set (match_dup 3) (match_dup 2))]
9958 operands[2] = gen_reg_rtx (Pmode);
9959 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9962 (define_expand "save_stack_nonlocal"
9963 [(match_operand 0 "memory_operand" "")
9964 (match_operand 1 "register_operand" "")]
9968 rtx temp = gen_reg_rtx (Pmode);
9969 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9971 /* Copy the backchain to the first word, sp to the second. */
9972 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9973 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
9974 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
9979 (define_expand "restore_stack_nonlocal"
9980 [(match_operand 0 "register_operand" "")
9981 (match_operand 1 "memory_operand" "")]
9985 rtx temp = gen_reg_rtx (Pmode);
9986 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9988 /* Restore the backchain from the first word, sp from the second. */
9989 emit_move_insn (temp,
9990 adjust_address_nv (operands[1], Pmode, 0));
9991 emit_move_insn (operands[0],
9992 adjust_address_nv (operands[1], Pmode, units_per_word));
9993 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9997 ;; TOC register handling.
9999 ;; Code to initialize the TOC register...
10001 (define_insn "load_toc_aix_si"
10002 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10003 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10004 (use (reg:SI 2))])]
10005 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10009 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10010 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10011 operands[2] = gen_rtx_REG (Pmode, 2);
10012 return \"{l|lwz} %0,%1(%2)\";
10014 [(set_attr "type" "load")])
10016 (define_insn "load_toc_aix_di"
10017 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10018 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10019 (use (reg:DI 2))])]
10020 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10024 #ifdef TARGET_RELOCATABLE
10025 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10026 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10028 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10031 strcat (buf, \"@toc\");
10032 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10033 operands[2] = gen_rtx_REG (Pmode, 2);
10034 return \"ld %0,%1(%2)\";
10036 [(set_attr "type" "load")])
10038 (define_insn "load_toc_v4_pic_si"
10039 [(set (match_operand:SI 0 "register_operand" "=l")
10040 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10041 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10042 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10043 [(set_attr "type" "branch")
10044 (set_attr "length" "4")])
10046 (define_insn "load_toc_v4_PIC_1"
10047 [(set (match_operand:SI 0 "register_operand" "=l")
10048 (match_operand:SI 1 "immediate_operand" "s"))
10049 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
10050 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10051 "bcl 20,31,%1\\n%1:"
10052 [(set_attr "type" "branch")
10053 (set_attr "length" "4")])
10055 (define_insn "load_toc_v4_PIC_1b"
10056 [(set (match_operand:SI 0 "register_operand" "=l")
10057 (match_operand:SI 1 "immediate_operand" "s"))
10058 (use (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")]
10060 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10061 "bcl 20,31,%1+4\\n%1:\\n\\t.long %2-%1"
10062 [(set_attr "type" "branch")
10063 (set_attr "length" "8")])
10065 (define_insn "load_toc_v4_PIC_2"
10066 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10067 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10068 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10069 (match_operand:SI 3 "immediate_operand" "s")))))]
10070 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10071 "{l|lwz} %0,%2-%3(%1)"
10072 [(set_attr "type" "load")])
10074 (define_insn "load_macho_picbase"
10075 [(set (match_operand:SI 0 "register_operand" "=l")
10076 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
10078 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
10079 "bcl 20,31,%1\\n%1:"
10080 [(set_attr "type" "branch")
10081 (set_attr "length" "4")])
10083 (define_insn "macho_correct_pic"
10084 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10085 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10086 (unspec:SI [(match_operand:SI 2 "immediate_operand" "s")
10087 (match_operand:SI 3 "immediate_operand" "s")]
10088 UNSPEC_MPIC_CORRECT)))]
10089 "DEFAULT_ABI == ABI_DARWIN"
10090 "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)"
10091 [(set_attr "length" "8")])
10093 ;; If the TOC is shared over a translation unit, as happens with all
10094 ;; the kinds of PIC that we support, we need to restore the TOC
10095 ;; pointer only when jumping over units of translation.
10096 ;; On Darwin, we need to reload the picbase.
10098 (define_expand "builtin_setjmp_receiver"
10099 [(use (label_ref (match_operand 0 "" "")))]
10100 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10101 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10102 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10106 if (DEFAULT_ABI == ABI_DARWIN)
10108 const char *picbase = machopic_function_base_name ();
10109 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10110 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10114 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10115 CODE_LABEL_NUMBER (operands[0]));
10116 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10118 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10119 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10123 rs6000_emit_load_toc_table (FALSE);
10127 ;; A function pointer under AIX is a pointer to a data area whose first word
10128 ;; contains the actual address of the function, whose second word contains a
10129 ;; pointer to its TOC, and whose third word contains a value to place in the
10130 ;; static chain register (r11). Note that if we load the static chain, our
10131 ;; "trampoline" need not have any executable code.
10133 (define_expand "call_indirect_aix32"
10134 [(set (match_dup 2)
10135 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10136 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10139 (mem:SI (plus:SI (match_dup 0)
10142 (mem:SI (plus:SI (match_dup 0)
10144 (parallel [(call (mem:SI (match_dup 2))
10145 (match_operand 1 "" ""))
10149 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10150 (clobber (scratch:SI))])]
10153 { operands[2] = gen_reg_rtx (SImode); }")
10155 (define_expand "call_indirect_aix64"
10156 [(set (match_dup 2)
10157 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10158 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10161 (mem:DI (plus:DI (match_dup 0)
10164 (mem:DI (plus:DI (match_dup 0)
10166 (parallel [(call (mem:SI (match_dup 2))
10167 (match_operand 1 "" ""))
10171 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10172 (clobber (scratch:SI))])]
10175 { operands[2] = gen_reg_rtx (DImode); }")
10177 (define_expand "call_value_indirect_aix32"
10178 [(set (match_dup 3)
10179 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10180 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10183 (mem:SI (plus:SI (match_dup 1)
10186 (mem:SI (plus:SI (match_dup 1)
10188 (parallel [(set (match_operand 0 "" "")
10189 (call (mem:SI (match_dup 3))
10190 (match_operand 2 "" "")))
10194 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10195 (clobber (scratch:SI))])]
10198 { operands[3] = gen_reg_rtx (SImode); }")
10200 (define_expand "call_value_indirect_aix64"
10201 [(set (match_dup 3)
10202 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10203 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10206 (mem:DI (plus:DI (match_dup 1)
10209 (mem:DI (plus:DI (match_dup 1)
10211 (parallel [(set (match_operand 0 "" "")
10212 (call (mem:SI (match_dup 3))
10213 (match_operand 2 "" "")))
10217 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10218 (clobber (scratch:SI))])]
10221 { operands[3] = gen_reg_rtx (DImode); }")
10223 ;; Now the definitions for the call and call_value insns
10224 (define_expand "call"
10225 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10226 (match_operand 1 "" ""))
10227 (use (match_operand 2 "" ""))
10228 (clobber (scratch:SI))])]
10233 if (MACHOPIC_INDIRECT)
10234 operands[0] = machopic_indirect_call_target (operands[0]);
10237 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10240 operands[0] = XEXP (operands[0], 0);
10242 if (GET_CODE (operands[0]) != SYMBOL_REF
10243 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10244 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10246 if (INTVAL (operands[2]) & CALL_LONG)
10247 operands[0] = rs6000_longcall_ref (operands[0]);
10249 if (DEFAULT_ABI == ABI_V4
10250 || DEFAULT_ABI == ABI_DARWIN)
10251 operands[0] = force_reg (Pmode, operands[0]);
10253 else if (DEFAULT_ABI == ABI_AIX)
10255 /* AIX function pointers are really pointers to a three word
10257 emit_call_insn (TARGET_32BIT
10258 ? gen_call_indirect_aix32 (force_reg (SImode,
10261 : gen_call_indirect_aix64 (force_reg (DImode,
10271 (define_expand "call_value"
10272 [(parallel [(set (match_operand 0 "" "")
10273 (call (mem:SI (match_operand 1 "address_operand" ""))
10274 (match_operand 2 "" "")))
10275 (use (match_operand 3 "" ""))
10276 (clobber (scratch:SI))])]
10281 if (MACHOPIC_INDIRECT)
10282 operands[1] = machopic_indirect_call_target (operands[1]);
10285 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10288 operands[1] = XEXP (operands[1], 0);
10290 if (GET_CODE (operands[1]) != SYMBOL_REF
10291 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10292 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10294 if (INTVAL (operands[3]) & CALL_LONG)
10295 operands[1] = rs6000_longcall_ref (operands[1]);
10297 if (DEFAULT_ABI == ABI_V4
10298 || DEFAULT_ABI == ABI_DARWIN)
10299 operands[1] = force_reg (Pmode, operands[1]);
10301 else if (DEFAULT_ABI == ABI_AIX)
10303 /* AIX function pointers are really pointers to a three word
10305 emit_call_insn (TARGET_32BIT
10306 ? gen_call_value_indirect_aix32 (operands[0],
10310 : gen_call_value_indirect_aix64 (operands[0],
10321 ;; Call to function in current module. No TOC pointer reload needed.
10322 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10323 ;; either the function was not prototyped, or it was prototyped as a
10324 ;; variable argument function. It is > 0 if FP registers were passed
10325 ;; and < 0 if they were not.
10327 (define_insn "*call_local32"
10328 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10329 (match_operand 1 "" "g,g"))
10330 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10331 (clobber (match_scratch:SI 3 "=l,l"))]
10332 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10335 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10336 output_asm_insn (\"crxor 6,6,6\", operands);
10338 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10339 output_asm_insn (\"creqv 6,6,6\", operands);
10341 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10343 [(set_attr "type" "branch")
10344 (set_attr "length" "4,8")])
10346 (define_insn "*call_local64"
10347 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10348 (match_operand 1 "" "g,g"))
10349 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10350 (clobber (match_scratch:SI 3 "=l,l"))]
10351 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10354 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10355 output_asm_insn (\"crxor 6,6,6\", operands);
10357 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10358 output_asm_insn (\"creqv 6,6,6\", operands);
10360 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10362 [(set_attr "type" "branch")
10363 (set_attr "length" "4,8")])
10365 (define_insn "*call_value_local32"
10366 [(set (match_operand 0 "" "")
10367 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10368 (match_operand 2 "" "g,g")))
10369 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10370 (clobber (match_scratch:SI 4 "=l,l"))]
10371 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10374 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10375 output_asm_insn (\"crxor 6,6,6\", operands);
10377 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10378 output_asm_insn (\"creqv 6,6,6\", operands);
10380 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10382 [(set_attr "type" "branch")
10383 (set_attr "length" "4,8")])
10386 (define_insn "*call_value_local64"
10387 [(set (match_operand 0 "" "")
10388 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10389 (match_operand 2 "" "g,g")))
10390 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10391 (clobber (match_scratch:SI 4 "=l,l"))]
10392 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10395 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10396 output_asm_insn (\"crxor 6,6,6\", operands);
10398 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10399 output_asm_insn (\"creqv 6,6,6\", operands);
10401 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10403 [(set_attr "type" "branch")
10404 (set_attr "length" "4,8")])
10406 ;; Call to function which may be in another module. Restore the TOC
10407 ;; pointer (r2) after the call unless this is System V.
10408 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10409 ;; either the function was not prototyped, or it was prototyped as a
10410 ;; variable argument function. It is > 0 if FP registers were passed
10411 ;; and < 0 if they were not.
10413 (define_insn "*call_indirect_nonlocal_aix32"
10414 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10415 (match_operand 1 "" "g"))
10419 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10420 (clobber (match_scratch:SI 2 "=l"))]
10421 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10422 "b%T0l\;{l|lwz} 2,20(1)"
10423 [(set_attr "type" "jmpreg")
10424 (set_attr "length" "8")])
10426 (define_insn "*call_nonlocal_aix32"
10427 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10428 (match_operand 1 "" "g"))
10429 (use (match_operand:SI 2 "immediate_operand" "O"))
10430 (clobber (match_scratch:SI 3 "=l"))]
10432 && DEFAULT_ABI == ABI_AIX
10433 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10435 [(set_attr "type" "branch")
10436 (set_attr "length" "8")])
10438 (define_insn "*call_indirect_nonlocal_aix64"
10439 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10440 (match_operand 1 "" "g"))
10444 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10445 (clobber (match_scratch:SI 2 "=l"))]
10446 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10447 "b%T0l\;ld 2,40(1)"
10448 [(set_attr "type" "jmpreg")
10449 (set_attr "length" "8")])
10451 (define_insn "*call_nonlocal_aix64"
10452 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10453 (match_operand 1 "" "g"))
10454 (use (match_operand:SI 2 "immediate_operand" "O"))
10455 (clobber (match_scratch:SI 3 "=l"))]
10457 && DEFAULT_ABI == ABI_AIX
10458 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10460 [(set_attr "type" "branch")
10461 (set_attr "length" "8")])
10463 (define_insn "*call_value_indirect_nonlocal_aix32"
10464 [(set (match_operand 0 "" "")
10465 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10466 (match_operand 2 "" "g")))
10470 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10471 (clobber (match_scratch:SI 3 "=l"))]
10472 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10473 "b%T1l\;{l|lwz} 2,20(1)"
10474 [(set_attr "type" "jmpreg")
10475 (set_attr "length" "8")])
10477 (define_insn "*call_value_nonlocal_aix32"
10478 [(set (match_operand 0 "" "")
10479 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10480 (match_operand 2 "" "g")))
10481 (use (match_operand:SI 3 "immediate_operand" "O"))
10482 (clobber (match_scratch:SI 4 "=l"))]
10484 && DEFAULT_ABI == ABI_AIX
10485 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10487 [(set_attr "type" "branch")
10488 (set_attr "length" "8")])
10490 (define_insn "*call_value_indirect_nonlocal_aix64"
10491 [(set (match_operand 0 "" "")
10492 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10493 (match_operand 2 "" "g")))
10497 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10498 (clobber (match_scratch:SI 3 "=l"))]
10499 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10500 "b%T1l\;ld 2,40(1)"
10501 [(set_attr "type" "jmpreg")
10502 (set_attr "length" "8")])
10504 (define_insn "*call_value_nonlocal_aix64"
10505 [(set (match_operand 0 "" "")
10506 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10507 (match_operand 2 "" "g")))
10508 (use (match_operand:SI 3 "immediate_operand" "O"))
10509 (clobber (match_scratch:SI 4 "=l"))]
10511 && DEFAULT_ABI == ABI_AIX
10512 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10514 [(set_attr "type" "branch")
10515 (set_attr "length" "8")])
10517 ;; A function pointer under System V is just a normal pointer
10518 ;; operands[0] is the function pointer
10519 ;; operands[1] is the stack size to clean up
10520 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10521 ;; which indicates how to set cr1
10523 (define_insn "*call_indirect_nonlocal_sysv"
10524 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10525 (match_operand 1 "" "g,g"))
10526 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10527 (clobber (match_scratch:SI 3 "=l,l"))]
10528 "DEFAULT_ABI == ABI_V4
10529 || DEFAULT_ABI == ABI_DARWIN"
10531 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10532 output_asm_insn ("crxor 6,6,6", operands);
10534 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10535 output_asm_insn ("creqv 6,6,6", operands);
10539 [(set_attr "type" "jmpreg,jmpreg")
10540 (set_attr "length" "4,8")])
10542 (define_insn "*call_nonlocal_sysv"
10543 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10544 (match_operand 1 "" "g,g"))
10545 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10546 (clobber (match_scratch:SI 3 "=l,l"))]
10547 "(DEFAULT_ABI == ABI_DARWIN
10548 || (DEFAULT_ABI == ABI_V4
10549 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10551 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10552 output_asm_insn ("crxor 6,6,6", operands);
10554 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10555 output_asm_insn ("creqv 6,6,6", operands);
10558 return output_call(insn, operands, 0, 2);
10560 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10563 [(set_attr "type" "branch,branch")
10564 (set_attr "length" "4,8")])
10566 (define_insn "*call_value_indirect_nonlocal_sysv"
10567 [(set (match_operand 0 "" "")
10568 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10569 (match_operand 2 "" "g,g")))
10570 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10571 (clobber (match_scratch:SI 4 "=l,l"))]
10572 "DEFAULT_ABI == ABI_V4
10573 || DEFAULT_ABI == ABI_DARWIN"
10575 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10576 output_asm_insn ("crxor 6,6,6", operands);
10578 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10579 output_asm_insn ("creqv 6,6,6", operands);
10583 [(set_attr "type" "jmpreg,jmpreg")
10584 (set_attr "length" "4,8")])
10586 (define_insn "*call_value_nonlocal_sysv"
10587 [(set (match_operand 0 "" "")
10588 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10589 (match_operand 2 "" "g,g")))
10590 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10591 (clobber (match_scratch:SI 4 "=l,l"))]
10592 "(DEFAULT_ABI == ABI_DARWIN
10593 || (DEFAULT_ABI == ABI_V4
10594 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10596 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10597 output_asm_insn ("crxor 6,6,6", operands);
10599 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10600 output_asm_insn ("creqv 6,6,6", operands);
10603 return output_call(insn, operands, 1, 3);
10605 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10608 [(set_attr "type" "branch,branch")
10609 (set_attr "length" "4,8")])
10611 ;; Call subroutine returning any type.
10612 (define_expand "untyped_call"
10613 [(parallel [(call (match_operand 0 "" "")
10615 (match_operand 1 "" "")
10616 (match_operand 2 "" "")])]
10622 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10624 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10626 rtx set = XVECEXP (operands[2], 0, i);
10627 emit_move_insn (SET_DEST (set), SET_SRC (set));
10630 /* The optimizer does not know that the call sets the function value
10631 registers we stored in the result block. We avoid problems by
10632 claiming that all hard registers are used and clobbered at this
10634 emit_insn (gen_blockage ());
10639 ;; sibling call patterns
10640 (define_expand "sibcall"
10641 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10642 (match_operand 1 "" ""))
10643 (use (match_operand 2 "" ""))
10644 (use (match_operand 3 "" ""))
10650 if (MACHOPIC_INDIRECT)
10651 operands[0] = machopic_indirect_call_target (operands[0]);
10654 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10657 operands[0] = XEXP (operands[0], 0);
10658 operands[3] = gen_reg_rtx (SImode);
10662 ;; this and similar patterns must be marked as using LR, otherwise
10663 ;; dataflow will try to delete the store into it. This is true
10664 ;; even when the actual reg to jump to is in CTR, when LR was
10665 ;; saved and restored around the PIC-setting BCL.
10666 (define_insn "*sibcall_local32"
10667 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10668 (match_operand 1 "" "g,g"))
10669 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10670 (use (match_operand:SI 3 "register_operand" "l,l"))
10672 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10675 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10676 output_asm_insn (\"crxor 6,6,6\", operands);
10678 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10679 output_asm_insn (\"creqv 6,6,6\", operands);
10681 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10683 [(set_attr "type" "branch")
10684 (set_attr "length" "4,8")])
10686 (define_insn "*sibcall_local64"
10687 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10688 (match_operand 1 "" "g,g"))
10689 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10690 (use (match_operand:SI 3 "register_operand" "l,l"))
10692 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10695 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10696 output_asm_insn (\"crxor 6,6,6\", operands);
10698 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10699 output_asm_insn (\"creqv 6,6,6\", operands);
10701 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10703 [(set_attr "type" "branch")
10704 (set_attr "length" "4,8")])
10706 (define_insn "*sibcall_value_local32"
10707 [(set (match_operand 0 "" "")
10708 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10709 (match_operand 2 "" "g,g")))
10710 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10711 (use (match_operand:SI 4 "register_operand" "l,l"))
10713 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10716 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10717 output_asm_insn (\"crxor 6,6,6\", operands);
10719 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10720 output_asm_insn (\"creqv 6,6,6\", operands);
10722 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10724 [(set_attr "type" "branch")
10725 (set_attr "length" "4,8")])
10728 (define_insn "*sibcall_value_local64"
10729 [(set (match_operand 0 "" "")
10730 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10731 (match_operand 2 "" "g,g")))
10732 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10733 (use (match_operand:SI 4 "register_operand" "l,l"))
10735 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10738 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10739 output_asm_insn (\"crxor 6,6,6\", operands);
10741 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10742 output_asm_insn (\"creqv 6,6,6\", operands);
10744 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10746 [(set_attr "type" "branch")
10747 (set_attr "length" "4,8")])
10749 (define_insn "*sibcall_nonlocal_aix32"
10750 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10751 (match_operand 1 "" "g"))
10752 (use (match_operand:SI 2 "immediate_operand" "O"))
10753 (use (match_operand:SI 3 "register_operand" "l"))
10756 && DEFAULT_ABI == ABI_AIX
10757 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10759 [(set_attr "type" "branch")
10760 (set_attr "length" "4")])
10762 (define_insn "*sibcall_nonlocal_aix64"
10763 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10764 (match_operand 1 "" "g"))
10765 (use (match_operand:SI 2 "immediate_operand" "O"))
10766 (use (match_operand:SI 3 "register_operand" "l"))
10769 && DEFAULT_ABI == ABI_AIX
10770 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10772 [(set_attr "type" "branch")
10773 (set_attr "length" "4")])
10775 (define_insn "*sibcall_value_nonlocal_aix32"
10776 [(set (match_operand 0 "" "")
10777 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10778 (match_operand 2 "" "g")))
10779 (use (match_operand:SI 3 "immediate_operand" "O"))
10780 (use (match_operand:SI 4 "register_operand" "l"))
10783 && DEFAULT_ABI == ABI_AIX
10784 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10786 [(set_attr "type" "branch")
10787 (set_attr "length" "4")])
10789 (define_insn "*sibcall_value_nonlocal_aix64"
10790 [(set (match_operand 0 "" "")
10791 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10792 (match_operand 2 "" "g")))
10793 (use (match_operand:SI 3 "immediate_operand" "O"))
10794 (use (match_operand:SI 4 "register_operand" "l"))
10797 && DEFAULT_ABI == ABI_AIX
10798 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10800 [(set_attr "type" "branch")
10801 (set_attr "length" "4")])
10803 (define_insn "*sibcall_nonlocal_sysv"
10804 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10805 (match_operand 1 "" ""))
10806 (use (match_operand 2 "immediate_operand" "O,n"))
10807 (use (match_operand:SI 3 "register_operand" "l,l"))
10809 "(DEFAULT_ABI == ABI_DARWIN
10810 || DEFAULT_ABI == ABI_V4)
10811 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10814 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10815 output_asm_insn (\"crxor 6,6,6\", operands);
10817 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10818 output_asm_insn (\"creqv 6,6,6\", operands);
10820 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
10822 [(set_attr "type" "branch,branch")
10823 (set_attr "length" "4,8")])
10825 (define_expand "sibcall_value"
10826 [(parallel [(set (match_operand 0 "register_operand" "")
10827 (call (mem:SI (match_operand 1 "address_operand" ""))
10828 (match_operand 2 "" "")))
10829 (use (match_operand 3 "" ""))
10830 (use (match_operand 4 "" ""))
10836 if (MACHOPIC_INDIRECT)
10837 operands[1] = machopic_indirect_call_target (operands[1]);
10840 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10843 operands[1] = XEXP (operands[1], 0);
10844 operands[4] = gen_reg_rtx (SImode);
10848 (define_insn "*sibcall_value_nonlocal_sysv"
10849 [(set (match_operand 0 "" "")
10850 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10851 (match_operand 2 "" "")))
10852 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10853 (use (match_operand:SI 4 "register_operand" "l,l"))
10855 "(DEFAULT_ABI == ABI_DARWIN
10856 || DEFAULT_ABI == ABI_V4)
10857 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10860 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10861 output_asm_insn (\"crxor 6,6,6\", operands);
10863 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10864 output_asm_insn (\"creqv 6,6,6\", operands);
10866 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
10868 [(set_attr "type" "branch,branch")
10869 (set_attr "length" "4,8")])
10871 (define_expand "sibcall_epilogue"
10872 [(use (const_int 0))]
10873 "TARGET_SCHED_PROLOG"
10876 rs6000_emit_epilogue (TRUE);
10880 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10881 ;; all of memory. This blocks insns from being moved across this point.
10883 (define_insn "blockage"
10884 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10888 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10889 ;; signed & unsigned, and one type of branch.
10891 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10892 ;; insns, and branches. We store the operands of compares until we see
10894 (define_expand "cmpsi"
10896 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10897 (match_operand:SI 1 "reg_or_short_operand" "")))]
10901 /* Take care of the possibility that operands[1] might be negative but
10902 this might be a logical operation. That insn doesn't exist. */
10903 if (GET_CODE (operands[1]) == CONST_INT
10904 && INTVAL (operands[1]) < 0)
10905 operands[1] = force_reg (SImode, operands[1]);
10907 rs6000_compare_op0 = operands[0];
10908 rs6000_compare_op1 = operands[1];
10909 rs6000_compare_fp_p = 0;
10913 (define_expand "cmpdi"
10915 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10916 (match_operand:DI 1 "reg_or_short_operand" "")))]
10920 /* Take care of the possibility that operands[1] might be negative but
10921 this might be a logical operation. That insn doesn't exist. */
10922 if (GET_CODE (operands[1]) == CONST_INT
10923 && INTVAL (operands[1]) < 0)
10924 operands[1] = force_reg (DImode, operands[1]);
10926 rs6000_compare_op0 = operands[0];
10927 rs6000_compare_op1 = operands[1];
10928 rs6000_compare_fp_p = 0;
10932 (define_expand "cmpsf"
10933 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10934 (match_operand:SF 1 "gpc_reg_operand" "")))]
10935 "TARGET_HARD_FLOAT"
10938 rs6000_compare_op0 = operands[0];
10939 rs6000_compare_op1 = operands[1];
10940 rs6000_compare_fp_p = 1;
10944 (define_expand "cmpdf"
10945 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10946 (match_operand:DF 1 "gpc_reg_operand" "")))]
10947 "TARGET_HARD_FLOAT && TARGET_FPRS"
10950 rs6000_compare_op0 = operands[0];
10951 rs6000_compare_op1 = operands[1];
10952 rs6000_compare_fp_p = 1;
10956 (define_expand "cmptf"
10957 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
10958 (match_operand:TF 1 "gpc_reg_operand" "")))]
10959 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
10960 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10963 rs6000_compare_op0 = operands[0];
10964 rs6000_compare_op1 = operands[1];
10965 rs6000_compare_fp_p = 1;
10969 (define_expand "beq"
10970 [(use (match_operand 0 "" ""))]
10972 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10974 (define_expand "bne"
10975 [(use (match_operand 0 "" ""))]
10977 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10979 (define_expand "bge"
10980 [(use (match_operand 0 "" ""))]
10982 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10984 (define_expand "bgt"
10985 [(use (match_operand 0 "" ""))]
10987 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10989 (define_expand "ble"
10990 [(use (match_operand 0 "" ""))]
10992 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10994 (define_expand "blt"
10995 [(use (match_operand 0 "" ""))]
10997 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10999 (define_expand "bgeu"
11000 [(use (match_operand 0 "" ""))]
11002 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11004 (define_expand "bgtu"
11005 [(use (match_operand 0 "" ""))]
11007 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11009 (define_expand "bleu"
11010 [(use (match_operand 0 "" ""))]
11012 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11014 (define_expand "bltu"
11015 [(use (match_operand 0 "" ""))]
11017 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11019 (define_expand "bunordered"
11020 [(use (match_operand 0 "" ""))]
11022 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11024 (define_expand "bordered"
11025 [(use (match_operand 0 "" ""))]
11027 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11029 (define_expand "buneq"
11030 [(use (match_operand 0 "" ""))]
11032 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11034 (define_expand "bunge"
11035 [(use (match_operand 0 "" ""))]
11037 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11039 (define_expand "bungt"
11040 [(use (match_operand 0 "" ""))]
11042 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11044 (define_expand "bunle"
11045 [(use (match_operand 0 "" ""))]
11047 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11049 (define_expand "bunlt"
11050 [(use (match_operand 0 "" ""))]
11052 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11054 (define_expand "bltgt"
11055 [(use (match_operand 0 "" ""))]
11057 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11059 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11060 ;; For SEQ, likewise, except that comparisons with zero should be done
11061 ;; with an scc insns. However, due to the order that combine see the
11062 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11063 ;; the cases we don't want to handle.
11064 (define_expand "seq"
11065 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11067 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11069 (define_expand "sne"
11070 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11074 if (! rs6000_compare_fp_p)
11077 rs6000_emit_sCOND (NE, operands[0]);
11081 ;; A >= 0 is best done the portable way for A an integer.
11082 (define_expand "sge"
11083 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11087 if (! rs6000_compare_fp_p
11088 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11091 rs6000_emit_sCOND (GE, operands[0]);
11095 ;; A > 0 is best done using the portable sequence, so fail in that case.
11096 (define_expand "sgt"
11097 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11101 if (! rs6000_compare_fp_p
11102 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11105 rs6000_emit_sCOND (GT, operands[0]);
11109 ;; A <= 0 is best done the portable way for A an integer.
11110 (define_expand "sle"
11111 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11115 if (! rs6000_compare_fp_p
11116 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11119 rs6000_emit_sCOND (LE, operands[0]);
11123 ;; A < 0 is best done in the portable way for A an integer.
11124 (define_expand "slt"
11125 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11129 if (! rs6000_compare_fp_p
11130 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11133 rs6000_emit_sCOND (LT, operands[0]);
11137 (define_expand "sgeu"
11138 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11140 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11142 (define_expand "sgtu"
11143 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11145 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11147 (define_expand "sleu"
11148 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11150 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11152 (define_expand "sltu"
11153 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11155 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11157 (define_expand "sunordered"
11158 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11160 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11162 (define_expand "sordered"
11163 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11165 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11167 (define_expand "suneq"
11168 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11170 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11172 (define_expand "sunge"
11173 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11175 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11177 (define_expand "sungt"
11178 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11180 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11182 (define_expand "sunle"
11183 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11185 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11187 (define_expand "sunlt"
11188 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11190 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11192 (define_expand "sltgt"
11193 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11195 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11198 ;; Here are the actual compare insns.
11199 (define_insn "*cmpsi_internal1"
11200 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11201 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11202 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11204 "{cmp%I2|cmpw%I2} %0,%1,%2"
11205 [(set_attr "type" "cmp")])
11207 (define_insn "*cmpdi_internal1"
11208 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11209 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11210 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11213 [(set_attr "type" "cmp")])
11215 ;; If we are comparing a register for equality with a large constant,
11216 ;; we can do this with an XOR followed by a compare. But we need a scratch
11217 ;; register for the result of the XOR.
11220 [(set (match_operand:CC 0 "cc_reg_operand" "")
11221 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11222 (match_operand:SI 2 "non_short_cint_operand" "")))
11223 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11224 "find_single_use (operands[0], insn, 0)
11225 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11226 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11227 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11228 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11231 /* Get the constant we are comparing against, C, and see what it looks like
11232 sign-extended to 16 bits. Then see what constant could be XOR'ed
11233 with C to get the sign-extended value. */
11235 HOST_WIDE_INT c = INTVAL (operands[2]);
11236 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11237 HOST_WIDE_INT xorv = c ^ sextc;
11239 operands[4] = GEN_INT (xorv);
11240 operands[5] = GEN_INT (sextc);
11243 (define_insn "*cmpsi_internal2"
11244 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11245 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11246 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11248 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11249 [(set_attr "type" "cmp")])
11251 (define_insn "*cmpdi_internal2"
11252 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11253 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11254 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11256 "cmpld%I2 %0,%1,%b2"
11257 [(set_attr "type" "cmp")])
11259 ;; The following two insns don't exist as single insns, but if we provide
11260 ;; them, we can swap an add and compare, which will enable us to overlap more
11261 ;; of the required delay between a compare and branch. We generate code for
11262 ;; them by splitting.
11265 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11266 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11267 (match_operand:SI 2 "short_cint_operand" "i")))
11268 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11269 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11272 [(set_attr "length" "8")])
11275 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11276 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11277 (match_operand:SI 2 "u_short_cint_operand" "i")))
11278 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11279 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11282 [(set_attr "length" "8")])
11285 [(set (match_operand:CC 3 "cc_reg_operand" "")
11286 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11287 (match_operand:SI 2 "short_cint_operand" "")))
11288 (set (match_operand:SI 0 "gpc_reg_operand" "")
11289 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11291 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11292 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11295 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11296 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11297 (match_operand:SI 2 "u_short_cint_operand" "")))
11298 (set (match_operand:SI 0 "gpc_reg_operand" "")
11299 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11301 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11302 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11304 (define_insn "*cmpsf_internal1"
11305 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11306 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11307 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11308 "TARGET_HARD_FLOAT && TARGET_FPRS"
11310 [(set_attr "type" "fpcompare")])
11312 (define_insn "*cmpdf_internal1"
11313 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11314 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11315 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11316 "TARGET_HARD_FLOAT && TARGET_FPRS"
11318 [(set_attr "type" "fpcompare")])
11320 ;; Only need to compare second words if first words equal
11321 (define_insn "*cmptf_internal1"
11322 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11323 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11324 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11325 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
11326 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11327 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11328 [(set_attr "type" "fpcompare")
11329 (set_attr "length" "12")])
11331 ;; Now we have the scc insns. We can do some combinations because of the
11332 ;; way the machine works.
11334 ;; Note that this is probably faster if we can put an insn between the
11335 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11336 ;; cases the insns below which don't use an intermediate CR field will
11337 ;; be used instead.
11339 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11340 (match_operator:SI 1 "scc_comparison_operator"
11341 [(match_operand 2 "cc_reg_operand" "y")
11344 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11345 [(set (attr "type")
11346 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11347 (const_string "mfcrf")
11349 (const_string "mfcr")))
11350 (set_attr "length" "12")])
11352 ;; Same as above, but get the GT bit.
11353 (define_insn "move_from_CR_gt_bit"
11354 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11355 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11357 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,1"
11358 [(set_attr "type" "mfcr")
11359 (set_attr "length" "12")])
11361 ;; Same as above, but get the OV/ORDERED bit.
11362 (define_insn "move_from_CR_ov_bit"
11363 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11364 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11366 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11367 [(set_attr "type" "mfcr")
11368 (set_attr "length" "12")])
11371 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11372 (match_operator:DI 1 "scc_comparison_operator"
11373 [(match_operand 2 "cc_reg_operand" "y")
11376 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11377 [(set (attr "type")
11378 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11379 (const_string "mfcrf")
11381 (const_string "mfcr")))
11382 (set_attr "length" "12")])
11385 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11386 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11387 [(match_operand 2 "cc_reg_operand" "y,y")
11390 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11391 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11394 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11396 [(set_attr "type" "delayed_compare")
11397 (set_attr "length" "12,16")])
11400 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11401 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11402 [(match_operand 2 "cc_reg_operand" "")
11405 (set (match_operand:SI 3 "gpc_reg_operand" "")
11406 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11407 "TARGET_32BIT && reload_completed"
11408 [(set (match_dup 3)
11409 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11411 (compare:CC (match_dup 3)
11416 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11417 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11418 [(match_operand 2 "cc_reg_operand" "y")
11420 (match_operand:SI 3 "const_int_operand" "n")))]
11424 int is_bit = ccr_bit (operands[1], 1);
11425 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11428 if (is_bit >= put_bit)
11429 count = is_bit - put_bit;
11431 count = 32 - (put_bit - is_bit);
11433 operands[4] = GEN_INT (count);
11434 operands[5] = GEN_INT (put_bit);
11436 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11438 [(set (attr "type")
11439 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11440 (const_string "mfcrf")
11442 (const_string "mfcr")))
11443 (set_attr "length" "12")])
11446 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11448 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11449 [(match_operand 2 "cc_reg_operand" "y,y")
11451 (match_operand:SI 3 "const_int_operand" "n,n"))
11453 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11454 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11459 int is_bit = ccr_bit (operands[1], 1);
11460 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11463 /* Force split for non-cc0 compare. */
11464 if (which_alternative == 1)
11467 if (is_bit >= put_bit)
11468 count = is_bit - put_bit;
11470 count = 32 - (put_bit - is_bit);
11472 operands[5] = GEN_INT (count);
11473 operands[6] = GEN_INT (put_bit);
11475 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11477 [(set_attr "type" "delayed_compare")
11478 (set_attr "length" "12,16")])
11481 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11483 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11484 [(match_operand 2 "cc_reg_operand" "")
11486 (match_operand:SI 3 "const_int_operand" ""))
11488 (set (match_operand:SI 4 "gpc_reg_operand" "")
11489 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11492 [(set (match_dup 4)
11493 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11496 (compare:CC (match_dup 4)
11500 ;; There is a 3 cycle delay between consecutive mfcr instructions
11501 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11504 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11505 (match_operator:SI 1 "scc_comparison_operator"
11506 [(match_operand 2 "cc_reg_operand" "y")
11508 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11509 (match_operator:SI 4 "scc_comparison_operator"
11510 [(match_operand 5 "cc_reg_operand" "y")
11512 "REGNO (operands[2]) != REGNO (operands[5])"
11513 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11514 [(set_attr "type" "mfcr")
11515 (set_attr "length" "20")])
11518 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11519 (match_operator:DI 1 "scc_comparison_operator"
11520 [(match_operand 2 "cc_reg_operand" "y")
11522 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11523 (match_operator:DI 4 "scc_comparison_operator"
11524 [(match_operand 5 "cc_reg_operand" "y")
11526 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11527 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11528 [(set_attr "type" "mfcr")
11529 (set_attr "length" "20")])
11531 ;; There are some scc insns that can be done directly, without a compare.
11532 ;; These are faster because they don't involve the communications between
11533 ;; the FXU and branch units. In fact, we will be replacing all of the
11534 ;; integer scc insns here or in the portable methods in emit_store_flag.
11536 ;; Also support (neg (scc ..)) since that construct is used to replace
11537 ;; branches, (plus (scc ..) ..) since that construct is common and
11538 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11539 ;; cases where it is no more expensive than (neg (scc ..)).
11541 ;; Have reload force a constant into a register for the simple insns that
11542 ;; otherwise won't accept constants. We do this because it is faster than
11543 ;; the cmp/mfcr sequence we would otherwise generate.
11546 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11547 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11548 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11549 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11552 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11553 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11554 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11555 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11556 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11557 [(set_attr "length" "12,8,12,12,12")])
11560 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11561 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11562 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11563 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11566 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11567 subfic %3,%1,0\;adde %0,%3,%1
11568 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11569 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11570 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11571 [(set_attr "length" "12,8,12,12,12")])
11574 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11576 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11577 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11579 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11580 (eq:SI (match_dup 1) (match_dup 2)))
11581 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11584 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11585 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11586 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11587 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11588 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11594 [(set_attr "type" "compare")
11595 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11598 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11600 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11601 (match_operand:SI 2 "reg_or_cint_operand" ""))
11603 (set (match_operand:SI 0 "gpc_reg_operand" "")
11604 (eq:SI (match_dup 1) (match_dup 2)))
11605 (clobber (match_scratch:SI 3 ""))]
11606 "TARGET_32BIT && reload_completed"
11607 [(parallel [(set (match_dup 0)
11608 (eq:SI (match_dup 1) (match_dup 2)))
11609 (clobber (match_dup 3))])
11611 (compare:CC (match_dup 0)
11616 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11618 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11619 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11621 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11622 (eq:DI (match_dup 1) (match_dup 2)))
11623 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11626 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11627 subfic %3,%1,0\;adde. %0,%3,%1
11628 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11629 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11630 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11636 [(set_attr "type" "compare")
11637 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11640 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11642 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11643 (match_operand:DI 2 "reg_or_cint_operand" ""))
11645 (set (match_operand:DI 0 "gpc_reg_operand" "")
11646 (eq:DI (match_dup 1) (match_dup 2)))
11647 (clobber (match_scratch:DI 3 ""))]
11648 "TARGET_64BIT && reload_completed"
11649 [(parallel [(set (match_dup 0)
11650 (eq:DI (match_dup 1) (match_dup 2)))
11651 (clobber (match_dup 3))])
11653 (compare:CC (match_dup 0)
11657 ;; We have insns of the form shown by the first define_insn below. If
11658 ;; there is something inside the comparison operation, we must split it.
11660 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11661 (plus:SI (match_operator 1 "comparison_operator"
11662 [(match_operand:SI 2 "" "")
11663 (match_operand:SI 3
11664 "reg_or_cint_operand" "")])
11665 (match_operand:SI 4 "gpc_reg_operand" "")))
11666 (clobber (match_operand:SI 5 "register_operand" ""))]
11667 "! gpc_reg_operand (operands[2], SImode)"
11668 [(set (match_dup 5) (match_dup 2))
11669 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11673 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11674 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11675 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11676 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11679 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11680 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11681 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11682 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11683 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11684 [(set_attr "length" "12,8,12,12,12")])
11687 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11690 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11691 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11692 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11694 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11697 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11698 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11699 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11700 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11701 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11707 [(set_attr "type" "compare")
11708 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11711 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11714 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11715 (match_operand:SI 2 "reg_or_cint_operand" ""))
11716 (match_operand:SI 3 "gpc_reg_operand" ""))
11718 (clobber (match_scratch:SI 4 ""))]
11719 "TARGET_32BIT && reload_completed"
11720 [(set (match_dup 4)
11721 (plus:SI (eq:SI (match_dup 1)
11725 (compare:CC (match_dup 4)
11730 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11733 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11734 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11735 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11737 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11738 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11741 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11742 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11743 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11744 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11745 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11751 [(set_attr "type" "compare")
11752 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11755 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11758 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11759 (match_operand:SI 2 "reg_or_cint_operand" ""))
11760 (match_operand:SI 3 "gpc_reg_operand" ""))
11762 (set (match_operand:SI 0 "gpc_reg_operand" "")
11763 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11764 "TARGET_32BIT && reload_completed"
11765 [(set (match_dup 0)
11766 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11768 (compare:CC (match_dup 0)
11773 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11774 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11775 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11778 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11779 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11780 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11781 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11782 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11783 [(set_attr "length" "12,8,12,12,12")])
11785 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11786 ;; since it nabs/sr is just as fast.
11787 (define_insn "*ne0"
11788 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11789 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11791 (clobber (match_scratch:SI 2 "=&r"))]
11792 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11793 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11794 [(set_attr "length" "8")])
11797 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11798 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11800 (clobber (match_scratch:DI 2 "=&r"))]
11802 "addic %2,%1,-1\;subfe %0,%2,%1"
11803 [(set_attr "length" "8")])
11805 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11807 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11808 (plus:SI (lshiftrt:SI
11809 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11811 (match_operand:SI 2 "gpc_reg_operand" "r")))
11812 (clobber (match_scratch:SI 3 "=&r"))]
11814 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11815 [(set_attr "length" "8")])
11818 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11819 (plus:DI (lshiftrt:DI
11820 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11822 (match_operand:DI 2 "gpc_reg_operand" "r")))
11823 (clobber (match_scratch:DI 3 "=&r"))]
11825 "addic %3,%1,-1\;addze %0,%2"
11826 [(set_attr "length" "8")])
11829 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11831 (plus:SI (lshiftrt:SI
11832 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11834 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11836 (clobber (match_scratch:SI 3 "=&r,&r"))
11837 (clobber (match_scratch:SI 4 "=X,&r"))]
11840 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11842 [(set_attr "type" "compare")
11843 (set_attr "length" "8,12")])
11846 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11848 (plus:SI (lshiftrt:SI
11849 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11851 (match_operand:SI 2 "gpc_reg_operand" ""))
11853 (clobber (match_scratch:SI 3 ""))
11854 (clobber (match_scratch:SI 4 ""))]
11855 "TARGET_32BIT && reload_completed"
11856 [(parallel [(set (match_dup 3)
11857 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11860 (clobber (match_dup 4))])
11862 (compare:CC (match_dup 3)
11867 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11869 (plus:DI (lshiftrt:DI
11870 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11872 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11874 (clobber (match_scratch:DI 3 "=&r,&r"))]
11877 addic %3,%1,-1\;addze. %3,%2
11879 [(set_attr "type" "compare")
11880 (set_attr "length" "8,12")])
11883 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11885 (plus:DI (lshiftrt:DI
11886 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11888 (match_operand:DI 2 "gpc_reg_operand" ""))
11890 (clobber (match_scratch:DI 3 ""))]
11891 "TARGET_64BIT && reload_completed"
11892 [(set (match_dup 3)
11893 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11897 (compare:CC (match_dup 3)
11902 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11904 (plus:SI (lshiftrt:SI
11905 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11907 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11909 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11910 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11912 (clobber (match_scratch:SI 3 "=&r,&r"))]
11915 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11917 [(set_attr "type" "compare")
11918 (set_attr "length" "8,12")])
11921 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11923 (plus:SI (lshiftrt:SI
11924 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11926 (match_operand:SI 2 "gpc_reg_operand" ""))
11928 (set (match_operand:SI 0 "gpc_reg_operand" "")
11929 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11931 (clobber (match_scratch:SI 3 ""))]
11932 "TARGET_32BIT && reload_completed"
11933 [(parallel [(set (match_dup 0)
11934 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11936 (clobber (match_dup 3))])
11938 (compare:CC (match_dup 0)
11943 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11945 (plus:DI (lshiftrt:DI
11946 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11948 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11950 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11951 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11953 (clobber (match_scratch:DI 3 "=&r,&r"))]
11956 addic %3,%1,-1\;addze. %0,%2
11958 [(set_attr "type" "compare")
11959 (set_attr "length" "8,12")])
11962 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11964 (plus:DI (lshiftrt:DI
11965 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11967 (match_operand:DI 2 "gpc_reg_operand" ""))
11969 (set (match_operand:DI 0 "gpc_reg_operand" "")
11970 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11972 (clobber (match_scratch:DI 3 ""))]
11973 "TARGET_64BIT && reload_completed"
11974 [(parallel [(set (match_dup 0)
11975 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11977 (clobber (match_dup 3))])
11979 (compare:CC (match_dup 0)
11984 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11985 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11986 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11987 (clobber (match_scratch:SI 3 "=r,X"))]
11990 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11991 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11992 [(set_attr "length" "12")])
11995 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11997 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11998 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12000 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12001 (le:SI (match_dup 1) (match_dup 2)))
12002 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12005 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12006 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12009 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12010 (set_attr "length" "12,12,16,16")])
12013 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12015 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12016 (match_operand:SI 2 "reg_or_short_operand" ""))
12018 (set (match_operand:SI 0 "gpc_reg_operand" "")
12019 (le:SI (match_dup 1) (match_dup 2)))
12020 (clobber (match_scratch:SI 3 ""))]
12021 "TARGET_POWER && reload_completed"
12022 [(parallel [(set (match_dup 0)
12023 (le:SI (match_dup 1) (match_dup 2)))
12024 (clobber (match_dup 3))])
12026 (compare:CC (match_dup 0)
12031 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12032 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12033 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12034 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12037 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12038 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12039 [(set_attr "length" "12")])
12042 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12044 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12045 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12046 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12048 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12051 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12052 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12055 [(set_attr "type" "compare")
12056 (set_attr "length" "12,12,16,16")])
12059 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12061 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12062 (match_operand:SI 2 "reg_or_short_operand" ""))
12063 (match_operand:SI 3 "gpc_reg_operand" ""))
12065 (clobber (match_scratch:SI 4 ""))]
12066 "TARGET_POWER && reload_completed"
12067 [(set (match_dup 4)
12068 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12071 (compare:CC (match_dup 4)
12076 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12078 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12079 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12080 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12082 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12083 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12086 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12087 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12090 [(set_attr "type" "compare")
12091 (set_attr "length" "12,12,16,16")])
12094 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12096 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12097 (match_operand:SI 2 "reg_or_short_operand" ""))
12098 (match_operand:SI 3 "gpc_reg_operand" ""))
12100 (set (match_operand:SI 0 "gpc_reg_operand" "")
12101 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12102 "TARGET_POWER && reload_completed"
12103 [(set (match_dup 0)
12104 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12106 (compare:CC (match_dup 0)
12111 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12112 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12113 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12116 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12117 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12118 [(set_attr "length" "12")])
12121 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12122 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12123 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12125 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12126 [(set_attr "length" "12")])
12129 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12130 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12131 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12133 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12134 [(set_attr "length" "12")])
12137 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12139 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12140 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12142 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12143 (leu:DI (match_dup 1) (match_dup 2)))]
12146 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12148 [(set_attr "type" "compare")
12149 (set_attr "length" "12,16")])
12152 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12154 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12155 (match_operand:DI 2 "reg_or_short_operand" ""))
12157 (set (match_operand:DI 0 "gpc_reg_operand" "")
12158 (leu:DI (match_dup 1) (match_dup 2)))]
12159 "TARGET_64BIT && reload_completed"
12160 [(set (match_dup 0)
12161 (leu:DI (match_dup 1) (match_dup 2)))
12163 (compare:CC (match_dup 0)
12168 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12170 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12171 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12173 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12174 (leu:SI (match_dup 1) (match_dup 2)))]
12177 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12179 [(set_attr "type" "compare")
12180 (set_attr "length" "12,16")])
12183 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12185 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12186 (match_operand:SI 2 "reg_or_short_operand" ""))
12188 (set (match_operand:SI 0 "gpc_reg_operand" "")
12189 (leu:SI (match_dup 1) (match_dup 2)))]
12190 "TARGET_32BIT && reload_completed"
12191 [(set (match_dup 0)
12192 (leu:SI (match_dup 1) (match_dup 2)))
12194 (compare:CC (match_dup 0)
12199 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12200 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12201 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12202 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12204 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12205 [(set_attr "length" "8")])
12208 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12210 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12211 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12212 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12214 (clobber (match_scratch:SI 4 "=&r,&r"))]
12217 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12219 [(set_attr "type" "compare")
12220 (set_attr "length" "8,12")])
12223 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12225 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12226 (match_operand:SI 2 "reg_or_short_operand" ""))
12227 (match_operand:SI 3 "gpc_reg_operand" ""))
12229 (clobber (match_scratch:SI 4 ""))]
12230 "TARGET_32BIT && reload_completed"
12231 [(set (match_dup 4)
12232 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12235 (compare:CC (match_dup 4)
12240 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12242 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12243 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12244 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12246 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12247 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12250 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12252 [(set_attr "type" "compare")
12253 (set_attr "length" "8,12")])
12256 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12258 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12259 (match_operand:SI 2 "reg_or_short_operand" ""))
12260 (match_operand:SI 3 "gpc_reg_operand" ""))
12262 (set (match_operand:SI 0 "gpc_reg_operand" "")
12263 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12264 "TARGET_32BIT && reload_completed"
12265 [(set (match_dup 0)
12266 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12268 (compare:CC (match_dup 0)
12273 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12274 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12275 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12277 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12278 [(set_attr "length" "12")])
12281 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12283 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12284 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12285 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12287 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12288 [(set_attr "length" "12")])
12291 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12294 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12295 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12296 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12298 (clobber (match_scratch:SI 4 "=&r,&r"))]
12301 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12303 [(set_attr "type" "compare")
12304 (set_attr "length" "12,16")])
12307 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12310 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12311 (match_operand:SI 2 "reg_or_short_operand" "")))
12312 (match_operand:SI 3 "gpc_reg_operand" ""))
12314 (clobber (match_scratch:SI 4 ""))]
12315 "TARGET_32BIT && reload_completed"
12316 [(set (match_dup 4)
12317 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12320 (compare:CC (match_dup 4)
12325 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12328 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12329 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12330 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12332 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12333 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12336 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12338 [(set_attr "type" "compare")
12339 (set_attr "length" "12,16")])
12342 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12345 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12346 (match_operand:SI 2 "reg_or_short_operand" "")))
12347 (match_operand:SI 3 "gpc_reg_operand" ""))
12349 (set (match_operand:SI 0 "gpc_reg_operand" "")
12350 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12351 "TARGET_32BIT && reload_completed"
12352 [(set (match_dup 0)
12353 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12356 (compare:CC (match_dup 0)
12361 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12362 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12363 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12365 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12366 [(set_attr "length" "12")])
12369 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12371 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12372 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12374 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12375 (lt:SI (match_dup 1) (match_dup 2)))]
12378 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12380 [(set_attr "type" "delayed_compare")
12381 (set_attr "length" "12,16")])
12384 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12386 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12387 (match_operand:SI 2 "reg_or_short_operand" ""))
12389 (set (match_operand:SI 0 "gpc_reg_operand" "")
12390 (lt:SI (match_dup 1) (match_dup 2)))]
12391 "TARGET_POWER && reload_completed"
12392 [(set (match_dup 0)
12393 (lt:SI (match_dup 1) (match_dup 2)))
12395 (compare:CC (match_dup 0)
12400 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12401 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12402 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12403 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12405 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12406 [(set_attr "length" "12")])
12409 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12411 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12412 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12413 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12415 (clobber (match_scratch:SI 4 "=&r,&r"))]
12418 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12420 [(set_attr "type" "compare")
12421 (set_attr "length" "12,16")])
12424 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12426 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12427 (match_operand:SI 2 "reg_or_short_operand" ""))
12428 (match_operand:SI 3 "gpc_reg_operand" ""))
12430 (clobber (match_scratch:SI 4 ""))]
12431 "TARGET_POWER && reload_completed"
12432 [(set (match_dup 4)
12433 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12436 (compare:CC (match_dup 4)
12441 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12443 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12444 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12445 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12447 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12448 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12451 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12453 [(set_attr "type" "compare")
12454 (set_attr "length" "12,16")])
12457 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12459 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12460 (match_operand:SI 2 "reg_or_short_operand" ""))
12461 (match_operand:SI 3 "gpc_reg_operand" ""))
12463 (set (match_operand:SI 0 "gpc_reg_operand" "")
12464 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12465 "TARGET_POWER && reload_completed"
12466 [(set (match_dup 0)
12467 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12469 (compare:CC (match_dup 0)
12474 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12475 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12476 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12478 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12479 [(set_attr "length" "12")])
12482 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12483 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12484 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12487 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
12488 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12489 [(set_attr "length" "12")])
12492 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12494 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12495 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12497 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12498 (ltu:SI (match_dup 1) (match_dup 2)))]
12501 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12502 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12505 [(set_attr "type" "compare")
12506 (set_attr "length" "12,12,16,16")])
12509 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12511 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12512 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12514 (set (match_operand:SI 0 "gpc_reg_operand" "")
12515 (ltu:SI (match_dup 1) (match_dup 2)))]
12516 "TARGET_32BIT && reload_completed"
12517 [(set (match_dup 0)
12518 (ltu:SI (match_dup 1) (match_dup 2)))
12520 (compare:CC (match_dup 0)
12525 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12526 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12527 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12528 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12531 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
12532 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12533 [(set_attr "length" "12")])
12536 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12538 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12539 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12540 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12542 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12545 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12546 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12549 [(set_attr "type" "compare")
12550 (set_attr "length" "12,12,16,16")])
12553 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12555 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12556 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12557 (match_operand:SI 3 "gpc_reg_operand" ""))
12559 (clobber (match_scratch:SI 4 ""))]
12560 "TARGET_32BIT && reload_completed"
12561 [(set (match_dup 4)
12562 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12565 (compare:CC (match_dup 4)
12570 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12572 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12573 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12574 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12576 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12577 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12580 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12581 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12584 [(set_attr "type" "compare")
12585 (set_attr "length" "12,12,16,16")])
12588 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12590 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12591 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12592 (match_operand:SI 3 "gpc_reg_operand" ""))
12594 (set (match_operand:SI 0 "gpc_reg_operand" "")
12595 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12596 "TARGET_32BIT && reload_completed"
12597 [(set (match_dup 0)
12598 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12600 (compare:CC (match_dup 0)
12605 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12606 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12607 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12610 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12611 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12612 [(set_attr "length" "8")])
12615 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12616 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12617 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12618 (clobber (match_scratch:SI 3 "=r"))]
12620 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12621 [(set_attr "length" "12")])
12624 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12626 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12627 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12629 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12630 (ge:SI (match_dup 1) (match_dup 2)))
12631 (clobber (match_scratch:SI 3 "=r,r"))]
12634 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12636 [(set_attr "type" "compare")
12637 (set_attr "length" "12,16")])
12640 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12642 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12643 (match_operand:SI 2 "reg_or_short_operand" ""))
12645 (set (match_operand:SI 0 "gpc_reg_operand" "")
12646 (ge:SI (match_dup 1) (match_dup 2)))
12647 (clobber (match_scratch:SI 3 ""))]
12648 "TARGET_POWER && reload_completed"
12649 [(parallel [(set (match_dup 0)
12650 (ge:SI (match_dup 1) (match_dup 2)))
12651 (clobber (match_dup 3))])
12653 (compare:CC (match_dup 0)
12658 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12659 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12660 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12661 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12663 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12664 [(set_attr "length" "12")])
12667 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12669 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12670 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12671 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12673 (clobber (match_scratch:SI 4 "=&r,&r"))]
12676 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12678 [(set_attr "type" "compare")
12679 (set_attr "length" "12,16")])
12682 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12684 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12685 (match_operand:SI 2 "reg_or_short_operand" ""))
12686 (match_operand:SI 3 "gpc_reg_operand" ""))
12688 (clobber (match_scratch:SI 4 ""))]
12689 "TARGET_POWER && reload_completed"
12690 [(set (match_dup 4)
12691 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12694 (compare:CC (match_dup 4)
12699 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12701 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12702 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12703 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12705 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12706 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12709 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12711 [(set_attr "type" "compare")
12712 (set_attr "length" "12,16")])
12715 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12717 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12718 (match_operand:SI 2 "reg_or_short_operand" ""))
12719 (match_operand:SI 3 "gpc_reg_operand" ""))
12721 (set (match_operand:SI 0 "gpc_reg_operand" "")
12722 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12723 "TARGET_POWER && reload_completed"
12724 [(set (match_dup 0)
12725 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12727 (compare:CC (match_dup 0)
12732 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12733 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12734 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12736 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12737 [(set_attr "length" "12")])
12740 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12741 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12742 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12745 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12746 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12747 [(set_attr "length" "12")])
12750 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12751 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12752 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12755 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12756 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12757 [(set_attr "length" "12")])
12760 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12762 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12763 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12765 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12766 (geu:SI (match_dup 1) (match_dup 2)))]
12769 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12770 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12773 [(set_attr "type" "compare")
12774 (set_attr "length" "12,12,16,16")])
12777 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12779 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12780 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12782 (set (match_operand:SI 0 "gpc_reg_operand" "")
12783 (geu:SI (match_dup 1) (match_dup 2)))]
12784 "TARGET_32BIT && reload_completed"
12785 [(set (match_dup 0)
12786 (geu:SI (match_dup 1) (match_dup 2)))
12788 (compare:CC (match_dup 0)
12793 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12795 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12796 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12798 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12799 (geu:DI (match_dup 1) (match_dup 2)))]
12802 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12803 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12806 [(set_attr "type" "compare")
12807 (set_attr "length" "12,12,16,16")])
12810 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12812 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12813 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12815 (set (match_operand:DI 0 "gpc_reg_operand" "")
12816 (geu:DI (match_dup 1) (match_dup 2)))]
12817 "TARGET_64BIT && reload_completed"
12818 [(set (match_dup 0)
12819 (geu:DI (match_dup 1) (match_dup 2)))
12821 (compare:CC (match_dup 0)
12826 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12827 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12828 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12829 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12832 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12833 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12834 [(set_attr "length" "8")])
12837 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12839 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12840 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12841 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12843 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12846 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12847 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12850 [(set_attr "type" "compare")
12851 (set_attr "length" "8,8,12,12")])
12854 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12856 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12857 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12858 (match_operand:SI 3 "gpc_reg_operand" ""))
12860 (clobber (match_scratch:SI 4 ""))]
12861 "TARGET_32BIT && reload_completed"
12862 [(set (match_dup 4)
12863 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12866 (compare:CC (match_dup 4)
12871 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12873 (plus:SI (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 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12878 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12881 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12882 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12885 [(set_attr "type" "compare")
12886 (set_attr "length" "8,8,12,12")])
12889 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12891 (plus:SI (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 (set (match_operand:SI 0 "gpc_reg_operand" "")
12896 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12897 "TARGET_32BIT && reload_completed"
12898 [(set (match_dup 0)
12899 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12901 (compare:CC (match_dup 0)
12906 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12907 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12908 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12911 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12912 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12913 [(set_attr "length" "12")])
12916 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12918 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12919 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12920 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12923 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12924 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12925 [(set_attr "length" "12")])
12928 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12931 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12932 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12933 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12935 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12938 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12939 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12942 [(set_attr "type" "compare")
12943 (set_attr "length" "12,12,16,16")])
12946 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12949 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12950 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12951 (match_operand:SI 3 "gpc_reg_operand" ""))
12953 (clobber (match_scratch:SI 4 ""))]
12954 "TARGET_32BIT && reload_completed"
12955 [(set (match_dup 4)
12956 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12959 (compare:CC (match_dup 4)
12964 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12967 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12968 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12969 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12971 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12972 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12975 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12976 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12979 [(set_attr "type" "compare")
12980 (set_attr "length" "12,12,16,16")])
12983 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12986 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12987 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12988 (match_operand:SI 3 "gpc_reg_operand" ""))
12990 (set (match_operand:SI 0 "gpc_reg_operand" "")
12991 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12992 "TARGET_32BIT && reload_completed"
12993 [(set (match_dup 0)
12994 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12996 (compare:CC (match_dup 0)
13001 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13002 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13005 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
13006 [(set_attr "length" "12")])
13009 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13010 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13013 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
13014 [(set_attr "length" "12")])
13017 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13019 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13022 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13023 (gt:SI (match_dup 1) (const_int 0)))]
13026 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
13028 [(set_attr "type" "delayed_compare")
13029 (set_attr "length" "12,16")])
13032 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13034 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13037 (set (match_operand:SI 0 "gpc_reg_operand" "")
13038 (gt:SI (match_dup 1) (const_int 0)))]
13039 "TARGET_32BIT && reload_completed"
13040 [(set (match_dup 0)
13041 (gt:SI (match_dup 1) (const_int 0)))
13043 (compare:CC (match_dup 0)
13048 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13050 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13053 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13054 (gt:DI (match_dup 1) (const_int 0)))]
13057 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
13059 [(set_attr "type" "delayed_compare")
13060 (set_attr "length" "12,16")])
13063 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13065 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13068 (set (match_operand:DI 0 "gpc_reg_operand" "")
13069 (gt:DI (match_dup 1) (const_int 0)))]
13070 "TARGET_64BIT && reload_completed"
13071 [(set (match_dup 0)
13072 (gt:DI (match_dup 1) (const_int 0)))
13074 (compare:CC (match_dup 0)
13079 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13080 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13081 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13083 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13084 [(set_attr "length" "12")])
13087 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13089 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13090 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13092 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13093 (gt:SI (match_dup 1) (match_dup 2)))]
13096 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13098 [(set_attr "type" "delayed_compare")
13099 (set_attr "length" "12,16")])
13102 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13104 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13105 (match_operand:SI 2 "reg_or_short_operand" ""))
13107 (set (match_operand:SI 0 "gpc_reg_operand" "")
13108 (gt:SI (match_dup 1) (match_dup 2)))]
13109 "TARGET_POWER && reload_completed"
13110 [(set (match_dup 0)
13111 (gt:SI (match_dup 1) (match_dup 2)))
13113 (compare:CC (match_dup 0)
13118 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13119 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13121 (match_operand:SI 2 "gpc_reg_operand" "r")))]
13123 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13124 [(set_attr "length" "12")])
13127 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13128 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13130 (match_operand:DI 2 "gpc_reg_operand" "r")))]
13132 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13133 [(set_attr "length" "12")])
13136 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13138 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13140 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13142 (clobber (match_scratch:SI 3 "=&r,&r"))]
13145 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13147 [(set_attr "type" "compare")
13148 (set_attr "length" "12,16")])
13151 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13153 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13155 (match_operand:SI 2 "gpc_reg_operand" ""))
13157 (clobber (match_scratch:SI 3 ""))]
13158 "TARGET_32BIT && reload_completed"
13159 [(set (match_dup 3)
13160 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13163 (compare:CC (match_dup 3)
13168 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13170 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13172 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13174 (clobber (match_scratch:DI 3 "=&r,&r"))]
13177 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13179 [(set_attr "type" "compare")
13180 (set_attr "length" "12,16")])
13183 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13185 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13187 (match_operand:DI 2 "gpc_reg_operand" ""))
13189 (clobber (match_scratch:DI 3 ""))]
13190 "TARGET_64BIT && reload_completed"
13191 [(set (match_dup 3)
13192 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13195 (compare:CC (match_dup 3)
13200 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13202 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13204 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13206 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13207 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13210 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13212 [(set_attr "type" "compare")
13213 (set_attr "length" "12,16")])
13216 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13218 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13220 (match_operand:SI 2 "gpc_reg_operand" ""))
13222 (set (match_operand:SI 0 "gpc_reg_operand" "")
13223 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13224 "TARGET_32BIT && reload_completed"
13225 [(set (match_dup 0)
13226 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13228 (compare:CC (match_dup 0)
13233 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13235 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13237 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13239 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13240 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13243 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13245 [(set_attr "type" "compare")
13246 (set_attr "length" "12,16")])
13249 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13251 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13253 (match_operand:DI 2 "gpc_reg_operand" ""))
13255 (set (match_operand:DI 0 "gpc_reg_operand" "")
13256 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13257 "TARGET_64BIT && reload_completed"
13258 [(set (match_dup 0)
13259 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13261 (compare:CC (match_dup 0)
13266 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13267 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13268 (match_operand:SI 2 "reg_or_short_operand" "r"))
13269 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13271 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13272 [(set_attr "length" "12")])
13275 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13277 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13278 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13279 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13281 (clobber (match_scratch:SI 4 "=&r,&r"))]
13284 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13286 [(set_attr "type" "compare")
13287 (set_attr "length" "12,16")])
13290 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13292 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13293 (match_operand:SI 2 "reg_or_short_operand" ""))
13294 (match_operand:SI 3 "gpc_reg_operand" ""))
13296 (clobber (match_scratch:SI 4 ""))]
13297 "TARGET_POWER && reload_completed"
13298 [(set (match_dup 4)
13299 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13301 (compare:CC (match_dup 4)
13306 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13308 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13309 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13310 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13312 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13313 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13316 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13318 [(set_attr "type" "compare")
13319 (set_attr "length" "12,16")])
13322 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13324 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13325 (match_operand:SI 2 "reg_or_short_operand" ""))
13326 (match_operand:SI 3 "gpc_reg_operand" ""))
13328 (set (match_operand:SI 0 "gpc_reg_operand" "")
13329 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13330 "TARGET_POWER && reload_completed"
13331 [(set (match_dup 0)
13332 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13334 (compare:CC (match_dup 0)
13339 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13340 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13343 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13344 [(set_attr "length" "12")])
13347 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13348 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13351 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13352 [(set_attr "length" "12")])
13355 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13356 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13357 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13359 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13360 [(set_attr "length" "12")])
13363 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13364 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13365 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13367 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
13368 [(set_attr "length" "12")])
13371 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13372 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13373 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13375 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
13376 [(set_attr "length" "12")])
13379 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13381 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13382 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13384 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13385 (gtu:SI (match_dup 1) (match_dup 2)))]
13388 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13390 [(set_attr "type" "compare")
13391 (set_attr "length" "12,16")])
13394 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13396 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13397 (match_operand:SI 2 "reg_or_short_operand" ""))
13399 (set (match_operand:SI 0 "gpc_reg_operand" "")
13400 (gtu:SI (match_dup 1) (match_dup 2)))]
13401 "TARGET_32BIT && reload_completed"
13402 [(set (match_dup 0)
13403 (gtu:SI (match_dup 1) (match_dup 2)))
13405 (compare:CC (match_dup 0)
13410 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13412 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13413 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13415 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13416 (gtu:DI (match_dup 1) (match_dup 2)))]
13419 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13421 [(set_attr "type" "compare")
13422 (set_attr "length" "12,16")])
13425 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13427 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13428 (match_operand:DI 2 "reg_or_short_operand" ""))
13430 (set (match_operand:DI 0 "gpc_reg_operand" "")
13431 (gtu:DI (match_dup 1) (match_dup 2)))]
13432 "TARGET_64BIT && reload_completed"
13433 [(set (match_dup 0)
13434 (gtu:DI (match_dup 1) (match_dup 2)))
13436 (compare:CC (match_dup 0)
13441 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13442 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13443 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
13444 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
13447 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
13448 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
13449 [(set_attr "length" "8,12")])
13452 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13453 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13454 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
13455 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))]
13458 addic %0,%1,%k2\;addze %0,%3
13459 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf%I3c %0,%0,%3"
13460 [(set_attr "length" "8,12")])
13463 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13465 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13466 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13467 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13469 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13472 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13473 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
13476 [(set_attr "type" "compare")
13477 (set_attr "length" "8,12,12,16")])
13480 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13482 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13483 (match_operand:SI 2 "reg_or_short_operand" ""))
13484 (match_operand:SI 3 "gpc_reg_operand" ""))
13486 (clobber (match_scratch:SI 4 ""))]
13487 "TARGET_32BIT && reload_completed"
13488 [(set (match_dup 4)
13489 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13492 (compare:CC (match_dup 4)
13497 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13499 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13500 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13501 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13503 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13506 addic %4,%1,%k2\;addze. %4,%3
13507 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
13510 [(set_attr "type" "compare")
13511 (set_attr "length" "8,12,12,16")])
13514 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13516 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13517 (match_operand:DI 2 "reg_or_short_operand" ""))
13518 (match_operand:DI 3 "gpc_reg_operand" ""))
13520 (clobber (match_scratch:DI 4 ""))]
13521 "TARGET_64BIT && reload_completed"
13522 [(set (match_dup 4)
13523 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13526 (compare:CC (match_dup 4)
13531 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13533 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13534 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13535 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13537 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13538 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13541 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13542 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
13545 [(set_attr "type" "compare")
13546 (set_attr "length" "8,12,12,16")])
13549 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13551 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13552 (match_operand:SI 2 "reg_or_short_operand" ""))
13553 (match_operand:SI 3 "gpc_reg_operand" ""))
13555 (set (match_operand:SI 0 "gpc_reg_operand" "")
13556 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13557 "TARGET_32BIT && reload_completed"
13558 [(set (match_dup 0)
13559 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13561 (compare:CC (match_dup 0)
13566 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13568 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13569 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13570 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13572 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13573 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13576 addic %0,%1,%k2\;addze. %0,%3
13577 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subfc. %0,%0,%3
13580 [(set_attr "type" "compare")
13581 (set_attr "length" "8,12,12,16")])
13584 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13586 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13587 (match_operand:DI 2 "reg_or_short_operand" ""))
13588 (match_operand:DI 3 "gpc_reg_operand" ""))
13590 (set (match_operand:DI 0 "gpc_reg_operand" "")
13591 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13592 "TARGET_64BIT && reload_completed"
13593 [(set (match_dup 0)
13594 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13596 (compare:CC (match_dup 0)
13601 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13602 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13603 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13605 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13606 [(set_attr "length" "8")])
13609 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13610 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13611 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13613 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13614 [(set_attr "length" "8")])
13616 ;; Define both directions of branch and return. If we need a reload
13617 ;; register, we'd rather use CR0 since it is much easier to copy a
13618 ;; register CC value to there.
13622 (if_then_else (match_operator 1 "branch_comparison_operator"
13624 "cc_reg_operand" "y")
13626 (label_ref (match_operand 0 "" ""))
13631 return output_cbranch (operands[1], \"%l0\", 0, insn);
13633 [(set_attr "type" "branch")])
13637 (if_then_else (match_operator 0 "branch_comparison_operator"
13639 "cc_reg_operand" "y")
13646 return output_cbranch (operands[0], NULL, 0, insn);
13648 [(set_attr "type" "branch")
13649 (set_attr "length" "4")])
13653 (if_then_else (match_operator 1 "branch_comparison_operator"
13655 "cc_reg_operand" "y")
13658 (label_ref (match_operand 0 "" ""))))]
13662 return output_cbranch (operands[1], \"%l0\", 1, insn);
13664 [(set_attr "type" "branch")])
13668 (if_then_else (match_operator 0 "branch_comparison_operator"
13670 "cc_reg_operand" "y")
13677 return output_cbranch (operands[0], NULL, 1, insn);
13679 [(set_attr "type" "branch")
13680 (set_attr "length" "4")])
13682 ;; Logic on condition register values.
13684 ; This pattern matches things like
13685 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13686 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13688 ; which are generated by the branch logic.
13689 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13691 (define_insn "*cceq_ior_compare"
13692 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13693 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13694 [(match_operator:SI 2
13695 "branch_positive_comparison_operator"
13697 "cc_reg_operand" "y,y")
13699 (match_operator:SI 4
13700 "branch_positive_comparison_operator"
13702 "cc_reg_operand" "0,y")
13705 "!(TARGET_E500 && TARGET_HARD_FLOAT && !TARGET_FPRS)"
13706 "cr%q1 %E0,%j2,%j4"
13707 [(set_attr "type" "cr_logical,delayed_cr")])
13709 ; Why is the constant -1 here, but 1 in the previous pattern?
13710 ; Because ~1 has all but the low bit set.
13712 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13713 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13714 [(not:SI (match_operator:SI 2
13715 "branch_positive_comparison_operator"
13717 "cc_reg_operand" "y,y")
13719 (match_operator:SI 4
13720 "branch_positive_comparison_operator"
13722 "cc_reg_operand" "0,y")
13726 "cr%q1 %E0,%j2,%j4"
13727 [(set_attr "type" "cr_logical,delayed_cr")])
13729 (define_insn "*cceq_rev_compare"
13730 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13731 (compare:CCEQ (match_operator:SI 1
13732 "branch_positive_comparison_operator"
13734 "cc_reg_operand" "0,y")
13738 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13739 [(set_attr "type" "cr_logical,delayed_cr")])
13741 ;; If we are comparing the result of two comparisons, this can be done
13742 ;; using creqv or crxor.
13744 (define_insn_and_split ""
13745 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13746 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13747 [(match_operand 2 "cc_reg_operand" "y")
13749 (match_operator 3 "branch_comparison_operator"
13750 [(match_operand 4 "cc_reg_operand" "y")
13755 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13759 int positive_1, positive_2;
13761 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13762 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13765 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13766 GET_CODE (operands[1])),
13768 operands[2], const0_rtx);
13769 else if (GET_MODE (operands[1]) != SImode)
13770 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13771 operands[2], const0_rtx);
13774 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13775 GET_CODE (operands[3])),
13777 operands[4], const0_rtx);
13778 else if (GET_MODE (operands[3]) != SImode)
13779 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13780 operands[4], const0_rtx);
13782 if (positive_1 == positive_2)
13784 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13785 operands[5] = constm1_rtx;
13789 operands[5] = const1_rtx;
13793 ;; Unconditional branch and return.
13795 (define_insn "jump"
13797 (label_ref (match_operand 0 "" "")))]
13800 [(set_attr "type" "branch")])
13802 (define_insn "return"
13806 [(set_attr "type" "jmpreg")])
13808 (define_expand "indirect_jump"
13809 [(set (pc) (match_operand 0 "register_operand" ""))]
13814 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13816 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13820 (define_insn "indirect_jumpsi"
13821 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13826 [(set_attr "type" "jmpreg")])
13828 (define_insn "indirect_jumpdi"
13829 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13834 [(set_attr "type" "jmpreg")])
13836 ;; Table jump for switch statements:
13837 (define_expand "tablejump"
13838 [(use (match_operand 0 "" ""))
13839 (use (label_ref (match_operand 1 "" "")))]
13844 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13846 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13850 (define_expand "tablejumpsi"
13851 [(set (match_dup 3)
13852 (plus:SI (match_operand:SI 0 "" "")
13854 (parallel [(set (pc) (match_dup 3))
13855 (use (label_ref (match_operand 1 "" "")))])]
13858 { operands[0] = force_reg (SImode, operands[0]);
13859 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13860 operands[3] = gen_reg_rtx (SImode);
13863 (define_expand "tablejumpdi"
13864 [(set (match_dup 4)
13865 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13867 (plus:DI (match_dup 4)
13869 (parallel [(set (pc) (match_dup 3))
13870 (use (label_ref (match_operand 1 "" "")))])]
13873 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13874 operands[3] = gen_reg_rtx (DImode);
13875 operands[4] = gen_reg_rtx (DImode);
13880 (match_operand:SI 0 "register_operand" "c,*l"))
13881 (use (label_ref (match_operand 1 "" "")))]
13886 [(set_attr "type" "jmpreg")])
13890 (match_operand:DI 0 "register_operand" "c,*l"))
13891 (use (label_ref (match_operand 1 "" "")))]
13896 [(set_attr "type" "jmpreg")])
13901 "{cror 0,0,0|nop}")
13903 ;; Define the subtract-one-and-jump insns, starting with the template
13904 ;; so loop.c knows what to generate.
13906 (define_expand "doloop_end"
13907 [(use (match_operand 0 "" "")) ; loop pseudo
13908 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13909 (use (match_operand 2 "" "")) ; max iterations
13910 (use (match_operand 3 "" "")) ; loop level
13911 (use (match_operand 4 "" ""))] ; label
13915 /* Only use this on innermost loops. */
13916 if (INTVAL (operands[3]) > 1)
13920 if (GET_MODE (operands[0]) != DImode)
13922 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13926 if (GET_MODE (operands[0]) != SImode)
13928 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13933 (define_expand "ctrsi"
13934 [(parallel [(set (pc)
13935 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
13937 (label_ref (match_operand 1 "" ""))
13940 (plus:SI (match_dup 0)
13942 (clobber (match_scratch:CC 2 ""))
13943 (clobber (match_scratch:SI 3 ""))])]
13947 (define_expand "ctrdi"
13948 [(parallel [(set (pc)
13949 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
13951 (label_ref (match_operand 1 "" ""))
13954 (plus:DI (match_dup 0)
13956 (clobber (match_scratch:CC 2 ""))
13957 (clobber (match_scratch:DI 3 ""))])]
13961 ;; We need to be able to do this for any operand, including MEM, or we
13962 ;; will cause reload to blow up since we don't allow output reloads on
13964 ;; For the length attribute to be calculated correctly, the
13965 ;; label MUST be operand 0.
13967 (define_insn "*ctrsi_internal1"
13969 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
13971 (label_ref (match_operand 0 "" ""))
13973 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13974 (plus:SI (match_dup 1)
13976 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13977 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
13981 if (which_alternative != 0)
13983 else if (get_attr_length (insn) == 4)
13984 return \"{bdn|bdnz} %l0\";
13986 return \"bdz $+8\;b %l0\";
13988 [(set_attr "type" "branch")
13989 (set_attr "length" "*,12,16,16")])
13991 (define_insn "*ctrsi_internal2"
13993 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
13996 (label_ref (match_operand 0 "" ""))))
13997 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13998 (plus:SI (match_dup 1)
14000 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14001 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14005 if (which_alternative != 0)
14007 else if (get_attr_length (insn) == 4)
14008 return \"bdz %l0\";
14010 return \"{bdn|bdnz} $+8\;b %l0\";
14012 [(set_attr "type" "branch")
14013 (set_attr "length" "*,12,16,16")])
14015 (define_insn "*ctrdi_internal1"
14017 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14019 (label_ref (match_operand 0 "" ""))
14021 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14022 (plus:DI (match_dup 1)
14024 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14025 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14029 if (which_alternative != 0)
14031 else if (get_attr_length (insn) == 4)
14032 return \"{bdn|bdnz} %l0\";
14034 return \"bdz $+8\;b %l0\";
14036 [(set_attr "type" "branch")
14037 (set_attr "length" "*,12,16,16")])
14039 (define_insn "*ctrdi_internal2"
14041 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14044 (label_ref (match_operand 0 "" ""))))
14045 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14046 (plus:DI (match_dup 1)
14048 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14049 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14053 if (which_alternative != 0)
14055 else if (get_attr_length (insn) == 4)
14056 return \"bdz %l0\";
14058 return \"{bdn|bdnz} $+8\;b %l0\";
14060 [(set_attr "type" "branch")
14061 (set_attr "length" "*,12,16,16")])
14063 ;; Similar but use EQ
14065 (define_insn "*ctrsi_internal5"
14067 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14069 (label_ref (match_operand 0 "" ""))
14071 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14072 (plus:SI (match_dup 1)
14074 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14075 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14079 if (which_alternative != 0)
14081 else if (get_attr_length (insn) == 4)
14082 return \"bdz %l0\";
14084 return \"{bdn|bdnz} $+8\;b %l0\";
14086 [(set_attr "type" "branch")
14087 (set_attr "length" "*,12,16,16")])
14089 (define_insn "*ctrsi_internal6"
14091 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14094 (label_ref (match_operand 0 "" ""))))
14095 (set (match_operand:SI 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14096 (plus:SI (match_dup 1)
14098 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14099 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14103 if (which_alternative != 0)
14105 else if (get_attr_length (insn) == 4)
14106 return \"{bdn|bdnz} %l0\";
14108 return \"bdz $+8\;b %l0\";
14110 [(set_attr "type" "branch")
14111 (set_attr "length" "*,12,16,16")])
14113 (define_insn "*ctrdi_internal5"
14115 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14117 (label_ref (match_operand 0 "" ""))
14119 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14120 (plus:DI (match_dup 1)
14122 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14123 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14127 if (which_alternative != 0)
14129 else if (get_attr_length (insn) == 4)
14130 return \"bdz %l0\";
14132 return \"{bdn|bdnz} $+8\;b %l0\";
14134 [(set_attr "type" "branch")
14135 (set_attr "length" "*,12,16,16")])
14137 (define_insn "*ctrdi_internal6"
14139 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14142 (label_ref (match_operand 0 "" ""))))
14143 (set (match_operand:DI 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14144 (plus:DI (match_dup 1)
14146 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14147 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14151 if (which_alternative != 0)
14153 else if (get_attr_length (insn) == 4)
14154 return \"{bdn|bdnz} %l0\";
14156 return \"bdz $+8\;b %l0\";
14158 [(set_attr "type" "branch")
14159 (set_attr "length" "*,12,16,16")])
14161 ;; Now the splitters if we could not allocate the CTR register
14165 (if_then_else (match_operator 2 "comparison_operator"
14166 [(match_operand:SI 1 "gpc_reg_operand" "")
14168 (match_operand 5 "" "")
14169 (match_operand 6 "" "")))
14170 (set (match_operand:SI 0 "gpc_reg_operand" "")
14171 (plus:SI (match_dup 1)
14173 (clobber (match_scratch:CC 3 ""))
14174 (clobber (match_scratch:SI 4 ""))]
14175 "TARGET_32BIT && reload_completed"
14176 [(parallel [(set (match_dup 3)
14177 (compare:CC (plus:SI (match_dup 1)
14181 (plus:SI (match_dup 1)
14183 (set (pc) (if_then_else (match_dup 7)
14187 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14188 operands[3], const0_rtx); }")
14192 (if_then_else (match_operator 2 "comparison_operator"
14193 [(match_operand:SI 1 "gpc_reg_operand" "")
14195 (match_operand 5 "" "")
14196 (match_operand 6 "" "")))
14197 (set (match_operand:SI 0 "nonimmediate_operand" "")
14198 (plus:SI (match_dup 1) (const_int -1)))
14199 (clobber (match_scratch:CC 3 ""))
14200 (clobber (match_scratch:SI 4 ""))]
14201 "TARGET_32BIT && reload_completed
14202 && ! gpc_reg_operand (operands[0], SImode)"
14203 [(parallel [(set (match_dup 3)
14204 (compare:CC (plus:SI (match_dup 1)
14208 (plus:SI (match_dup 1)
14212 (set (pc) (if_then_else (match_dup 7)
14216 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14217 operands[3], const0_rtx); }")
14220 (if_then_else (match_operator 2 "comparison_operator"
14221 [(match_operand:DI 1 "gpc_reg_operand" "")
14223 (match_operand 5 "" "")
14224 (match_operand 6 "" "")))
14225 (set (match_operand:DI 0 "gpc_reg_operand" "")
14226 (plus:DI (match_dup 1)
14228 (clobber (match_scratch:CC 3 ""))
14229 (clobber (match_scratch:DI 4 ""))]
14230 "TARGET_64BIT && reload_completed"
14231 [(parallel [(set (match_dup 3)
14232 (compare:CC (plus:DI (match_dup 1)
14236 (plus:DI (match_dup 1)
14238 (set (pc) (if_then_else (match_dup 7)
14242 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14243 operands[3], const0_rtx); }")
14247 (if_then_else (match_operator 2 "comparison_operator"
14248 [(match_operand:DI 1 "gpc_reg_operand" "")
14250 (match_operand 5 "" "")
14251 (match_operand 6 "" "")))
14252 (set (match_operand:DI 0 "nonimmediate_operand" "")
14253 (plus:DI (match_dup 1) (const_int -1)))
14254 (clobber (match_scratch:CC 3 ""))
14255 (clobber (match_scratch:DI 4 ""))]
14256 "TARGET_64BIT && reload_completed
14257 && ! gpc_reg_operand (operands[0], DImode)"
14258 [(parallel [(set (match_dup 3)
14259 (compare:CC (plus:DI (match_dup 1)
14263 (plus:DI (match_dup 1)
14267 (set (pc) (if_then_else (match_dup 7)
14271 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14272 operands[3], const0_rtx); }")
14274 (define_insn "trap"
14275 [(trap_if (const_int 1) (const_int 0))]
14279 (define_expand "conditional_trap"
14280 [(trap_if (match_operator 0 "trap_comparison_operator"
14281 [(match_dup 2) (match_dup 3)])
14282 (match_operand 1 "const_int_operand" ""))]
14284 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14285 operands[2] = rs6000_compare_op0;
14286 operands[3] = rs6000_compare_op1;")
14289 [(trap_if (match_operator 0 "trap_comparison_operator"
14290 [(match_operand:SI 1 "register_operand" "r")
14291 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14294 "{t|tw}%V0%I2 %1,%2")
14297 [(trap_if (match_operator 0 "trap_comparison_operator"
14298 [(match_operand:DI 1 "register_operand" "r")
14299 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14304 ;; Insns related to generating the function prologue and epilogue.
14306 (define_expand "prologue"
14307 [(use (const_int 0))]
14308 "TARGET_SCHED_PROLOG"
14311 rs6000_emit_prologue ();
14315 (define_insn "*movesi_from_cr_one"
14316 [(match_parallel 0 "mfcr_operation"
14317 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14318 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14319 (match_operand 3 "immediate_operand" "n")]
14320 UNSPEC_MOVESI_FROM_CR))])]
14326 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14328 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14329 operands[4] = GEN_INT (mask);
14330 output_asm_insn (\"mfcr %1,%4\", operands);
14334 [(set_attr "type" "mfcrf")])
14336 (define_insn "movesi_from_cr"
14337 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14338 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14339 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14340 UNSPEC_MOVESI_FROM_CR))]
14343 [(set_attr "type" "mfcr")])
14345 (define_insn "*stmw"
14346 [(match_parallel 0 "stmw_operation"
14347 [(set (match_operand:SI 1 "memory_operand" "=m")
14348 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14350 "{stm|stmw} %2,%1")
14352 (define_insn "*save_fpregs_si"
14353 [(match_parallel 0 "any_operand"
14354 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14355 (use (match_operand:SI 2 "call_operand" "s"))
14356 (set (match_operand:DF 3 "memory_operand" "=m")
14357 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14360 [(set_attr "type" "branch")
14361 (set_attr "length" "4")])
14363 (define_insn "*save_fpregs_di"
14364 [(match_parallel 0 "any_operand"
14365 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14366 (use (match_operand:DI 2 "call_operand" "s"))
14367 (set (match_operand:DF 3 "memory_operand" "=m")
14368 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14371 [(set_attr "type" "branch")
14372 (set_attr "length" "4")])
14374 ; These are to explain that changes to the stack pointer should
14375 ; not be moved over stores to stack memory.
14376 (define_insn "stack_tie"
14377 [(set (match_operand:BLK 0 "memory_operand" "+m")
14378 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14381 [(set_attr "length" "0")])
14384 (define_expand "epilogue"
14385 [(use (const_int 0))]
14386 "TARGET_SCHED_PROLOG"
14389 rs6000_emit_epilogue (FALSE);
14393 ; On some processors, doing the mtcrf one CC register at a time is
14394 ; faster (like on the 604e). On others, doing them all at once is
14395 ; faster; for instance, on the 601 and 750.
14397 (define_expand "movsi_to_cr_one"
14398 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14399 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14400 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14402 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14404 (define_insn "*movsi_to_cr"
14405 [(match_parallel 0 "mtcrf_operation"
14406 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14407 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14408 (match_operand 3 "immediate_operand" "n")]
14409 UNSPEC_MOVESI_TO_CR))])]
14415 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14416 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14417 operands[4] = GEN_INT (mask);
14418 return \"mtcrf %4,%2\";
14420 [(set_attr "type" "mtcr")])
14422 (define_insn "*mtcrfsi"
14423 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14424 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14425 (match_operand 2 "immediate_operand" "n")]
14426 UNSPEC_MOVESI_TO_CR))]
14427 "GET_CODE (operands[0]) == REG
14428 && CR_REGNO_P (REGNO (operands[0]))
14429 && GET_CODE (operands[2]) == CONST_INT
14430 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14432 [(set_attr "type" "mtcr")])
14434 ; The load-multiple instructions have similar properties.
14435 ; Note that "load_multiple" is a name known to the machine-independent
14436 ; code that actually corresponds to the powerpc load-string.
14438 (define_insn "*lmw"
14439 [(match_parallel 0 "lmw_operation"
14440 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14441 (match_operand:SI 2 "memory_operand" "m"))])]
14445 (define_insn "*return_internal_si"
14447 (use (match_operand:SI 0 "register_operand" "lc"))]
14450 [(set_attr "type" "jmpreg")])
14452 (define_insn "*return_internal_di"
14454 (use (match_operand:DI 0 "register_operand" "lc"))]
14457 [(set_attr "type" "jmpreg")])
14459 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14460 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
14462 (define_insn "*return_and_restore_fpregs_si"
14463 [(match_parallel 0 "any_operand"
14465 (use (match_operand:SI 1 "register_operand" "l"))
14466 (use (match_operand:SI 2 "call_operand" "s"))
14467 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14468 (match_operand:DF 4 "memory_operand" "m"))])]
14472 (define_insn "*return_and_restore_fpregs_di"
14473 [(match_parallel 0 "any_operand"
14475 (use (match_operand:DI 1 "register_operand" "l"))
14476 (use (match_operand:DI 2 "call_operand" "s"))
14477 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14478 (match_operand:DF 4 "memory_operand" "m"))])]
14482 ; This is used in compiling the unwind routines.
14483 (define_expand "eh_return"
14484 [(use (match_operand 0 "general_operand" ""))]
14489 emit_insn (gen_eh_set_lr_si (operands[0]));
14491 emit_insn (gen_eh_set_lr_di (operands[0]));
14495 ; We can't expand this before we know where the link register is stored.
14496 (define_insn "eh_set_lr_si"
14497 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")]
14499 (clobber (match_scratch:SI 1 "=&b"))]
14503 (define_insn "eh_set_lr_di"
14504 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
14506 (clobber (match_scratch:DI 1 "=&b"))]
14511 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14512 (clobber (match_scratch 1 ""))]
14517 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14521 (define_insn "prefetch"
14522 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14523 (match_operand:SI 1 "const_int_operand" "n")
14524 (match_operand:SI 2 "const_int_operand" "n"))]
14528 if (GET_CODE (operands[0]) == REG)
14529 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14530 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14532 [(set_attr "type" "load")])
14534 (include "altivec.md")